From patchwork Thu Oct 27 07:13:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp81327wru; Thu, 27 Oct 2022 00:25:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5t++n0Tqs7a8W91igSmSi2ZH3skjcdxNkOD6NwtXj8zR98CCLvsHn1N6Az3dRwiR/osmyj X-Received: by 2002:a17:907:5c2:b0:77e:def7:65d8 with SMTP id wg2-20020a17090705c200b0077edef765d8mr41537448ejb.487.1666855506600; Thu, 27 Oct 2022 00:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666855506; cv=none; d=google.com; s=arc-20160816; b=gMuDyaa7qdMynuO1r/Yjr9JokR4mKk+YF+p1eK+BFtSwaMzRsalOkbNF0M5I31ziKa BNl9mvxYFQUBuLUseZI5u8oznSjnSaMLhaTzgpiMmESFlIY+KXBhoO1mw3POOcHIJcKp fV1lAwz/7OuO5XuxZeL1+fJIUR5ER9SfloZitdz/uFSGI1TWZl3ec+gLA48cJpiRpQVA YB4+LikUSO7AAA1lNILSaW3PQS2M3JbLRGbzXPgA0ik2QHtoZP5ZZ2zwK+dxUIn2kGvC hTx8xJk2RU3Xv4HAptktwZZu8q0ePnMxXrRy4sZcK8eVfpcoW8yttUmspDax4lCFIuaY J4ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aO2vSiBw4r8kxSG3x2i3TU8RhpwFlgnN7/8MKjdn5V8=; b=dxm9Hr/ti735j7FPZYW+tRycb7YjHg3vjJOwn/Ym9pHZATNtTnnKsM8I/mv+TJZLZ6 dF003O7VV4PP0+uzwhoPzOFAgIMQ1U5uTjy68+41N58zaB8tIkn6vA8+hTrQcPemgjJZ LTagILMhj3kX9NqJYQ8x6WLk4ql/llUewdFS49xXA1otePzkIsWYcKh6jQAB2CTMq/Tb c1Drw6s/+JYDcxMs0dgoFQyn+ZUQYFvSzDRc2+miWmnh/xEPhKSGvCdy4yadsZ1IyT0h yA6Mxle31fLnVWnphWEseZPjUCxWMah8iLIyevnRDU1V2wrYuhJoLSgHJfzENGfrIACl o4Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gHMufNYg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et19-20020a170907295300b0078cff711da6si456370ejc.976.2022.10.27.00.24.42; Thu, 27 Oct 2022 00:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gHMufNYg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234514AbiJ0HN4 (ORCPT + 99 others); Thu, 27 Oct 2022 03:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234161AbiJ0HNy (ORCPT ); Thu, 27 Oct 2022 03:13:54 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE3C278BC8; Thu, 27 Oct 2022 00:13:53 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id y13so643463pfp.7; Thu, 27 Oct 2022 00:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aO2vSiBw4r8kxSG3x2i3TU8RhpwFlgnN7/8MKjdn5V8=; b=gHMufNYgTorNIK4InMe7Dj0RAninDI8s2CXXIxPeZYqPuvUoydVL50WgCIjUD6tFQD vkGLjZZv2VG30qWH9iSi7DNZEnC6xMDnEgJ9W6FoZRbnMmR709niHvmjdGWrcWg8uata lSv6W77/0NRd4hj09n/+aoFjUshn7LX5ifTQMThjJmUQxsdj2nIYQzmXawbgCF2wWZXt Gmwe4pAO55u14XLbIDxcOmN3Ovse+1b22u7WecmahZNSeaU/t5zCUTWVaTsM0iyqnLFB 5j5aSf9Xq79hxOIeYCG29Vc7IMurihx4HOyI/bZKYZnusOJX6XBG123uCeltOm6ckmts 1uqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aO2vSiBw4r8kxSG3x2i3TU8RhpwFlgnN7/8MKjdn5V8=; b=yp3ndAeUpCxZiaKLCYoqeIB3C44NihPegqdlvJJmwV4/DajvJxl6WfQs2zSiV++8AF CnmiSoAx9xvygdg7bIaLxDpjxPfsuKSQbRczBvwZCH5iA2OsrObkTMI5pJ/SOFQDwtfq Mo/JBOwxPDjU0vHkDHJXgoH6a2v586IAVB0fPiqlenGIIle8cZSdBatIsEb303t9XDd5 WxxcmZYfnOGwEFq+v99DmRH+iW0BLF/TFTJkyrFyE7j39bfMKghvLp4CVD9TC2jBLWjV UUm6WMrwXuz/maOeARx2MTcQ7WFISYRS8I8IOCeEX4bOTZt+fPtzYIb+p3/uh2vWUIUc LKXA== X-Gm-Message-State: ACrzQf1zOyKfJyvWTtL9x6/b3unUm4yR7XI8ThF3r6UO7gAr3sMm2zH+ 6nQ6pVr1oNrtWNi7rAofOfM= X-Received: by 2002:a05:6a00:1781:b0:561:7f7f:dc38 with SMTP id s1-20020a056a00178100b005617f7fdc38mr48494158pfg.42.1666854833298; Thu, 27 Oct 2022 00:13:53 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:99d6:ae15:f9aa:1819]) by smtp.gmail.com with ESMTPSA id je11-20020a170903264b00b00186ac812ab0sm496321plb.83.2022.10.27.00.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 00:13:52 -0700 (PDT) From: Dmitry Torokhov To: Peter Huewe , Jarkko Sakkinen Cc: Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] tpm: st33zp24: drop support for platform data Date: Thu, 27 Oct 2022 00:13:47 -0700 Message-Id: <20221027071349.991730-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747824679954679031?= X-GMAIL-MSGID: =?utf-8?q?1747824679954679031?= Drop support for platform data from the driver because there are no users of st33zp24_platform_data structure in the mainline kernel. Signed-off-by: Dmitry Torokhov Reviewed-by: Jarkko Sakkinen --- v3: switch back to using TPM_ST33_SPI macro when setting SPI driver name v2: reworked commit message drivers/char/tpm/st33zp24/i2c.c | 41 ++----------------------- drivers/char/tpm/st33zp24/spi.c | 42 ++------------------------ drivers/char/tpm/st33zp24/st33zp24.h | 3 ++ include/linux/platform_data/st33zp24.h | 16 ---------- 4 files changed, 9 insertions(+), 93 deletions(-) delete mode 100644 include/linux/platform_data/st33zp24.h diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index a3aa411389e7..c560532647c8 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -12,7 +12,6 @@ #include #include #include -#include #include "../tpm.h" #include "st33zp24.h" @@ -178,36 +177,6 @@ static int st33zp24_i2c_of_request_resources(struct i2c_client *client) return 0; } -static int st33zp24_i2c_request_resources(struct i2c_client *client) -{ - struct tpm_chip *chip = i2c_get_clientdata(client); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_i2c_phy *phy = tpm_dev->phy_id; - struct st33zp24_platform_data *pdata; - int ret; - - pdata = client->dev.platform_data; - if (!pdata) { - dev_err(&client->dev, "No platform data\n"); - return -ENODEV; - } - - /* store for late use */ - phy->io_lpcpd = pdata->io_lpcpd; - - if (gpio_is_valid(pdata->io_lpcpd)) { - ret = devm_gpio_request_one(&client->dev, - pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH, - "TPM IO_LPCPD"); - if (ret) { - dev_err(&client->dev, "Failed to request lpcpd pin\n"); - return ret; - } - } - - return 0; -} - /* * st33zp24_i2c_probe initialize the TPM device * @param: client, the i2c_client description (TPM I2C description). @@ -219,7 +188,6 @@ static int st33zp24_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int ret; - struct st33zp24_platform_data *pdata; struct st33zp24_i2c_phy *phy; if (!client) { @@ -240,19 +208,16 @@ static int st33zp24_i2c_probe(struct i2c_client *client, phy->client = client; - pdata = client->dev.platform_data; - if (!pdata && client->dev.of_node) { + if (client->dev.of_node) { ret = st33zp24_i2c_of_request_resources(client); if (ret) return ret; - } else if (pdata) { - ret = st33zp24_i2c_request_resources(client); - if (ret) - return ret; } else if (ACPI_HANDLE(&client->dev)) { ret = st33zp24_i2c_acpi_request_resources(client); if (ret) return ret; + } else { + return -ENODEV; } return st33zp24_probe(phy, &i2c_phy_ops, &client->dev, client->irq, diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 22d184884694..2b121d009959 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -12,7 +12,6 @@ #include #include #include -#include #include "../tpm.h" #include "st33zp24.h" @@ -296,37 +295,6 @@ static int st33zp24_spi_of_request_resources(struct spi_device *spi_dev) return 0; } -static int st33zp24_spi_request_resources(struct spi_device *dev) -{ - struct tpm_chip *chip = spi_get_drvdata(dev); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_spi_phy *phy = tpm_dev->phy_id; - struct st33zp24_platform_data *pdata; - int ret; - - pdata = dev->dev.platform_data; - if (!pdata) { - dev_err(&dev->dev, "No platform data\n"); - return -ENODEV; - } - - /* store for late use */ - phy->io_lpcpd = pdata->io_lpcpd; - - if (gpio_is_valid(pdata->io_lpcpd)) { - ret = devm_gpio_request_one(&dev->dev, - pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH, - "TPM IO_LPCPD"); - if (ret) { - dev_err(&dev->dev, "%s : reset gpio_request failed\n", - __FILE__); - return ret; - } - } - - return 0; -} - /* * st33zp24_spi_probe initialize the TPM device * @param: dev, the spi_device description (TPM SPI description). @@ -336,7 +304,6 @@ static int st33zp24_spi_request_resources(struct spi_device *dev) static int st33zp24_spi_probe(struct spi_device *dev) { int ret; - struct st33zp24_platform_data *pdata; struct st33zp24_spi_phy *phy; /* Check SPI platform functionnalities */ @@ -353,19 +320,16 @@ static int st33zp24_spi_probe(struct spi_device *dev) phy->spi_device = dev; - pdata = dev->dev.platform_data; - if (!pdata && dev->dev.of_node) { + if (dev->dev.of_node) { ret = st33zp24_spi_of_request_resources(dev); if (ret) return ret; - } else if (pdata) { - ret = st33zp24_spi_request_resources(dev); - if (ret) - return ret; } else if (ACPI_HANDLE(&dev->dev)) { ret = st33zp24_spi_acpi_request_resources(dev); if (ret) return ret; + } else { + return -ENODEV; } phy->latency = st33zp24_spi_evaluate_latency(phy); diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h index b387a476c555..6a26dbc3206b 100644 --- a/drivers/char/tpm/st33zp24/st33zp24.h +++ b/drivers/char/tpm/st33zp24/st33zp24.h @@ -7,6 +7,9 @@ #ifndef __LOCAL_ST33ZP24_H__ #define __LOCAL_ST33ZP24_H__ +#define TPM_ST33_I2C "st33zp24-i2c" +#define TPM_ST33_SPI "st33zp24-spi" + #define TPM_WRITE_DIRECTION 0x80 #define ST33ZP24_BUFSIZE 2048 diff --git a/include/linux/platform_data/st33zp24.h b/include/linux/platform_data/st33zp24.h deleted file mode 100644 index 61db674f36cc..000000000000 --- a/include/linux/platform_data/st33zp24.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * STMicroelectronics TPM Linux driver for TPM 1.2 ST33ZP24 - * Copyright (C) 2009 - 2016 STMicroelectronics - */ -#ifndef __ST33ZP24_H__ -#define __ST33ZP24_H__ - -#define TPM_ST33_I2C "st33zp24-i2c" -#define TPM_ST33_SPI "st33zp24-spi" - -struct st33zp24_platform_data { - int io_lpcpd; -}; - -#endif /* __ST33ZP24_H__ */ From patchwork Thu Oct 27 07:13:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp81461wru; Thu, 27 Oct 2022 00:25:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ksg5VkWn9ZReRBW5+xoL7dgEQSxM16Khr/3QtF5ezb2TtUVQFMJr/+6L9T5iJeiWRzOW4 X-Received: by 2002:a17:906:6a04:b0:78d:ee09:d956 with SMTP id qw4-20020a1709066a0400b0078dee09d956mr39690520ejc.698.1666855533736; Thu, 27 Oct 2022 00:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666855533; cv=none; d=google.com; s=arc-20160816; b=pOenVFZgivwaFDlPpW6pfXVjD/m7+vH0L9Jqz2GLDKA3Ja3V6/sjkrzP3QwTWkU40e OqXSoATaIJFzIET8tpFYbr+M4P6KhOlTetYlahirAPikY7aLkhLlpYoHS6PC7Yd/j9mb aM5uv6mATQFn459KqX/6K1biv9/QMGphzdXYvs3jaKZQH1wvOfcV5kDf61/d2Nlsf6jo QCN+diafTF16JoVhZYDUio4asl2KA0MW/FzGx1E/A1tl9Ckyu+jTzA94wBBmQokH2q8B 8cJjZUt4/Phok/FizT2k4/rvMjp209xzCoXdJnbpr7eMTeAOKFhyDsoqEP002lz5zg4F dL+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBk5Pr/0uz+nD0LU5dG90VZHR7HUckWoD7yrq/1T9nw=; b=xT4h3Vbynrr96RWMZtDPqbGlYq799pD1oZ0l2WyGxMgNnIqhTSvLT+7ToZ0buZo6TC O+eSPTFFGEQe89hKUiqKK8g0Z2S9jNvEoTl+Xl1x1K3RmwaESODHE7doQ3DY/3WCKLGo SelUZEZ1uSU5bekMRsOqe/9DUwiSnR0IZ48Ki92gX4aSqXqiZKbKxu6RLtFKZfV0Ogse 7bIfKIBSG3WPPrMKHsSxp68zQgflPepo36wdVdxLRslEPKhkAQrfk7yhXVReCGePUwmO OXDMGn6ucckYAT8nAGt5PpJOZXH0w/rLbjXqqPHwhhYDt0Xi0uuvMLef5ljSZdkMpmhf IXhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZcXcw0pN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020aa7d30d000000b00447dfae6181si747786edq.235.2022.10.27.00.25.10; Thu, 27 Oct 2022 00:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZcXcw0pN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234650AbiJ0HOB (ORCPT + 99 others); Thu, 27 Oct 2022 03:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234553AbiJ0HN4 (ORCPT ); Thu, 27 Oct 2022 03:13:56 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4BE878BC8; Thu, 27 Oct 2022 00:13:55 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id m14-20020a17090a3f8e00b00212dab39bcdso5478489pjc.0; Thu, 27 Oct 2022 00:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yBk5Pr/0uz+nD0LU5dG90VZHR7HUckWoD7yrq/1T9nw=; b=ZcXcw0pNn85rUcMZFIKJR9WGvuiKem6MkPFg5Ezq4Qb4xvWw5efadkvBK74BEUOGnD S9x30QuO0XKdQ3nmDUAAgPRRd1t4WtTNit0gtTTHEh/0Cj24DVRbEkg7KXJbh67pnGh6 yw0TU+ErsATKhZUpM73j/XwILqcGvXSrm+l8w7NuvApnwYsul2mylLk/wv1ciye18bpn N3K0AVbG9Ks7r+Mo+yZFVxulHKbiCde2qF0s15pQG1MZEKJTFLy9NRAOq3O+s2GBqL27 Oty+2Xaqmeq4NtCfnlSvChehP+fuEhrv0lcvpGIEuCqdo3GTf3RjQQImgspoeDz2Y/VF VWlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yBk5Pr/0uz+nD0LU5dG90VZHR7HUckWoD7yrq/1T9nw=; b=HHauZcsiC5krzzmSSzIWBtw0x1MNqYpP2hzv0wdo+BZt2krgh3z1Pl6XoHd84Wplat ZK9PfkBE/wclKb79ThtsdlG0wRW1dFY2G6D1avqnFOW+KLv8Ee/tequ/F+8lTnNAG1JM zREPQvXWTpiITWcpJ/5+xHhUIptlO33/mSvcTFgqd5k85PWPLVN8EkC0rv+LJ+C512Mc bnZGuQsrCVve76GmIUww3OutVNyu7qnJ+v22zf5CMwG9PDvhDdpKCylALkm6+AwH0CA1 O8N/54LI1O0SL97oEcbysfFJM4gUA5dtW2yy47qsiw8uVLN+PsH/7dRzfVohBzNJGJ3a Le3w== X-Gm-Message-State: ACrzQf1zZ1Gx3udb8y2/E2KLdYrWYQVIz9J0gW2DMUVB905XNAZliOSa 7hhwq+MxWH2dRhnHIyfvppQ= X-Received: by 2002:a17:903:1205:b0:178:ac4e:70b8 with SMTP id l5-20020a170903120500b00178ac4e70b8mr47139528plh.52.1666854835079; Thu, 27 Oct 2022 00:13:55 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:99d6:ae15:f9aa:1819]) by smtp.gmail.com with ESMTPSA id je11-20020a170903264b00b00186ac812ab0sm496321plb.83.2022.10.27.00.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 00:13:54 -0700 (PDT) From: Dmitry Torokhov To: Peter Huewe , Jarkko Sakkinen Cc: Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] tpm: st33zp24: switch to using gpiod API Date: Thu, 27 Oct 2022 00:13:48 -0700 Message-Id: <20221027071349.991730-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221027071349.991730-1-dmitry.torokhov@gmail.com> References: <20221027071349.991730-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747824708001087662?= X-GMAIL-MSGID: =?utf-8?q?1747824708001087662?= Switch the driver from legacy gpio API (that uses flat GPIO numbering) to the newer gpiod API (which used descriptors and respects line polarities specified in ACPI or device tree). Because gpio handling code for SPI and I2C variants duplicates each other it is moved into the core code for the driver. Also, it seems that the driver never assigned tpm_dev->io_lpcpd in the past, so gpio-based power management was most likely not working ever. Signed-off-by: Dmitry Torokhov Reviewed-by: Jarkko Sakkinen --- v3: no changes v2: reworked commit message drivers/char/tpm/st33zp24/i2c.c | 101 +-------------------------- drivers/char/tpm/st33zp24/spi.c | 100 +------------------------- drivers/char/tpm/st33zp24/st33zp24.c | 39 +++++++++-- drivers/char/tpm/st33zp24/st33zp24.h | 4 +- 4 files changed, 39 insertions(+), 205 deletions(-) diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index c560532647c8..614c7d8ed84f 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -6,10 +6,7 @@ #include #include -#include -#include -#include -#include +#include #include #include @@ -21,7 +18,6 @@ struct st33zp24_i2c_phy { struct i2c_client *client; u8 buf[ST33ZP24_BUFSIZE + 1]; - int io_lpcpd; }; /* @@ -98,85 +94,6 @@ static const struct st33zp24_phy_ops i2c_phy_ops = { .recv = st33zp24_i2c_recv, }; -static const struct acpi_gpio_params lpcpd_gpios = { 1, 0, false }; - -static const struct acpi_gpio_mapping acpi_st33zp24_gpios[] = { - { "lpcpd-gpios", &lpcpd_gpios, 1 }, - {}, -}; - -static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client) -{ - struct tpm_chip *chip = i2c_get_clientdata(client); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_i2c_phy *phy = tpm_dev->phy_id; - struct gpio_desc *gpiod_lpcpd; - struct device *dev = &client->dev; - int ret; - - ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios); - if (ret) - return ret; - - /* Get LPCPD GPIO from ACPI */ - gpiod_lpcpd = devm_gpiod_get(dev, "lpcpd", GPIOD_OUT_HIGH); - if (IS_ERR(gpiod_lpcpd)) { - dev_err(&client->dev, - "Failed to retrieve lpcpd-gpios from acpi.\n"); - phy->io_lpcpd = -1; - /* - * lpcpd pin is not specified. This is not an issue as - * power management can be also managed by TPM specific - * commands. So leave with a success status code. - */ - return 0; - } - - phy->io_lpcpd = desc_to_gpio(gpiod_lpcpd); - - return 0; -} - -static int st33zp24_i2c_of_request_resources(struct i2c_client *client) -{ - struct tpm_chip *chip = i2c_get_clientdata(client); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_i2c_phy *phy = tpm_dev->phy_id; - struct device_node *pp; - int gpio; - int ret; - - pp = client->dev.of_node; - if (!pp) { - dev_err(&client->dev, "No platform data\n"); - return -ENODEV; - } - - /* Get GPIO from device tree */ - gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0); - if (gpio < 0) { - dev_err(&client->dev, - "Failed to retrieve lpcpd-gpios from dts.\n"); - phy->io_lpcpd = -1; - /* - * lpcpd pin is not specified. This is not an issue as - * power management can be also managed by TPM specific - * commands. So leave with a success status code. - */ - return 0; - } - /* GPIO request and configuration */ - ret = devm_gpio_request_one(&client->dev, gpio, - GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD"); - if (ret) { - dev_err(&client->dev, "Failed to request lpcpd pin\n"); - return -ENODEV; - } - phy->io_lpcpd = gpio; - - return 0; -} - /* * st33zp24_i2c_probe initialize the TPM device * @param: client, the i2c_client description (TPM I2C description). @@ -187,7 +104,6 @@ static int st33zp24_i2c_of_request_resources(struct i2c_client *client) static int st33zp24_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { - int ret; struct st33zp24_i2c_phy *phy; if (!client) { @@ -208,20 +124,7 @@ static int st33zp24_i2c_probe(struct i2c_client *client, phy->client = client; - if (client->dev.of_node) { - ret = st33zp24_i2c_of_request_resources(client); - if (ret) - return ret; - } else if (ACPI_HANDLE(&client->dev)) { - ret = st33zp24_i2c_acpi_request_resources(client); - if (ret) - return ret; - } else { - return -ENODEV; - } - - return st33zp24_probe(phy, &i2c_phy_ops, &client->dev, client->irq, - phy->io_lpcpd); + return st33zp24_probe(phy, &i2c_phy_ops, &client->dev, client->irq); } /* diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 2b121d009959..25b0e7994d27 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -6,10 +6,7 @@ #include #include -#include -#include -#include -#include +#include #include #include @@ -60,7 +57,6 @@ struct st33zp24_spi_phy { u8 tx_buf[ST33ZP24_SPI_BUFFER_SIZE]; u8 rx_buf[ST33ZP24_SPI_BUFFER_SIZE]; - int io_lpcpd; int latency; }; @@ -217,84 +213,6 @@ static const struct st33zp24_phy_ops spi_phy_ops = { .recv = st33zp24_spi_recv, }; -static const struct acpi_gpio_params lpcpd_gpios = { 1, 0, false }; - -static const struct acpi_gpio_mapping acpi_st33zp24_gpios[] = { - { "lpcpd-gpios", &lpcpd_gpios, 1 }, - {}, -}; - -static int st33zp24_spi_acpi_request_resources(struct spi_device *spi_dev) -{ - struct tpm_chip *chip = spi_get_drvdata(spi_dev); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_spi_phy *phy = tpm_dev->phy_id; - struct gpio_desc *gpiod_lpcpd; - struct device *dev = &spi_dev->dev; - int ret; - - ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios); - if (ret) - return ret; - - /* Get LPCPD GPIO from ACPI */ - gpiod_lpcpd = devm_gpiod_get(dev, "lpcpd", GPIOD_OUT_HIGH); - if (IS_ERR(gpiod_lpcpd)) { - dev_err(dev, "Failed to retrieve lpcpd-gpios from acpi.\n"); - phy->io_lpcpd = -1; - /* - * lpcpd pin is not specified. This is not an issue as - * power management can be also managed by TPM specific - * commands. So leave with a success status code. - */ - return 0; - } - - phy->io_lpcpd = desc_to_gpio(gpiod_lpcpd); - - return 0; -} - -static int st33zp24_spi_of_request_resources(struct spi_device *spi_dev) -{ - struct tpm_chip *chip = spi_get_drvdata(spi_dev); - struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); - struct st33zp24_spi_phy *phy = tpm_dev->phy_id; - struct device_node *pp; - int gpio; - int ret; - - pp = spi_dev->dev.of_node; - if (!pp) { - dev_err(&spi_dev->dev, "No platform data\n"); - return -ENODEV; - } - - /* Get GPIO from device tree */ - gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0); - if (gpio < 0) { - dev_err(&spi_dev->dev, - "Failed to retrieve lpcpd-gpios from dts.\n"); - phy->io_lpcpd = -1; - /* - * lpcpd pin is not specified. This is not an issue as - * power management can be also managed by TPM specific - * commands. So leave with a success status code. - */ - return 0; - } - /* GPIO request and configuration */ - ret = devm_gpio_request_one(&spi_dev->dev, gpio, - GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD"); - if (ret) { - dev_err(&spi_dev->dev, "Failed to request lpcpd pin\n"); - return -ENODEV; - } - phy->io_lpcpd = gpio; - - return 0; -} - /* * st33zp24_spi_probe initialize the TPM device * @param: dev, the spi_device description (TPM SPI description). @@ -303,7 +221,6 @@ static int st33zp24_spi_of_request_resources(struct spi_device *spi_dev) */ static int st33zp24_spi_probe(struct spi_device *dev) { - int ret; struct st33zp24_spi_phy *phy; /* Check SPI platform functionnalities */ @@ -320,24 +237,11 @@ static int st33zp24_spi_probe(struct spi_device *dev) phy->spi_device = dev; - if (dev->dev.of_node) { - ret = st33zp24_spi_of_request_resources(dev); - if (ret) - return ret; - } else if (ACPI_HANDLE(&dev->dev)) { - ret = st33zp24_spi_acpi_request_resources(dev); - if (ret) - return ret; - } else { - return -ENODEV; - } - phy->latency = st33zp24_spi_evaluate_latency(phy); if (phy->latency <= 0) return -ENODEV; - return st33zp24_probe(phy, &spi_phy_ops, &dev->dev, dev->irq, - phy->io_lpcpd); + return st33zp24_probe(phy, &spi_phy_ops, &dev->dev, dev->irq); } /* diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c index 15b393e92c8e..a5b554cd4778 100644 --- a/drivers/char/tpm/st33zp24/st33zp24.c +++ b/drivers/char/tpm/st33zp24/st33zp24.c @@ -4,6 +4,7 @@ * Copyright (C) 2009 - 2016 STMicroelectronics */ +#include #include #include #include @@ -12,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -432,11 +433,18 @@ static const struct tpm_class_ops st33zp24_tpm = { .req_canceled = st33zp24_req_canceled, }; +static const struct acpi_gpio_params lpcpd_gpios = { 1, 0, false }; + +static const struct acpi_gpio_mapping acpi_st33zp24_gpios[] = { + { "lpcpd-gpios", &lpcpd_gpios, 1 }, + { }, +}; + /* * initialize the TPM device */ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, - struct device *dev, int irq, int io_lpcpd) + struct device *dev, int irq) { int ret; u8 intmask = 0; @@ -463,6 +471,25 @@ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, tpm_dev->locality = LOCALITY0; + if (ACPI_COMPANION(dev)) { + ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios); + if (ret) + return ret; + } + + /* + * Get LPCPD GPIO. If lpcpd pin is not specified. This is not an + * issue as power management can be also managed by TPM specific + * commands. + */ + tpm_dev->io_lpcpd = devm_gpiod_get_optional(dev, "lpcpd", + GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(tpm_dev->io_lpcpd); + if (ret) { + dev_err(dev, "failed to request lpcpd gpio: %d\n", ret); + return ret; + } + if (irq) { /* INTERRUPT Setup */ init_waitqueue_head(&tpm_dev->read_queue); @@ -525,8 +552,8 @@ int st33zp24_pm_suspend(struct device *dev) int ret = 0; - if (gpio_is_valid(tpm_dev->io_lpcpd)) - gpio_set_value(tpm_dev->io_lpcpd, 0); + if (tpm_dev->io_lpcpd) + gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 0); else ret = tpm_pm_suspend(dev); @@ -540,8 +567,8 @@ int st33zp24_pm_resume(struct device *dev) struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev); int ret = 0; - if (gpio_is_valid(tpm_dev->io_lpcpd)) { - gpio_set_value(tpm_dev->io_lpcpd, 1); + if (tpm_dev->io_lpcpd) { + gpiod_set_value_cansleep(tpm_dev->io_lpcpd, 1); ret = wait_for_stat(chip, TPM_STS_VALID, chip->timeout_b, &tpm_dev->read_queue, false); diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h index 6a26dbc3206b..5acc85f711e6 100644 --- a/drivers/char/tpm/st33zp24/st33zp24.h +++ b/drivers/char/tpm/st33zp24/st33zp24.h @@ -20,7 +20,7 @@ struct st33zp24_dev { int locality; int irq; u32 intrs; - int io_lpcpd; + struct gpio_desc *io_lpcpd; wait_queue_head_t read_queue; }; @@ -36,6 +36,6 @@ int st33zp24_pm_resume(struct device *dev); #endif int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops, - struct device *dev, int irq, int io_lpcpd); + struct device *dev, int irq); void st33zp24_remove(struct tpm_chip *chip); #endif /* __LOCAL_ST33ZP24_H__ */ From patchwork Thu Oct 27 07:13:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp81671wru; Thu, 27 Oct 2022 00:26:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fALHDVUKhGBMpECUTo094OyhzvM2brMGCuX5rZPo37JlgWovoEQI74UWQQXn0WrC/Co2r X-Received: by 2002:a17:907:31c1:b0:742:28a3:5d08 with SMTP id xf1-20020a17090731c100b0074228a35d08mr40377043ejb.112.1666855564510; Thu, 27 Oct 2022 00:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666855564; cv=none; d=google.com; s=arc-20160816; b=xlUoB44P/MOct56rtk2V6sQvTy5FaOX1UdJc1d6y0wMkvzZm4aI/Isbi8XXXPTzc/w NJVNVacigIKAInfqg+LxtLY+JJYY/ITjHEO7btJvhL5xEM2dY84ZWXVEsxAUt5t8w6We J/rGvAHawqfld0HMV0IOy7naBybrqY+3Zf4+b8lSThbjDTCDl8hcppTKforWnpZu0v1l UbxK6Hf9i3O3Vot9MAHYYBgCfoajVQ2KCvLuO/qmx73YzmY+MZuwbLPe7x6nNywNjsNK p937yClasuUbz5MyCFMl9htTMIN9hqissFEGLk5tD2LbN5uAubxQnXIoJh6GWzQ3hKCa iUsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z8uC60Lm5VPQvrMvRNF42R32uBkv9Pf19UWsJ/wtWPU=; b=gxwmFQMrKVOjmm/Yshx+4vgyk7YR4bgI7GY2fhbTSYklmRBCNg2v83EvCOp5l/ryqI i4gXIyJpBU7QDKbq5Ri6327PGuV+8Pab7v25IDwvEN21FZWKYtPFlUeqc7zIZhtR+lRo c9FcZSYBdRjO1sDKSWHwdTgjY8oL6TsER+Bf3IwV++7D1PTu7uTelD3ai5/8Em6iLBQx YEeqGK0FpddxKlg0Ug4hBphWmmB8WMRXCwG4a6x9FkAIiBpku65GAX5FFfUTq1tSVHiM nJ2ehrboQZpVCGKqLLBp9RSf41sHJFRY5iKERkALkqyovHrRniF4q+KoMsT53Y3PFssC LOMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QBgrM6yN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg3-20020a1709072cc300b0078da3218b54si677445ejc.171.2022.10.27.00.25.40; Thu, 27 Oct 2022 00:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QBgrM6yN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbiJ0HOG (ORCPT + 99 others); Thu, 27 Oct 2022 03:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234475AbiJ0HN6 (ORCPT ); Thu, 27 Oct 2022 03:13:58 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5679A153E0F; Thu, 27 Oct 2022 00:13:57 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id l6so746576pjj.0; Thu, 27 Oct 2022 00:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z8uC60Lm5VPQvrMvRNF42R32uBkv9Pf19UWsJ/wtWPU=; b=QBgrM6yNGhTKdBH2jup/NAGiL/CLp/VY8VlvFR5+hlHOj+B6LhTkei9NtNa9+/vxF0 x84vsvtzspU4nnfkRt4O6p0fyq6BhXTVoh4dB7Uhs5GywQxCIrm3rXpCdF87l6vZMzdP U85dYCB4DJbGOJp1gQGQEqhgkhqJ2kFv5EWGnaV7Ym5vlq4rPB7VqsBI9B9g1ANMokuV odsDdFX6MB6QLKeelXmqCWRHzNZFCRVeRAaRsFtJFBIhxoDdXo59vIhyFfRa8UetLVAO /TBUkrJffERVJQ0BR4NsqgHkphQZfguBF9YH+kU5M0AeuL7nzjSsAN1D80IYTgJrCnT6 0uCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z8uC60Lm5VPQvrMvRNF42R32uBkv9Pf19UWsJ/wtWPU=; b=s1c/c31OgnO1VS4b9AH1eakI0GThM6lQDX1Ulbm1F7ZbP5ljrxuxSDKnaV+g2VX8HG U9yaD5XdiLFFQPCigbCjI+duU7soKa8pH1sigatsc38IfZdr3nAJ3zprnoXHyXNX9dDC 6dMRRf7f1ChlLR/8MCorTflegYN2TieG8lGf+lpVF2ZndRaFIKRZxM+chXE9pY8Mwl8r QdBdR64o0UwTuQ0xHoe9OBfhhmC7F+iAw+NfMjqPzY59m8gp5GS2l7UGqsRrPVu2r/mv A9UkrLQrQ+pB88AX1Vwc+8kn1LVQ+FsCG5hEXsTqlta6E0ILO2+WtNljSky9ilf37OjQ PFeQ== X-Gm-Message-State: ACrzQf3rkKPZYE2c9UeC9OohoLD9ny8YtJQrw98Hw+GdwWcCq+I3IqDH yrRBOqS2pox9sqmQnlHmDXaIpbzN7bs= X-Received: by 2002:a17:902:ef52:b0:17c:f072:95bc with SMTP id e18-20020a170902ef5200b0017cf07295bcmr6845576plx.28.1666854836693; Thu, 27 Oct 2022 00:13:56 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:99d6:ae15:f9aa:1819]) by smtp.gmail.com with ESMTPSA id je11-20020a170903264b00b00186ac812ab0sm496321plb.83.2022.10.27.00.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 00:13:55 -0700 (PDT) From: Dmitry Torokhov To: Peter Huewe , Jarkko Sakkinen Cc: Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] tpm: st33zp24: remove pointless checks on probe Date: Thu, 27 Oct 2022 00:13:49 -0700 Message-Id: <20221027071349.991730-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221027071349.991730-1-dmitry.torokhov@gmail.com> References: <20221027071349.991730-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747824740433824975?= X-GMAIL-MSGID: =?utf-8?q?1747824740433824975?= Remove tests for SPI device or I2C client to be non-NULL because driver core will never call driver's probe method without having a valid device structure. Signed-off-by: Dmitry Torokhov Reviewed-by: Jarkko Sakkinen --- v3: no changes v2: reworked commit message drivers/char/tpm/st33zp24/i2c.c | 6 ------ drivers/char/tpm/st33zp24/spi.c | 7 ------- 2 files changed, 13 deletions(-) diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c index 614c7d8ed84f..8156bb2af78c 100644 --- a/drivers/char/tpm/st33zp24/i2c.c +++ b/drivers/char/tpm/st33zp24/i2c.c @@ -106,12 +106,6 @@ static int st33zp24_i2c_probe(struct i2c_client *client, { struct st33zp24_i2c_phy *phy; - if (!client) { - pr_info("%s: i2c client is NULL. Device not accessible.\n", - __func__); - return -ENODEV; - } - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { dev_info(&client->dev, "client not i2c capable\n"); return -ENODEV; diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c index 25b0e7994d27..c249d3f964fd 100644 --- a/drivers/char/tpm/st33zp24/spi.c +++ b/drivers/char/tpm/st33zp24/spi.c @@ -223,13 +223,6 @@ static int st33zp24_spi_probe(struct spi_device *dev) { struct st33zp24_spi_phy *phy; - /* Check SPI platform functionnalities */ - if (!dev) { - pr_info("%s: dev is NULL. Device is not accessible.\n", - __func__); - return -ENODEV; - } - phy = devm_kzalloc(&dev->dev, sizeof(struct st33zp24_spi_phy), GFP_KERNEL); if (!phy)