From patchwork Mon Jul 3 09:04:50 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: 115235 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp383604vqx; Mon, 3 Jul 2023 02:08:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlFMlzL+kvwU0tje4KACFEpeViMfA9DXiyUYjN04KQvBd2O533nvfQ93dM+Ri6/2VLSJWJ7l X-Received: by 2002:a17:90b:3706:b0:263:6297:9f73 with SMTP id mg6-20020a17090b370600b0026362979f73mr11353375pjb.1.1688375324907; Mon, 03 Jul 2023 02:08:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688375324; cv=pass; d=google.com; s=arc-20160816; b=X9BUQsX24UW1NPZUtChjF1iWfbPtvq0pfcSdqfuimwG2N2X/lVwRf8R304JRV8xCvD RZ7D1DkZRiozoMDaZxVtoRZVzCdAJ7RGAs1yIEowmIUGts+epOAzt7wLt3VFDOieBYGx KeeE2eSEUgh3NJQZ4H+Efooin9vGbTjipfOniYvLBhBnlxJiXMS9O2EtH5R4xB+8HfgO Yb1P5Y0nskLHWiJpnXJKpo+G17sG9EQ649w6bJ+ekI9Z/tKo+Mrl79g0khRpA1UWcuxP +QKod1MPmcBw5iArFy7QUS6uuC/eIK2sWrhlRFkRg5RS3iBLlJCu/05hvdraXLcN0NoH bAeg== 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=csZfkdHrHMpJmVGWyQNG7mFt5Qs5fq/20hx9DDm9Hos=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=efHRkpwf8KKg6d4WVeybGy07urVsN2Qbn50WD9eiA082Bf9+KZSHFzxSjtsCxNZJMJ pLmh9/IE2J2SPgVQ1CCq7eU+gPVUvWmmNQraj0ge/IoENEOaEmDdIDJx7V+V527d8F5c 843qdqpXG9QhD1JeL/+0plKO+oy7L131ccZFp7f5Q4/VVfivyqnYVRlLxurvM4cUsoUf Slv+22yPdVcEhYZDO4DvsHEPYkKB0o0K5XrNcHX5/vRkLSZMQ4018GBpr4c7zRUCxiIA tJNTX2jOnwmRM6LsjA4Cc3sh2tPQAL90I7LFNWFrvhy+PenAVR7ywtvjWFOUzw5PnzgW qTKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=V3PY19hP; 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 r20-20020a6560d4000000b00545072f800fsi8481963pgv.320.2023.07.03.02.08.30; Mon, 03 Jul 2023 02:08:44 -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=V3PY19hP; 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 S230430AbjGCJFY (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbjGCJFR (ORCPT ); Mon, 3 Jul 2023 05:05:17 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2114.outbound.protection.outlook.com [40.107.117.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DEFEE43; Mon, 3 Jul 2023 02:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFLleYF0J0R6KacPulnEj3+MtwbMNuQWdn+BcosqFoyGuW5aXANVtwTmANPfJ7TDQu9d34QcaBsM0V+AwggnYfGToX1yfFl6L7TWIXsA5jIMr6Z9MnyEYkr5xd8Z9NHjSsi8iJSQ6e+2p7q3YPjGoAun8l5faJarsMx7Y6xXOUIECllPZcPE5c5xQ4CQv2d6yVwSGS8nk+tyOm4RLm7ztNych0RZELg2lKSwWvToS7Zb9wm1e19KD2K0syZB/e8fjr5XeSFmOEYwi57YWp56PadKVNF3SGK8aoySYS+JtWQFese7FYFvWO6PeOgOdZy9MvvhMu1+7W7JAoKhXlt/xA== 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=csZfkdHrHMpJmVGWyQNG7mFt5Qs5fq/20hx9DDm9Hos=; b=b06mgmvs0d1B/itJONZ3SFR5SZZNYh+IRk2c3BVDD8mqc1OpPonIqtNs7xlTBKy7jkiYI8TyQSthf0oiKmmx/lZVagNrMHV18eLy8h1ONSU5sZ0aCrHVJGFyrOgyzB3/cGKDD7v/P6BtYVXwXPzNubANJrSJXcbG+GUUmxrl9WntRM1LMlhcBuO2dBEV7Tfhlpr6so+dLazOgJGpbEnpT5vcf3wIkZX457ANfB9ZOseEApZej8nS+Rrqpiki+g2S/Tlwz7LhRVAvHTC7yPCKCiGKBOWXLqS2E43X4VWrSJw9/2nNvFZCu4/QvlZ8+G+0g4DyIC207Xl9VuZYHpVFQA== 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=csZfkdHrHMpJmVGWyQNG7mFt5Qs5fq/20hx9DDm9Hos=; b=V3PY19hP5/bhwLyHu7GKQRiVGe7O7VZKIE0DzojWb7BiZYDtAhTyQHvIOFD8smRbzYJR0h68O3n28KyS6ZCWgYF748fi4eOddiExNv6zITWzCkjHBiR4JLOnjjTl0LdYdc/9x3QDEuqIh4RyBHn0bCT2aQdE6RFgxcfdS63zVyfX5XX7vJsVfFXFjdmDEZ3o2FDABnOT4OKV/6HFNRwxyOmtu/LtvHT3aRVX+mxrsNxfEQXEeiKZ8HZmYrczG0U4vr1kNlSdrfPMD2dYKcqUYN2plFZwR+gK0PnvNoHa0Xm+y3Swm67fLDLX6tqWwF0nf027Ru17L44IxhPZLQRYsw== 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:12 +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:12 +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 1/5] genirq/devres: Add devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:50 +0800 Message-Id: <20230703090455.62101-2-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: 939e675a-b1de-488c-add5-08db7ba49bcb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zYV4QM9pDQWhWsiJzBRz15tR7VpTwoXvFvthBMjbHqZhLQaPjibCtUu+ZMHWzeXghBOlJCGqGSdc4Dt66fXGFcR1tH3oayGNyZY/OP2y6TOt60Mm240ZLSZztk4g/CtjuCnbpZtZQLAbM2XIa3FsJoArIAnA74TvBMPoVc1L95swsDDNis5n4YLYaZ5WClkcEiS0BHDSRaeq0qmqQ1EvmNRkRDltNVz0M/S/zRwUGn17Lz00dBjcFhnHzJ96zouwaWYBIErtcSAUOV3ZTuAN2/9Bc84CkIAiqL8Sk9s1W89MB/DJmsPt+ukOLGVwddNGZv3E9sZdmXNENsOzBvExnQBQdaAmwSoOdOGqkznHvyq/Q/isXgAuA9MTJsvZprxVObjZP+xVbLkGfqFOANVvTp4A8aKb23FROpqp9ngSRlaWNN3VONyD5gy+2BZdWxLkNeWJhnrkp9wv8TQEpdCXGP/QYo4WE8eo6qxutD6GIsT9SQ2oI/JturMOylvky0EuUIqKT15qUjqvcgPOwWgKWXUCiUg4Pcnjn8jWi7jcAJZjdLA8beATYIhZnDczDWkfa3zJJ9qxPa1iVL6JYIz/DPCXwDPu4lNRFb84ztqpi82Gw/CjKVGK1lOXDeQvTMZ/oV/uFgs7px4GK65+Uh6Yxw== 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: 3WQpwtzEUhJ5nTx4Tzokn7G0fG0fFLRYuauXFCfQ+zRwOKQGZoZANU+/GuAtInLW7JPkCHq2Org8JEJd3vdUvNlMCrbjJuPQSVGx0w355MjKgHc/noMlBSoC4S4vgMleQ+dh9n3IycqRrjk/d07Ad9X53yowmUXmEVPEK8m4eeosWhto8Enqo/JFpmNI3RD/HbrBrBnF6WMBf+cqEx2FUZNY3M+yXGLmVKigpZduP+/V8kxN8RAMPDziGcadqfrIxtPXmavzVSSBbzhHvFQ6PbQ3jd3k9BHMLkD6ujSd6/Af8VlHKOTIks+zsywZ7YlVc1/ew/RarJDJs1SX7UH4ab48mNB1/4xkqf/sBtUHTGaY6dqJn9qTkQQWcdhf8hZZHqBRCQb1SIWu9YstMxLQarG7sutiy4OjcINyEbMbUZN/tTg5GqNTJyit3umqJmaynClMmeMePHYEybwBeDtysPVciftZW5rk6XUgoaph+JIj73BrkBhxRhv8TolVBaYz0FNa95dKxgmO2Sq68iO3o4g7AgJzlCx26aC3zG5cak20hZipOG/m2a1UFbHNfmxSz/r4UzQy3n7SBpIBbXhpfcjQHht72sTS98nX/I4Giowqw+7MsrfsN8pjf4GKZJ/CscSYTK+tRJT36KhMfkWo5yxxzZ9YU1fhe3j9iClZmmBUOqksIEAfDYycHwktHyXVel/gbOVy4dTdvSuzXujsS1PfISNgMRk8GoKveg9d5AHw5NumefUVXLwBKTZ4XNSdqT6oZ9sfIMAaAyTG2WRnak7KJzImdJ+kOJAT7wW6pswzHO+vwslFImPtS6vGYPT0yEfYQfgATX8u2pLiVrxvBuJ+ot0Lk4MlMH0R7hPAgOkAyf3eswesk7OOfLv7AMMeNn5yeJB2AKeCUrAleiJ0nivVgdETiHUIW2GvsoDj7P8kuzm/V22WIdGEzELCb8Metjz5cVbAmzFDadw/FoNr2PC9qPT1qPieOgMrB3n9xYFR68hxAxaAVOehDii6K4s7iNGcY3rJ0tgNJj0+UkqiHdgnxrZyn2RPJKL2/G4BawQTmjynsEG5uoi+9a8HsbWhIe7slidcOMADxKRGh2qxxakqP6jAYLpS4ud8+sZvXnC6RiSffprBYUyso/tkkiPqf8tEKKCUd70VgdKNlZt/lEy1MUT3SZFoSaLmy8I97hmrsbRWo++xZrfaNu1BO1IBs68DYU2JR0oLOQD/3GXGNUYAj2nUhtW/o5CB/ncqlT63Qy0h5NlJsqEwdFKSdhXLTfkygzJ2funQHUv0UYF5peLWaExCMBf6lI4Xh5sWrbc+NeNPlDOdDuH2mqE02UXkRMjBifvvS05ZvcjuaS/lf2pr7MJEcX1W3pM+zlxHdhk6iljmuh7LL+W8VS+uFHdrKTGxfpnmr1+10rS7a3Cw+k0Kz7+DT2rNWGGpiHWY10tiqpq6HMvYe++WKfrr3SrqqxMNSTiBrNfyGieGAUPiPwEK1EPXO4ijCihs9tjMjSvBs6N4hZzBujIhcp1fc/VzR9O1Q3kMmC6iSsiQL76Wwz0ze2oMCe19RGt7IJwyOFiy+I2Me1uUsB28rjE720sx X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 939e675a-b1de-488c-add5-08db7ba49bcb 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:12.5184 (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: 32c+wNU9o3xR85LqHZFsLg4P0BXzvlk84uVlv45dzVUAAXx8lG0p5zJblo1Zzo+eKmRFR6XUaTcI6C3v97TWmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5850 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 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?1770389844886653311?= X-GMAIL-MSGID: =?utf-8?q?1770389844886653311?= 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. So add 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 --- include/linux/interrupt.h | 6 ++++++ kernel/irq/devres.c | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a92bce40b04b..cde034006e3e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -201,6 +201,12 @@ extern void free_percpu_nmi(unsigned int irq, void __percpu *percpu_dev_id); struct device; +extern int __must_check +devm_request_threaded_irq_emsg(struct device *dev, unsigned int irq, + irq_handler_t handler, irq_handler_t thread_fn, + unsigned long irqflags, const char *devname, + void *dev_id, const char *emsg); + extern int __must_check devm_request_threaded_irq(struct device *dev, unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c index f6e5515ee077..f2e669ccd5d4 100644 --- a/kernel/irq/devres.c +++ b/kernel/irq/devres.c @@ -79,6 +79,48 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq, } EXPORT_SYMBOL(devm_request_threaded_irq); +/** + * devm_request_threaded_irq_emsg - allocate an interrupt line for a managed device + * @dev: device to request interrupt for + * @irq: Interrupt line to allocate + * @handler: Function to be called when the IRQ occurs + * @thread_fn: function to be called in a threaded interrupt context. NULL + * for devices which handle everything in @handler + * @irqflags: Interrupt type flags + * @devname: An ascii name for the claiming device, dev_name(dev) if NULL + * @dev_id: A cookie passed back to the handler function + * @emsg: Optional additional error log + * + * This is a variant of the devm_request_threaded_irq function. + * It will print an error message by default when the request fails, + * and the consumer can add a special error msg. + * + * Except for the extra @dev argument, this function takes the + * same arguments and performs the same function as + * request_threaded_irq(). IRQs requested with this function will be + * automatically freed on driver detach. + * + * If an IRQ allocated with this function needs to be freed + * separately, devm_free_irq() must be used. + */ +int devm_request_threaded_irq_emsg(struct device *dev, unsigned int irq, + irq_handler_t handler, irq_handler_t thread_fn, + unsigned long irqflags, const char *devname, + void *dev_id, const char *emsg) +{ + int rc; + + rc = devm_request_threaded_irq(dev, irq, handler, NULL, irqflags, + devname, dev_id); + if (rc && rc != -EPROBE_DEFER) { + dev_err(dev, "Failed to request %sinterrupt %u %s %s: %pe\n", + thread_fn ? "threaded " : "", irq, devname ? : dev_name(dev), + emsg ? : "", ERR_PTR(rc)); + } + return rc; +} +EXPORT_SYMBOL(devm_request_threaded_irq_emsg); + /** * devm_request_any_context_irq - allocate an interrupt line for a managed device * @dev: device to request interrupt for From patchwork Mon Jul 3 09:04:51 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: 115240 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp387180vqx; Mon, 3 Jul 2023 02:17:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlE3dQR8ucHo2LoP/LiuDuMJiRXFTNssM194dABwhchPPfk82ZfytCMpyqH4OIPRJTFHpUJ3 X-Received: by 2002:a17:90a:6a87:b0:263:5c30:2cf8 with SMTP id u7-20020a17090a6a8700b002635c302cf8mr11406555pjj.0.1688375840930; Mon, 03 Jul 2023 02:17:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688375840; cv=pass; d=google.com; s=arc-20160816; b=XiNrFkMSCffLB9e0RtUsHN0R+0zNkLqvPHEQOUQ8rryoYxEDw8R1yAaaxVKirxecbe Il7ikN8KiTpzbFO/8lw5r0IktL47koCAlXd9BRrJ/N8kSym/6+Hf44JsKvnZeHGJIsBs epJKagZRMkQ/mnOxyAphtDwIfO7iRhqN1IOTN18eXN2RKdIPNE8/R2o4wvnTQwRuk3lz v6OGMnrGDDmMOoLQKQdi954ZgkRqEWAEzoNv3Lm0Kqvaa+N6hi41iF5O1848mBYvWgac BXaNgekClqTA27g3zt3iVdF8Kn0PrGg6H4ftitzQ8LjWEL8mIomUllY7XXxCyYBz4efz qr2g== 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=dYGUVywrmxzNO+kWApoSurXTtnHeZ5eGtEzct5L3Y98=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=SRsNLDS8pd6z6AElNfuuvaQ3X+Hd80d2EYkFqUA+ticSXjlEpaePbWwtO9oKz+3rsy BEbZWYyHu2HCEyGg4mHqHiaKqeuYW13RlYKF6qvvj9DxhGwFbG8TQ1DANpQivx3lMTZw Fb1EYEtg5F5D8gkmXBdrKhpfCbnUMUY7DbRo3gPLsXEwQw9lHHs99bl8ghIZaEpC3iQI hc9tF0PjafdHVLGeoGTWOTTzzZJSGpuGotKB0+7zf3XoF5fkI31FkZ2h9OZF+ERrzlVt r4HTZujC1tcE2y3/x05fg4N+gyMOtINmNegZ1Y7U2qVbdxaImtvQaNWogm7UYljL/gso n3uA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=jafgzI9H; 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 s205-20020a632cd6000000b0055ae20ada77si14690852pgs.591.2023.07.03.02.17.06; Mon, 03 Jul 2023 02:17:20 -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=jafgzI9H; 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 S230483AbjGCJF2 (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230427AbjGCJFT (ORCPT ); Mon, 3 Jul 2023 05:05:19 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2114.outbound.protection.outlook.com [40.107.117.114]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF326CA; Mon, 3 Jul 2023 02:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DMFOa0sADL6rTGJzcgutDNMXOPrUxO4bmG9FTLhHQKjSJe1ZNJTqeNAG16ZX69gZcz83/axWQOSGCohKxUml0KbskQ5J3fGCgFi2BxsAFclNAFBjtbv1WRxXHTPxu4awyyIEH4pfRAVlsXciDPdTHyzUYYE19vtyj8pmWYlhGCG7y13geXQ1lybo237ipXxDMaLr3eyZdIof26JtLyfOwSPKo6YY666hUqHgZkvqoFCdwj0y6Wx5uikMV2rIj3h5LEs1iJSCJ7vMHXimjWDKJROvcunoCBMt2ZuQi7l9nRyi266zq9q5kYUx7FEApks7VkMWxvryMamfVnw6BjehjQ== 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=dYGUVywrmxzNO+kWApoSurXTtnHeZ5eGtEzct5L3Y98=; b=fVdumqv10ZnD31pIE9sUyTT0gvnpLvWvxguzTohGfYw3b2nKlUbp7Sb+TF6Dl6puxVknLy4kt/w1qUTpSQr6l2NXq7M2NoTv/LM7z9ZQKRPAbDKuRonPt+HgZY/mA9Hdz41WM21j0zXa24Oq8ki62AtevU5d5FVZnuwxwJ4kA0ZmW7hk1DRXFHRCovhRNO/flB65UhXq+zDI5924g73CcNxdMwbWEyPaAN2L6aT8cIpTCGDfkJG8m8F+8p1RK2K8ecUN7ul/3v98xoi4vDiQxLInLLm/gjkYIHBbpInK1HRtMxesp2VqShjM3SODhth2fzBL5cAX1Yybn8S8tv2tYg== 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=dYGUVywrmxzNO+kWApoSurXTtnHeZ5eGtEzct5L3Y98=; b=jafgzI9H/ox1F2MJx5qVPp0JoJaNqqV5LSY3yVW7LOYn32TK0YiMbrA4h0f+DrvGB01939moNMpZsOr2E1nmeW2Zqlj/cZyOFH2vHakHqeUIWlPeksvu4fR9VY7MuRhogq52HuLXSYDzuYJO+PVzidf3tiW1/AgLmdH1PMk48k9NT094uYbYsNDb9udsB/0JtUwas4O1dbSG2zVMoax6JONXwN3dYGQwTfEf0wMdn4cgnckviQVJdJKcF3Zy1C5LjyF4AmSCajNyb/+rpf1nxwYHE/1osmkoYYqvdcyivsQDRhSMMEDFAK+BKO4n8EGRjF8x7KNRnkvJfv4gIIMACw== 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:16 +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:16 +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 2/5] thermal/drivers/armada: convert to use devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:51 +0800 Message-Id: <20230703090455.62101-3-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: 2f992d0f-f8c4-4004-d595-08db7ba49e39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3pF0aBmFlCFjWqbwlIQhWPZwHC8KXI/IRdljHlDcFmWaPlG7tP8/WW70MGruBebBQTehsljs/2idP0CRCoZnmq7im4gg4sEa+dYHfrrLFea++8eLM3fdQ8Yh58JboXjiuJchgj9hG53DJMEng/1o+4RVn5xHu6RdyMLUXnyIdfvicufqZWVpHhEdgxTESjR18Ml2IzyohT4si4Y+b34rBuJpsXEQxwz7toYqfdNYGNTyTemM17EbysONhSvQT8N92bR0rcPU3IyjigHnW8y/pR4uhVhyAGv20k1prlHOeTtPNNxeDGY/pmXNbiqKgIus6CDYk5T7POdZO0nCILhrZjoBHZfKt18NyiN+qL0O4m/M7hRt21PcBZBsPkcpnQaL3UL5chPZgw+U279uMp/aHGnBgV6YPSb2oRGwp8DHoYHeD4WdmAtL1aNTlbnF3NQpPms+GsQIDiskgtzau67tQ7lRHMbPzVg251fqBfJInYC+fxhv1mJn2bBTB0h2HH+rwW4q2oWWgRTMW42tkgcNe0bBdCO2s/o3BcW6gq2BHEf/0kT0VClIvKDxKJGw0UBicOPCcfYzUhBtjuDyOIfD4Pu1owpyXCB/9IhVRt8Mqx5Hiln4+3Bg07jRkPWIZn+C1rWglvlPR6eU/SrQ6hKBXw== 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: aoqqFQqOKKcXj6ZBZp6NpE5OtfQARxNk2UuAyrHzkwSBkMdc2p4jabM6QCOYAeUnSVR4p/LBIIGzunLaquwUjzA2fQoDWsw5GBAYclFlFbVnRymSmQNVccnCMEzALT3Qi5MJoK85ByuyJQ/4LEo9yq0SWV9jOr6M606fBduur39Ct9MyxdW/YzWNKs1BW0kFr3cEUWC51P+i8LG4D8+l7sJQbdUSmwNvA1htuAAmBBx4AfC42egeRLal99tNSz3kQGhkOm4+SWNT5AEw11+Hpx8ZvVyhO3yh6F6nuuWEJ2+1pp29blzyN+oVMy4cOvuF96Jin5Yz7v4Xqiftxlt1cQ1Ky2OIM/CdC6Cxh+Jng3ih4lr3Qtk3KuF+nXkCnyNCeXOE9Ew9zO/Q2HbMvamvv23bFe2mnF0suYHurWasm1G/vml6I2p6VYfx/6iV4lV26EsPV1JdcKahgKjFQ0elmWWlJxtURlQtVza4vOXBv1g6pv2heMqR6NTKkmcku46xcL+CxvBQNNyioQg7AzXZdEAt2VHPUemthKHoL1LxsaJQxCHyXZDvQ2PqFSdSqn4bx+yutuQIEv7QGZ7TlZrJg9mbrAXNmYnnuE56RbW1Vjs/r9iLjYZouedQ06zZ/LZL2z+zlD1ciHc6Dn/6c15ov2AOEQFSRK6ihKAUYIJJl0I+JSE+nJink75aN1BOgVpuDQY6eYl25UKoWblJUNnfi5fWf6oZ2bRH3Q+4FRKG+IHxcw2YSXXqghOOOKviTnAS+O9+dtRFCgO70fbfFN6XBVtWU911QhOovIXgDzETFHlIhGyaDKi0jOPL3iGnWenJPPu5VjKQ/tu5qifI6ESkE7UxypuJ/7pd4G33tINg4J1dB2T+pL6sedks6nJQc0vXSPaMKuGaeoWGyVseEN2ObHq71UQ3c573m1OAB5ElCntaotFjgEX1tFCdA6Ges83ikZjykapvELNVIgDDhAdKCTeCWvCGomzyj4gU27VNsh4+1HO1QT+voHg0V9Ago24AeSR9VkQtBPGuHuNMb+F/m6ZiUivYvs0QQYgh7MRaMbS6qa0Hj3vNiGjDnYnk3cotmYqUCjKW5R+8VHSKVA6+Rvhgvp/zl1+RAeVzEryXpw/9opt3VYFbLs2/5KEBSG0O10d9mkD8XKnMjEnLg6wObWOc6gk1ZjqBggMnrGdNZYpuBlQZQpK1ImuCqVBHbUIs+C9tr5mjUyFhHwZtk4nKG4d+XtE1pjXaAY8eEIcL7xweBqV1ij57u4F2z9d87rcFGl+SDJLCSvnFSVzfZgMRSig+6r2zy8c4909ZG1GoP9RKXjGe5wenitllYf4bakd3sC4EwoKS1GejvxBn+J8mrz+8uQjRzQ39VNZIcHblhuu0J8wxy14GBuFv18uVcSNhYQHxSkN9juXU8D9KcfR8/xzhADG84f7u6OGDzG/J2F1pgaE4XJhDd4mRLWcafTreIAKPZyJq2mfntwI3bAtkkAH4OZslhS+3pBVSIgw9nNrWdl08TGNjdBd2yDE6Txxe+nefyZz3IHFCbcuGPOUdjPUN12qFT/aJwNAA/er75p8oQazY30XXk6fn7DSG/hls X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f992d0f-f8c4-4004-d595-08db7ba49e39 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:16.3937 (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: dZObO4O8x2rUclmcAgKQuQL8xHcnirv4twVGlqw21q5Z5YlkeeNI3PNZSCJoili8A0OvWqui4MNBCZDC2nQUqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5850 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 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?1770390385751332219?= X-GMAIL-MSGID: =?utf-8?q?1770390385751332219?= 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 Acked-by: Miquel Raynal --- drivers/thermal/armada_thermal.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 9f6dc4fc9112..a5e140643f00 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -913,15 +913,12 @@ static int armada_thermal_probe(struct platform_device *pdev) /* The overheat interrupt feature is not mandatory */ if (irq > 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, - armada_overheat_isr, - armada_overheat_isr_thread, - 0, NULL, priv); - if (ret) { - dev_err(&pdev->dev, "Cannot request threaded IRQ %d\n", - irq); + ret = devm_request_threaded_irq_emsg(&pdev->dev, irq, + armada_overheat_isr, + armada_overheat_isr_thread, + 0, NULL, priv, NULL); + if (ret) return ret; - } } /* From patchwork Mon Jul 3 09:04:52 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: 115243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp387711vqx; Mon, 3 Jul 2023 02:18:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AYlJ44LTF2JB9YvcJ6pFRoCVI7JmBaGyNLghCIHqaCAJVPjkqVgAcjqGncRwJcXopMP4t X-Received: by 2002:a05:6a20:1446:b0:111:a0e5:d2b7 with SMTP id a6-20020a056a20144600b00111a0e5d2b7mr14563089pzi.4.1688375910342; Mon, 03 Jul 2023 02:18:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688375910; cv=pass; d=google.com; s=arc-20160816; b=kql8991I/AI8RLF/UuxBdXylOIbXIWbUZsgDEcA60tPOEBR3Z8oZdGbxWo1H6NrAZd zw6YHjdnTh3YW93FWcE19izRReyolVVWCJVcJHx7QgXS1UrGZo6YsP+KCsMXeVyiEY5Q 7o1Viot2Jm1G6HJsP1UiyxYt+XvbPrOQvKNDXdX0s/m91kLpDtdlhdaLmfSkobVWjeJo GCyYv7Mo55NM6wj0bKuJXYI1Naqm53jzzRMo/N+R0qH2hMHy4uWjXYc2kSt8CjW77P6O 5B+NI3RtccE6031TqewdxzoasebVod0V0VbWXmreL4QUKc/rzHsm44pxmt8RwjOgM8XA p7eQ== 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=pWVA0ByOKffyDSYcHumvNc3C1/Qhx+bH8OiRfeIFbdQ=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=I2Bxv1DvxZq7fww4C+LX2WGq5yXhIHaVKSzDk9zDZ2gnewTtAc52sQBQ0oDuFAz0rp 3Rdf1QZJtpgx7i4zqjbNkRhRgd/0CWRSR/4fbKb9OHdHMdbSt0O9+9rPPmzU6P38ivwg hDbEL30tPt4iw/lffz15+HuMNVXA/MclXJzdsEIb2+tQOYChcUMf/dXc1BHx+Y3gOH+L vOsiJXdjHXFpcuIFsTOnuYaWDixW6PWys/EvrDvLA7LsiGWHuN4aosIfH8+9oMahKFAr fC9dBWUqtIxQHvbPoUOCVUqGpE1nQ63XmVL/280lU9TCbSgk5sJjVzziOix5TZgtij6S 1u0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ZKMlthuS; 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 bw27-20020a056a00409b00b0064d419dd566si16526507pfb.205.2023.07.03.02.18.16; Mon, 03 Jul 2023 02:18:30 -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=ZKMlthuS; 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 S231135AbjGCJFf (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230459AbjGCJFZ (ORCPT ); Mon, 3 Jul 2023 05:05:25 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2101.outbound.protection.outlook.com [40.107.117.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A931E47; Mon, 3 Jul 2023 02:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N0ckBMOWOx28Bh0EwAiK9hBH3TUa4nUXP0LYl6KWEqRU2rS7WlYw8/K7OCrEqzIc25ca1+NNEBkyU5JclZhZBdugsFIrfJOjy0+rXpa1g2HareRL9GspdX4FB0ePh9DS7Xb7XRka6grlLlD08LBXEx5/rZdmC50BijW+g7DTEgwegaRAumA0BSIMHjNASmGMEhRyCSmpi/N2gOFX+WCdaaC0CShbFdfPbBzBU7u60FDByG642toB0e3JcLbroeB/RL1yt9rIZXRJl2XbpMHViblRUeWo2u2HqX3MaWV8MiQhW2cyhmkRwn1hT4Kwc9ygJ8noWRwjPfZajEsZQvqCYQ== 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=pWVA0ByOKffyDSYcHumvNc3C1/Qhx+bH8OiRfeIFbdQ=; b=nGmmNOkvvClYQGtAy9RNGHvBg8yEJ0xTernb0FophIw6jLTDEof+sPprlmTbvt6u2xg9LBlw1bg47CEYG8FOyKjvcwWtBQe0x6NUitcsJQCscI4Rnf7y8DKyHehxzVxU3HpoNNrW6CfK+VdujqSNUdq3AROIa5eIsZzLkZ0PlPGpm1p+iuwCgd1V+U4IfaHWvyfVrwORVjzdm/Ow6YgT/rRQrUmgB+QpbIsJWnr0qZGsw4QiGbZqqxz/nrwY4RdytekI3M0w5SsICD1mVlJL4cKcUdJ5LoIzr3v9G8mVUFsnUdMF2MjUIXd5bBZPV/6mE1V6mfZsp+1AL4mA2f6gRw== 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=pWVA0ByOKffyDSYcHumvNc3C1/Qhx+bH8OiRfeIFbdQ=; b=ZKMlthuSXz8Fl0Izf1e7hHEgCaoSrEPp4dO1phbZS5fhocUu9o7NQbMm2mdyZ2cgRrPBp1CfhGTkAknp+Mqvd5RHtKCYACw6QJ1n+bHpPh8iuFaEi/vm2RGBjDNJsSguxMIHwf5qLEvx1WY3aI+lPjb/eZVz9G1ojNlmJEMj7hU5u1H4+u/XlcOp69eeD89Td3B77Wveoy9/vbBZEDsKAEsJLko2TFGkIZb5MRljx9JpcY45JO0els5tluhhnvHwvvCizYxsyd9KdPCu8kulgLB4rs5AwverVwneSsctMzhuBrP5HakxBfxcwnHsB7Y8j7apzz3H96Emc/SqVS2RnQ== 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:19 +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:19 +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 3/5] thermal/drivers/brcmstb_thermal: convert to use devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:52 +0800 Message-Id: <20230703090455.62101-4-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: cb4debbc-50ed-40a1-e24a-08db7ba4a024 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wuLoRazj/shZywzQdiOiMWtrqjbJcVXZPOYmxYHqlahTgrhM2fhLVcTafdM3J8pk1rBlArdFGYD47JDVeB2MyqzUaFGyB4rKlO1ggF6GTU/2q9SppCOykuWBZa/97Ul1Fa5Hi3ciFAxp6K2BcZ2VTwjVEOqXejZD2OZcYZWtgznpaXERgpdV7bLbcrEhjzlM6Z6ZBl31TUMmqJJVCQDTSFtgINobifz9tNxIf/ticutYBKYsclIR1OtGqhtz+hxIG5nTFEhVpa6MPRwOkOkM01WD9RgLC53bkaqbX5hFFza/YxPOx1aCBANzvX7u1YQSpLvysuw/b4YqszNoMPT41VVLG98aklPUnVdqJ7aKL9nVF3Ew9yslQkdy/KIDdbC19zwijMEumsJoDsrq9O21gqxfNmapQg6ZHSWwvBhA6ZDNy31amumIgf6+dGCm+PLAnfR+uscUtuSn0BOIdQcN9xTLaQ/yhJ0jPrAZtfZEmMMVL8/99ZuBzDdbQRABj7EMSs6GpuSqLVlb/OicKrBZJiusN+72YwIkvzHNYD46jWTGjDZxzMMYjCQsemWkhd7tkFrNkoGvGYmBV+hUiD1iHFitujdjGhJnG6KLnlKLZntAeptAvIWYD3/jkI4yupkeWVDHhlqc43dG1zVYsCR7gA== 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: oT5inER2najQLvCMYbWkikHhuwutwgBxoHeK/QhkGul7lV0EdR4b26pmYzMEboLC3QVRgOz5C50VUJmeqtK1jbl6Sw/Tz0cmNBHeWEDrkVCWfv1Q4SFkXE7ScxclEsbDRnSNF5xhutjEjKWNdoOn4xNhhy3WYpNxbhj806ggXb7Qx3kYL77L5BOTkAWGdhmQqEgNihpspWyLHjI3zHh/DhvrHDYx/PHOwuXyNS2Q1PfMsYeQSu7I8xZuPiHttoqvztZDMcoikvaOqxtdx09dP/ojWuTQES6mOeJ4jgKnZ9mibmsKwrJg7ktukX4KOTMq1ImgBsqKm/QEN/lDOV+I/73rMukLOfIf/VTKASH8AYu0XdmoSk8wf5Yum5cM0e4HwV2Y2YxDb03M4a0L+VveRcxpAJyYds+wmu4PuXkpBqVvCKzmJAwL4QPJHbUntbn2+b80D2v8tGge5QDi4nDyQY4Js+lKhjwUatf/QPSL1vQCyiAiwqUpI7x6Fttj7pt55pFR2NooCxpOwdeGaV7rwhIsfiE7FToiFjh0IEfc0YE2XpSF6lyLGdzyTTDp5PJB9+IAy1TH0svM6lXzJ6zTltTtSjLeBkFh0/5g3QsbD5yykWByYsW5Ghui4UFImLyuYunJVT8tX/C63CPXsTnUnMbdhSQ0exQTygABZjHg6Xp9DUZY1dob1Ouu4PE09LYs87TAqYIU8Ae5/e4KaUenFMCGQzgpjsqNy8M6TisUGX+JX/IAI+MpLqGmMyZi6ydbzFGaGRLvyDkZgw5XGT2guKzEoSV4lCeIMflt8rp14L7mek4UG6r9FP12FYclyAIxSFOwGP8LZe52/KooDTuwBkoXNbL1h3YyT0xdfwDVUzvUvCyDjw/+x0q5xPMCju3bC495hkhYxALKd6GcBiy6ZKghBzhIj2QkqiGLc1FyVlXyEQGzw604MDbvP7THI45ls26p61GIZk1aePHNAz40roKoXwrf18630OjW50zPItl0mAq4oA1xhykG/FqIgmbNA2U6nD1Xrc+HoHaVJE06J0IRFzzv9941ZpoaihEdxpCuGiVEQL9t4Q2fuxEpDcIESbj5FNhGFhSscUog2lWYl3FASzqduyDI34H2JLrpvWnB0y98EBoEcAWpfDfwvR+EFg+OlqXihUHIK9OC4NN/IzlheWVhEAARrK6dH+cU6PTUP1gFwLamanKiX5cNnqj7kLtUONapS5m8GUnW4VUvSvbDthwJko/Oybg3n0DuAtylGuBsnh+xz4TV3y1zIRO9tVqFYe3HnjOgGEOGCCSEYO7Mf/7y/LSXKx/wb+SrLEBqUzQsWL+x/SGGVCEEZtOQWgqopzCl3eCI7tnzpaLscZiOFB0xkKvehcu+SRzhzjG8WzvL1Utpz8GhnLjEnI6xmPK2d23T319e4OEUkqp8NImaUqseW3qdoQ2aS4jV+Vzv2ozHQRegUe7IMlwiL5CqKVMmD3s3PeyPBnnJ5ZonpNhp4TMgDHF3QIFrw7Wlsn3WYUKQqSQhUx7lfKA7OhQvb9f6H2n7gcmQPP62Ai5hnoU+38wUFYehZ5P3VWjNoFFI3i8wEgBYvwqPMC40d10n X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb4debbc-50ed-40a1-e24a-08db7ba4a024 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:19.6754 (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: jaTWDdYIbLZPEIKG6nobFYOCDku0KWUF+xio7zu9TMvU9HeePauAqDou/SbhN8HR1qJIQiW+O5Rjdv7S3VqLhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5850 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_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390458596536669?= X-GMAIL-MSGID: =?utf-8?q?1770390458596536669?= 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/broadcom/brcmstb_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 72d1dbe60b8f..b922f8278f62 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -349,14 +349,12 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) irq = platform_get_irq_optional(pdev, 0); if (irq >= 0) { - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - brcmstb_tmon_irq_thread, - IRQF_ONESHOT, - DRV_NAME, priv); - if (ret < 0) { - dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); + ret = devm_request_threaded_irq_emsg(&pdev->dev, irq, NULL, + brcmstb_tmon_irq_thread, + IRQF_ONESHOT, + DRV_NAME, priv, NULL); + if (ret < 0) return ret; - } } dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); 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: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 115245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp388536vqx; Mon, 3 Jul 2023 02:20:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlHoUEpwCAsgQrfl23OqNYX9Y2yMY+eowVenBAQCVyKyRFk6mai9RcIBGBy6IfjHBVAGkqiQ X-Received: by 2002:a05:6870:828b:b0:1a6:6847:f5ec with SMTP id q11-20020a056870828b00b001a66847f5ecmr7392197oae.1.1688376029043; Mon, 03 Jul 2023 02:20:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688376029; cv=pass; d=google.com; s=arc-20160816; b=gNMW6aITp68ddevqTHSilWPyaUNwgUQid4HfSTJ3MJvbP8OpxHY/lizVgf//D5SeQk W2az0DiZvh5QlL1oFCmAftkp+OzW4EI1v4lIhg8gz6yOSnhmCrUJJtbnqm2z+JLWCkld RiVj5OG8lrA9jTOu5VvZYoZRoFlHWAhU1/fYN3yArhLlAgp5HohgxiKyhlE+BY2aT5ia uBk9xOITH8XyDaK+tCUUnVPnw7QUqJTsuKh5A7WHjd7GdBRAsGhpBe16A9Zbl4+UcLBf WprZYowx44qWDHcyfIUJhbQ4bQZyK2hMXio4xC2tdKWKNsYOI5o4gNEKACkMTY0eVZff 32pg== 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=0magnPJQRnCZwr1tEy52cKTZtysz6+nDWT6m4PG6trg=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=he77OyZ2wqhMO563v4mY+WU5/yGRVlKW4rsJOzSF+GB/+iDJ0/yw6E3hBTCLS47W8m EJ+dSzoNz95E3lLenHqOl1wRP82XkShepVthKGRuikmIGVs7At+gdiTrPJegWBPIZuRG ntJ3JKDz+c/NIwtAPCVNLl6lmSsmYYmAgFA+1fT1GnK22hUXG5PeKtG5GODkXWfBBjVo PPAPASzxiasAuut3OelEYIaR9Y4pjCx5v2PAvneNvmGBa0fgMH+e0PfONe7BITiK9zgk i8tavdGCPyyxAOetj71QlebxAKIXZfzWmHN7BHWAe63WOu4NgesJ9343iuBWskMB3BMv hRiQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=pd+K4a34; 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 a185-20020a6390c2000000b00553c2f8509esi18675535pge.706.2023.07.03.02.20.14; Mon, 03 Jul 2023 02:20:29 -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=pd+K4a34; 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 S231147AbjGCJFi (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjGCJF1 (ORCPT ); Mon, 3 Jul 2023 05:05:27 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2101.outbound.protection.outlook.com [40.107.117.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C98A8E4C; Mon, 3 Jul 2023 02:05:25 -0700 (PDT) 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+aXcWWbSfV5T/OMtnXJS1JI7YL6odId+zYqg4nv8xfIEM8jpUV05cxFzLJHbfeOlQ0LmIVyKFYrD6W5MRwJdewx1SxNoWB0Nlmbq18++5oiPk1ykT2aQqyR3Q5TzcDudrSvbdRaPpjxDpdRQatf1VKmCf+lq6l9jiKChkFYZMZ6oDUDtmCjzNmDGTbM5bnkKmxBXmdHQHQEPL68HdYt9Jt7HvB/nnThSJRN1twlOM4AYGyVLtoBRgAPCqVTsqSgABTjKlXsnthn9AEZTdAsRkOLCGe1xHNk5eowBnSCwdgU7LLYgzaxbVSRt+r753PclI0k3OW+RVHpwh1Hx9JJhIMlSV6Q9psUvemtGX5JAqj96LrS1pJ5QfCQx1va/SuZyhLiwsqMGu/dL9VqMe+Vn87PMryA/S886LeRdTVcbhHKYoYGh739iLFowB+bhqOQJ59yV9shkwKBr97BqaaMahLI7PmMj1lJrk4KDbrgc4Ou6oPcha62peEDg1zMNpyqT9RToTh0sPmMgqr79CAHjcIvPNg80Luoz+82o26QYV5kYeBJ2ThDRDt/mSTIHiWilKSMC1bNfGObz53y0r2MRYhJALsUMrnmLBx9zyPaXHMWquaziawMJ00DaLJhfV0MP++BgnwR4o9tcNAGmWNyMhnE/q1TyyxYBM0ZKoqfxBxX4nrUASm9r5ZH+3S9vp8KnLLcPBElHwpwaptTr9du4QOL8EE8KVbeSxIIEBLCnVkq4yV2f6hmTa1prQMy2LCPRX3T9A51BK0iVlT9PHyIEn+C5vnrYWjEtG80tzZD3Q4oc6ogAJPuArqDDqVWhj1c5Z5/2AcRHXaEc0PsFl7BJyvRFINcHgMjYx6jIqj6keRwZ4KxtQW0bOXERxpOUS14qiUn3E2qc+oZ/uXkmfJU/ZYzlRPyRh1lSVI30H7pPaS0cvHSYlhlCx0meuamLGDbzyNrSDduQZY67Mp8zN39kwNAJscgCxxvbFoWOnYuBKx6VdNeG3YonGCmTCK82NrzvQsbwmr4Lwo3za3szkAZLQ0Um0hEYHBGsWUUSyN93w6TsSZoo7QHe5JUg0Y2H9a+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-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_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390582663651788?= X-GMAIL-MSGID: =?utf-8?q?1770390582663651788?= 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); From patchwork Mon Jul 3 09:04:54 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: 115247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp389048vqx; Mon, 3 Jul 2023 02:21:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ602tSF6WX9qmtrYWbMzIQoiBgRpZse1DTYE8n9pbFolLbvH90UNwKcKNsInQvqZ5FSHzRe X-Received: by 2002:a9d:6b90:0:b0:6b8:6a58:78ca with SMTP id b16-20020a9d6b90000000b006b86a5878camr7562796otq.3.1688376106372; Mon, 03 Jul 2023 02:21:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688376106; cv=pass; d=google.com; s=arc-20160816; b=qQovMgVBklaQDtjAuS+airRgF0j/Mg4ZcE5yXoyzBgtJmm3U1EnbE5gONQIcFc5YEz SYJr09AOv3Hy9W7Y3cEz4hQ/+dOdTWFePjeFPYih5cUwlKT/in4TUfvXjmGHGgWeqBP8 rFTtQbRrwnUb6o3JDeaMwxnU52xljqDrJVdQDeZaALsUIPzibjYarGkdCIuGVqj4bkIR ezw0Rjw5F6Ru87o1N4xwfKRVlyjHJftUWe+/7NIOOuhSTVIGIoGfBzAwFcjcOc7kmclw lkD6G7d+sKMFjQULIFxluyfdDerfXbrFLa1Rkw4w695hX4n6MbAo9MrP9ZxZaegrgc74 SA0Q== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=vAKSn7BYwKM8NkQgcA4seLGa/c5pjJtqMwbdItrc9jTvrDp3PVOqPye8gjbxYY8YyO y0MdxygYtDrFeHDtq6y1hVR+PZtQ46HB7PscJsULs5bjZQaT+PDCtl6Pop5m8MH6WVhT wR/kauPf/yYkvwTcsqw2xWArn8e7T+ytrS+fKz7ERX78yLMp2lNqN39B7LXMd/fX2JNV Ne5gddlCT6c4dvjiM7ZA/ni0G2HSpYWxMt4pmQt4XeYKVQ7ILNicmtbGVlaJjaJJHOZm XZzAuaTfQaszR3wJpYkJ4xbD9H14s6HoNdMCB9zz5hlR+PHCJozXf0/BKFOH5V1r+SX0 ykfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=SKkBWrq1; 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 b15-20020a630c0f000000b00553ad455581si18140260pgl.296.2023.07.03.02.21.33; Mon, 03 Jul 2023 02:21:46 -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=SKkBWrq1; 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 S230503AbjGCJFv (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjGCJFr (ORCPT ); Mon, 3 Jul 2023 05:05:47 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2091.outbound.protection.outlook.com [40.107.215.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEA1E4F; Mon, 3 Jul 2023 02:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UExPwP9TUJxGUc0lz10IiAqhDWv7OOmOI1EKggvN8xoqqNqNMIzpklJ0fa60hTxfkwpmgNIgYn8E6p22rbBYfP+HPnX/JU507Vo3LXfsLZVoCeqY1tgOYBe0sJvXvZ5WW8fBByTj5NHp0epyPe0AeIgjCij55vT0u0pLSWwtjz8pa8GrT1vUDWPYf1RunM+RhXoz/1j9yw2S2YB3Id5MaD2fp5KnZvX9n+PzwR2Xh/5uhWkcFUbk9+sqaDBrh9cyKjqWaCKX19+NXIpPQcl/n10MifsIjqiUDDvAkSsEQwJnAhWsJCm9vXx3sFOi+0CcbZdhHkoZ2mOnlJY7m1tiyA== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; b=CbawsFPD0JGXTRAPiIqlPUBYFh1fpNVYKiQICperrV2EZ2oTDYcrMFZSCQxfLF9NSeT1GnpasJhbuytOdgBX3OzLzpxyHdMDJluDJwDdVmtjVHD9NVol8n0eBXNXMx0v1VKtFeT/gD38eu6BDx0y/7qFRRaFWcesDaqDg8Cme48PWU0n+EgjqqI/B/UkoEIxXKB20WG3HBVSF0hvNE7lOemR+EI+GIfy8SENVzBLA703UgTvRGpnMEVlp2xKVLV/4L98y8RQ1Yt+YwnZNlQ00nUCPsI/vfbNLkZHOiZJpEaPMKz3+M/efnVBPu+0u0cEOXXKLnri3+2//1iaBdKNxg== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; b=SKkBWrq1jH6+fq+lSJo9Sy9mYp7Pj8HUq5bo/kSrAQnNmsvkjATvCEDgGqpTTvKg2wNMqVjJVJn8QdZBWE9ez5ybXwGR1FnakEO7aXpcRtM41Y44hdver+yvTgAc+fhROwiTsBhna4EzS5LVx1LVz/mkRDSr99an81jgJr/dCMKee4HbYwS9HwUGmQQ6EDzhnVsakeojq6y/jTg7xiscOITBV1zZGDD4kyCGs2j/jnBa4lkO4+BXzcmlzI9LfUyCECjc+k2WctnyxVD9uSsdS5/VMZ9jR0OnUf9JtoOaqOFvTtmHxEmPO93vASBA7M3cPgbZKGg8KOKU3k82PIcm3Q== 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 KL1PR0601MB4003.apcprd06.prod.outlook.com (2603:1096:820:26::6) 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:27 +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:26 +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 5/5] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:54 +0800 Message-Id: <20230703090455.62101-6-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_|KL1PR0601MB4003:EE_ X-MS-Office365-Filtering-Correlation-Id: 48f740ee-ed59-4742-b9e8-08db7ba4a43d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DvvG71hKtKNhUlpc+OpP2jVcnAoUjJDawXvgWggrrn/c+iO064n+TUtBEb4ZyC3e455+JJFrPdKHneHrQjelEyPPt2BIM35jJ/0BLqhrSuR5WXNNqbdUX6ECN6xb4uYF7u4K9A+m2xdTPiW+n6OIUz3lIUicqaoV6+QNLV41yOYXoTfcFLjU5DqV6edoTfW/Us9RfHEiAoBzez7ezqJzl8aAKPq4equg/fxwkXo3/I8n3ubGBftTkrh5O9+ECn3ONOvLNn5tungCRPbLznT1Xjc+7P+4fyLPZ/1PBkJvaSFWtzGJxZIQHPa35G9ULkh9tp/vlDxxi74NyhNaRxrBLmzRIdgkpKNgf2Obt+m3OBToLpxO4UlLeEeaFlDsgdf4t3gk5VhIkYT0b4HIGtuKk+DLmoYMvT8lcv+XFhipO0LA94ldY18zc8oZkcZjCx2s3yDTlWKYl32UgToH/Zd6Jyqa7KIXptECOx/Zu2brKyyfc44kuwXYAoPFAQS1DbNSPNMXqjbLpSm8wRsu4HuyNxDaPdgZete053Obvt95vEQovmbnPmO4skygCJ7MDtCE7tuSa+qnq7otzYoGwSHRg1ZIJDcTabF4mpON5nmkLYMPaS3sttaHnvA3a7EOD67rdryIhPDn5Z2WC11VYn3UhA== 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)(39860400002)(346002)(376002)(396003)(136003)(366004)(451199021)(26005)(478600001)(1076003)(6666004)(6506007)(6512007)(86362001)(2616005)(186003)(38350700002)(38100700002)(66946007)(66556008)(4326008)(66476007)(83380400001)(921005)(52116002)(6486002)(316002)(5660300002)(8936002)(8676002)(7416002)(41300700001)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AlP49cWogshT7IMjJwq20YMrET1TehDWe3jp79Xpuelwq0tVXO2Jvf+zRsSiBMJu3nO++nvopN/rwuyx6UAZtvdCxdnGpsm4fu3UHjA6nXkxipCC0800HPAWqlICrkAG0jKDwrSwnPQt//It7wGjozUFGalRTDlE1dqUAxdF17mO9D6qF0KhR4G1W9Znh7vXlFuzgOuWuGx84EC2saKfdYINOKnJTBpxKVlnZvPyDxy7RXhf+IkkXfkWRTTBPyYYOkl0HYhK4MPi/x4SG72HBAQbKMHpNwPCEtX9szVAT1zxFnUapsSLS90wFWwll5qqh5qt9UkK0nuYAa8sKptIXQkhUy+Z87jjjYUoWFkSraaZXQQT5TgvpnLF3O31eQZrZ3IXdaUIDEinQku1oyJljSp0y/1TgTA+/5OGLgDVO5uVFJZ9VUM7hJdU+tIoc5WEhcENGo+aPL8GLpjt+7q/kBX3jlTMi4Nov5uekBV7hhIMLdTHY8FL5nDAF6a8/ZP3JgiZENVes3CzVgFv271nYNVxM1B4O1QuVVr7Nf3SzXw26NE78vQXyjH1CcDWKaoIyVeIwAqi9q+utG4NVJrwOPkvIHl/Yl0ABC0ckn9GqiBZ4nCWahkG1aTGvJzkyS1Ro7rtLFh6/UDrHu9VPFA8JJvq29BbyhV2dbTORqdT6QOeNabrJIx/D6V83ShMGtFvT/PbRs4SLcmhyhWFD4Yf0QfzSAV4U0o3v3bWn05fw+Rc4YAmskJR8nmUM/z1xgC51xTNSJASiHbp8sijI3Cc+B5vvN0cviRh38hIuIELfVzQbV0HsHb9WSOXrA0PyNvV/IxHy0CeaqcQq7A2Y0Ni+JjMYYASlRI/80S76WTdkoyJOdAVaut6bNTzMKFscfE42ZLnkjMQQ5m483QeMtgNV4ZaBGVc1LtcImkyYpTjzWAWzMYaXlmeiNo+TuQA/yEe6kz7XAXdlfdfRy6cggO1mKeofci6vQVLOtuV/XBBH2KI4VcouLf7BvT2BsK1GLnbcMt3UhxAOz1wkFI+NVR8FoLDx3pyAeLYR1GRKZNdXpq3AddgJM7XdNqDx7gXdNfwV8/tv7+5r1Q2TMp5JPk/3rJ8ipgUvasfMlXMqCgCsRQsu7CDPz1tUD6oxOg9VpeNsHe6xXtlgigvD9DB9g0V1gZC+4jFHdJj4n3FLIIN3GXRsXKMXdxX4W879Q+5Zdenxs29PWBnylMFfpt2uueXYQZYU1CL99883E3MJePpM+jIHQMTjq3PWrASFq39mrN9+s2sNCfCd9v6lotgfVSlIzANARcdNsh6NdlPTLNcXvrkm6VuAw72RC1mXBfbKFV+E7Py6lmE5T6DYv9z/3hjxWOxBNhE3qjt2ZSKv/CCqNCMGMgA8uRalaYherzPDTzCjZsmlRtfMXwJd3kNGuKncCAPpW/e/xSBeDBJViE6ShNsTJfDDC+i0o9gs4aNef6f47D7+jpTN3but6QIGBJcQQstEh0lvhimJgCWIEMgdw+5dLTZ/jPsLRU5CmSEGGaBT3gGmFOG8g50liDxLY5aXDE+pJVfbH/FmlI6rdhZeUCWKJ9wytRO+PG/mMEqV0Zo X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48f740ee-ed59-4742-b9e8-08db7ba4a43d 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:26.4851 (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: m2rcRdXB5EyvNvlrVkT4GGC42c2jeCicjYzruu3+zMsy0AFDjdSPTPfQL4Ep46p5/iYPGhL6EaqFoXP5N6bA+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB4003 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_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390663975671972?= X-GMAIL-MSGID: =?utf-8?q?1770390663975671972?= 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/mediatek/lvts_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index b693fac2d677..b6403bf2300f 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -1148,10 +1148,10 @@ static int lvts_probe(struct platform_device *pdev) * At this point the LVTS is initialized and enabled. We can * safely enable the interrupt. */ - ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler, - IRQF_ONESHOT, dev_name(dev), lvts_td); + ret = devm_request_threaded_irq_emsg(dev, irq, NULL, lvts_irq_handler, + IRQF_ONESHOT, dev_name(dev), lvts_td, NULL); if (ret) - return dev_err_probe(dev, ret, "Failed to request interrupt\n"); + return ret; platform_set_drvdata(pdev, lvts_td);