From patchwork Mon Jul 3 09:04:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 115247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp389048vqx; Mon, 3 Jul 2023 02:21:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ602tSF6WX9qmtrYWbMzIQoiBgRpZse1DTYE8n9pbFolLbvH90UNwKcKNsInQvqZ5FSHzRe X-Received: by 2002:a9d:6b90:0:b0:6b8:6a58:78ca with SMTP id b16-20020a9d6b90000000b006b86a5878camr7562796otq.3.1688376106372; Mon, 03 Jul 2023 02:21:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688376106; cv=pass; d=google.com; s=arc-20160816; b=qQovMgVBklaQDtjAuS+airRgF0j/Mg4ZcE5yXoyzBgtJmm3U1EnbE5gONQIcFc5YEz SYJr09AOv3Hy9W7Y3cEz4hQ/+dOdTWFePjeFPYih5cUwlKT/in4TUfvXjmGHGgWeqBP8 rFTtQbRrwnUb6o3JDeaMwxnU52xljqDrJVdQDeZaALsUIPzibjYarGkdCIuGVqj4bkIR ezw0Rjw5F6Ru87o1N4xwfKRVlyjHJftUWe+/7NIOOuhSTVIGIoGfBzAwFcjcOc7kmclw lkD6G7d+sKMFjQULIFxluyfdDerfXbrFLa1Rkw4w695hX4n6MbAo9MrP9ZxZaegrgc74 SA0Q== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; fh=4un03g5hOgD4vDsakT198ju82L+hg2mJrKi74hj9gEc=; b=vAKSn7BYwKM8NkQgcA4seLGa/c5pjJtqMwbdItrc9jTvrDp3PVOqPye8gjbxYY8YyO y0MdxygYtDrFeHDtq6y1hVR+PZtQ46HB7PscJsULs5bjZQaT+PDCtl6Pop5m8MH6WVhT wR/kauPf/yYkvwTcsqw2xWArn8e7T+ytrS+fKz7ERX78yLMp2lNqN39B7LXMd/fX2JNV Ne5gddlCT6c4dvjiM7ZA/ni0G2HSpYWxMt4pmQt4XeYKVQ7ILNicmtbGVlaJjaJJHOZm XZzAuaTfQaszR3wJpYkJ4xbD9H14s6HoNdMCB9zz5hlR+PHCJozXf0/BKFOH5V1r+SX0 ykfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=SKkBWrq1; 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 b15-20020a630c0f000000b00553ad455581si18140260pgl.296.2023.07.03.02.21.33; Mon, 03 Jul 2023 02:21:46 -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=SKkBWrq1; 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 S230503AbjGCJFv (ORCPT + 99 others); Mon, 3 Jul 2023 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjGCJFr (ORCPT ); Mon, 3 Jul 2023 05:05:47 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2091.outbound.protection.outlook.com [40.107.215.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEA1E4F; Mon, 3 Jul 2023 02:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UExPwP9TUJxGUc0lz10IiAqhDWv7OOmOI1EKggvN8xoqqNqNMIzpklJ0fa60hTxfkwpmgNIgYn8E6p22rbBYfP+HPnX/JU507Vo3LXfsLZVoCeqY1tgOYBe0sJvXvZ5WW8fBByTj5NHp0epyPe0AeIgjCij55vT0u0pLSWwtjz8pa8GrT1vUDWPYf1RunM+RhXoz/1j9yw2S2YB3Id5MaD2fp5KnZvX9n+PzwR2Xh/5uhWkcFUbk9+sqaDBrh9cyKjqWaCKX19+NXIpPQcl/n10MifsIjqiUDDvAkSsEQwJnAhWsJCm9vXx3sFOi+0CcbZdhHkoZ2mOnlJY7m1tiyA== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; b=CbawsFPD0JGXTRAPiIqlPUBYFh1fpNVYKiQICperrV2EZ2oTDYcrMFZSCQxfLF9NSeT1GnpasJhbuytOdgBX3OzLzpxyHdMDJluDJwDdVmtjVHD9NVol8n0eBXNXMx0v1VKtFeT/gD38eu6BDx0y/7qFRRaFWcesDaqDg8Cme48PWU0n+EgjqqI/B/UkoEIxXKB20WG3HBVSF0hvNE7lOemR+EI+GIfy8SENVzBLA703UgTvRGpnMEVlp2xKVLV/4L98y8RQ1Yt+YwnZNlQ00nUCPsI/vfbNLkZHOiZJpEaPMKz3+M/efnVBPu+0u0cEOXXKLnri3+2//1iaBdKNxg== 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=rzTrLLCsS8hWf9pHbl4ls2xtiQpiF4o81Aj2dajeQBo=; b=SKkBWrq1jH6+fq+lSJo9Sy9mYp7Pj8HUq5bo/kSrAQnNmsvkjATvCEDgGqpTTvKg2wNMqVjJVJn8QdZBWE9ez5ybXwGR1FnakEO7aXpcRtM41Y44hdver+yvTgAc+fhROwiTsBhna4EzS5LVx1LVz/mkRDSr99an81jgJr/dCMKee4HbYwS9HwUGmQQ6EDzhnVsakeojq6y/jTg7xiscOITBV1zZGDD4kyCGs2j/jnBa4lkO4+BXzcmlzI9LfUyCECjc+k2WctnyxVD9uSsdS5/VMZ9jR0OnUf9JtoOaqOFvTtmHxEmPO93vASBA7M3cPgbZKGg8KOKU3k82PIcm3Q== 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 KL1PR0601MB4003.apcprd06.prod.outlook.com (2603:1096:820:26::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 09:05:27 +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.6544.024; Mon, 3 Jul 2023 09:05:26 +0000 From: Yangtao Li To: miquel.raynal@bootlin.com, rafael@kernel.org, daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com, mmayer@broadcom.com, bcm-kernel-feedback-list@broadcom.com, florian.fainelli@broadcom.com, tglx@linutronix.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, bchihi@baylibre.com, frank.li@vivo.com, wenst@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 5/5] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request_threaded_irq_emsg() Date: Mon, 3 Jul 2023 17:04:54 +0800 Message-Id: <20230703090455.62101-6-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230703090455.62101-1-frank.li@vivo.com> References: <20230703090455.62101-1-frank.li@vivo.com> X-ClientProxiedBy: SI1PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:1f7::8) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR0601MB4003:EE_ X-MS-Office365-Filtering-Correlation-Id: 48f740ee-ed59-4742-b9e8-08db7ba4a43d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DvvG71hKtKNhUlpc+OpP2jVcnAoUjJDawXvgWggrrn/c+iO064n+TUtBEb4ZyC3e455+JJFrPdKHneHrQjelEyPPt2BIM35jJ/0BLqhrSuR5WXNNqbdUX6ECN6xb4uYF7u4K9A+m2xdTPiW+n6OIUz3lIUicqaoV6+QNLV41yOYXoTfcFLjU5DqV6edoTfW/Us9RfHEiAoBzez7ezqJzl8aAKPq4equg/fxwkXo3/I8n3ubGBftTkrh5O9+ECn3ONOvLNn5tungCRPbLznT1Xjc+7P+4fyLPZ/1PBkJvaSFWtzGJxZIQHPa35G9ULkh9tp/vlDxxi74NyhNaRxrBLmzRIdgkpKNgf2Obt+m3OBToLpxO4UlLeEeaFlDsgdf4t3gk5VhIkYT0b4HIGtuKk+DLmoYMvT8lcv+XFhipO0LA94ldY18zc8oZkcZjCx2s3yDTlWKYl32UgToH/Zd6Jyqa7KIXptECOx/Zu2brKyyfc44kuwXYAoPFAQS1DbNSPNMXqjbLpSm8wRsu4HuyNxDaPdgZete053Obvt95vEQovmbnPmO4skygCJ7MDtCE7tuSa+qnq7otzYoGwSHRg1ZIJDcTabF4mpON5nmkLYMPaS3sttaHnvA3a7EOD67rdryIhPDn5Z2WC11VYn3UhA== 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)(39860400002)(346002)(376002)(396003)(136003)(366004)(451199021)(26005)(478600001)(1076003)(6666004)(6506007)(6512007)(86362001)(2616005)(186003)(38350700002)(38100700002)(66946007)(66556008)(4326008)(66476007)(83380400001)(921005)(52116002)(6486002)(316002)(5660300002)(8936002)(8676002)(7416002)(41300700001)(2906002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AlP49cWogshT7IMjJwq20YMrET1TehDWe3jp79Xpuelwq0tVXO2Jvf+zRsSiBMJu3nO++nvopN/rwuyx6UAZtvdCxdnGpsm4fu3UHjA6nXkxipCC0800HPAWqlICrkAG0jKDwrSwnPQt//It7wGjozUFGalRTDlE1dqUAxdF17mO9D6qF0KhR4G1W9Znh7vXlFuzgOuWuGx84EC2saKfdYINOKnJTBpxKVlnZvPyDxy7R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cdNsh6NdlPTLNcXvrkm6VuAw72RC1mXBfbKFV+E7Py6lmE5T6DYv9z/3hjxWOxBNhE3qjt2ZSKv/CCqNCMGMgA8uRalaYherzPDTzCjZsmlRtfMXwJd3kNGuKncCAPpW/e/xSBeDBJViE6ShNsTJfDDC+i0o9gs4aNef6f47D7+jpTN3but6QIGBJcQQstEh0lvhimJgCWIEMgdw+5dLTZ/jPsLRU5CmSEGGaBT3gGmFOG8g50liDxLY5aXDE+pJVfbH/FmlI6rdhZeUCWKJ9wytRO+PG/mMEqV0Zo X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48f740ee-ed59-4742-b9e8-08db7ba4a43d X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2023 09:05:26.4851 (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: m2rcRdXB5EyvNvlrVkT4GGC42c2jeCicjYzruu3+zMsy0AFDjdSPTPfQL4Ep46p5/iYPGhL6EaqFoXP5N6bA+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB4003 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_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770390663975671972?= X-GMAIL-MSGID: =?utf-8?q?1770390663975671972?= There are more than 700 calls to the devm_request_threaded_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 1000 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. Let's use devm_request_threaded_irq_emsg(), 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 Signed-off-by: Yangtao Li --- drivers/thermal/mediatek/lvts_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index b693fac2d677..b6403bf2300f 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -1148,10 +1148,10 @@ static int lvts_probe(struct platform_device *pdev) * At this point the LVTS is initialized and enabled. We can * safely enable the interrupt. */ - ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler, - IRQF_ONESHOT, dev_name(dev), lvts_td); + ret = devm_request_threaded_irq_emsg(dev, irq, NULL, lvts_irq_handler, + IRQF_ONESHOT, dev_name(dev), lvts_td, NULL); if (ret) - return dev_err_probe(dev, ret, "Failed to request interrupt\n"); + return ret; platform_set_drvdata(pdev, lvts_td);