From patchwork Fri Jul 21 09:46:25 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: 123733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp100131vqg; Fri, 21 Jul 2023 03:14:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1zF4M/VVriY5RMHrO//OiyRJrnJQYtwyeuqeURlCrlL/NRfCoZg7LU+9rLqnC270RObi0 X-Received: by 2002:a17:906:8a54:b0:999:80cf:82fd with SMTP id gx20-20020a1709068a5400b0099980cf82fdmr1364083ejc.18.1689934466583; Fri, 21 Jul 2023 03:14:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689934466; cv=pass; d=google.com; s=arc-20160816; b=SK6dlGA+E7RrVMaBCXqMOfTVvrKibicZGWPJOOluUMcCj30bhLFhL7sNgHH08jHWB5 SDNXdhTlAcXahRSzrFCbHZ8me6xfhmq4DLuXY4Nenu+/r64IwtaGc6hn/bTfY9AmnLgI lx28bXIuX/kbyXVRSZMBfd60Tc51c1/5pBFn2uusFMivrLRfpP2Jytqj3gsEFop8mLe1 yz+jCxNFLuUEkZfZK/35y29q7YC4Pzj/Q6vVom8aUcV5BUL/yIX3VH/cQ1kxtr2cT7qp jsLYRJOAckJBwe4xJt+glmHXssVgj9tWgip6S2zwILWojnVwmk33eaQNSnr2U7tS6wgM 71gw== 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=OEGCtasWCOSsSknQ0GZz9Yd5JlWw//E0x5dPjE1KYLQ=; fh=YO7dzwI6zK8jP/zWXotBHy3qgCoa1CXMYZZpgV202FY=; b=gpC2s9z17E0FcJmEMP+cXjAE3EMjA4SqoWnXEDnUsOk4ZX+N2jMXcxA2mi4HijVn9U XWV2zccn+K/rWcG6PqOSQTBcm1IhSMRMZlm1u5bApIUqDziBS7qTQisG0vZnI2vRWJOM oqAnj5YsF3tCoM3sSM6rwRk1PhT+ix2DqgiZpEwC4Fd0gb2haHd7d1RmMWsM+c6wAez1 W6IvGJpE8aV1aDheWD8jVkKaXPfQDemvH825Gplh55MnW/b2NWoAqUO+bwgjokmySvtp +sJlcVRlb4VWRxbnwJG2S+vaJ1uGedzQdcCCY/ggKGKNtItmyqXF9Kt8srh60f4uiIH7 28Pw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=fx4kYkOZ; 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 kd26-20020a17090798da00b009888ce5d3d4si1856800ejc.436.2023.07.21.03.14.02; Fri, 21 Jul 2023 03:14:26 -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=fx4kYkOZ; 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 S231833AbjGUJrp (ORCPT + 99 others); Fri, 21 Jul 2023 05:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbjGUJrV (ORCPT ); Fri, 21 Jul 2023 05:47:21 -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 130E030C7; Fri, 21 Jul 2023 02:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2eNIq/WnazaKQTWORgJO/oL1lSpSx2MFwpQAo9l65CzMaNqeW/ASQBvC1VmU1UqUD1xGgJjWf5KZ3I6cvJRg9NzRg6V7vj25Tzn78ZfSBW/2ozUYNXgzfT4+WFnUwtZtL/gHmmfpuBozkSFaOvYhrEvDPXYn0YLt0jeCO1Qot1KE/jrmO6GSPW7IjOxwn8sAXvzlOvTMXoiD/vXox8ybA0z6xCJk+TukGCgjiXDkj2a6f3r2wxPLRkGOXv9FKvqXwg33BkNLOzRvQ1rPj4M4X1XBtHRUX6WWzI04SXFSANYlDWUokgHLGGjtu/9oYlcvFx9s1kK49ZzIkaCG6ujaA== 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=OEGCtasWCOSsSknQ0GZz9Yd5JlWw//E0x5dPjE1KYLQ=; b=VPS+cy1up6OuFUufLm1kbZcGcWk5jNiIrrT3Q2ucD4LbpxqV8m4pSwxBDa7EhbhF9zmwqPTVK8jYqrt1KiFjf71yn13A55zMOn6Kt80bszEtHbRZTtKQs6Tcll/g5fqaOTtcEDPIecY0knAfkd8T2S0YyCFs1/m/hfs6oodzp5aUna1CCM6y+NG3TkwDUhPfTSJBo208idz7yzMuMU2TrKHIjyp5rVbC3r3J7Rn47VsF1nglQuGSIaEAsvXCrm3XfbyLcUrQ6U5/kSZeuD5HA01Jc+kJzzqtU77Mq++9jwTAascsFZ6YZOR05mQizrssQHKsshZB3tH6M0czKQ0iNQ== 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=OEGCtasWCOSsSknQ0GZz9Yd5JlWw//E0x5dPjE1KYLQ=; b=fx4kYkOZifPa/0KlMBxDl7LwrtimndrdTnyiS8ZtcIF5wk0kxVUDJVCrWTt3QHCucbVjsGXwNSaBOa80OK4SBoqS9EybEFT23Dagn/ZMC7Mnyb1MkYyBVo47vo65SQ0Nf0NJfgBl12u2FZ8bMc3ZT0C+8iCqtpeIL+RM4IZV1+pAFKEMKduUOOCsVZfKQFPqCvgDxFGAtlXQMFxxpxJ5C60ill9GX8H1DccTlkCFdTrTV+DGCS2IvMJ9Xytj6lg7XsZXXa81WB+Gvij0c1ZzbTpoimB9wlqynisDfaUu+QmU2+L83N30XT8fiEYE4RgPCfKhZMSjkobUaMcbyTwigA== 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:10 +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:10 +0000 From: Yangtao Li To: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 06/22] thermal/drivers/qcom/lmh: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:25 +0800 Message-Id: <20230721094641.77189-6-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: 1c826e84-7bc9-4cb9-1992-08db89cf740e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mnMlm9bGtj/jWhIWppXFpAYUjCvwFErB2VVBRYGpvizB/QDSW7KCJVq3bf1lyMexkdpxr7Bcbq3crRWn/wc6BUxjFdkZBMPExb84Lm+Awoz11AcVxUb72STe1N4Lgf/XtcgjT4TJ4uB7vZ/duw96cKYPdWNPoriBXbO5mxwkzScUsKl0lpZhtwOzmQihLpdQqujN12Ae3FvyjA7q5xoTHroEHs1Xk5NbLLNPDpmq7VDHDxdKbNO7B3JFCUHnl7ixiMynEgNDiKmVDzGiT0jRlI8okXkqNagRDlFnRgkHhJkwzSK2wC/kgAMyiQwANtWyY9BAti0D8m5c0SKJQ1dStUGxrpkSgKedW1Pq8+di4Lv2xzyyRw2eyLjKol+WeiwvJe6TXRjo4ljC+4iAcC5C+pV1QlqYm8G0ZZdJeIPSKdI1gDk5U538AMskqzaokML47wflAF2LCR5gZnTm47j8MLRAa2Unnl06Oexm8+r6u8WbTnPuYkwvbsQ9kdmK1QDoAO+zi1ikc0y8s5B8C6F3UAcZT8HhRy21AdFyOr+DH1DmUs3BZgPbiBuW1nt/2Ts83W3aXuM0Q/qXR7LvM5BEEFnGkMob+ZEs8X4JFze1UC7wQmZc47vieZZDuhq7829F 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?2NKEr39uN2Wv4JZHezP+D58SVxGE?= =?utf-8?q?b0t271iy9OoSG5HF2S4oIYbe0NvF4t60a0kLHlE6Bnsxm7WQMk41T3UUaUlhK6cIg?= =?utf-8?q?bVFuN7XFVUmmC87zrzqEPCKD88QbF6SwXhdtmNKLqlUClHCrg4gNA7kBS5t1LEb2k?= =?utf-8?q?cCSKPwIdelxu4mVOnRyec4CqJt0NSy3I1hUS/a7wiSM+KquqMK7cf4w+YbTf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-8?q?ynsy4e72N/P0bjYDoDq6wqiBNZX/Dk0gd6bnRSgEZF1SeuDzLGD0kRakPzJXF0Xy2?= =?utf-8?q?7f4Ce6y1tCEJwzMHlVNFrKqsTvS2B9FLgbaG1SRGnouaCBNDFPZNq42gsXL6kXiLa?= =?utf-8?q?vJbHEa3L8364LaDjGT1b9D5I++yuBgdqbA1GR5G369x4+KRHeaI55f+1Y2EcskLmX?= =?utf-8?q?LNDkAu/bQ2fT08budwlVlKEZSS3Bd+hALIBxu5WWHS4VJzUMuC4SdqbaAoR43totG?= =?utf-8?q?fyJjBrZcJKL+9xWuqhZyyRhrtgvSYw3zszk20vnKIK+h4JeVjAytW6T8qClLpcKgq?= =?utf-8?q?zILYCM7fqFsdwRIY7z1155Ib/XQ3nm78gRxQo+2roC0DK1WM0rVLhgEdy6ekAv0EE?= =?utf-8?q?mmVDeNsOm0/qKiyUyW6t8N+kmallGvFr71VIwt6ylqSaja0jnSEkg4eNrVEugksog?= =?utf-8?q?TuGBDxIs35KQ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c826e84-7bc9-4cb9-1992-08db89cf740e 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:10.3028 (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: rueYrhLiUgrUucvyzkb4TPktGJja1cwq8WVjB2LGMxeNlOuVn4nePFmOfhFz1dBZ5OFc/DifCkArw8nu8UmcQQ== 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: 1772024722907989467 X-GMAIL-MSGID: 1772024722907989467 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: Dmitry Baryshkov --- drivers/thermal/qcom/lmh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c index f6edb12ec004..48a14d7e8bf5 100644 --- a/drivers/thermal/qcom/lmh.c +++ b/drivers/thermal/qcom/lmh.c @@ -207,11 +207,10 @@ static int lmh_probe(struct platform_device *pdev) /* Disable the irq and let cpufreq enable it when ready to handle the interrupt */ irq_set_status_flags(lmh_data->irq, IRQ_NOAUTOEN); - ret = devm_request_irq(dev, lmh_data->irq, lmh_handle_irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, - "lmh-irq", lmh_data); + ret = devm_request_irq_probe(dev, lmh_data->irq, lmh_handle_irq, + IRQF_ONESHOT | IRQF_NO_SUSPEND, + "lmh-irq", lmh_data, NULL); if (ret) { - dev_err(dev, "Error %d registering irq %x\n", ret, lmh_data->irq); irq_domain_remove(lmh_data->domain); return ret; }