From patchwork Fri Jul 21 09:46:24 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: 123736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp100497vqg; Fri, 21 Jul 2023 03:15:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvPF++pg5gwAdHeIXgMu+Cx9cba38COjwr8ZDoDp9zfDZLn7u3iFGZ6p+WRjsJM7ad/iCV X-Received: by 2002:a05:6512:3d86:b0:4fb:8616:7a03 with SMTP id k6-20020a0565123d8600b004fb86167a03mr1237162lfv.4.1689934507511; Fri, 21 Jul 2023 03:15:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689934507; cv=pass; d=google.com; s=arc-20160816; b=uWKWx1Gvbukwq8h0+wg0h40J0mz/MEoQr3m4TUpnwy22qoijEoY4N2HpKLeEVAB5nW gedwoNF5LmHIhLuO7tjbSqZGjsSh0M0qxDcZhdzvMUJbVrOMqhvXgNYmKItwVaSCKea/ L10ojQfITVZUzkNfHwb591IKwiPNk23CVMAYojzfn+QuslZj7ICmEfRpdxOI3qo8Auf/ xOsrFdbv8oGgRbygbSxCutrGZL4BkfATnpR9C83S+ZuEMuizNzIKAc8E3DlifvtFUAkH HyqWJMd28LrLeE/Yo8R1Pp5xAEdU42jnxRBqy9e0TgM8fV4bWjN2HJC4PTH00G+p/Z9/ i0rw== 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=iZN/WFcRaP+9FH5BrXgS8aXZCGQPSUC13FV+qNWDPYY=; fh=rOCi8f4S9lgt8FYmciyOdpqeSC132hytSY0T3bZgXro=; b=Ajiao0ou/0kNt5Bo2+F7Ya6iO+UzpzMxL3iGC6/wIDNZkCPKikLCT7RSAJNQuF2ioz qXrDmAHS/pbwnTBSvzbsirgtbvgQkMMk+BmTsloi4cLBBhS2X0O1Urizr8bc1M8b68xd l4F8EbaQf70Zt5eGD0IeTPfyf0S3LO3LX9TU4ZZD2yRsfwPn95UxDQhHcJvJuolPTdQ6 5uYvUDeaiN+kmDj9PZVUAK4s6168fmx9EY7B8zahhV/1Uw4fVKCeGKV/JMoDVFzHg+cE 20D1a9ZFLFEz+jGTUg/UKCMF7Q7Ed1XfhJaFKF2rFqKBcJUEf1gkVG2BTe1lx02q8WKE OTlw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ep9CqEnu; 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 f2-20020aa7d842000000b0051e10e83750si2067941eds.294.2023.07.21.03.14.43; Fri, 21 Jul 2023 03:15:07 -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=ep9CqEnu; 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 S231608AbjGUJrX (ORCPT + 99 others); Fri, 21 Jul 2023 05:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbjGUJrM (ORCPT ); Fri, 21 Jul 2023 05:47:12 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8ED6121; Fri, 21 Jul 2023 02:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlBnFID395hIWZq+tA4uOukFYY/FkZlzQBu5zT7tVw753PX1Mhl8sSR3dBx/RVzpGiYjD2rWZ+NBEX3quNO6+rWlNUOEgYsnWHL4m2gMVolNw6WAdgzRkp4v94eTV/T9RIscjE9vNxDAFKUC7Ci6m3uskBfqF4qvLoBPukAAXHg+Y6cwAnOe46Xul3XbkmEW1u+rNRyQ1ICKvrQp/d11Fjs09F+OZyH++eAMAAVoLccJKM623qD92AxNoryJ8uSCVsTH/AuApHEf4V8tK7tqfDh6jWwEnh4VL7HRkdaOHJJ6dJ/sk8sWn/DmIJzedjZetO1b9GMx8BVKOhxMkpnmSQ== 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=iZN/WFcRaP+9FH5BrXgS8aXZCGQPSUC13FV+qNWDPYY=; b=U8uyrTNEWl0DaPNn1ufB8CWc2L1LtbjtMJs1Oco2c3tsmVq/EYJHqWUf3nBX99nblJcrMcfHZrypNlG5jllH+9O2MA8Y/uRjri7FnaOd3DpJuIrLn38p4SlkIOHIfabQ6Q5cNziRNjl2O9dtYw9XeOmyT+sfcmZdqyUyrHX2dNLuBhXTQVRECdfW7M/fmLXZe07HGcH+X+nz3+edIMP8S3771Jh+dvh/UI9gKLMYcvdYZd/MUYX5FEjMvW3w4ebUiL1nQoDqVV7kU7uKTmHJ1UZLC8HtgJwS1YJSHEOMvlTmmOT5Y1jY/KTErdyvRxcPi1Bx12M03+m+doTRMCzrbg== 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=iZN/WFcRaP+9FH5BrXgS8aXZCGQPSUC13FV+qNWDPYY=; b=ep9CqEnu0mGdkvWCRjA9ppnKJJ/8RruH02IhFwNlq2QTGBI7i9rSHhrOkwKqyvg8cQaX25hxUHUiOA7WFPZjQJYL3DBufGquc//l6ErW5DPjiMHsayg18MnmFWUL/yPYx8k/e5oE9Dh67mhpn5qoEvEWPbMZpED4JsIGD3QNtELTiQd/lratoa4uPZQRg4/WMVx4pmGcK9NmruLkH3pLgKa57AYYKWFnW11azTwz1IfbI87vUohoIf5EIPxtUbpj7zuUDPpFQ7M1rj/+JhOTWkak33ZEr+vmSfVfd859CHvvJAZWU4PIdW0r6XrTNTHHNlHe1mn1Jd54rwFiJjsLCA== 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 KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:07 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:07 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Thierry Reding , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 05/22] thermal/drivers/tegra: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:24 +0800 Message-Id: <20230721094641.77189-5-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 8586879e-d2ef-4691-cb8d-08db89cf7265 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N1R/WRYUXWBRTlE/G6rI4oDPrXXitKWVveITneUu59A89PbAwXLRDrsboXQb5ia+kPWCK7OCn8eKoxNNciLT88c/jwRpVRMKqdGH/lN1RJ2Y28Hl/oZ7YnpCqDR7Eq4PPwYNb15x1Inna9Dc3QBYy0wTmlkIkMroaMNxD9LghV4+sR6qoJYp/ov8FB3y/GBoduKl2spiMtozsG8s8XlKgGM/DR1Ujx6PQ4tiv2UnMvuqxGNpX0yGcgjLIVATPvRBrRGa5F54oMLrDm9pHM9f6qrFHWIi2m2LtNTTKtFnLpITIlSGaJoMo7fupW2hZalF6wDoFd2UxpSBtT1iVsfBW9R5BWv0mD57WJtFaiuMp/oOdGKm3fLBPpzQkmHsMis5umpPahRj4YBvuuOs62f/2EJH7PiosOl95mGXvrzjmxl4LYsi6l0VLObTcE5/Dpzm6jAYhBJz2K6lHBCZg6I/82EKZ5yCvP5w2tv2Yl+jpO7X+avFfTtb63+7/wwagj1ppL7IxzzHNkhPYZk/Fzc3BX0tbsfGff+wJfXU0R+eFXR2bSF2p/ImBYtFfAkHCPRvWoAHtVn1FvJ/uueRVrP7MQIqPMisoAdT/TbIsMM2H+UakNfkZpSedeFJ3pCRvAhH 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)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?1ofWZt24utouz97Lh3DZE3SAEQ2D?= =?utf-8?q?hjX30ks2EC0HBzKCQT0OYpTNhDnrx2eDrie9jGdw66j4s35YdHoPYwpMQmnQDxOiG?= =?utf-8?q?IQmA9Fb1l+jAXFklIzU8jkVTyCIt1NNYPlyIc6VH7PyaAlgorTgy9C/Kb/3cAfnxG?= =?utf-8?q?rdYM6Xuq6owng3DTl4AAQdVPHOm/p97tj1sUirc3GuH68sD1aOZoEDeIrDAOmCl81?= =?utf-8?q?gsHnDJ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ctqW7L4UmydnWpVMKIGM67enW2FLyWFOzR4JzeehX?= =?utf-8?q?XeP/6vYcsm5++T+vFYdSt7AVsaP9g6jPwKN3i2VWaK1cTlfXIW8nmVkYkonLWKKYz?= =?utf-8?q?TjHLBSgPLYhyt7IrC995nTH3Jcr24blBo4RLJvjvnevQL+HgH1Pp7WufVz9EH37v9?= =?utf-8?q?ZW2JDZoTU1aemmjfJ/Kn0094v1TsBfzUe7sEa+jKKUa3CSMrHcVdpfHzsUqK4hP4e?= =?utf-8?q?wYCHOkIGkgDuV6aFHwh4Ti6QCirF34YEmaRyWYTY1TJdYC4enxyrcfO95zTP2uptD?= =?utf-8?q?B4VQZ111ttLm8+lO3oAflfxfBAnpUEZ5x54cIHqSGXpxC5GDOauUpJNC2bHTPGMOT?= =?utf-8?q?4PtmyoLj15hmDcCGbaFvtUoZy7EvZLX1g3NzEvx8Us1YMXn1w9Ua1Z6Ao4G0v5Wet?= =?utf-8?q?W/2nDd9jK8DV?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8586879e-d2ef-4691-cb8d-08db89cf7265 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:07.4997 (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: wNW3TPwwtEjDrm5Rz4FYU65osTkUsFpEgq9VpYL5lhx99qUiQhIr9x+rwn/fyMoruybFom/egyYNNbnF3KJsDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 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, URIBL_BLOCKED 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: 1772024765987207875 X-GMAIL-MSGID: 1772024765987207875 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 Acked-by: Thierry Reding --- drivers/thermal/tegra/soctherm.c | 38 ++++++++++++------------- drivers/thermal/tegra/tegra30-tsensor.c | 9 +++--- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index ea66cba09e56..3d144377d90a 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1993,29 +1993,27 @@ static int soctherm_interrupts_init(struct platform_device *pdev, return 0; } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->thermal_irq, - soctherm_thermal_isr, - soctherm_thermal_isr_thread, - IRQF_ONESHOT, - dev_name(&pdev->dev), - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'thermal_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->thermal_irq, + soctherm_thermal_isr, + soctherm_thermal_isr_thread, + IRQF_ONESHOT, + dev_name(&pdev->dev), + tegra, + "thermal_irq"); + if (ret < 0) return ret; - } - ret = devm_request_threaded_irq(&pdev->dev, - tegra->edp_irq, - soctherm_edp_isr, - soctherm_edp_isr_thread, - IRQF_ONESHOT, - "soctherm_edp", - tegra); - if (ret < 0) { - dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n"); + ret = devm_request_threaded_irq_probe(&pdev->dev, + tegra->edp_irq, + soctherm_edp_isr, + soctherm_edp_isr_thread, + IRQF_ONESHOT, + "soctherm_edp", + tegra, + "edp_irq"); + if (ret < 0) return ret; - } return 0; } diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index c243e9d76d3c..dd4c2deba93a 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -593,12 +593,11 @@ static int tegra_tsensor_probe(struct platform_device *pdev) return err; } - err = devm_request_threaded_irq(&pdev->dev, irq, NULL, - tegra_tsensor_isr, IRQF_ONESHOT, - "tegra_tsensor", ts); + err = devm_request_threaded_irq_probe(&pdev->dev, irq, NULL, + tegra_tsensor_isr, IRQF_ONESHOT, + "tegra_tsensor", ts, NULL); if (err) - return dev_err_probe(&pdev->dev, err, - "failed to request interrupt\n"); + return err; return 0; }