From patchwork Mon Jul 3 09:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13299749 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 C6931C001DE for ; Mon, 3 Jul 2023 09:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=0magnPJQRnCZwr1tEy52cKTZtysz6+nDWT6m4PG6trg=; b=u1qn17kYAx36/VpTtmoCFA8YD9 EXBP8bcfOpfEZdD+/E1KB+m44h9yb0fPVrccx6g2bLDlw7NuqDf17t1oU6xGVntiU1yf8YkFWfOdi uRXu6HjwClPWdo1JGa/9dr1AlntKfkFhG9VD9UPRZnM2UOKHxoereeIuVdXAKnysK6Bvxwtr9oJtS oAUopU4SpqwgoLfVh0TV4G4+3NdwVRlLYeZTc1SyMKen3T1KD9QZ/VeFDLHv+4YHP81mO2pTPnK0o 1Nv61wn/qE8DLURvKAW5JtmJzT/OlIZs1c0Rq0W3q+UO0ghkaOJqlGRw8JNiMAuPbntJRWiMmJw5u J9RG1BDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qGFUx-009qp6-20; Mon, 03 Jul 2023 09:05:31 +0000 Received: from mail-tyzapc01on2071a.outbound.protection.outlook.com ([2a01:111:f403:704b::71a] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qGFUt-009qcn-2o; Mon, 03 Jul 2023 09:05:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNS5uZ8vYLcs0tCJfdkxynPWi+hkbB4dNi95dh26wrtcjppKZnm5Ak4y+5LvlulwOkQjL2oukUedwCziBDaLFlyAyPImrsrypCMWgU5zPbKkYr6vz4Q8SICEYWPzd8UnqvhON2KjD9qM+n2orSZS/GOvQqjKPvgQUxK0wMXJLZvUgILnZNT8aKzAd2obqIpz00mosI7QlkoXTNT5fJ/wd2QXdougQ2TrGg7ILTiKX9lSshpJ4FWJKBeEBpSn/bVCxDNHdEfPSaanaej2nO1iIli16lYd/cuBld6YxufdDSUVVwVGxeoAhB20d2BuUFdDAPfG804C4XHM6jTKXjM/3Q== 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=0magnPJQRnCZwr1tEy52cKTZtysz6+nDWT6m4PG6trg=; b=Kr9amVwjNNx4rY5KglMpb/HRVjzX5kr7rEoOrdSOmrcFo0KRd7AzTBAlblOI3hPzUk/7HP/jISWgmL3CBUsd2000//WPwpTOMn99Oh3O5Ma09XWP8wjEEo2AkdZ/THeVbNST9UB3d4MePGPC2CTV6nftao/WOId0LXXSkqf17lyoPUau8J8LwdmpHJzpZiVLtISDz549qvOmE7YsmNRn5jqX3r4sVqdiGLcob/L/vGh2/G6qmgfaMOlPjz4eVJFMr54x3indnah5/V4xo9fMEURfbRm8A7oiJtnB56OFqTCGfa/ftlkMwXvX3mBZZ+AANak8gf+gVsznQtIdHqfF2w== 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=0magnPJQRnCZwr1tEy52cKTZtysz6+nDWT6m4PG6trg=; b=pd+K4a34lmg6ewUWd8+K0j+Kc59fTdpWGyK8f7JTC55XLSQRQU13MKAAubHBOb9KjXcpuL6e9GAsT7z+cbiA+U9UG6/JQxe/sCzgtlbUbB31AiboT4cjeb/EP3Zzirw9sgyxSyao12Bqqib4eT/28oprkR0/5OxZSbv9IdCCNieVEDWWqSWQec8qkM+IdoQ0HBekRF1koGqDheEZ+LcC0DitKPq5iNcf+nHgDlSw10dwT+0EqojAHTmOW3R1QMEnTWNySTjRZO9ArIIVg9XOgRLu/5kGOJdBxr0OL/a+drA7IXY6MUNkmDMEt3UgxFgX2PCx2NNbAcoZz7uryrD7ZA== 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 PUZPR06MB5850.apcprd06.prod.outlook.com (2603:1096:301:fa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 09:05:23 +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.6544.024; Mon, 3 Jul 2023 09:05:23 +0000 From: Yangtao Li To: miquel.raynal@bootlin.com, rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, mmayer@broadcom.com, bcm-kernel-feedback-list@broadcom.com, florian.fainelli@broadcom.com, tglx@linutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, bchihi@baylibre.com, frank.li@vivo.com, wenst@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 4/5] thermal/drivers/db8500: convert to use devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:53 +0800 Message-Id: <20230703090455.62101-5-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230703090455.62101-1-frank.li@vivo.com> References: <20230703090455.62101-1-frank.li@vivo.com> X-ClientProxiedBy: SI1PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:1f7::8) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|PUZPR06MB5850:EE_ X-MS-Office365-Filtering-Correlation-Id: e3b6ce06-857e-4cf1-3656-08db7ba4a25c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zWAoBXtVhr+Dev5SYoFRUV/0BP4x4fdWrLEdlCpxegI6Nv9pQymGrarUu7I4XsrFZ+xkMn8hBZtyogvKn8ehxuLH3TBTJPte8wNdrZei3M/ZVcV3eapvE5qexsXyNcWqJDyzyiVmMP7q40IZGw9VHumkpg0VmCEUDR9mISHjfh4KJ1A4fiE+ik17xU0+q/YX/to5tfnvgmJiEzXkbeFnAu5TVeYEo3hWlPhr6xgusWsv83LUzlAiw4B7zxu+i9BjsisiF3mq+/ODATT2adwFoANFGZJ5fN8p2vbddSWspwLgPP0QIsHyALi0NUgXo4Nlb9Q/7pYcLxBk5fyKxMW+g7KmyPrr0h9EZAkec4voN9C+Ez6kv/4o762yul8Dd3kjUzMmVmxiN7pY0rKQiIuzba9LSjctFD9GWMDHhYSQzvIWIMvaNuJi+gr0r8+bqu4p66pdYPKiSPsF9ieHQt46Fl0nLFsR6CsMa1dYdLuNO/sEbVvFFARbkA7KVhBoe5E0FhFkYZ9zHg07bdHjnd4Nci/tjsB4FnhQp8/4cigTBfY/k1P+aOSR751KE1+kWUCCoX9oBsC3dVdXF4zrMid0Ml1OwXwHQ4W4ICZXNNH5r/6yRiBmUwBk0LS1qVpZh4Dlv8/bcjFDM1q6jkwhUckqMg== 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)(396003)(366004)(136003)(39860400002)(346002)(451199021)(2906002)(41300700001)(5660300002)(8676002)(8936002)(7416002)(36756003)(86362001)(186003)(2616005)(478600001)(26005)(6512007)(6506007)(1076003)(6666004)(6486002)(52116002)(316002)(4326008)(66476007)(66556008)(66946007)(38100700002)(38350700002)(921005)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F2UB1UvMdTFnD/RLGPVng/jYSNo8TiJLtW8s5qbjl0eOhrogH3pRs7/xY+krTglM1S/qQFfZMBAv90Bsv/C+lP1aFeNYqPPeY5mhIMsgduyI2XdJ+cohf/jQwGM2YHKmXUSvJ4fnob7nbR4uyF/fkidpEGV5ISd5WjYb/fohDOxH0FbmehXECewav+9WTjP1I0KMV0FJlki9MlBKpQNMQ7kgytvt7M2On+QxfVH7jpGVNN9zpGx3nTWPnWvPDDTMswRhe6LiG1GI/O5ck62reUUL+rn7hEWooo5h4siceuqUoSbSzyOGMPpddeKvG/UXsJ34DvgwfxYEyBFz6/bRG71+IT2Iv8rQZp6MmJmUUrnoVmonuFGrL+aXcWWbSf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H9a+yUpM2QTV7995qmZEl6WQH5mL6koI+Fo/GMgavlYCyIJysdB0LBlYcz92jba0Or14g/FG6VGCy0NRQM/YjQJY9WiyrqaDuAJi+mvjHinFjDzZhtEtMNtgf96sW/LxUU4N0I2M7uryhHLt X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3b6ce06-857e-4cf1-3656-08db7ba4a25c X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2023 09:05:23.3811 (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: Ia5KjdP2DcibX+OQfXajaZcmbnsMZSWQoZSALUqh9pSzt8xMLisDOSUv96O6PHdm4/P2vSkID24pOLMK6AuqfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5850 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230703_020527_933497_2E26988F X-CRM114-Status: GOOD ( 16.65 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org There are more than 700 calls to the devm_request_threaded_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 1000 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. Let's use devm_request_threaded_irq_emsg(), 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 Signed-off-by: Yangtao Li --- drivers/thermal/db8500_thermal.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index fca5c2c93bf9..195caf954aca 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -164,25 +164,21 @@ static int db8500_thermal_probe(struct platform_device *pdev) if (low_irq < 0) return low_irq; - ret = devm_request_threaded_irq(dev, low_irq, NULL, + ret = devm_request_threaded_irq_emsg(dev, low_irq, NULL, prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_low", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp low irq\n"); + "dbx500_temp_low", th, "temp low"); + if (ret < 0) return ret; - } high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH"); if (high_irq < 0) return high_irq; - ret = devm_request_threaded_irq(dev, high_irq, NULL, + ret = devm_request_threaded_irq_emsg(dev, high_irq, NULL, prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT, - "dbx500_temp_high", th); - if (ret < 0) { - dev_err(dev, "failed to allocate temp high irq\n"); + "dbx500_temp_high", th, "temp high"); + if (ret < 0) return ret; - } /* register of thermal sensor and get info from DT */ th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops);