Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35180313rwd; Mon, 10 Jul 2023 03:56:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHD4bbEv+ZQhlOP+HHvZe/UuQKRMDL/u+4XKuOiz5m2mK1rNeJl6bDmx9FvLLLc9d8aKgv9 X-Received: by 2002:a50:ee0b:0:b0:51e:3558:5eb8 with SMTP id g11-20020a50ee0b000000b0051e35585eb8mr10471825eds.19.1688986605054; Mon, 10 Jul 2023 03:56:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688986605; cv=pass; d=google.com; s=arc-20160816; b=IpUMWbdYOgg7ISVWD3M+haqk7kF//zUYbaQ37Nx24KLud7h9L6A8AV//Cn7i3+1WHa Blqp86MMjOfxnAgRVJNWEvEi3sYoBJnFBbcKOwLDCc+MusUjxsYM3Tzu0f5xeppXwLXM RnhDrSMYaJ+NQpr/uiPHEsNnzVKiNXdfJ6767aWuf+MV90noG5FlSAKI2Z7jeFsumpWM qawG58n+uLOl1Lgee7U+TWjDgGdFJF4atW0spjrxNKJxwkJfsc6fLFHGK1JY8GTvvjio tQhjdp/xBl/WbH+Edj4QYWfeJFsTYgoUHmpWVC4HQY9QbofQ/HoyEQ4k+v4YYBg4s/dR JXTQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; fh=KTv2T1r/QNJZkf7UmS3j/ysaXQ+6ICZoxyH0IbK8Eew=; b=SjqXkgqzK9FucMb78lC1swo0/xUfeF/++1RdimG7/bwTV+p6jsMvvxvWFAmdZSVl7A 2k2R7hzzGtsghx1/XSsaNuPbL/zq2Tn3GSUyjXUlFH3g1Lf3DZ87sJu4D+V8cuqqxFDV J/ApHVES5/pddQyug3HR4w7FpS7xi81anGJ/QBaYW7AyTCRdUlyn7gTHuOOWuA18QjDb Z1iOm+2jApaGyGO8EkltEgpkppFc/0PAy6dBDJiiTzDPoS7Ekq3kav37AJkLJlCdPC6W AEIOLPWLDIZMr7h4+my4bOlEKcsJhjtoq7xMgd4gO+t26Op3Uwh1OAZE92rw9m8dz71p dq/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=AT40YGdu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca15-20020aa7cd6f000000b0051df8ee23f5si9013589edb.175.2023.07.10.03.56.21; Mon, 10 Jul 2023 03:56:45 -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=AT40YGdu; 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 S232976AbjGJKDw (ORCPT + 99 others); Mon, 10 Jul 2023 06:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232979AbjGJKCx (ORCPT ); Mon, 10 Jul 2023 06:02:53 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2093.outbound.protection.outlook.com [40.107.255.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5EA1FEC; Mon, 10 Jul 2023 03:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLXNsb5TPOSxD3nk8+tQbzOcqi8tpvz01vKsfRl5z25+UhqVahof6jlLQo8UY7qNcIIhyBL+Lai/jYxHCA8p2LH4dOur8nDatkqi9tW+hAaUX/lEREOUUO+nLEh9OcuWrEIDu787UjuonUh1d4CD1AGl/rGSU/H/0lRk48M4lfgThENL49GMmib7TDF83E0SsillXPO0F7Lk7F3ptUDrG47RWpR5tGm2iEKnFREXn6Pv0/7g/eFmFae5ByB3NLKssdNY1IpPfnD/XibnMzyy2ltmGIIOV1yQBS1POV3xakNMGPCYeTtv/NoLkkFtQYpIkhSMLKd8tT8F0p2oqfFwCQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=UyxYhv0Vh2KT6ygqGjl5gC7dVb5CNdSXJI91sDbqlbXxKB/X0pU9TwE++RvGeyUdxoz7TGV2Xr65vroPMU4FLKvRbgFl5K+fStUSav5Oh/F6q1tuDLtF2TtO7TZ2JJ4p/wpg1JK6RrzBd3Qd6WrQwk+erJw3h11vHf0JcwyV9vNWfyepUv09gmHxR5CzX93PoGAWGaSPMxvaWEdgczAwXjheGkU3C2aYJ+qeXwpyQMtS9udjn8Lyy6RQJ6Z0JPr8DpcL3wDDktg0r26zFiAr6zb4FeAGhAWJFxLReH/6eYIUYjAdjrOg0AH9Auz/Pdy8BI9S5fWT5jwIJ8M21AHttQ== 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=Q2g69HSmEHuTTYKyKe+Ic9ejjUzfByis+TpAlcnSq4U=; b=AT40YGdufwDaOVOEV+ha4HA4p2KbzY3AUL/1ByQoe04WbEYihn0vx3JDzcKKF3rsQxcGqfKhO/ZjR/PDcckHhNZQABeEttyihYo/8YYEIE1H8OtDT8w+yZbqB7aWnp7Wq7qYNen2nu1zagn9/OTcWtGy/SbaDWNXkjIQmGNx9E9sJxG8/seL/bKJffE4IeXZKoFtLb/9b0P5iKO7JM0KPXfbHGjXXUifFiUWkamLfOGFxt2Xtb9d4+NIS9T8JyGwrTAg94CehK1s/EDzSP/EPbcrW0mMHZvj5mAIdFZIv1UzWEeKzFJeMFzBmbskpKH5mVFT+nlyRXv+F3YwZVZwvg== 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:07 +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:07 +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=20Kleine-K=C3=B6nig?= , Jonathan Cameron , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 11/21] thermal/drivers/hisi: convert to use devm_request*_irq_probe() Date: Mon, 10 Jul 2023 17:59:15 +0800 Message-Id: <20230710095926.15614-11-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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: c012a024-865f-4e2f-da4e-08db812c70ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VCfBdFcFVDBbB1xWMbL4qv+HwaiTAXjGYzsY8pjZcQp48nEji2U5iBkmZMKjvvWl1lzPqvu5zkZcAaWq3qAbTamRRljPKoky1Z60pnv8GPWDDwDI/jv7wpclwH5KsGqDKmhkTTHcOnPiPcceSnzJr+VyzKLQujXKzDhVt4iaSpjnPV76oWAo80wWE1NBVjdU/Nj8N3yz3EgsgkZnR/PXjtnLPwWzf0NhZ5MTkeUmCBDCN4oBN/4S/Eygrk+YAkxbGNtOzRmw9TzXYb6m75DuJR5LxA5pKuB5MuS4/1DZmx5CNk1IXHs6g4FiQmUAuA2i2X8JlnvuyRMl/TVE08P8lMMvBzAcbl00fnEoKA2z5JSwQfTpRVWXXxyfipCfS/xjbasAUvv5kSa76VJPgyNxwW8Vt4LMYEPyhmBysHtVagYMMvXOxaADy29WQ/gFO/ZtKtBbiYb4cH+SO1kD/UdhMuf03U6MaPONSPPzeAZJSlx9FOiXotMIx0Dw3SEfbHEMN72mEaIxqfMGIDuBdxzlTC8z0mlAMxad/FsYJosMtX+T+eTAeFLkC2feIkQT1nKvmel4ptsnpoJtZWFByyhXLP4oPy1hgi3doYhryKfIl2iZlO6nv/6aUjPZ/zpvWnJh 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?B?RTRoN3dEL0Z2Mzdnd0lCSzhENFdZRm41SDhGWGpCbFVtMnExNGx4V0hqTWU3?= =?utf-8?B?Y1RDUTJTU2pJVG1adThMTERvK1VWT3A1RVVuaHE5SzhKanJ4ck0yZXl2MGRj?= =?utf-8?B?N2RJN2FSZzNOaTNQVE1TK0FPanZ3dURsQ3FWclZkcngzM2FDa25QL0NpckFM?= =?utf-8?B?cTVyQlAyQk0wMEcvZWRsY05GTjgzanZOckdmRlZhN001enFTRTRrMWNlWDVJ?= =?utf-8?B?ZW5FRDVTMy90aml6SGgxajNGbjM0bHdDZm9aOXA0U2JXVlNxNVJQYUNKTEFG?= =?utf-8?B?NjFoUkx5WFQxSkxyWTJZYXBiWUhDckZBdEZud2d1cjJ4WS95VlhuZ3VyMGdu?=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Wx?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c012a024-865f-4e2f-da4e-08db812c70ac 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:07.3731 (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: Pvez/33xPWAzRALUN2EeHni9xPzxHBPjDXCB8lzrLe9mZGceLEHuvN9C+TKZ2T6WiYJ8fV9nt23/eLGnNJWD5A== 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 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/hisi_thermal.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 3f09ef8be41a..ee5f50fb2b68 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -576,14 +576,12 @@ static int hisi_thermal_probe(struct platform_device *pdev) if (ret < 0) return ret; - ret = devm_request_threaded_irq(dev, ret, NULL, - hisi_thermal_alarm_irq_thread, - IRQF_ONESHOT, sensor->irq_name, - sensor); - if (ret < 0) { - dev_err(dev, "Failed to request alarm irq: %d\n", ret); + ret = devm_request_threaded_irq_probe(dev, ret, NULL, + hisi_thermal_alarm_irq_thread, + IRQF_ONESHOT, sensor->irq_name, + sensor, "alarm"); + if (ret < 0) return ret; - } ret = data->ops->enable_sensor(sensor); if (ret) { -- 2.39.0