From patchwork Mon Jul 10 09:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 117823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4923722vqx; Mon, 10 Jul 2023 03:30:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFaZALFHvk6Cyb2IA4wSJjtUKnim6TKpzdYQzi8FyMDIJEXUu05gL4l+g9Zwku5mCpJNPWH X-Received: by 2002:a05:6a00:1593:b0:65e:ec60:b019 with SMTP id u19-20020a056a00159300b0065eec60b019mr11842195pfk.25.1688985017856; Mon, 10 Jul 2023 03:30:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688985017; cv=pass; d=google.com; s=arc-20160816; b=Y6q/85zC9YCeJU73mEuaPWH8M26q0UV2WfDjBCiymmNQFsM2ECtirWUnNBJ+aUB/E9 5RvFcwLz6MUB3Eb3moiIdHoU4AWiSUNEUdjUEbFohv3dtRguMSwJfQJpARiS93G0/V8+ 9fpRiDF/+ICLeQJeDignliCNxXljR/3LUYvElI3uTAV+OxlLL79GouuKf/yj/SEUkdcS JJsBgTh5XdkJeBpt4Nz/wUmS7p+mt+RNB3BNrxkN2b9Rd0Ggc6DhliF9X3wYU3wzxO92 HWU8yvMIuuc3h7lw4a//Ac++50yPGaYxJ4OL2H28Bx/QMKqPHq5tVoWz7JJZ2/ka0Ziu mw/g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; fh=uhb0tWY3DZhFoiMRpCYT6Zpdsm7pw1omYkhuSEHw6hc=; b=JQwTALisK98scM+tQhb39+XZkmcea5Wrm7XuzeyN8V2uaZwD+TJfM94J7Simz/hSBH Q8PJlyc/wZZbjkWQpa4STJaAzYisA4Yu9r1cV/Tb1bUJhuYgZzSI1jnCLq4+BuspBbNP SURXTlLUOstAyTbt9SlMKXJSa/XSmGGKDQT023TKyZ+E2QGDHPPi0Y1XlKhDuVgJVQYm hSUtZQPR4A7F77t4EgzqEYXYZZELTxvHcrQR2E0Ald8t7jCV6WW2Ghr2+MOa4mY+sKmj XF5SZCSur72yWotvB+x2+fa6baIlXGPOwmd6Bbd3hu4wra+f5Ib/z2sjJAlNvpTTwx7f BYqw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=OTivwJYd; 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 i11-20020a63e44b000000b0055bdf89c9d8si8431810pgk.436.2023.07.10.03.30.05; Mon, 10 Jul 2023 03:30:17 -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=OTivwJYd; 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 S233080AbjGJKEW (ORCPT + 99 others); Mon, 10 Jul 2023 06:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233175AbjGJKDE (ORCPT ); Mon, 10 Jul 2023 06:03:04 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2116.outbound.protection.outlook.com [40.107.255.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0914A30ED; Mon, 10 Jul 2023 03:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kmg3uoddLgH2HqJ4Lq9wtmkTHazEPeYHk0yc60f7Zq8+YLQIbKTH1DGIwyie3W182vXBcd7FQ3F6rrLHXE1yirmTn7R++qhRPf5FeyzKVMkIezDZX7VRwLBY4SEi1AxCOkqiRoMkfVJNHdedJiWtBA+JTKs/X94K/6csnoPkmKPgbrOal6+6I4aV0c/uhLFmzHFc8xpjbtTMOqUkO71A84mUnj2FROlsTcvojAGGPrRoyHx76f9J+oEnWFU2gbtFCDWbb3RIkC+HXbQDUQyCfx2RoEutIAI6VsWtXHbMKKHVzt3KBqMu00h6W/vnVSGflQ55TuQPrx47bVw5V6X+kg== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=j3DVgwAHwNEaKMtwybnIJCQ3vVFTXCoKlCW/ElXB08pUg0+roeiJRnG26cuHnrjDBgO09FcAvLRzNfgjBuQvrJfDsACi5WScnjdveLL31xcCVfdgwRR47D0g97xTaguy0Xr07d26aICULr+JTl+3vt9fH9Xk8cp90zoPgyhZ06eqz9xDangnXsqXfVvfZHvqx4sWnnyGLyMgrleEyNs72mwBJ60+ndg3QDsKv10yD+zwj/0UtQctE/QhuGQK42NMBP8XdjYDw55/pu/rujiNgJdrQxk0sZthYKXdKel3t+HWyTWsEKLGrgdh8PJJi5al3cudI0nFd6zikQ2QATIiug== 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=z2bNiGiAU1XFsAzb166a8FEiVMJJWw+3IBnh7N4SJ7M=; b=OTivwJYdrPsPuKlTbRSi7SdXPMYC56kvgKem8+V7MKZFNoNjz4PnKglGg1C5XXACLz1g32ufLpTf1aiBGp4DDw/u3q80N9gmnW+26UZnYzwpwOdEVR91UsQjCFGKQW/9fyTdzV69kgyp6ztYb8SImIBWTTnY022TYv6FvUOwTfv3HB1BRaXmjSbQ1zOTC0EzZqOJpvp2yiK0+aVCQbIeHeDIlLviRx/c3tuECalcQX7B/RL+YLAAyDF7jCB2rRhhhN3jfsnFhbY0p4U+Nz6kGhVu/NGUUmss3IgDSlMPz908u7/pxO8MGmW6MkSJZt+zAz5aP3CM1gM7SShsY1TkgA== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 10:00:13 +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.028; Mon, 10 Jul 2023 10:00:13 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 13/21] drivers/thermal/rcar_gen3_thermal: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:17 +0800 Message-Id: <20230710095926.15614-13-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FGFxXNSk8r927CST4YDqi6bWtLMal84kHb1QTmR3jv+iCCQ7r09Qx11XFZOmL1vXy/+l0yIQbWBil1C/ZiES0QLoIx1XcgkVeErhbeHF7RUikL89bxEH+jd15Cars6rLcbXRYt5pIAcq7KNyX5fdB/CEWKOOhQe/hJuuttdQWLdfi9nNIjC6UO+Gr+Po7OY5Jx0nSvU1o8GBkEwwEjizejuHOM/VjkH59evPuAGctmeOxWt/oieLFDOsa4zzzQKg6FQ0/2DGSsD9dNHGkuP/jSd8qWm7LST6AvLxujD1ylam9SacWH1VV7i10jLKdP+J959lvfUZM6QE4kIhlFRiZrhpkNBM8wauF2UVVmGxxKaQ2aFlrEKVEqfyppQG8un6eCDzXEXd//AV+yGlVNZ54aexK5TwowRGhTLj+ZIGelDuHRrBf2rQgOwzldvUosHCq44asUBt2BlpBAahkXpB7+/2HlwQgT/+GNZzIVPrcx/HFJK2VdRqTFczgmvLoPstbPS0+xiA6AaD+n3NtoTVvN0rmQdFmlv467nxLlDEVzI6yChrhzhqgR16RMGCSJy/1qSYG8WfnSpy8fLicj+XnlRpZOPnTh4BPWAZjliicVGOF39mVCUVyGOmmmOrxUTM 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)(376002)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0kJPr3YzBcZ/WwV+V6dGQ7WwNVi6?= =?utf-8?q?uDqrTYeW10RnvVtUAi6MDX9eKs6x80sw2Y73o7ukwUbmDzRjv8YKHYDUwh7EsgSmX?= =?utf-8?q?60kBU1K5qk1bEbB3/vJQ8VkK2kcnk90fEqFkqo0XbYYPLAbRuhlgz+95Rpcsxux4q?= =?utf-8?q?IursXaK0mAjQSjquhnmhYRqnIx2pbaWvUQzqRAhClcV75GojEoO96bS+126xjI/VQ?= =?utf-8?q?qNuQyxbnszhrw8v5Kbgg+3JGnGG1fNAWgHrMewn59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TD829yGTSlykaHU4JmoFd?= =?utf-8?q?is8hIQznz4VjdmXW3IpsEpr2YJ24r19hYspXOJL4F8XQrBBOkA3O45UD5+r0vYHzG?= =?utf-8?q?wHAL1rBjLP03qkkbSmaEWNZNyhm2Kd7iYk+ArK66ZHA32OHXy/Sr+61/6kw/fwFfZ?= =?utf-8?q?xYrexF6y7eMSYJRKEPpkB/Z8MEIR2dBvtHg2n3M1bgy5rahe1I9CH7nvBU7jzAxKT?= =?utf-8?q?fk3up8wuY4aVjwoTIY0w7hP50nmQ5FaxX9f3McGJIGlvCZdGgYyChLk01ryGkseZO?= =?utf-8?q?QfdK23J5VQNJ8ivX2g0C7plJSAauqgvKh8GBuPP6nCA3Z70wLinkf1+YE1ytuNxrn?= =?utf-8?q?oXvFmPUwjozwJ2XADsSFzpcpOPxZlbQgwFJsKg+fM36EMPk4D4yrC5iBUYJ2LDe8V?= =?utf-8?q?RCsP6H82JZHg?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f49ba53-00f4-41dd-a016-08db812c73e5 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:13.0849 (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: jK3OZip0T5XvRxstfX7oP9M7m0NVbAiRX95lgWxXkEemUO7bVjk69ESr9BmGMecugVDNL5KhHmlQyJC5G/2+ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771029153851762470 X-GMAIL-MSGID: 1771029153851762470 There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 2000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So convert to use devm_request*_irq_probe() API, which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Reviewed-by: Geert Uytterhoeven --- drivers/thermal/rcar_gen3_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 9029d01e029b..ff9cd43e1881 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -467,9 +467,10 @@ static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv, if (!irqname) return -ENOMEM; - ret = devm_request_threaded_irq(dev, irq, NULL, - rcar_gen3_thermal_irq, - IRQF_ONESHOT, irqname, priv); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + rcar_gen3_thermal_irq, + IRQF_ONESHOT, irqname, + priv, NULL); if (ret) return ret; }