From patchwork Fri Jul 21 09:46:21 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: 123742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp100844vqg; Fri, 21 Jul 2023 03:15:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlHy+Yc3z06Tg4cDcuDNXyU3aR1CqczxrwzYFBjuxt9CSC6PlMbjlNnLuO9qzUDWI+Lu+UfR X-Received: by 2002:a17:906:748c:b0:973:ff8d:2a46 with SMTP id e12-20020a170906748c00b00973ff8d2a46mr1444415ejl.3.1689934549606; Fri, 21 Jul 2023 03:15:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689934549; cv=pass; d=google.com; s=arc-20160816; b=O3/swazgPjOEn55dQoxo4nKO30ekJtPXRHqgbYkQ+L6/bv1i3CJ6XK1TB+prV74bnj mBxwBbNPpKI+WbyUv3DFgcoAwmU6qo0fgT5/1eDNIEXzF01L9TfuyFkQgs8kLGaw4Mkr vMm4lROKBmg0tqAsGHeU1qxSuxseMYiZ8/wGdAb6K1Ij41L0UAH8qCsqHGtprWEOwV/9 b+JxOYrcYMozhEU6ozCQ3zlQermdaxdSHJFg66b5TsNwWbxuhGNNaqZTKXkEhvonluWK rgtprG6X5aFuK9zDwiy4f2/4I8dGTG9jSbffigKFwsnjVo+6tuP7iZgIMxChpGZoc+34 ZuTg== 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=4cslGBST80PBLFMrkaY/Jc9M1A0EqquN1GEpZNPex7Y=; fh=0SOMuHSJRJUal0e2QZYr0vChXTWHLyDZ7oQm5zYDano=; b=X/C6y7Lnh6GtH0hJRVT6r4k8c6L3t29d15UwUMGyAHas1l/Rf3isO215NKugzzV8Vu vI5aiay86wTGR+zdkfVw+9/NXf0D6z3fvupALQzHlUn9xtqb20fJfMdlDh/6r0jEecEf sKSVi18qU8kIJvUURs4wB/JGVH6qcA74Hw4b4BIK0hXkXloGUYvml0dWUetHbC3bIlli 5xl4hl4WAIoOjPpTz+Nle3XS0Z5QjCAff9gMEtQ/xgDimtPmoEWquC7oJA5kRW65Fny6 DX7Z5CQCTPrwHTr/mOZyLdnNRfuBHXMxRInoMyHrS9qbi1tCeDujUX7kG05ACPI49mum L6oA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=KiuBelRL; 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 v15-20020a17090606cf00b009937e7c4e50si1935025ejb.546.2023.07.21.03.15.24; Fri, 21 Jul 2023 03:15:49 -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=KiuBelRL; 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 S231494AbjGUJrI (ORCPT + 99 others); Fri, 21 Jul 2023 05:47:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbjGUJrG (ORCPT ); Fri, 21 Jul 2023 05:47:06 -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 2A270121; Fri, 21 Jul 2023 02:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AUkcqD3NiZTKjp1xtzU16fhIaEr4bUOtV4T8Rh7TrRlfGgWfJBffyslg0xE9HicWdo0UZ3Dfj6w+r2yAt5C6Z0F4M31MWQIGuUOhsBFFS+lQA4ggdhufES7cb2MZ2LSYaBDHrA5Sqfp14PNCp50OVsi8IqPvjpcX/dDtvMr+vlQONxkL0VtpAtRDhmhKzF7noKG+WxqsrpivJUccg6ztFGg5LKhBvfKo5HmPk+12q0m/KmIkXkynFOBFHM3eQT7C16t5W75TzW/0E/14JDZ3ku6YTs4DwGmxi4cwykJXlWo0YAEPKMHWV/IIUuAqHNDLVNdDhXmOMMhFR9bbM8pmAg== 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=4cslGBST80PBLFMrkaY/Jc9M1A0EqquN1GEpZNPex7Y=; b=iJFot14QsAyv72wxSMx6hYjatkE58tdkJPlaRH65ekLppH71SS+gi25HMtuCETzps3Z1UHq9BdNogrNfcCWkR/BcHDmen6+KE5l/3Sg3Dj7KPbrErtIIN25SfcOLyoQswKkswO7timKaGcm5r76G8RroERVL56nuXeUiF1O4+RwWzkKytLxZLbKRKuYP3of6bekQHdnRzK+Um5vrnQGBQniNIAvRo3XwWRCS2FZJ4/kZUYnbgP1HtfA9UCpZusDxN6uQkiCiB65BsClfFVPvIc1nQ3DptQi17gEdx7LacKNKFPKujLhdkSltHHrtc3R37Sy114IB6LDAkI7un3t4Lw== 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=4cslGBST80PBLFMrkaY/Jc9M1A0EqquN1GEpZNPex7Y=; b=KiuBelRL1XtxPBzvfMW2WALHrf5ChiaYMUGjzSc9PPGb/qwmHPomqFuXIidtuiPae0pEP5pgk2y2+A58syo3Phg/92rSsijld5Aq1ylj00PfAdSRsNP+rtov1Gluqj2knJeHKWmSxF2jwI7AdvTHibM3GzmzrIJa2M25qbQgsiO49CpOWA3e8ukujZchYPq4pLN1zZEMDJYlKQf6gyCCE+ej5+kukKIz+2QC02bAKBV6qP1jB9lyweAdnsaf6CJhh/RUy8G1slq2KsuCPnVhezBKMbwddgax7wLkAX1AJucHUFXLSwMZyEkCaRlg2DeGSSz0bsMASVPs0rQcPS984g== 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:46:59 +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:46:59 +0000 From: Yangtao Li To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland 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-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v5 02/22] thermal/drivers/sun8i: convert to use devm_request*_irq_probe() Date: Fri, 21 Jul 2023 17:46:21 +0800 Message-Id: <20230721094641.77189-2-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: 96f6255f-4cc6-441d-81da-08db89cf6d4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YkJVPqDdoPCaO/MbhkSoJ0LTDGeToK5sNowFuzka6xhjQZrlYcrQe8Qlsmy2ae4bygQe0LquxRngQoPxEh/yg2Rg/4n3rz805GVks1VA8gCKjSMMbSpm9FdJu02BzBYFLaZGXlq20h0Pw4/QK5nH5aErt9tuzVaG0Q1FwLiFABHn+n0gT6+urvMy7OQE2DxqN1NL9yFKTFOrAemI8h03eFq/QzVe/uY2c7jwIfpqJpoVLMv7Yq3clyz8jlqIGYFzEYAE2piZyoML0EU47mEsOArdmc8aLlD5Zw3e0+ZVQVL+o+joAi6+xuRWTTiv4+Q9pHSnvmoB5NMbvkFJY57mArOqFhAXpuTPF5KrzIWM8PqMe/Ag1DnDqiCnIUd12Jg/qWfyBPKCQU1PBP1MjPreTzeQ7Q61I597R4B3slPPDZzYXiZigT/kU5tTd4Y4hIhmna+DEd+mbU5nPklrcXSEwGW5I7m+MQSPHtftEZD6BV02vCVVwubqjl45ToZZp1KdViy77FFUy1U8ib4QZSznmgDa6iBmoSCkizGPh8DHK6plAY5LUnX5twfRT00V8YU95CvUzMKz7rBSD1518yqkWpXANK6ajJjBOgYX8x/yXn8lDIaGozjn5QdhyRRfngNe 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?x83WvHWsUhLcjonVuhlsY/RxgMQz?= =?utf-8?q?orCXKWkdm+S/mvH+HZLwT5FT6dv3Jxwj2MBgwEx44xvBUt2GCbnWeePGiF43WJtDz?= =?utf-8?q?AQ+PsOfo5ptdhe2hu/2y834AiZYJyy0r37i7NnpLDdZJ1At+zpl9L5NdyzUpJ8pdy?= =?utf-8?q?Le7iqOjsqtzemCIbvWPp4RWSZI+Onq2O3HNKt4hohsPt3GaY00KbdOxrpufd5OsFF?= =?utf-8?q?F2ZIAAnYYg1/+lMbz6A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JkWMYzHlOdjg0YgxctyU7bVGTS1ZNgMDUFnEZxy/1E01VkJRBgu?= =?utf-8?q?apvrhJjouActPBd3+JWJh9H/xSspNL3ZMiMQ1ydEuDI/sQ/W8EhIpOwhyzw9ZsD8B?= =?utf-8?q?79U/Z3vBy2Pyb2vnSVg99l0HeRbDWtcx+VzD49SBb56YdA7gtAUd0f/LgXWY+JXaS?= =?utf-8?q?/7U9oo0TT3Ag+dxKhu0z5IVX+/v5RvO9yIMAlbD5umbzUGRhh7UyTHwLxnFjHJxmm?= =?utf-8?q?wX0b9d0Iqrqu0LD4ysc898h5bSQhyz1qL/CaCTUrN5N+OEgkC2rxDo0xz9ByDt50z?= =?utf-8?q?/s5ZAUgu91mL767/dhHU+ty9AkRicmdTSZiOyMsSOSn2wrVhJccLp9/pqjSNM5xnE?= =?utf-8?q?gUZVuBWeoCEGy+yFyiCzXP6LVkhaIsIE9tnCOAmCjoJYD3sad+wQeC9xEDOGM+rK7?= =?utf-8?q?yS4xR7jzVFGs?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96f6255f-4cc6-441d-81da-08db89cf6d4b 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:46:59.0249 (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: 0pW2SSACajjScwYqnzDxFJFRqKjDgQGYKolViSop/ST3DOWC4v/rKKUARSTAiTCuB7XAzsu8q9fqHJj9nPYj0g== 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: 1772024810603769342 X-GMAIL-MSGID: 1772024810603769342 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 Acked-by: Jernej Skrabec --- drivers/thermal/sun8i_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 195f3c5d0b38..a952804ff993 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -512,9 +512,9 @@ static int sun8i_ths_probe(struct platform_device *pdev) * registered yet, we deffer the registration of the interrupt to * the end. */ - ret = devm_request_threaded_irq(dev, irq, NULL, - sun8i_irq_thread, - IRQF_ONESHOT, "ths", tmdev); + ret = devm_request_threaded_irq_probe(dev, irq, NULL, + sun8i_irq_thread, + IRQF_ONESHOT, "ths", tmdev, NULL); if (ret) return ret;