From patchwork Mon Jul 10 09:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13306650 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D934EB64D9 for ; Mon, 10 Jul 2023 10:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232851AbjGJKCw (ORCPT ); Mon, 10 Jul 2023 06:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232922AbjGJKCK (ORCPT ); Mon, 10 Jul 2023 06:02:10 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2116.outbound.protection.outlook.com [40.107.255.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82F242716; Mon, 10 Jul 2023 03:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9UOekh70PjWwE84uhkavOTKNAcMPNZcuFQ444I2ry/5O1deGl3O2qfAwThHETb7GI4xQdjrFK4QbcQ9hE9B7SoafIB7KrNnVJsCP0YJPWR9vg/oVsebSGHMji/+A7FZsV3jzhILs2JeLuSds808ADUFli44Gc9KgEl8MXbyx7fPCiqryLOyLfoCVW6JLLlPA0OJoDIR+ckPowQKpKM4GPiRrlP0YK+n5ILwCt5klD9UFbsuARnbfVxKZFxEz33qt5KC7JywGIfG64Nb0xMiLOQpf7l1roz4gqQXe++GT5dN9xyBpIAMt3TNrR1suH4p4b/IJfKW/ACwd5WZC/I/zw== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=ZJhpuzbmOPWIhFTlzyqSnM0SFWqydqwVDZA22I7TcXyF+KH0pvAE/8tCaNqfI3PR+MnmoQy4IhVpnTm0clhykMGa5GHmN7C8R1Oaf4G1lYvmEL1NwuKZPv90fMtaew7fdZb9DKMrooseyGCZIsQC2RR4jQxkNhnb7Efrd4gvJffO3INKtES2NiSp9oDkM+XlHB18KnxpWouOk2/vyWjMgX8ju0gp199Cwvb9KOMqDHLwg2vA9UlZIuWqMoMN/0GComkMZDJymtcSTPX5NOI9jlZIGZ7dt5CEdOy9r1GwC4JVCYhVRtc+ECEBYAQq6OBRsFa9v+mhfMiesULrpHqrNA== 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=uHojIhWiIchKie5prnQ0Ii6NtBQrjHSYpApVgve/ZX0=; b=AWoZdthE0HasAo4m1BnyepY5KsmRzZ47py0WH8UctJCjefBXHoaNB6+Z+ZhPPZh4MQTzlTlwLafRTWsbmrQs/dJtZMsQcLUDHy4SHS3PWsT1aaU8Y0f5Pm3P2dvDScSLGA9PmcvOb2MiG+PQ9Qrrcis49DhAtZtNCKcWoxTosS9ftBUNNinHT6YIJPGOdyCLnPdJiDOgBvJPs33sOLASBb7elLqXijOctUTa6tmbeXWM02bBLHILYZJUnlZCokG+/hYopoXfT+KMvIyky5JnQZZMYVH2f3bwBZmks6CqjqB1YiDb1m6kOjwfWcv12eicYEp1ysQL6/MWP50eTQyXRA== 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 TYZPR06MB6096.apcprd06.prod.outlook.com (2603:1096:400:33e::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:56 +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:56 +0000 From: Yangtao Li To: =?utf-8?q?Niklas_S=C3=B6derlund?= , "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-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/21] thermal/drivers/rcar: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:11 +0800 Message-Id: <20230710095926.15614-7-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_|TYZPR06MB6096:EE_ X-MS-Office365-Filtering-Correlation-Id: 04e312a8-b6fd-41f6-697f-08db812c69f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFkrTWieUWAi4Md00nGOX9B7it/08X1CH1GI+iBrjqkTn2jGPXZm6cG7yaR0p0D5N58fzg4z3jWFDdNsQMehDasRrUTDYZGlaWdWnBbjBNMHxmwkL27+Exdl3+6CyBfNphE6vn+1zy69z/xhlUdFVRrWgx8ZxxSVF7pfmNDdG736u8yIIOp7RwMyV3ji6U+Sonj8d/BVdlxeoUDkFapJLzYGRw45Q+EuXKLjm0q22hAT7Lr+G3Caj8iBsdQh6TcTJP6ZYNRYtNpSDGfuUY8yhSjCXea0mM/8kxPQuPGNXPdy02+n3UVOzizVDW3vTxcSueBsqKaPYaJCCRz1cwJ/5BbGID54AG0RMbOcyGiPWXrCSWaE0mHXAuY2ahn27pmbnTEZn/y4/kfJTBwX+vDQb0zZIGsezpwUzQqXxFCdarvaJxgJL+QWpcx8H8krThj80kPHRn5368mmZ74TkpXwE7jKLFX7BSfjrLHuFLrpv0dn0wMH/OdToJQXTRwUNNBqLVOj+2UhjuUeRt50rCikJHZY46LxvM8RkJxiiFqSxTOvsVYk+TCBiDM/ReLVpKPsVlcgW5mMz2Dia6O1AqMmsckF+EU5E1GwOV2Lajfq6/lmYQCUQpDBfovowcWMH8xj 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)(39850400004)(366004)(136003)(346002)(396003)(451199021)(186003)(6506007)(1076003)(2616005)(6512007)(26005)(66574015)(83380400001)(41300700001)(4326008)(66476007)(2906002)(66556008)(316002)(7416002)(5660300002)(8936002)(8676002)(478600001)(66946007)(6486002)(52116002)(6666004)(110136005)(54906003)(36756003)(38350700002)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?TvInmcE4QzJtW481LWze7iZFES2+?= =?utf-8?q?TAigFDAuo74noWKtH1KvbPpZK5R+nKlfI5891e9aECmkzVMJnWKvU/dx33zJhMFzn?= =?utf-8?q?BGm2yjSsm3ZxdtkRSjE4tAYzXXke0FZm7sJQbBO9LxAnsGb59au2ypB1KB7gJpfoL?= =?utf-8?q?Ui5IZF29akrBUF9qqnLbN93RJWuvbw7GQexiyKjMJq8r1wyXs329lCLIF0yT7711S?= =?utf-8?q?qisQqD8ta64x/p5inFj7a3Z2iD7c9TgL+jXkKIo94Aj8BORkNWg3mORReHza14dq1?= =?utf-8?q?bLgJkhDDg01QAdxf+P1lgGoENldqlw6OIJZJGJ/H8nbwXWnW+FHGrAk55utkxGBA2?= =?utf-8?q?rhk8vLNLW0jlJk8Vl//7ZOPZTxHdtxG+jb9jZI+FIP9tmMBms2K9RBfKjeSBQbee+?= =?utf-8?q?K96Uu9MZF11vlFAzhz1Oz/5x/J8JudQr1AWVR4jVtrrtB79nziTTh7aj5253b7jBt?= =?utf-8?q?oiOzt89feqUvXx84GptXVkjLTEfLluUVNZiV+EXaonQzHZsa0bC+5DIF1GnBa6Uob?= =?utf-8?q?azIBjCr2x8XlibFpcqOtuOWjXBj0i40Y50d6ucVW7wlQB4AcvUeE/Bq1x0vZ+g1N6?= =?utf-8?q?QSir64I5IjoFmboFTRKXtVkTUnzP9uqG4twLyIthK6viWxMdofErYDyVTdnvLFDNb?= =?utf-8?q?nKfy0flrPcY9ydk6f+9939h9yEFspTa56Vrp164WWmuf1EvJcFnv1occGAsN2gvQz?= =?utf-8?q?SNJ9qvHoBeH5U1z7bjWio0ZRO+S2nSZmUUlF/aa+wDGZsuGIR/ijRxrN5S8tbkaFp?= =?utf-8?q?UqrXHVqRjtCVDQHf5B9hLmJ5TQ6iyHGUdddt+OAxQ9QWWwn/tV3e830nz6CiiuX0i?= =?utf-8?q?boIWzXQXyENTFF5I3eNMHtenJ84ONpGv6+D6nEcdmv8RmIpIR2LXK0k3ud/us/ZJ3?= =?utf-8?q?m45PsexxRLAb815Yso3AgM3U60hKSRko8OpzDrGIs9tUHJ6zvIC8A36PyPK+tp1Q5?= =?utf-8?q?7KHBvq3ZKQzJzmlTranF0joP9aw+x9lXFEkGYsnkvnIR9VVrFDwZbJw1y+2p7cDst?= =?utf-8?q?C9J8qkJ3dLxCTfu8dO4uXqIiYMyCTDXNItLzk3sL1B63rxrxs0kTtTUPjEE5n9law?= =?utf-8?q?wNvuJ91Q3kLN1uT//y/GqqQ6Q2ttLm8sQWp8kxw9ryhqcwn1Inggh3/e23CdHp7d9?= =?utf-8?q?GPcDQnjr5i1VshYubb1nJX1NH3fbimTKsQPVN//9XI+JBeEJy06kfN5+Ln2kWUl59?= =?utf-8?q?OSheNGsxRHgo5K7dVt2qos4zpRbvEPq6D6TLZL7YJvib6+sDVSVX4mmXp/bHoY+0/?= =?utf-8?q?z0fgz220UFzDrC2pHE8EDnxFpKZjAhIjEKJj2R0vBS7BoFPS7V9COivMknSONiBut?= =?utf-8?q?lB6fpE1GSU37T1JjMAxfrlpU3X5hvAomgQv9TLktEMwfP6BYf4pszViCTR+/qt7iQ?= =?utf-8?q?myFk+E0y888h/m8xdWXqIILErqOOEA4XyVfaKC337B5ePATSOdp3vD+G/11eQNia2?= =?utf-8?q?h8ixGNrqtVd2uMCZocqCfQUHe3Zf0Az54z+lwH25Z/mCdrCNBU4c7FrZFc0yiIvht?= =?utf-8?q?29+SAp6WAgKd?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04e312a8-b6fd-41f6-697f-08db812c69f1 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:56.0434 (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: 4DaDiWgAIj0OpWnp5pmRMI2545Ji9XN6T8mjhdbZ0GkGqeJ6TwyMKWiKShsBViejSyQ/dZw7CQ+um/FGYxB95A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 Reviewed-by: Geert Uytterhoeven --- drivers/thermal/rcar_thermal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index b8571f7090aa..56f3983dcd5f 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -446,12 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev) idle = 0; /* polling delay is not needed */ } - ret = devm_request_irq(dev, irq, rcar_thermal_irq, - IRQF_SHARED, dev_name(dev), common); - if (ret) { - dev_err(dev, "irq request failed\n "); + ret = devm_request_irq_probe(dev, irq, rcar_thermal_irq, + IRQF_SHARED, dev_name(dev), common, NULL); + if (ret) goto error_unregister; - } /* update ENR bits */ if (chip->irq_per_ch)