From patchwork Mon Jul 10 09:59:20 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: 117799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4918549vqx; Mon, 10 Jul 2023 03:18:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFAJQfFUlafs47rZFm4ODQibsF59yn1MgWjL2LP3DqQw6rElIt1N9pmWEwrF61bYsjkfe5/ X-Received: by 2002:a17:902:a514:b0:1b1:99c9:8ce5 with SMTP id s20-20020a170902a51400b001b199c98ce5mr18474314plq.16.1688984319051; Mon, 10 Jul 2023 03:18:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688984319; cv=pass; d=google.com; s=arc-20160816; b=vanxhnzWJY3+cS2diEcoFTLr3DfuHXwaO1ShD9pSrHolObOTbgxSlDh+I/ULbl3CVS YSe95PMsGWKPJNNUvSQETnQrHYABTH/Wco4havf3IBAbW7Y1ouK7kr7I1HoGXJoG+I/4 I4nP6dXBE/hX9EXH0iSKzr7/fuhjC0/H3I5j3qutfAf2dyndyiPtl2WWRhZ1bOfuYHIi PYOyooto/TvS9YivHHlzIhng1UazPkfh06X3aXELQhDVV4jWeeTaHmxgLjfuxwdJt363 X8VBh51Es+gSXPXzREkTOUtrKYYS1yNtJ1kc1D913eJnAYhCy/O0L0Z3yzqFMoClFhW+ CX6Q== 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=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; fh=KTv2T1r/QNJZkf7UmS3j/ysaXQ+6ICZoxyH0IbK8Eew=; b=EhAmElMLUOXvy8oROY2vVyD/opNZacr2SaE5obkLSTndc8PqQGol+k9DH6i0MsX9dJ rruFboQhyWRpixNt3V9Mdg7Dm9XVI0hmELakXCFj47dyc+6XvI0bZCbuIaXNt4LF0TTv NRts7u4IfStZf3LsbCT7SjCBhnKZ24iSCWTLpo2xSnnauyPa+0WBRj4wCcuqm3agKRJU LsI3LxxheW3pJHLgbWk77MivEhFQ6rm/9zsp8VLLH+m004uthJ9uLV9Aco48nRmSA0Yd qCFmCafLEh4H9uP1TDGTH608MHJIJskhyStDicR3LuFHdu9dq47O2ddGmRda8IMYoOl6 kxCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=m2VWPRu5; 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 e16-20020a17090301d000b001b8c6890612si8538923plh.594.2023.07.10.03.18.26; Mon, 10 Jul 2023 03:18:39 -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=m2VWPRu5; 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 S233048AbjGJKEz (ORCPT + 99 others); Mon, 10 Jul 2023 06:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232873AbjGJKDU (ORCPT ); Mon, 10 Jul 2023 06:03:20 -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 6BB5C271D; Mon, 10 Jul 2023 03:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CU/xUBIrmiYVFP7bgPZ2LW3bbFPsozhh2NbnL57lGNKbptyIFePeaheEwBAxN/AKR2OtXDR3iGkrbLQxxF1cWFphnfbB5Hn/hz60K4cZ+0/yxBhBOyTi3Rw35T1CePbGeWoWHhhkJYRRH81s9qI1w5OLGWklBa9RdX8vn2fxlCjDZP8Yr8pUkIGmrxX/cBHKvTS/A3Q9M5XfumYLRNLuG+HaU7oW2+s1j6M2jnueLU73ruCPvN3XFObOszsIfOnmF2/LRgS58DDkG7M4nZtTl0jdWDxszZlL8ozZmITDhY2J012Tci8vvl7JiuwJrAig9kE4QGnRFR9/ko4hDqKhpg== 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=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=IL6SwD0W6dXt2Iz//EACJwD3Kv44EXzw6mZV4Lkezy6lAkLkH8aNAPRGHCVRoDNcX3/DZR0Bjvg/FdyEVfGHUjZzosyD3ofo7VA2UC8kJve8f9Foux/6js27YphYPYZUPKT+WQn+8YgwdgoRSl6OVUGgXlaOoRvmMgrsui6e2IwBr8JibjRxjNjUdcAgGOxbfGmZ/QzcSNZpZ9GdjGj2AgS68LY0vqgiPsHd7veQQaGXH7bzUqko2wUYq3AGAy0VzEsDQ5yWQ3HxHXxIB2GBcSxAyz60/5clGvxQeWnmvF97p57FWTxNQ4PX0jGR5V8wCqwppfH6M4UEPL3IcRhhbQ== 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=LKc+TavFd7Ci1xyoSggA9UVGFRc6ndR0B+ijlcDKBLQ=; b=m2VWPRu5jhlFSB0j9z2ZhN9ulwoolNRRd5mRgVRgzPk1n9/D/UXj5/Nqo3JPc00XXzZ0uvbxFmxpOJ+tda71E9mocktm/XzqMulaAY04BRdLY1iEix1I7bfannNR4Cfqxoo1GK4pJe/1me63tuqNGr8v967Sre1tbV4SMjr6IUdK8OCBVv1QGpBubmKGeWeRJjyA1v1uH2/fWDd+YfWdnggM5fBk/PyZhwW1ksE4BIvlPGsWml0e1LUDOSXDqzJGwO+qbTpXFwBORDRUjoS30Qn5mdanV7us5r5ojgc49OHNS2WnOVaIp5Jr4sRXhk9TfuEBXB1lrd74yYchbpIvkw== 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:20 +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:20 +0000 From: Yangtao Li To: "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-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 16/21] thermal/drivers/intel/bxt_pmic: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:20 +0800 Message-Id: <20230710095926.15614-16-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: 12835003-c01c-4d4b-1919-08db812c78aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qKLOWuVt7NVUGJ+zyAMoyvLNtP/Oq4SGxS9ACJqWjKF3WNuWSkQI/KMbRGcONQ8/A+DqudaGrkPNq5cF5OxUDCiNJtjN7QJvxGfh5dqfjNWIbxFDabfjWOMThZQUfZKhtGhC06+i5jHgcPhTCcQ7+9b48swCPaar8x+2D4Yt0CQQ2ZQzNp3pACx+3TyP6y7W4QN7M5YHNjzeKWqwB9LglGTG1Wckz5IB+RKLs8ZSTj1PmP1mKE7k3A1vrcgI8Px3c8CNlAOWr5Pimo44vFpsy3ex7YrV7ClDxQISAWYbYSRMKTR+YMSxijULhdJfU9tdgiL/Wu/Uu3qsC4EixBvJ+ZVKzPPGHwgxXUxku+hyFlM5UMokaJ3+1dQ4BymTUbn30AKMk14xUzxjcd3+wFWZhH364ncqo7ezT9ZPfeSsyz5dCqvvTtqEy4COxcfvqYsj1F/mU30Cp8IwmFZUyCeM811O+/PhfPBQJs//EIObmcHvIRqcjNc4zUVF/xjh+ZO2IXV9YL1lwC6nMxChz1c/PM0BuRoJdLfxMK2eEUlIjOc7SRy4htERlAp2SqaBD+Pf+7+KycA87l5eiDRQSvo+UsxdVtN08JMUN6KSXWtvJEtynrXJA9MA7f0oHHFpMlRD 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)(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?sNZ5wFOrwapcOxBs5F1YVi+EBd8I?= =?utf-8?q?uJZt4n4ZPzKMXCoAtAI4uvjv6NVphzDWi5ZKoIbzDJWe2D+nygYeqInRSdqcfwc8J?= =?utf-8?q?v1oplluiWKPydAQX12mZYsll8qpcuc96k7dV1TDpeluku1RQMe1oml5Vc8BvZF7LG?= =?utf-8?q?zWo2Xju2osmZC/zwUxsWxtgipaDy9nU4cqnw5jN8b0gwrxzN8cTQQghx+dkSIkD3f?= =?utf-8?q?bZF5aO8tEgqNmpGbLNa/tRkiFbbA70RO96nOxupCXq4toJtaUq35yDp5Yvay+GdC3?= =?utf-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f-8?q?x3PYsfuLN6cimKAlSJpn3XwFPkAxVBI31WYWvg4fA++kVCJojFeAxP67QkbHmJ8wT?= =?utf-8?q?Pt2mLJA7u2V+mb5XX/K86zjveCbJqEuhvv9ef7AGBkHW+JRyCI3f5No8UK/Y5Qq4G?= =?utf-8?q?vbsDAU1po3NeqniRXQ+/KhwL4b13T5b3NELg4Ay2+CGZA7Km1GeGstPq+L9meB7+1?= =?utf-8?q?X2kdKrfQlIgq6XnlWs52YO5T5v9pTwzWVyYmSDryk1nhsKQSXs2G7t3fXySK/sbTq?= =?utf-8?q?356ouyvzAFIRzAmlhpu3t9n2ZADjNvq8FoX94udmEATLDdA8BQRepmHpI6QG++B9N?= =?utf-8?q?os5SXo5OyIL2f7fMSOtXFInbM2x5o9ZBMDflhfDwQjErtpon46E+WBBb8AN2Q6y0D?= =?utf-8?q?FDV2fN3Tid4H?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12835003-c01c-4d4b-1919-08db812c78aa 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:20.7622 (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: bDz1uEb2s9sSD0k0Xq+WcNcfzmef94oxdkH170q5DQYGv9avtCw+a8NsQB2oumwXl+nBc0Cy2HX8pcC4/VXy/g== 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: 1771028421434218402 X-GMAIL-MSGID: 1771028421434218402 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/intel/intel_bxt_pmic_thermal.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/intel/intel_bxt_pmic_thermal.c b/drivers/thermal/intel/intel_bxt_pmic_thermal.c index 6312c6ba081f..1bf3e6bf8052 100644 --- a/drivers/thermal/intel/intel_bxt_pmic_thermal.c +++ b/drivers/thermal/intel/intel_bxt_pmic_thermal.c @@ -241,14 +241,11 @@ static int pmic_thermal_probe(struct platform_device *pdev) return virq; } - ret = devm_request_threaded_irq(&pdev->dev, virq, - NULL, pmic_thermal_irq_handler, - IRQF_ONESHOT, "pmic_thermal", pdev); - - if (ret) { - dev_err(dev, "request irq(%d) failed: %d\n", virq, ret); + ret = devm_request_threaded_irq_probe(&pdev->dev, virq, NULL, + pmic_thermal_irq_handler, IRQF_ONESHOT, + "pmic_thermal", pdev, NULL); + if (ret) return ret; - } pmic_irq_count++; }