From patchwork Fri Jul 21 09:46:23 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: 123743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp101015vqg; Fri, 21 Jul 2023 03:16:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlHvFSyZtQQDfOTOf+kZ9QnAk9t6sTqJsxM5afxDWDrO4zM3fkhSGv5ORkxO3GNgiqgE4w6G X-Received: by 2002:a05:6a20:9694:b0:137:63fa:2a17 with SMTP id hp20-20020a056a20969400b0013763fa2a17mr1314749pzc.12.1689934568647; Fri, 21 Jul 2023 03:16:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689934568; cv=pass; d=google.com; s=arc-20160816; b=yO7/EUifmftVWN+oKatJcPWQ5m4xBDTcohAFOqAHhqestYZsGSX/CCRjCpnqyH59Pi rrzQ5nq0rSJTw9VAkE7htQM9vfydfRmNPkpT2h/xCM2Ql6HCh7MuYk+EDtuLxtcDuxGP 6+yPGB8QhAdA8jHUopJJmOTvk0nHBAmgtMAzSEJLmOHFfbD/qZPQvpvwCjGFAH7pX3FQ E+d1yBPjLPDDuBmRnxqsKpRsO0joEpuuNBKDro14VkpD+M7H6vcVYDNdFqK3RNr8fuze aBXZ4C6/8OdY/SgPx/cRT3aZv7IoQ6jfmUnc5uNmiD5sP1JXQ0V4rvCpQ1enFdMj3eDj Ra6Q== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; fh=fADlBFm3z5Kl1epeHwX5HN7QoBU/RjTs6Acse9/Zu2Q=; b=WxDzGzP6TJ2VgGRFm3gMyZd6MUVbMiNaG1C1DA/Tdsy+TI6mzfLjfHPhcua2IouW3P pRqISDtM10W6XEK/elx3K6OkChfun6h9PWjm7lBVoC053wctbhBR0pP/a2uMhfNWiA/z nPIwFuPE9SIKpF5G7Io/m6N/z/wfrScrJoiTan/mm2+2tnM6ePeKIpq5MXzxCvcHrqxx fd3XeVcpbZvwVm5sX3HgaQdvjU4S1M23brnn/3YnyMYcYxje2WtJ2N+fo8t+H04A1VDH Vv+eTWaQfKeQN3mQfD2SLvCj1vrJptz/EoOkWp0iuXaBcFtLV0d9tTDXe61T5dwFpUP1 6WNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=e+8GAP9D; 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 cn11-20020a056a00340b00b006827c671c1asi2686923pfb.226.2023.07.21.03.15.55; Fri, 21 Jul 2023 03:16:08 -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=e+8GAP9D; 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 S231783AbjGUJrT (ORCPT + 99 others); Fri, 21 Jul 2023 05:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjGUJrK (ORCPT ); Fri, 21 Jul 2023 05:47:10 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871D4270F; Fri, 21 Jul 2023 02:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kDXd/CPMirmrO+1y5VAH2c7LX0EU8LQnpp8FpQH3y9WwiHimci7yC0RbSqvnTuGIiFEhQSBvZLUQJSIVCgsXnfAScACyWDuRD4+pO+dteVkbFARD+BM+MMk9a6MuUj9t57K45qO7ec0kqhk5s4LO6DEpdQGqj6AJlsGYuz0B16Za4aKKz8HLMyfHjTR5XC1/T3LsnAdxDQxQ4grpfkmP5zh4SS7L/ZbOkM70LfFU6zhbuRaoo220LX+b6oriZ32aTODsrDMK3ijb5EYbBejQSMt/vPQyAbGA2J5JeFxB+cFe8+oZA8V9jEmB8UWaLmF6vn+jRC8/XdeO3ANQmIlRsA== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=Ne6nVZOisOBoZ1H7/Yag2haTWq5quNDobNRcL1NAGihZCdvsT10TcGvviGGYkQeHLJvJCBroDRWlWBdMNob6OT81vC0rscl7txGcIn4PaqyHCvkhtmHio4fv2jGpt5tDQqmr0bW/N/Oj1YN5LinOHsC5gO49OSICu3SJMD5hxyaXGdFEhuw01Wn9Z/2BFY3RfbcR+l2B61xZzChpCDPR2yg5EHK3N+qxqA38TBzK2xDsCWoQ3bujH4IZTijBfrWprjaS1dCMNM2+FlCOTgiCSRhzrbtfUNhRLR77Tmu05kllfFq4iPUAywoR3QXZ5f/pU+2moUqr7Lx9/0/0mbyezQ== 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=OjfxK/rG41MW8xIM0n4h07DdTRX37piixiXYncIAkj4=; b=e+8GAP9DxQENM00UXpAQWRd2hHCR5SqBmD+Iwc9E1ooecbqOKto43uVdUfAUsaVWzGJ+NuAl/1sJowUoWF0UrRifOckhp0yQr/1YR4LGVs+15fDGzvcG348evNFz8n12PS5J6Bhn9waG3EYBRrC8OqsQGzKb5WTLouWTt601J1smK3IMxM+o9i9d9U8m7yb5AgPnSzVn86JT9Fe9KeotI3Uv/RIRXMOB5KUn6GEylabPUiXoMX2wRZF31X1LEKuj/xPzyn2EYT/vPTcAyiWZn0JUjEfpNHvlpDZ/jWei+Fo3ux6fTO2YUivw6fb+5GHnPj8hL/foTcY7g1c88Tfdrw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR06MB6789.apcprd06.prod.outlook.com (2603:1096:820:ff::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Fri, 21 Jul 2023 09:47:04 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::732f:ea1d:45a1:1e0b%3]) with mapi id 15.20.6588.031; Fri, 21 Jul 2023 09:47:04 +0000 From: Yangtao Li To: Markus Mayer , Broadcom internal kernel review list , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Florian Fainelli Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 04/22] thermal/drivers/broadcom: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:23 +0800 Message-Id: <20230721094641.77189-4-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230721094641.77189-1-frank.li@vivo.com> References: <20230721094641.77189-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR01CA0031.apcprd01.prod.exchangelabs.com (2603:1096:4:192::11) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6789:EE_ X-MS-Office365-Filtering-Correlation-Id: 251298ff-5de7-4960-2ff5-08db89cf70af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: csWfH3CDlS4Q/rOIrUoJlYR/FVBebOJJXmnfcteUKGJDSOXklyrRmk46RVkT95zga50fuLc/4+v7k5L2/FVvTQQjnnO+jXFO/8CgjnbqNwmTzXOrzCDyDWk6J5GXtupBPbW0e9kqH7UHBBQ/TDVmaKM3htdIiZ9GTd6FTG78OjQXXJ2j/k8JHAWz/xpc2TsMefVwrXcRiSNwrgsPqJq53ATcgCqR1xmbHGeJ1g+nGCzLCIfRQC2YX4gwSeGljdvagMe+KIHXAGES4XUoLQyj0N9WhdY5eGUhUDx+28gTuU49pODQihOuLdbMDPlWRLVwnas2WSuFw5Pc/Ar4ZDiQGsrs6kAsbF+sSEKj4M8Xl12FUKLDqcD3tc+lHCSJfB54SFRww8P7XWHRpVUr/AkOEMPbKhiPkqiI7wF9PKL6keFaOZzo68IJN+7L9bgOn6Kz7jQZ62wt2vFI+Wy8uSWPKaD/oi9NdXyp8sr5vZdj9VtkdWe2ihvsY0YNAtuGPinlj+qY87BRxVtmNbufUJw7qD+4ViLGRuq/rsnJ0Lf96Ty6JnIP/MQBe5KQk9Pid4sfZ+XABTHEB6iArmlcWaI9Tanf1nfBbVMAucn/NWIPYIUbeONe+wMPEZCE5UVk3cLR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(451199021)(83380400001)(66574015)(2616005)(2906002)(38350700002)(38100700002)(66556008)(316002)(66946007)(478600001)(6486002)(41300700001)(4326008)(6506007)(26005)(186003)(1076003)(66476007)(52116002)(6512007)(110136005)(54906003)(36756003)(5660300002)(8936002)(8676002)(86362001)(6666004)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pcJz+DlOsLYTMO72BSk1oiS1D3YY?= =?utf-8?q?Z61GcCQs2Rd63SS749EOiia/vlYnBbAj/2mB+GVksLEhhmYYo+JHRlZPenSpWNQ+o?= =?utf-8?q?ey/PHiYrGrCE5T8ci7kzcuS/eToWpwVl0u3+UC9kz89s9gE/ROPZtxBULWiCfUKIG?= =?utf-8?q?CHr4V8SqXiGafzosm/ZefQtZ81KfkBfDFJ6UvG9WrrGFbvPQ/wfqzUqnskhI9jm7f?= =?utf-8?q?4/sR3D9J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l4K34b/d2ylMo69KjWmaF/WvLLCFFezEZPAE7Mjg/8v2jSmF00XLhi31?= =?utf-8?q?fr3iXGlyJI8flBrlNrcBnRc/WXnBfH+KGElwEfK8fMcLTfLW9ZWAUgV1eZNotoCvr?= =?utf-8?q?c+bznapA/6rEu3pDlD3HhWYFVjCdfMKKLE3xRg/9AsPt7QHIDkcqzqJ4A7p4xkzP1?= =?utf-8?q?ozu0nNdRhPRM3pLZY5iSjfU81aPpX7VxRx/k32cpMGF5lajZtJGwtdei+BhBsd7y6?= =?utf-8?q?aMzp01fpKzZLCbfl6LfSo4iwqqL+nTNysCdOPeId3+p1LGNLCAx/GMQyIDwktRr00?= =?utf-8?q?HkT9E/kE8hoTRwGNTsDrTGtG1HeUWiuC6oHkmN0Bpp/+3mRIzU01ROZ9RduehVUIc?= =?utf-8?q?3CD6pkLCkNLUVwFA5FMPyHwjos9t5sBRGfX3hp+9NRM4YhLBYdncHo8+CrujAL8fu?= =?utf-8?q?1EOa/9P5d/Bl?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 251298ff-5de7-4960-2ff5-08db89cf70af X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 09:47:04.6538 (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: TaILFn6eWtfhLoaQNiFFPimwnJpDkxzmQwFeY95M72/kvVNlMg30+EDAdO2nqaK2gxIVpSLc89Kz1oDPN+C3kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6789 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772024830317877956 X-GMAIL-MSGID: 1772024830317877956 There are more than 700 calls to devm_request_threaded_irq method and more than 1000 calls to devm_request_irq method. Most drivers only request one interrupt resource, and these error messages are basically the same. If error messages are printed everywhere, more than 2000 lines of code can be saved by removing the msg in the driver. And tglx point out that: If we actually look at the call sites of devm_request_threaded_irq() then the vast majority of them print more or less lousy error messages. A quick grep/sed/awk/sort/uniq revealed 519 messages total (there are probably more) 352 unique messages 323 unique messages after lower casing Those 323 are mostly just variants of the same patterns with slight modifications in formatting and information provided. 186 of these messages do not deliver any useful information, e.g. "no irq", " The most useful one of all is: "could request wakeup irq: %d" So there is certainly an argument to be made that this particular function should print a well formatted and informative error message. It's not a general allocator like kmalloc(). It's specialized and in the vast majority of cases failing to request the interrupt causes the device probe to fail. So having proper and consistent information why the device cannot be used _is_ useful. So convert to use devm_request*_irq_probe() API, which ensure that all error handling branches print error information. In this way, when this function fails, the upper-layer functions can directly return an error code without missing debugging information. Otherwise, the error message will be printed redundantly or missing. Cc: Thomas Gleixner Cc: Krzysztof Kozlowski Cc: "Uwe Kleine-König" Cc: Jonathan Cameron Cc: AngeloGioacchino Del Regno Signed-off-by: Yangtao Li --- drivers/thermal/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..ea37e7ee688a 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_probe(&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");