From patchwork Mon Jul 10 09:59:14 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: 117811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4922839vqx; Mon, 10 Jul 2023 03:28:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYunSXiQV+OrF7rL3S3m9puzUAkAla7V42BMQ3cWjgvr4QYk5BVzIVxZCYPl9xURgLyCq4 X-Received: by 2002:a05:6808:208e:b0:39a:bd0e:449 with SMTP id s14-20020a056808208e00b0039abd0e0449mr12757022oiw.26.1688984893868; Mon, 10 Jul 2023 03:28:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688984893; cv=pass; d=google.com; s=arc-20160816; b=ih6Ebp1wDGdNgee0QMc0AK6G2DNw/YrEz/ag8aDNS4nMnYhla8q/SSaqFq65rIiuXf LddTX5KbiB/JIAUAkRKIbD3ZnfeCY/0wIT2KVdlimV9UPdwLMBuJcoOTO9NFmD+JLulf PwJkTyWMo8633yP7uD2YupEQ1Bp8yVRNQx4U6kZvjg7bM8BVcV3jcCpihOp5oB0muB6f vn4YIFxSHbK4l6qW2lwMaZ262yA4jufoKUdJjhCZL8Fa5sFanUx/rhnen6fcyxhEmVio ubFSV+LcuqrSLcK5ssaPMpk9ExJPXCTt+MD5VQSX+7WFDUUrYi6uEm1U37do1BiKiN0U KY+A== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; fh=9l4jrsSHyS68V2wntipVw1TlkFTVvLOwXnzO6qLLzSQ=; b=EcYC58gRCr63aVdn0AnJ8RK5/lGlQh0Sg4FNk5g+mstL86nA0QQFZ2+Ew2iych1bKj UvGsUK6YSshEbIHtQIIYhAPB5Vz4WR0m327e0TYsEttq4TkL44jSL/ELHsI/bfdmJFo/ qxe4Jss5rBTmJ15lr3/Nj7EuAdR7jJQBI4T6SH9zyOZ96vzaC3+nm8PSyAiwRVTVO+tw Hhsx4iGXqmvZUCCQXbfPAGEw1jPmzFtYQw95rtTWkBYBzCJ13YPKr3k7JgYWaYd1MU+l NcrG6n9AdkHOQKhN1MtD6RYyTLbf+zb7d9GJXcHSboTys9XVz5Ot4cKDdIrWOXVoqTZZ hU4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=opyC4pOF; 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 189-20020a6302c6000000b0055379a7131csi9355813pgc.721.2023.07.10.03.28.01; Mon, 10 Jul 2023 03:28:13 -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=opyC4pOF; 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 S232930AbjGJKDk (ORCPT + 99 others); Mon, 10 Jul 2023 06:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbjGJKCt (ORCPT ); Mon, 10 Jul 2023 06:02:49 -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 B48052D70; Mon, 10 Jul 2023 03:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZGNGbLWAdsfJQzEsJKK1I+Vv+k99KwfgVRZX637+54ukTIlYM6b0GQIvlfsv/H2+joh67yKUCBVyPsvurBy7/xVcItESOx0m3ExqZCkvPDE1eJTlIs/UhwYFehBnxNfB5jF4DrpC0gqlZAm99JLnFB2qo7GMDmIRScNlrXka5j3dBduDy6RMf2HkHag8fG7ztDqjYZIx9LYzAZ5pYdMAsKjpAB+Vep+MqsAk0T+R4Y0Q+uJr8GcMAmLHeHxFtyPujdovnYcqGNEHGXVNEwkH/V4W7wpbmAvWQgaR/ExIett2VHwi+WuOWpJHBZzI8zqhEO6iC1e9Eru6v+CTQEJlQ== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=LgfdDn5cI+msfQqApRLJj5QW1t9BCckMraX0NJUJ8Rmw1WIcU3kkGYUhcbAZWmDvDXhbS5qBxrWqqKzPrzbTTg1lxXWft1HHgsTLKTYJ/5SS1iS5MTmEG6PNoZzCN/BjywGvGg/gRliQUxe036qfck8W2E1bbj1LB63a4pbeA8Ndnog3yU7wOl/etoXSKcoHpZ2zV1babTeU1mpAwPIxETI4Zp2Ks7ICoUI0+HpNEES9UctrTb13cQv1ngScRqVHjRNeB+2MRnaC0d82b0ovcikA2ufH4X4hSTix4ZiBTktKBP+kvtFz5T1TUUma1gytv73ecOro5dz03GQZRkDshw== 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=xb6eS0PaxW2FdVEkfZYti3txNl0ppvMkAmkHrLIDlqA=; b=opyC4pOFN0xYgdK1N432pz/vgL41tqm+YfRyTu1h/EiP8/ovtJMrLSrkvbMPh+AfUTDgQFmDuJAGUF25gXlGaWa6SuWUpqCMAzqpGgaUfKYYBkWKhAFcqdaq5SwfOgIiA85rBuEktMwKVGwxs2Ul50yifVPGOZ/Zf2dyLqbR+DNCyZwR+VuLsZ0Vhu1opRuSD86CL2lO82jTgYKtvid5xNNRUxVyE97TESZQ7E1cgj/sJHkCUTEsNRCCGJfBtCJVIjfb+zIX6F5t3KCmfpY805hrBIKHOIyMyRNuv4mbCFVxHmGuR5fmf4UeSXpfknjLN6b08LCdSwRRkqK0cdZ8GA== 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 10:00:04 +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:04 +0000 From: Yangtao Li To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar 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-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/21] thermal/drivers/exynos: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:14 +0800 Message-Id: <20230710095926.15614-10-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: 9411cbf1-5cb1-4660-c7c5-08db812c6eff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ojWhGgu/i/UdOo/v3OHWeSi0yBG7NH/nwMhWW6J8kyMTx4VqLOUH82MQRWjWg2Wxdwbh9XXYLorQY9fpjLVmvfWBV7Hh74Z5ApH7px//0XxAmilMPeRMhoSiMtFtuVGCwfcIjuYxSmZQn56mb962hRL/B4FZL24If94AT0/giu/kiYm4qgxWNswdn73XstTVKjAEr43QpWfXZpyWWxAdPMU71noF71LYUCZtHZiuPezdfGg910gAoTOonJ8CNNlZxmnDj8po2cvLOWJL5A/gh2mrH5PjlZEgfrGviBxcvU5NkNX1+HnpcrhRSoLboO3P/mSuQk9BAnH8YvExaWFQCYKNpmPclHLRtlm5Rs9Pb4JBJ87mr+rfHB2ePJxxF7fLzyxW5qsfdnj35hKE38CuZbW1UIy4YuhMEeYAn2iLNsDEBmJlajQvrec0uT8aqz1DEmaJ+e+vURjSdZ/DLS1S22fdN9caxhVszGvNRsOO0XtovFDGMxCuGufcgZi6NOLBXR//jY9nLGuZhOBQ4X1ZkTWdYKhj1dh5MJW7llBkNedIS7XfnoPhyJ2ThKH8Z4u51uHeXKCBBtSWBaNiNJagqEe7rrJcyTdybq1G6co1GEsKA6gNBlDtORtsbKUOuakJ 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?8WVukFZYsleFzLNR+xbe4U3EK9Ls?= =?utf-8?q?3YmGAllVAmIE0MFNK6/DX+wSEvXcCRQwe0U76Rl480/MRiNHoE4/KfN9VZlLftB0c?= =?utf-8?q?h/IkZ2KbaUMNnAYQriIlIKGo1DOqC02WAsRHOJSVUceQa1nefRwE862BxEvpG8eBL?= =?utf-8?q?s+HkonYuEG6A/COEK/K73OzreSeQ6J2XhsNE+A0ZwMaA9Hm/E/24JEB9kSepHv3Mc?= =?utf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-8?q?HHLjayJesvMbVckdzheogqbDl8tUThmfxdRrBFgWKVfGQJFlsrYivoKKKUB5C78NT?= =?utf-8?q?8xqbbmWDiVYKPpNVofTEiA8p3CIQj2qDTTfycbxE37qL5TLbtudxQtEO0FBVob13a?= =?utf-8?q?f7yu2MzU00cw0qff4OT0O9h2O09iWaO4p6aa37l0kM+yUxD+o4RvQ2yuCYtoHX4TU?= =?utf-8?q?gOqaWEc0sUnRXO97AO7F8S5eCtNWs+DH6Hoa5blu1/i5W98xsXHnYKld18GDRl02l?= =?utf-8?q?vM3JgF1mAGbj+UBeMpsM+0iNMGfBath2vILsehVW1mJsA0NCr8drSn6uo1izhFpl4?= =?utf-8?q?yPdT1tlUblW2gbb/Pj+sqCXpC9y4tJhhY8NZjHIkyQJ25O+QBuviK0h2W9dCbMCJ1?= =?utf-8?q?XcqioHX/bV2+zUKmNnkhAnG1XnA7rW9/9kKFwmovGzfB2g6/m3cVJ9d9YrmZVcVf0?= =?utf-8?q?qOZo8A0qDnKS?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9411cbf1-5cb1-4660-c7c5-08db812c6eff 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:04.5437 (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: HtZIFT9FjTuz1y0tN42XEqIf72iw7ZbFN77Ay9ejNF0wWbxMy383uezFuZJD5Ah4Xk5YTn0voQa79Fop0O4o3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6096 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: 1771028554961501005 X-GMAIL-MSGID: 1771029024019478553 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/samsung/exynos_tmu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 45e5c840d130..697d2fbdb1bf 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1100,12 +1100,11 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); - if (ret) { - dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); + ret = devm_request_irq_probe(&pdev->dev, data->irq, exynos_tmu_irq, + IRQF_TRIGGER_RISING | IRQF_SHARED, + dev_name(&pdev->dev), data, NULL); + if (ret) goto err_sclk; - } exynos_tmu_control(pdev, true); return 0;