From patchwork Mon Jul 10 09:59: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: 117805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4920395vqx; Mon, 10 Jul 2023 03:22:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlG4vtXimFNzI2zCga6ubuqRynxk5PvPKC9PJPZV6Vv/d8r/nUHip//66HSkNIWJGEgrqPc3 X-Received: by 2002:a05:6358:5e1e:b0:135:4f95:4320 with SMTP id q30-20020a0563585e1e00b001354f954320mr4009265rwn.24.1688984544346; Mon, 10 Jul 2023 03:22:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688984544; cv=pass; d=google.com; s=arc-20160816; b=DT5hhxeJmQLz6lexRWmxAY01UgZoInbzBQw26vDT4np884kQKeD6kP5tOcMNdtW2Ta 1vXZJA/6Z1g+E2/Wita0FgIrtaD0LTsnfx2l9OCbFI/Ndzc4Uy4BJI4zwyaxUgq3znr0 49bDFuhnR1gMGOymDvjDzAQlFogbuhNnOY56g1UkKdHdHngD0cW0Acuvuyd7KbTRe6ii jg5r9X1twgfD5fdPqxdvvL0u7GCvlT7E6R8S52T96ifw7tKFMlPnsj63VSSlhXnkhj+t rPPRXGknnRS903lQTTYkMmgmmHi0O0VPYM39p2R9Y8oNyrBr83iUNV2Ddg5DiDLU9o40 aNLQ== 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=W/w//BqtE6H8wecTg1zc6Yupf+C+wlKTV4AmMFCwu/Q=; fh=4lb/oKXNBsHBaGM4+74JfytgnBVcyC3MaeVTSWrmw0w=; b=zqCqjyLqLtlHOSbovfLXkUsqxwG1IVtbJqPPQm48JiXbB6YLyx17S1HerzcAvP3jix 93+QRgbK0ksGzyVROB6zyHwUMwdLQvnt2yM69pshPjBWfnNtflQ/qCmUp+dABdlG//Ht BvAE2YIo2hNkAruBhvWxUT+npNSOWRdD9DB3Xlu64tdhe2je6vN0I8f72CBiMxZSSoxA CTL3HrydAOM00l4VpVqaZ0HozmtA9DiuWaNGXtU1lbNi9hH13vdGELX54puejFCwqar9 4y5g+HijKMxoQvYOKr16hDilnGa2YZxwee2SgNRk7Rk69MJznleRStvMxX+QakQY3LhA Dnkw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=BxBRDJ5f; 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 u6-20020a63df06000000b0051374678f95si8625415pgg.808.2023.07.10.03.22.12; Mon, 10 Jul 2023 03:22:24 -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=BxBRDJ5f; 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 S233013AbjGJKEE (ORCPT + 99 others); Mon, 10 Jul 2023 06:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233060AbjGJKC6 (ORCPT ); Mon, 10 Jul 2023 06:02:58 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2110.outbound.protection.outlook.com [40.107.255.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98BB730CA; Mon, 10 Jul 2023 03:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZyw6G2pNefYS17jxRwKTPn0Jd98FFnNpo5p7eHBal41/vmvsUcJ/V9JkpDawzCKKZJVvQEEMLG4Jz66U/lB//12wc53F5Sao7Z8KJ20SO9DZriU8UUebugV0hw5xwdp0QAhaKbGpXwcWde0UFZop1IZj71Cv2NojqpNfpgLDUp9H/gtntVg81nxUvsl6gU1UmOLprdcFRzqYUEgoi/zfyN+vCEiYyqcOKp04HFb7cgIQxg2DGFaYS7ImVKH72oh+2vx4oFM2CZOv8XEK6gMOMMmS5GXSDFxhK2C7oFGaYxassyHEz6OjXN26u5OLV9ZBfPnZEG0JlCSCJAwOFXykQ== 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=W/w//BqtE6H8wecTg1zc6Yupf+C+wlKTV4AmMFCwu/Q=; b=V/q0Fa/2a4jGnoEG/XGEOiheHyhMI314shHB6xUQbSlROTasRjewUqRXAcPzzJGKNp5B6ZwcChe4FYq6tJ+TOy9sUbZnYZzle8E9HJhEHwzeR5xPvkbbAw9xvL/3ISrcjM6/XWJJZBoC5RcAe18y2bncinDEL28bP6O/MGithSZGXCI/DPRHp37AcTbjbUz8m7zAjQhKzI6bakrAR19leHvaaH6s0BFgEWXKKNPz6oLVEdP/klYBHTBuJ/sZFe5PgtFIGx/ugtz4PX+m5Ao4I/2UTnWF/vsVJ0SfaYMAQp/A7K8alL2Nvy1Q/Hu+ZYQHZ2PEo47/6v7fu0SANaBAyA== 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=W/w//BqtE6H8wecTg1zc6Yupf+C+wlKTV4AmMFCwu/Q=; b=BxBRDJ5fVlRSh4qy3BnkFuDzI2NGLrQdk9Ce/fdo4qdDX/Pl9QABLOy4z85XWgLbxvoSA/gAyGIm7e/n8h6ODjLx4Pf6g254VFXhKtQXDh2mi5YND0sRRnlqyi4U+73ZuVCqmKRZZxA15IfZJIRXmpxNTp9vP1QEboQ7D+e/VW7/nrwmNcH6RAl3KEfZ71kJbj6Kvo72gX4+9WBluZuS0G11PnLU0wQnlh0RNPt8Od0ARVXxxHicGevnXyKaCN7C1UNowRMMwGaSKPKgKajYV5xeCo3X/HQ6kRBnvfD6EGrRTDyxw6DM0M3fFz8u0Ha18kpXse5DAI6FJBccgKxoCg== 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:30 +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:30 +0000 From: Yangtao Li To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Amit Kucheria , Thara Gopinath , "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 , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 19/21] thermal: qcom-spmi-adc-tm5: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:23 +0800 Message-Id: <20230710095926.15614-19-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: 081ffad6-8613-4e7d-77e5-08db812c7e85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iOhfQAv3U+V78sVR3FD3jZXUpwShDL4Zi/P5AbI22p7bpTNuVd3J1XyFZFUtXqHa+OqaKPkx5emMkCGAluv2TVKKH7+cw4L44Gg6lI7sBrCIrqtWYhvqZj8yCoNKFhtugCNYTZSQ6cTlipkNzuZSjDc+VERzxB0ZyRFPBaCxLOHW8RT4sEi4n3WlCGcDYR2hY3qGVUgQVeOSqiP8wbkOAZMnk45dHWhXZyiz3ZP82ZhkdNWi88JypKp+Kjmo9bP+3IQit0Qq4fKM0Zf2joze2LncyzytxwGDNjnW+4lBfsR+KSz5FbXamHS5A9iFgmYiscmgr1Hb73SrNY50ps26oKVuEXzWaFG3Moae0iTwuOqvnOPV7Q+PeP1xzQkQPlIb+rzk9R7/pPublvMX9SKy8WjH5oMIMeUk5rG0l8mOY7BsWH8sgHMyZRlfBVRF7l+QLIOS1Oip3oao3GF0P47sKkiNb2EoCnO7ERlgWJehXHQ372RMEoFAeA8UotyPsMOOVETtFugYqi5lC4Jl1jc9ANKCv+25XkaYgeJ2IMHlH/E7KdI8Olk7SGWT3IAA/rbqY1YWprbyaZKIUOUNe3ySiJDUKpwWMgcNID5BFsZCTWmHP9OfolqqFUEeqocwtoCT 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?8UEtkPZXgPkQ7j8TLKG9elDjzXZT?= =?utf-8?q?LizWz4IPyiBz39uJynDnWyCuiVN5X6TmlvtzpEFYmgO1SEY21+0G+9HiAO9qqt0mA?= =?utf-8?q?pj4Yk8c63yvoLm0X3Qc8/rpkhgvOhJzFBQBUM35mwrbf9rkFc+/4RebGL2BvT1fhX?= =?utf-8?q?HL/Ekuyh8FwhC3pu7uRSLkwZY4KUaOZAJMrPfl7Jw+8z1zX85gGAGLAIcjgBVQzx9?= =?utf-8?q?38ABh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RahZeoNw7nrLSkmWjXFLV54WHR7sakospnOpCegu23hYsa?= =?utf-8?q?S3nH4YqzVoOzvxeG77ftYe0gZbrK3bGOaTny6Sz43zqi+J+PlBLAGG/erLwFk+Ujt?= =?utf-8?q?h5VX7K0Umj9pJ4BjoktkuuGUy4IKOUOsUQlbTxXz3lyhLeYZlBGEvgb8xkPw9uXDm?= =?utf-8?q?iROlpyYkGVTjgDZ8xt14PuHmjHRqxT0czSnDcxOK/s2KH3shipy+GIM1bCVOwMAMf?= =?utf-8?q?QFRcXGQIfV7iOmPBCn3//JpaeKhTSJ51vAxYBlwBuDJ2CTVqh3+oWbzXkFKhW+LDU?= =?utf-8?q?Mbwsuun5ogRb+SzDkzazRREXkPNe5/ReL5i5TZqX+VSjgevukMXyVfdZoxQbIJ48P?= =?utf-8?q?y6YF2YM+o5ZTvhztLOIEarKz6W2DpYPbZGxBqocv+++tB4S4i7xkn5xiWXMtbWwY1?= =?utf-8?q?xsmAjI+OpmXZ?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 081ffad6-8613-4e7d-77e5-08db812c7e85 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:30.5281 (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: ip65RVVM/spuJ8GTIiT+V7pdCgYdnRMxl/WSlp5p8LbXj5qZNLgFzz77GTMjcyJGBSsF2u4lqz/vXgEjnMZGoQ== 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: 1771028657523738545 X-GMAIL-MSGID: 1771028657523738545 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/qcom-spmi-adc-tm5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 5ddc39b2be32..90d46dc60806 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -1044,8 +1044,9 @@ static int adc_tm5_probe(struct platform_device *pdev) return ret; } - return devm_request_threaded_irq(dev, irq, NULL, adc_tm->data->isr, - IRQF_ONESHOT, adc_tm->data->irq_name, adc_tm); + return devm_request_threaded_irq_probe(dev, irq, NULL, adc_tm->data->isr, + IRQF_ONESHOT, adc_tm->data->irq_name, + adc_tm, NULL); } static const struct of_device_id adc_tm5_match_table[] = {