From patchwork Mon Jul 10 09:59:24 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: 117814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4923008vqx; Mon, 10 Jul 2023 03:28:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlHQ0zeQdRT+EIzIAaFDhjAnmU6sCNFmRITl4bccQ40klafbuAJ496fBFxADoLOvWnU5F0Ul X-Received: by 2002:a17:90a:3842:b0:262:e742:f419 with SMTP id l2-20020a17090a384200b00262e742f419mr10160499pjf.47.1688984920310; Mon, 10 Jul 2023 03:28:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688984920; cv=pass; d=google.com; s=arc-20160816; b=bQANfO3ME3Mk+CfnNLmsSkt5zBUciKR2op8rHN1ZNh3Me0DgPhgYesGsWp3VKurI20 uNteOQCOFQQAgnzuTmzCVQMxMtipgtmYUWY8WBnpmOIVzjXMB4m+Q/GoTArkVhIV/3w+ 2kPqFFbSfWfieVWiySSe9Mo7uqBrSshs6iD7KnZTVp7atNiejz41jjQEm63HIsZ47eoa 6fJI/y/Y0iEJfP2AOQvRdIgk/P18L2R22fx6TklOyMKLtnhtI+3Be5rSSH4lUY1PWtwu ONiQBW/wtdeCbMqn6bgw9ym7eRRMDGW80b3N2KiPoS5mxQ7VjkNj2unjjh12KYzRGYdG YcMQ== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; fh=AD4CoxQWdgI7p7+N5rkrKbUXTxbis0AReCDws7kMtIA=; b=uyn1uBRydHnwrRssnKY+22ylcQwZwTS/77ULYIS405tAjGOO/nEcLfGDAMB80OpULB sopIIfZebIqTPf9dFcbX4gXJKXJ+U+cD1hIiAMHH0tQtyqtRloHWJ/qWkps7vzC7Idyi 1dgMUX5GVZQOQ7tgXCX9Mms49v3tHrkFijip25CP5tT4yRVSxxqOc/CW+AmXkuviQZrq SDuYjnRVCHDJ4RXZuHgHSYxHXEw0GZXbMxQtdPCIoo03yJNQB1J63K3ppLZQL5UzZDXK zgIAl9nJ3uCheVh8UUkUQqBwg0mHqXjkrKcxdQlI0POVS216MLb0UCR1jc3Kh0FFrssp qJEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b="GoUD/cVq"; 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 x1-20020a17090ab00100b00263a99b8448si7112191pjq.113.2023.07.10.03.28.28; Mon, 10 Jul 2023 03:28:40 -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="GoUD/cVq"; 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 S231876AbjGJKEg (ORCPT + 99 others); Mon, 10 Jul 2023 06:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231260AbjGJKDK (ORCPT ); Mon, 10 Jul 2023 06:03:10 -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 EAA8D35B1; Mon, 10 Jul 2023 03:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oI/s1nT7F4GNc8h3G+3IZXilBEYwOOUmWEHNROGlChKYY3LeknUiI7Pux8PR2aC2pANH5+6Qjt9UTcikBGZTV9OdyN/w6Kes/3kHFTHI47+Ry5g8bR8v8Q07zZ5fPYP2dMk4KvDhI/3RXd6oAgvD7PKmVEYWHNOUWXN554GviaiAFb+aqaHPnIONQz4vfEgJxK27bXdr2N94H5uphxIX+V3MM9L2/ZGA7SBSTnC9uvSX28v+dn4QE3DdrAog/VhckG8HNLDpAy36aYgrre/3wqoYS/xeCX5dS9MOukJUXs2B5gpq+3e0w2Kq6YsSPDiVsFf8bM8SQl+jceqHdV74SA== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=Iz7csKauyQ3v7FI3hVHVddE55P1CAg0rFd3mM8UQ4Y4iV1BITRI0T7jZ7QWTtnWwyGDtgQVvpcheD+hdUCQLIdT2o/bf4SguznBt4Z9+/wJY2I0vUvg6wwhaxABHCr9m1qNn06BK9vG8JZlL2ZHU56atkiA4dsZWXj+5kZJZRZvPRWs9TxU8JANxdsNsjLa5KJvgcOLGmaghwKMz8PDBk9xMMCO7xgv9XNzmAdCALKUG21yHcyHgkxAZTzVN9MyU3tNuyA+ltBHWPFamvsL4ktdd72vfFPL29OAXlXEwUuojvSdVTGICC7p7u8lIWTZ1KMig76mjFvcLYGp01V5x5w== 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=eHS28mIWTpLDBdxBKQHMC8i2TLY/+VTjWtqoEmhSPRU=; b=GoUD/cVqI5lPxSS09PDJO3cGMIEA3NC1x+cTeabIgL3jC29Bg84EFrRFX5PYZa5rOUr5nmUJsL3cB2CVT7UsFAKX93Ro9z7Wq9oXLjunzhoVmrnMvCX0asIF6Bv9qGUxfH1hOat0jtrFXWDS3zzMrFUK/dZ5SJEWtw2c2qtV1QlY94cqW0Jq1xwcEeYZF+iLiSB4fL2DmU9az7ns2lzApta4e7q9pi9w2uignhozU8/OGoXu60B6/YRRyVHFusH3P4g8tAKzpw71vvoOS60FWr2ms3xd0m8N+nC82azgyUPEdrrY5kATIoeyi4XZNCHYQL1/9kQzfzo3ElFbAy3n3A== 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 10:00:33 +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 10:00:33 +0000 From: Yangtao Li To: "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Kunihiko Hayashi , Masami Hiramatsu 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 v4 20/21] thermal/drivers/uniphier: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:24 +0800 Message-Id: <20230710095926.15614-20-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: 5ec64332-74e2-46a1-c5e2-08db812c802d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9nRFuOtEBI3RTkTY1kG3BdkhA/mxTaPq25KPoW6TN+sS/02Vay/ARsXu5zPdStC4nHUXk3r7FUV0fbFv74NY79BQvSkxxzkO1JdOGjbPv1sc2oxLAIOfguF8aaimnPyA+YEfpGuLKylbNtTYQlvXsWNXxeBqBHC4sYAdsBzHBuFkl1nyjnYE6ZKpFjQxPCsGKFKNgIY8TLJrvv5WBgLS6kF5Dy+OqA1nR9CDaovnyeBzIKGiTRtDngx00sYD3UqKcGXxAIUcXn7VF719T93bZ3CP2kWwonvgat7QYXHWcR7u1f2jdGJOyFkPFyZRGQTELkThk9rbH0kDlK9qR21/z/woUFeK6THMFPoM/7wkIC1nG5aHmNSX5dieouyVjEE8JEzsI7hKHgq5yOvLk6pxC7ThmXAKHdBT1kbfcqG50ir6aDiHF/AkXU01hwcIEyW/SGeLaWMFJ1aWbS8pkicCVEVuBqrbtFYk16QWQPLjqyJbnnis3MnhMW/A521Jr0E7KJ6hmEuLTTN7pjeJbUnn5Wz9Aw1Fj/y0UsgtVAFFQBMkggFDWtmWFh1foyaEkXCOBN405zWpJvjEN5noeo4RI+WAOtFSYbbEZ4QUA1xzwkCg2JvzsS+c522oEOH95qds 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?CKzU4mrHKPshw9D84JUwC7vd+noG?= =?utf-8?q?1v1BS6l/6yGkXtlpgNjSlQa7Bs2CROl7Rj+L0svSSIXxpYQsG+yzkHg7nrgkS1M4r?= =?utf-8?q?McX2czOjlU7juyjnElIMHqSET6a8/hxOrwV7q9/Gbw6vq7XbkDcknXTCeHh6O+tBe?= =?utf-8?q?uF6JVn605ofxCsVrtiBYp/+ECPo+FdMSkyrRYe4PgSJeOvy2hxmzeupynC6846YUI?= =?utf-8?q?ZIs87fGUgiaz2nJF7lGNIZr6ORlk56aEC1h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8VKW8kQkpo8ZRE?= =?utf-8?q?8qD2dgI2Au/XxMi8Q5/FuephSGwGaDVGAMyQn+fYgzG+5WPY+HmULEDu8Afa8ricA?= =?utf-8?q?gjp3KqLrVMiHVeupOYYVC5y1qjazs0rtwbtqHXBRT77Hpe4/PinEXX1MRrVtghpOd?= =?utf-8?q?kBh69VfdP1FCppStO/90Xf/MN55wq8nUnwrzk07CD1j2STxck2gWCOU+EyWThRRbY?= =?utf-8?q?NC1ZGHCViacYlIl4pMfbjEULalT4rgERxnTCitgREaGCy70AyReFhazul3PTCjvMc?= =?utf-8?q?vTOWJQqS0kyvnYm/S5eSXAcmHYeHq830ac3G56t7Ym3NA6wdTZza4aUm91yjsD8eo?= =?utf-8?q?1mCoFjXvSUPjTKKH9KWim37f/1Har1OxZva6ykwGbSv7bYmfKU+rmu02+E4Aumvt4?= =?utf-8?q?Fh+losfGpQuN?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ec64332-74e2-46a1-c5e2-08db812c802d X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 10:00:33.3917 (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: qH7Rf9GFzypxmdlxNU5OBBiNXki223smMMQeIVnlo33vIYY/4bXzRA0WOYgWva+H20kpDjplvbNiJF4HFQfGcQ== 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: 1771029051997603048 X-GMAIL-MSGID: 1771029051997603048 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/uniphier_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index aef6119cc004..34d8eb2138d3 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -278,9 +278,9 @@ static int uniphier_tm_probe(struct platform_device *pdev) return ret; } - ret = devm_request_threaded_irq(dev, irq, uniphier_tm_alarm_irq, - uniphier_tm_alarm_irq_thread, - 0, "thermal", tdev); + ret = devm_request_threaded_irq_probe(dev, irq, uniphier_tm_alarm_irq, + uniphier_tm_alarm_irq_thread, + 0, "thermal", tdev, NULL); if (ret) return ret;