From patchwork Wed Jul 5 11:55:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 116092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1820715vqx; Wed, 5 Jul 2023 05:11:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHVxNMghgJRptuptTd1IBiODwh1ukgP36xW0R9/38yu+tFRaPJKZCb0V6ETrBViQu2zNtFt X-Received: by 2002:a05:6a20:1610:b0:12f:dc60:2b9e with SMTP id l16-20020a056a20161000b0012fdc602b9emr316468pzj.48.1688559119493; Wed, 05 Jul 2023 05:11:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688559119; cv=pass; d=google.com; s=arc-20160816; b=Hxr2mx7dI51NLlkIY9lq5fQKy5UfpRq+m3iwmwa2D8q5UrpRa75DjdqQtwIDRouVBG 54gjQBWdKHI1JoL7Gq7zcMhWMgqsQgI+CWqxs6vuT3Uz+q6RwgVh6lcfwN+9taHsW652 zMBZUUtVIOtFEKgRBtx272C/8uMj9DDUn7txLc+ZO1UxM/rw2RIsl8XYMzQKGmNhnsdl 6V8DWXgPG2QKKu5TuF1mRaHApTh+UBMhew5jjPoWgWmqqcLGsAWjo0fKanEAntm3ByFl T9RUNu5tWixZ+L3JQSvM4E295nXM33Sms6YomDi72nGYQyZKd8XBJ+KDqNr15DsAJotF dAog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=1QBuSnDq08ApO+V1eouNE+uh8yS62/o0KYueG1oldmw=; fh=ubhl8ku9klSlzHy3ISe4G1rkR3V1exirv0zjb1XEOi4=; b=KRzrr83r+GTHpBPVN5GoeyX2ow0t2Kt6xML0Quo/DczapTnofBwoJiDqtWHhByKw1W TOa8srpUMMYNrYZeDB9w6ykCh7uUvIGzDGj23XES/l/9L7NplwGwk3uDv/661HFLTJ+S u776QGmZW6eeSRjCcntW2rjW/Z6XkTBTwsHdy8eoQzZ4CRnSmkD1lATKmTRda5SvlWsD ER5zQmr/jPjsKGQNiOxvhsjWpPns/q82KTXem4nz+iGSr6+7FMlDqXyu099Y8f2L9Lao RY0JnOLkx0MyAsem1BJgQHJIrcLs6BcBGtm9bA/5KwsVr1r2kNyR5Jyd9apvoSpuWXsC Xu3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=E5p99jgh; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a056a00148d00b006686a09ff4bsi20143336pfu.128.2023.07.05.05.11.46; Wed, 05 Jul 2023 05:11:59 -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=@vivo.com header.s=selector2 header.b=E5p99jgh; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231544AbjGELz6 (ORCPT + 99 others); Wed, 5 Jul 2023 07:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbjGELz5 (ORCPT ); Wed, 5 Jul 2023 07:55:57 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2118.outbound.protection.outlook.com [40.107.117.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E6541717; Wed, 5 Jul 2023 04:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ax+dBxSZ3se6ahR0ISIrafkZ5XJgCgviR9bJawVNJ1GOOWp9hZ3ZPmoozKLAcTf7TO/dMSVf5BAj/i7uhkK1MGv+TwNtKUqe22yTWJ7GGOgDeT0RyayyiZYIfxDJXZlim3CV5/eFuPiw+GSocbTswKY4UL1U1IuD/9UkpoGdgJONjB1EN34PP3rtiinOCi7rYAyIDC4jvnbekAza/9FsvqKbs59xYQz0njr5WICCArIXx+nuT7urSTPkLPF8JhKfH+l100zZEgF8arcUH41SrTQHwGLMZWpWJnGmWbF6j50UE/7FieMTZqIafItVCpuQUJQeRxyE6btoj02VY08aaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1QBuSnDq08ApO+V1eouNE+uh8yS62/o0KYueG1oldmw=; b=m/+vONnwwa9CKSr4IqVePvxMJ/7Ii6znlDum5vI+UAmG0dxBASKV0gCHOCHVyktZywjNMJPQxcvSvAB0X60fn8H+P+PvajXrvAuHqE4aWXegBPF8CGBGgB3j8vVYfoTcFo1NH2A9N2dweKkRWhhfNCxRGG/7jQt/zGOl5MNWnwIqlC2yuNlmd1y8CiB1U3w96V6fBRMsJ7l5TgwtRfOLTx+fPhAOkRqSE4OroKwSxqSt9XblqtolXwBVfdQdnKQcNOINcY3b5aTGesOq6shHZ+9194UkkmyGX/EqjE8/JcKQHbBmMtc61vrp+33WgA4wsNDSmpBRUJI8wSOT7XhKSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1QBuSnDq08ApO+V1eouNE+uh8yS62/o0KYueG1oldmw=; b=E5p99jgha2iV6uj6lCSjsjfnUjtNWZJXEkFL8t3j0okRjQX7rpzfXgdYco/CCWTDssi9FPnX/pqmFRU96QMkq4LpDS9ahrGNyCnr7sroMXeNJIEqxzfXMKStqPG0TcIgZdknMtnEHh67wWFNbqXw4C98C61j63w+DHpx6/8G5bI7fpvK+LX6eCdszyucN9cUl2vUbBKTChkUkiAvrarzdvIK5HMQu96/S9fDqS9EvJUC7lXsW80X45pQI4suJ1245IbjzZR0JU78RbvJ95+uww7pkeTcQo5ixph8gwTCWEHAkWfyd3sV5mU3s0ZeFLxlF2i7tQw8Njgya5WO6bLFYA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Wed, 5 Jul 2023 11:55:48 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 11:55:48 +0000 From: Yangtao Li To: Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe Cc: Yangtao Li , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] tpm/tpm_tis_synquacer: do some cleanup Date: Wed, 5 Jul 2023 19:55:36 +0800 Message-Id: <20230705115536.55931-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SI2PR02CA0045.apcprd02.prod.outlook.com (2603:1096:4:196::21) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB5140:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bdf6544-5c1e-4d44-dc8b-08db7d4ec58d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ThvCgH4ds1J1shgbg3lZxgYSCvizlpYciyIH46H0SVdL5fSstfcMXh45NLg/AOrLoV8mvGS2FYOVW16k8zTPgWSsrPzkLGN0XRM3Tw7tJVMu/BDGOaGs57N7laAjOQKfclyR86/yXOOAXVC7zFPE0E4KD05jUWKSF3EyInrGshuoDQDEGdCnyAByOKgw5tmPkesuiduSav4z5zRIdJPQXpjnxL27Cy/Q2ZxkR5zxWwiZ6sGSZZSDT9zWadfNWpcYrZjCAzHXa99L0t2f8JF/O7x+PCBKwvnd7/yW4OkV1J6+4DNnA7sFImDJBlLx9CEbN74ORzpU7BCEcdksm5CbjvIABL1zsF01h4rwYnSPf8ZXavUvKBpmOzxen7k06Yf42HEgqATGx+dQEjhaO5BfRH7dLB5J/uCImjF0VXRGxZo7L8/s3D0XYRAKXLtvPaZp8ALcnhCPDJkNwfXrSqd0+fMcanRpCfxGprjmNsnmAmRNAGk7moG7dHFg3QZK1eAlbDr8oNSP4mAk1aaKcw3LrkACt44BRHrZ7mLp8v8LuMS2eYz80fJChFQF/eTD7KgoR7GzkqjOMBg3nOdUiBt5oiIS+T3mQCaXLEg8otVZWh3RrR0kUcVNhXcmu3SX7lA6 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(451199021)(38100700002)(83380400001)(8936002)(38350700002)(8676002)(186003)(41300700001)(26005)(1076003)(6506007)(52116002)(2906002)(6486002)(86362001)(6666004)(6512007)(316002)(5660300002)(2616005)(36756003)(110136005)(4326008)(478600001)(66476007)(66946007)(66556008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jjLjrce6duO5il6kCDDw1abHUnog834V93F9hKRlYbl84kohATu8tgRFAyicVNYN2/yXJhAq1emOwKeYAu18d2gnmkSMST/+sjqerXLaS1k6PcKfJ8VsxSwt/rE/vwvqFoXL0AB/XiR8QUKjBEc42+3wZBDqQ56XvVWcEx3PjxD2FKRWNtjl7ErfANOScBGwv5HUN6EObOtLRTkcxhiZ7dA8LOyUyndCwdLIsGUP9G4hFKzmpbjjZqlSoU0pXSt+r4gNnpALvtQfJurDawpIR2foq8gkMMz1Q2WAKz/S+KXqy0kuulYoRBG5saP5OFNSb9DeY/9eHBMe1XqaWUslbpIfhXAw9ubQimBz+PW4dGq7JMDaSingvaWGXz8GNpZb1xhExX08OJ/7DV0L9KN87BdqOwFSnEoQeUFATsbUl4/dIKqXtgKm63PKY4PrHoMcIfy8Wgxq1nWAW1g64zDAq6Cilkeg9j72cfHNM0vWyAJSFgfUD4iQ6/sOhKQrRfPSdUy0osF6O2efj4CpNOVl4p6TJOoxzJCuqunjl9xS6Gr60e3E8x+SRzXTI2idGNOu956xO1aUKeBWmC9cM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dc8b-08db7d4ec58d X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 11:55:48.2945 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O5Sc7zY0ihffEaI3JGGuwB2N4rzrrMa04UGQRSszX+PPE5t7YsfZO00Dj+1QC/k5/Hoiau4sJqgz2XJOVmeEMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5140 X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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?1770582567420514173?= X-GMAIL-MSGID: =?utf-8?q?1770582567420514173?= Use devm_platform_ioremap_resource() to simplify code, and remove unnecessary struct tpm_tis_synquacer_info. Signed-off-by: Yangtao Li --- drivers/char/tpm/tpm_tis_synquacer.c | 39 +++++----------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/drivers/char/tpm/tpm_tis_synquacer.c b/drivers/char/tpm/tpm_tis_synquacer.c index 49278746b0e2..6e17b655cbde 100644 --- a/drivers/char/tpm/tpm_tis_synquacer.c +++ b/drivers/char/tpm/tpm_tis_synquacer.c @@ -14,16 +14,6 @@ #include "tpm.h" #include "tpm_tis_core.h" -/* - * irq > 0 means: use irq $irq; - * irq = 0 means: autoprobe for an irq; - * irq = -1 means: no irq support - */ -struct tpm_tis_synquacer_info { - struct resource res; - int irq; -}; - struct tpm_tis_synquacer_phy { struct tpm_tis_data priv; void __iomem *iobase; @@ -91,42 +81,25 @@ static const struct tpm_tis_phy_ops tpm_tcg_bw = { .write_bytes = tpm_tis_synquacer_write_bytes, }; -static int tpm_tis_synquacer_init(struct device *dev, - struct tpm_tis_synquacer_info *tpm_info) +static SIMPLE_DEV_PM_OPS(tpm_tis_synquacer_pm, tpm_pm_suspend, tpm_tis_resume); + +static int tpm_tis_synquacer_probe(struct platform_device *pdev) { struct tpm_tis_synquacer_phy *phy; + struct device *dev = &pdev->dev; phy = devm_kzalloc(dev, sizeof(struct tpm_tis_synquacer_phy), GFP_KERNEL); if (phy == NULL) return -ENOMEM; - phy->iobase = devm_ioremap_resource(dev, &tpm_info->res); + phy->iobase = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(phy->iobase)) return PTR_ERR(phy->iobase); - return tpm_tis_core_init(dev, &phy->priv, tpm_info->irq, &tpm_tcg_bw, + return tpm_tis_core_init(dev, &phy->priv, -1, &tpm_tcg_bw, ACPI_HANDLE(dev)); } -static SIMPLE_DEV_PM_OPS(tpm_tis_synquacer_pm, tpm_pm_suspend, tpm_tis_resume); - -static int tpm_tis_synquacer_probe(struct platform_device *pdev) -{ - struct tpm_tis_synquacer_info tpm_info = {}; - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no memory resource defined\n"); - return -ENODEV; - } - tpm_info.res = *res; - - tpm_info.irq = -1; - - return tpm_tis_synquacer_init(&pdev->dev, &tpm_info); -} - static void tpm_tis_synquacer_remove(struct platform_device *pdev) { struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);