From patchwork Thu Apr 7 11:18:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lino Sanfilippo X-Patchwork-Id: 12805086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F836C433EF for ; Thu, 7 Apr 2022 11:19:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244712AbiDGLVj (ORCPT ); Thu, 7 Apr 2022 07:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234990AbiDGLVb (ORCPT ); Thu, 7 Apr 2022 07:21:31 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E2F195D89; Thu, 7 Apr 2022 04:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1649330356; bh=5/6ZzUueHS3SF2yHi16HZRPFVZW5IvH0j1r8wVbaYU0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=H3la3kpTpg4Z7uOzU0ZQHQenpdBHeB5IDlmTgTean2DfC7LOJuEEYSF4L+riovkIy 0cWqenq7eMaTwGdK+mX/MIsF7PK/Cg5UjvjZMR8Uy+OkYzi2TMizC8QTISoQaQY1Wg sZtl9nHKmRd2JNzw93qBIDzovgq+u5WSj4jTTQ2A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from Venus.fritz.box ([46.223.2.23]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MplXz-1oLhfN1wzN-00qBBW; Thu, 07 Apr 2022 13:19:16 +0200 From: Lino Sanfilippo To: peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, =robh+dt@kernel.org Cc: devicetree@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, stefanb@linux.ibm.com, p.rosenberger@kunbus.com, lukas@wunner.de, Lino Sanfilippo Subject: [PATCH 4/5] tpm: tpm_tis: make functions available for external linkage Date: Thu, 7 Apr 2022 13:18:48 +0200 Message-Id: <20220407111849.5676-5-LinoSanfilippo@gmx.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407111849.5676-1-LinoSanfilippo@gmx.de> References: <20220407111849.5676-1-LinoSanfilippo@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:p5yGYHiR+LCe1gVoENeZriGuaH9Er4iA4m9Xa6QqaP/T7wAg51g ssafnceBC/S1gKqum8GjJA4guPukkYT14wZ65DXs5IrJ5ijaVZUKm5e2xsfQ8q3sxjGqp3Q aFxQDOl6+qTJE0Q4YK9JZeUV6SGwcKH7O5q7F6kW1rb51fEQ8qydzKn0WHz2abJIhhYjI3T Ts3cIhZ1fNYX2Po0p9QTw== X-UI-Out-Filterresults: notjunk:1;V03:K0:JWUi0rCOfiE=:2RHflXSnANxWyD6/rzfIIc Bjcsri+a9CzRXO2QpsUdmHFB9uWQor73qr4vxgcfYam7ybqNDDDaCWwE8SP9NVvQGmoBTKbQ9 fi0x46shfJt8DH1YMXRurg2JBZY/P4LhHP8mmYPmF5kM+lMIpM3qNGauI1d8E6Gc4mspiM+AB HEs64pDImgNAgNqss/fxjq5CSQqDPFWjbwEgXIiwHR7yVdcmkmpxhkDdqK92GNRWehYL+eC7K wGAk/oziryvcAe0scvWvbwD4hKSop8OyXBqqWeJFNHHO1PEzcaAUSjlI2czzO1svCYZNQbckz cHgAWxlRgoPWnybt7tPorhseElEko3ZpBf21GFKtuYLgmcw/rmbC0mzXQ3OtPfMlYyFMVUPqH ywH+18zITO5RaXM6S3yMuxY19h5M07dJMob+KAf+FEDlIUKYJep7WTWKFd1B+2H15Y++T44DB 0xHAyJ9ruZhtSJjdZ7KzQGieRi75hjAP8VdOofKtimG5Gg4OEhRug7yb/LkZbD28TClWNtmNz gLv+MqTMmBdMg150Risap3EfLvLwJMxdalwzcxNK4iiadSbMD7uLGI1yMIpgBCcB98sRBlxHH OgRfv1q57Ms1ZA0aKl/xrnvNTXPVJ2Co3k9fjr7xvqF9tED2pMnOT1yZIorNioNsFxtP8X9oA hf4XKqnYzVwRYcGAPHpByaWTCIGV9sovGHP+V1gMrSXD3U9DxSiwqFgQcVTLFAFCrdZ7MItjj rPBwpwzkri7gq2qOYjD6QEiHpguBO9P6NGUABuSFcdRp9DnKR0yXw59cxWcaoMSezvV8Q/GvU eLKVnSYy0E1U8MZOvcnE0gBz2caFlA1I6Kv/Oqo5DYcp1uzh3+m5cOekFMmQvHj9w8WiGpaCm K8GBqxAGeHLazD3uremT4KsLaDviyF132fXIIoldBoxlZNFH8gkK1BpD8G05AXmWrWLHIIMu+ ClGdTLZAwtfhZ6wTmFL5WClKp+qfBrq3QGyhMyWtfvaRmeIbTmTo21BjQOrziStxdppcf6/mA 00NIiFH7W6rGjBYk4Rbhqa+YKz/+qPA7VSZDs5DcZ0N1hYMLhodCrV7EIBFPC9Q9bY5URxAON 6hkas4z2PlDjXQ= Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org The tpm_tis_phy_ops functions tpm_tis_spi_read16, tpm_tis_spi_read32 and tpm_tis_spi_write32 are already declared extern to be used outside of tpm_tim_spi_main.c. Do the same with tpm_tis_spi_read_bytes and tpm_tis_spi_write_bytes to allow the external access to the complete set of tpm_tis_phy_ops. This is in preparation of the assignment of SLB9670 specific phy ops in a separate file. Furthermore declare tpm_tis_spi_flow_control extern, so that we can use it in a SLB9670 specific probe function in the same file. Signed-off-by: Lino Sanfilippo --- drivers/char/tpm/tpm_tis_spi.h | 7 +++++++ drivers/char/tpm/tpm_tis_spi_main.c | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_spi.h b/drivers/char/tpm/tpm_tis_spi.h index bba73979c368..8f4331d8a4dd 100644 --- a/drivers/char/tpm/tpm_tis_spi.h +++ b/drivers/char/tpm/tpm_tis_spi.h @@ -25,6 +25,9 @@ static inline struct tpm_tis_spi_phy *to_tpm_tis_spi_phy(struct tpm_tis_data *da return container_of(data, struct tpm_tis_spi_phy, priv); } +extern int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy, + struct spi_transfer *spi_xfer); + extern int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy, int irq, const struct tpm_tis_phy_ops *phy_ops); @@ -34,6 +37,10 @@ extern int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, extern int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result); extern int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result); extern int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value); +extern int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len, + u8 *result); +extern int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, + const u8 *value); #ifdef CONFIG_TCG_TIS_SPI_CR50 extern int cr50_spi_probe(struct spi_device *spi); diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c index 184396b3af50..b2d13b844659 100644 --- a/drivers/char/tpm/tpm_tis_spi_main.c +++ b/drivers/char/tpm/tpm_tis_spi_main.c @@ -45,8 +45,8 @@ * * [1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-profile-ptp-specification/ */ -static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy, - struct spi_transfer *spi_xfer) +int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy, + struct spi_transfer *spi_xfer) { struct spi_message m; int ret, i; @@ -140,14 +140,14 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, return ret; } -static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, u8 *result) +int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len, + u8 *result) { return tpm_tis_spi_transfer(data, addr, len, result, NULL); } -static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, - u16 len, const u8 *value) +int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, + const u8 *value) { return tpm_tis_spi_transfer(data, addr, len, NULL, value); }