From patchwork Mon Jul 10 09:59:07 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: 117800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4918585vqx; Mon, 10 Jul 2023 03:18:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHna+5ApQ3QxgD/PyDk0uO50CiqKycI2wdZcponz56+tk7TNa5oLRhJyHhoEaDJWOaMdIAo X-Received: by 2002:a05:6a20:320b:b0:126:5459:25e0 with SMTP id hl11-20020a056a20320b00b00126545925e0mr12265761pzc.16.1688984322930; Mon, 10 Jul 2023 03:18:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688984322; cv=pass; d=google.com; s=arc-20160816; b=aOyymay947aAub6H5P/Mp9tv9GKJPteB2ZVI2ob2vkZcFBJYbZrVokyXXp0ezl+X0t 4d2Ta3/xqzas9VlLGRJGMr7JJqgOTPV2d1oxrv6Ww5CNoIWpLt4HyYuTZ40NzgoPmuGg 5Y/PVCVi+NHKLJ4lSLAkHHNzEDtsE/a/85gT5MxaGloZjtFC26gxfAdTyu504tVXaEKv flaOqgn9N3JtRp5lS84Gxvid7MkDHHlgi27/GCOPTkVyyLMHWLZi6brt1vA7tTC69Exa BMHIzQj4JP4zTX5n/c7BPnAx3O6bj9WmVLnXgC/V7ML/mRsVJE0zCdXA0DOWk9tZQCP3 9gQQ== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; fh=t0bKF8TDHm2zqGW6x/Beg82VUEjuRqj0WcQHqaiSBSY=; b=a3lesSVfK/QUfG3cGbhNERiOv61ay/3vv+6WXH5Zwv35XkEbip3Uh5G7GgF93mzoNm XY4dgz6sEFEvnPdjo+uukQRiLYyKVgAV2yItYPhtOk7wNQyNYssg13U5Drh0FSw00wVN WKvbU1ZVF3OrYUe9d4SySvtPVuplO2d1C2VQPo+wRA08BTGxOMRODNIp9gGm8H4ilGx0 ky2s3316Xf3n04oHHWPUHQZDwpu1m0kMOyRc8Dw826a9F0CJXi7dOBx87t9Jpl1FIwFf Sn0ppwpltFz8iRHi/FPM6u6FvPQ0P0wGkBg4F/rjB3eWPZ3GSB1R1ASAJPRlMsyXHRTq +/aw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=IqyVESDT; 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 kx6-20020a170902f94600b001b7dcf3dd97si7980066plb.302.2023.07.10.03.18.30; Mon, 10 Jul 2023 03:18:42 -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=IqyVESDT; 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 S232381AbjGJKDR (ORCPT + 99 others); Mon, 10 Jul 2023 06:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbjGJKCa (ORCPT ); Mon, 10 Jul 2023 06:02:30 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34A02D48; Mon, 10 Jul 2023 03:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xe1CizoIC3zGG8UUHs/qu0Mk6M84VwvhR1euJPwQRxZ1i0xK4MJLhyEYVAOLcyGfwENHoloRdAWkr1+rRLHaIa9sS1Y0Xzspxm4DS8zyayaM4qoAttwX8RKZz50gawkalXE3duz0rFRQWdzLGPp6w8RB4EESpTbr4GpCSb93jfGJGiCE1xd/essmzvhygb89kg8zyBvu/jO5MqNDV+ZVuW5wesEMQZpN6zZh3DdRbEYLA6fYoP+whKjUUjHwwO9xWZ9kqzb0BAK48jgZ5A61RDNCetTlJ1zcpAqCT61WlaHH7CbX47PNVpsqujal4XQWBji9qVbt/v0nMUWlTaF5SQ== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=cwfftvOT4GFACIDHm5AB/vmXjbY92050hl1RLTMSDAFL7/mJQSljCSTW+Tw97XhyqLZ6n289rMVpooxxqXSRKrFvCeInYur3yZnYWtkCCqUfvjyhqT4GFB114IwND1kRGgd6bFwRrnV/TAHKHK3eSIkIjQi//cYUCXHjlV3GwKgjYR8skiPXv6GVotzaacw/FxTeIoi9GgZ1B4ZMbYvb58m7exP4Qoeg4q8fPjxumnE7CfGi+Kxb8ZSD1MzQHmGt1NnWxkwHTnBfC1ZSFMzzk1f7UqlvjdAJP5V9I2ZD7eqUzjVwQs+aG6u4E6JSSrtIyqVLJpMC23Lw5mHhI2TOtg== 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=f85Sj1Pf7S/hIg2p7O0a1eybgIjJgZrXjkRNBEWx7tE=; b=IqyVESDTbH2qB0d4Ut6esix+jGGnFkEVOWa2PGmK4PJEeL5EehA/OlAbKzDLZxmnUbCZS4yjMEQlXELe1UgEshEysqB0D8gs5Y2UNXZPsTztPKTdN2mE6ap5FfA5auHUKzh8oFQSpqjqQnTmeQ7ivTokMlkkMpl4mlo3lSBt6CGe4RYYMUC/b31gyq1gxWfnGtaKuNIfGUfaxolLoKiEvmHCLHU+p81biinRx4LhNxgbzGFH98OVjFCNa9HVMmtjQ9bPBY+aJUyLZv25j+5tYdJ92uO54MlzyaVPJOFM36UGmE2jh5t5sP2o0fOi+GOzyZdFNHt1pxMqpXfnMERAUQ== 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 SI2PR06MB3963.apcprd06.prod.outlook.com (2603:1096:4:f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 09:59:44 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::fa0e:6c06:7474:285c%5]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 09:59:44 +0000 From: Yangtao Li To: Miquel Raynal , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/21] thermal/drivers/armada: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:07 +0800 Message-Id: <20230710095926.15614-3-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230710095926.15614-1-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> X-ClientProxiedBy: SG2PR01CA0167.apcprd01.prod.exchangelabs.com (2603:1096:4:28::23) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB3963:EE_ X-MS-Office365-Filtering-Correlation-Id: 88995225-9557-4dd9-e69a-08db812c6322 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRJdLopltKtt1ChKXDmD0czfr3mkNSL66HDEYNHZNXTCEQDRU0vNrGToZrGI0zKN1cZAe3mI/50k9sF2N0+aQXWmfhSu5Jh9xdU8d9qRvKrPojm6esHxX4sRLEVKT/LpHVQv0I8Zd8l/aEs/tk+AKBo3sYw4Cl9Ts9saLuxGLypVC+gDrQP+AM3qUzZsMRL4XxtoGEbNSzQHPOydvE3HhL3jxdnfJIWPQT9hFC0M/4+0s0n0WMarkgzmYEu4UnXqO2j0soy2R4BPo6A+LaFFLTStlTH1rsG00wTV5qMH/yyqvcjTfg+GyFbNNVRbUEbxGjCJYFbasAOE7EvO6MR6K3ajs/JS6DabxBIkKgCmu9LEg0D+4v/ZGrrpEyXNyarLy8uJAbtjbXRtTf6CJiT6kmYsKkotrcn6BYe1Bx6tFS2bQQglqbey/68tBuXjKtBaGiJq57y9EvJsVZvhU0GJEzxAuitv63lJBk2MyzdRorsGIl8ZxSCcAHDVOhtasPL42RvRwByn2zNRR87IY/53Q5xdaD6pRDTz8vCJEYuMRI6lrKonpjJ7alh8ebuT89+kuWFI8VhGTwBW3pMJegc4GBrHFDcaZpsr/ukOddIcQRHJIFj086ZCrrWPvGk0dwc9 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)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(38100700002)(38350700002)(36756003)(6666004)(6486002)(52116002)(110136005)(54906003)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(7416002)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(66574015)(83380400001)(4326008)(41300700001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HjiTUnyIEozq4xruLGLdOK3K4P5y?= =?utf-8?q?XcXUSfel8hPPfxwf4hAKeMAG/UEfM3L/Z4S4OhM59kzy4oH7wVb+xorRUdhJapU2o?= =?utf-8?q?ZNU0tsj6KF5E5KHBGcHRtEgzG3K77nv2C9lYGigmpkGLl/MVJHCXQJj7jQ8M5LCZN?= =?utf-8?q?o2yGY9JfrP3sVG8LWOckrqy7VE6XLMD52P//loRKiWx7/iMfzgmSG+LBFx1MLAhd8?= =?utf-8?q?l4zwp+NiVCY8AccydKr+K/+fm2ixRhvETyldAjDLg3IXqnPQEt3BLBsqmutQKJhZm?= =?utf-8?q?TdehvqVMu79u87riiyZlprDy4729jtybIFeZdBOMegYccfyKx8cmzhXV70QE9hnU5?= =?utf-8?q?9/El6Ys8YK2SNoE3QHoM6F5yq5i2NFHS8qXenZRv/Ejk/jAj34rp88JeaDOmeTfNJ?= =?utf-8?q?qOqFr7SNdfbcLfbCByoLKwmLaEEndEuqOKz2iuOkrqkQqtJSIT0Driy541ReO90Ir?= =?utf-8?q?XLLnBsI3NONGh/XChp9/+pes5MHrcjfd0PPK1WXaSG7thYDjkdzf+DJmAJMdfvhyr?= =?utf-8?q?leXSWIXVPLu+YIF8/kMNq9LogUEjx8LuNQWj1JYY6skbvK69StRG+Kw7I28pfz8T5?= =?utf-8?q?X/xKfmLPVCA69ANEMvisWwKYjWtPOPakTdJvi0+v8SncR6haCsC8lWzwbIJ416YE5?= =?utf-8?q?8cWjqRmc/WbIqcVLhUFzGOUFrD/70+TERpXR6WAKxWBMqHGS/iGUBeUXpxQ/Jqs6z?= =?utf-8?q?y9phYItp5lyFXwThefNzM3GyiMtddm+69OSGDM6sG6LdZ9+SS46t1mHJPr1dvR1Kg?= =?utf-8?q?67m9LGmBVos1TnUB8uRBOKME/edeIXZ4Kc1Dru8VamSM6BLBvoHztpfB0BHK6460x?= =?utf-8?q?PjXCPuHIor7YqVutF70DwsnDmY80GKaaHWvMLf91ShB2KycfyvirvRRLQhMnPB+b9?= =?utf-8?q?/L0xgRxWeZXSHYOudiJcPYJczLLjVIZHChuPE66aU9I9dfM9oK2FnAHlBl0wVUbHS?= =?utf-8?q?s5jt8vx96N3X7UlDAFybULs7CZxupaJHtD8a/y4hhJcObbvxoUFssl/lT9XGlJvPu?= =?utf-8?q?fTZVK005j5HBR+cC766m3wTyVSZFcidLoFtyVF9tJIbLLdqRf1iBSZrGMpD+tsjfE?= =?utf-8?q?eA9ZBxusmPuo/lvcwm4jHE2+mEOs7cImf7CDZlS6387X+8XahL3cD5krNo3J2sdcr?= =?utf-8?q?2urYzudMxEdt+eVHRRfiilT4wSa9M324D3I0oPobH2P76m4jinkwQHiDgWSNNZVf0?= =?utf-8?q?GJOru3sx/6QeBAW6nWOZUOVnkatGQ9hR7/oZFcXpvAS6Se2k3Xjuxzi2iTA8aqH3w?= =?utf-8?q?erCRT6/+4wikB0XNauhfIWoSVUSNatOU5GNraG7NSUzPsR1v05XUGGwiHyqohPfXk?= =?utf-8?q?PiXgv3Bqc2W+ymXfe5velyk+6v+8EjHxoloKb8moj6AYY4EDd7XoAb5tHeYIkgFq7?= =?utf-8?q?Da0SWHS3bawOky3WwCggN779jZCzGXcySU+Kzxucr1W7yM9lQFF+rcDnqe56pMqfl?= =?utf-8?q?+30rFbtGcPyaP/L2Z62IUqlCHsEv95OLXnM659/5g6RxOwqJWnPbApqShO0LMUKAQ?= =?utf-8?q?7P3+Ss1hMNOj?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88995225-9557-4dd9-e69a-08db812c6322 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 09:59:44.6299 (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: WZABljUqseFgpI+MF83k/wjVo3yMI/9pUy60wOb3zKC8lz0LTRrJAD2Hz6MKU7hnxccZEJsPwiRrNaQztMDoYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3963 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771028425273745335 X-GMAIL-MSGID: 1771028425273745335 There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 2000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So convert to use devm_request*_irq_probe() API, which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li Acked-by: 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..b7f549b6f825 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_probe(&pdev->dev, irq, + armada_overheat_isr, + armada_overheat_isr_thread, + 0, NULL, priv, NULL); + if (ret) return ret; - } } /*