From patchwork Fri Jul 21 09:46:41 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: 13321762 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BF29C0015E for ; Fri, 21 Jul 2023 09:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LHGlk9eVVMzprf2vwS7UICyS8gA5u6fbqwDBsXoIrJc=; b=C9k65kH3NooyOR V5/HkkZcwMUrb6D/7Ih7FN6awuJiI2RIVKCgoldVRx4js8ApAySPicmgAjd68UXF4AHCezE2Ahnah v7AewQk9yko3E7dv/qWStOcUynQRaDu8ozwMwZCvN9q23NV5aPr9Pts9307BxoDEpw8/nXlQ3oJ4A gtspPc1L2gjmlb/RQORCVC9gh/QBHFm+eD6STKQEk7FlHriXpr/V3Sxrn6bf735u++AslYcYVwRHb EgywWgeNvarTH5W2bAlSVlQcyyjybYZWCaMtVkD7bJLCeSpYf79SeEZ4amoSCbFoIwF5gy6z83Ebg hOcPnd9gj3SpFFyXyjLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMmjx-00Dabg-0Z; Fri, 21 Jul 2023 09:48:01 +0000 Received: from mail-sgaapc01on2071c.outbound.protection.outlook.com ([2a01:111:f400:feab::71c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMmjs-00DaVw-1c for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2023 09:47:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1X9y9FcNNu/kjf/1setfIQ3zY07e2hMPNQhzMkbjMRBjs9PWUpvLAa1O6mN0PH3m3sDtyulsterfmTjx7eIDtXhL2ONqGardJaX/i124yCWr26/tXGc7jyL5PARLU8DsK7ctHUt1AQ8tbTYfOXt4k47wDeI+FosnPSRY3R6PX31O2SJlQtKcvQ7ljWvrAMjgApwJNzT6SNpEkN4W2AcwkISC5uuBMxtpyT+TJC7A+MpF+7HOIj9chrSVXUEl/NzSj7Vldj/id8zmnIqUNndD1yuLHqFHjXU8AiWitOFDtE1UuujRxMIq4VkVxWkJmAe+pQPSOMYLKFCaw21qjvdsg== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=OxLzCYm9O98vAmE18D4z3fGsPw2CghRbp5nI9lzxB34ffyoUbkTZG2oR59/PLvwm/0s53ullYaTrMwNNRP1E3/pVsZFdOSiA3fg61yfMkRZiTs8GWXZLzHiNPQ9+QGbwHirBHZqWT2vuRSqkiXwmuFMoZBrPg5K+DYNk7pY6va6X4hY7MgW+M9is60/t2490nmEyy+Bd2kw6uBAxWN/sR6msQdAdNaqH0ilS0YKEpUQPhIAvlcMldnJBtyZxNyYR0MbIcIzp9T9N5WOtPBJv2Ytc3fLUidnjtJfjuHT6pcy/ZmA7D0VLuv3iPEo6eVs/IFuarHCrX4Pf97rAimeXpA== 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=fIbTe94tJb+c7Hut//D6DIRJqgxdHnLzwdkufWRqizI=; b=YfLqnjU7d0ZgjnPx6Goh2df6H0perLUo5GqPhjXYBeRZwTP5SwtaTd80O9ttxW9miD489ghMngkpoipGYRvdwplxONFyaS2AWT24xNfSDdwY3xTxalTeRWgrNy3a45pMKiPR3A3INGOu2+pJe0zXJU+Zj1lC+3y3l5ySFzUoJojssEqdiQ8l5NfKqZGcYEJn7Mb+DUC1F1ZRizIsEYbZUwLeMK8Y/DPSY5r6YLk/NEoRtuzC7LcwPwlMjNn96AhlFKELmGDZ//qDqu8UvCOx9RQ037G0TSXebYNWiULAaSgKufQ54aTRRcgGFVmsoOv52qYtm9f6seYmDnmy4nBT5w== 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 SEYPR06MB6311.apcprd06.prod.outlook.com (2603:1096:101:13a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.28; Fri, 21 Jul 2023 09:47:51 +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:51 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 22/22] thermal/drivers/imx: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:41 +0800 Message-Id: <20230721094641.77189-22-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_|SEYPR06MB6311:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e42cdd8-88c2-4e7d-1846-08db89cf8c90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fWDUlaltgJhgCnQKW/leisz7mhcwSFLJqiRPwHMzPdZ5GiWwdZEPzAQ6J48RJ6tKro9ie9UINTgmR4JQiZ6hQDboQ4IIS+nHs8SPah/eavS587oin/YnhCmDWLD6K4CE3X9NPAerVJR6qAaD98F0Zn+mit8iMCgiv6sPT41LtTLHm+UXXcXfG80AmUcZoa8j6fShetkB9A9exzDRNlszjDZwoEh7Gp6vpq1lJnaubW+UZSbB/7ph9+dpRWmcXiF/xoLSdSQA5sFY0KGrygLbSUYT8pic2VlelWXqdZsQaYH159SXJN43MmND+tMYQc5/2fSH47OjjgLY+c1k74+dIQ172A9IS4bXATzwqsUguCHtQvpWHjzKhM93cM+RE1pUVCtGoq/ovsAjC5xu+2zjYgUJ+QXOYiNUsytBweq77vSQ+LsmXy6BKF3ZF/Bo7BSzXde3DPwCg+gYfvHe3+SVwniPQ1HfY4m/K26ADmr2MxivARD7aUTjTaYtnhrESiIC/u2IItLtlLk6t6JYIJbOaDMc8y6eDUvI3wO6kcTrmBHQrBO2b/HRKL5rzuc2kYrB1de/3tryZbYPUigR6aQ6hgcJ531hIZlQFxC+Pn7Nw1Ge4kJXL6TrNtpYOnrLLtK9 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)(376002)(346002)(136003)(366004)(39860400002)(451199021)(54906003)(52116002)(6486002)(6666004)(478600001)(110136005)(6512007)(186003)(6506007)(1076003)(26005)(2906002)(41300700001)(316002)(4326008)(7416002)(5660300002)(66476007)(8676002)(2616005)(66946007)(8936002)(66556008)(38100700002)(38350700002)(36756003)(86362001)(66574015)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?j/lit1x+XffgJMhwl/844lV+xZkp?= =?utf-8?q?vM7jGGRION3+sfvvNcDZxBA9JEYosr6QAtB4Z9jPGWpqa9BMRp4k08/HSvrnmrDsz?= =?utf-8?q?jy7z6sCnxw7ea7c18C2a2CQaohrbh3Z/NS++mOBPvW9414kkk7oYRCLS3LlKOp3vk?= =?utf-8?q?Uh4C/Wfa7wyIK4RjZhO6rogdCCBgMh0siamainECUO6NAIgngy2HmMFZqqJkvcpVI?= =?utf-8?q?OvFwgRwLqlLYhPZKaLjhiVDB9zSV/qQp57sJcULETSrNMMn0qoYnNOhtZPOGyu8MP?= =?utf-8?q?mGhwdpMdslLmLvWdAAGFdaAeImnXBi0V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5Unf/qWZZpC?= =?utf-8?q?GF3AyTRgzeNQ6imHlNCSsrnC5DsuTNDpbIKnul+Q5OvYyQXxfgACwVs9BKUe8Sjdc?= =?utf-8?q?QXbJwaK+ksxxdj/9nHmNv+3j6HblVkNBaow33+6Bv49Evl2bu4m8SPqBTVcthhCxR?= =?utf-8?q?bINLAjEdNmCQcLBOBmZ4b/niRHYoehT+XmdhU+8PeFyEzcFb/C8F5aQmvq//stIGg?= =?utf-8?q?zKQ+tvjdwTuftQVl4f1VsFe97x5Fv767/N9VRQSD8HlFnpNnIUiL67omqwLgDfi7T?= =?utf-8?q?uMn6f7hDvlDWAtco1t0tUJRgi2P/Z+a5FHeSql7jagxK3lfd+I4ZGtAkwAKsSUyVB?= =?utf-8?q?DiWsnScTSB40?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e42cdd8-88c2-4e7d-1846-08db89cf8c90 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:51.4455 (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: P+mqNAlShJxMX1ySgcwgYiTsVmWdSj4jbn3SSliafoG+HmcsCinI20aXBLVnIoTQT4k7d9ZtwwJ0cNlbj08KWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6311 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230721_024756_556607_863897D6 X-CRM114-Status: GOOD ( 19.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/thermal/imx_thermal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a94ec0a0c9dd..3131a09f9906 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -746,13 +746,12 @@ static int imx_thermal_probe(struct platform_device *pdev) if (ret) goto thermal_zone_unregister; - ret = devm_request_threaded_irq(&pdev->dev, data->irq, - imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, - 0, "imx_thermal", data); - if (ret < 0) { - dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, data->irq, + imx_thermal_alarm_irq, + imx_thermal_alarm_irq_thread, + 0, "imx_thermal", data, "alarm"); + if (ret < 0) goto thermal_zone_unregister; - } pm_runtime_put(data->dev);