Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37263514rwd; Tue, 11 Jul 2023 11:40:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlF1Fzn9MlL8CiOqnUy6++Z8g7dgZY6DQUA6fZ1htD2P47pzEn6zWRF6SIQenLTCsEyUDNvy X-Received: by 2002:a05:6a00:39a2:b0:666:66c0:fd5b with SMTP id fi34-20020a056a0039a200b0066666c0fd5bmr15157156pfb.18.1689100832064; Tue, 11 Jul 2023 11:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689100832; cv=none; d=google.com; s=arc-20160816; b=u1/8N/IxhEcs2T796pATjumHpakZ/2iu2CcqRqg8TBc0dwHT++WupRh/w0UQ2SQ+VW 3ftp1sLZgXSxpscjXcYPK3w21XnldQJpdcmjFiZB7jO2gmlx8k3+9Mtfk8ndFQkzT+qy oR1duAf2pn4i+VLnBjAu5wGlEXiefg0Q5URNBixmDCn1ONCNkFCm+7LHcyKqub5MRzAh JYCdGKIdJM6Y9NSGSFhiYLCUAymdFBrae0I+th4gkNzY9l5ZVJhrjukGbbVuAbSp5KB4 JKa3rDYfXrZWXtbnrjqfYnVZwQbiPce7zEF1ZUAFbkOY/cOVRQJp6In4Us121t94AX3z 4U3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GIFkoFyB9SW01SkRjiPF7cZKlQPCkHMlbvXQ3wgbocE=; fh=lVwK+h2fGBhv7F/rADxNeCx5SqtshSiHLzUPuFgyT5s=; b=HNe//6glkaUEK20DjHc/uh2lO4i0WnYqkZT5yRxXo+XdXl/VjjmKMQty+X4h6NleR7 RC8ENHob+xFQznlPM6C8ynORWDtiD2oPAlqU8iyzoqiHJkDbTABAQC/nSP8kSJtf6p71 ksv9td3NCa+rVir76+JoNhQGC9cWNNoOyk3fy3bwmC0nywFDDfXpe4Z15a/mP4R7KoFz LA3OR+vvb3kUNFSPCyhNjuIZ7QQVVwlYWyELdyKQVJcBLKOSvN7/F2sgWl6sfxqkT6ft CjDYJ3u+r2a7OkRa9yAFMVv0jGWwaucbOhFsXF4Q51r90r6QNjBJiVgYTso24voUm442 h/iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="PwU/eI3g"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a63d60e000000b00524eef20da6si1779338pgg.642.2023.07.11.11.40.19; Tue, 11 Jul 2023 11:40:32 -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=@gmail.com header.s=20221208 header.b="PwU/eI3g"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231919AbjGKR5f (ORCPT + 99 others); Tue, 11 Jul 2023 13:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbjGKR5e (ORCPT ); Tue, 11 Jul 2023 13:57:34 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD2DF10EF; Tue, 11 Jul 2023 10:57:31 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbf7fbe722so68332425e9.3; Tue, 11 Jul 2023 10:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689098250; x=1691690250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GIFkoFyB9SW01SkRjiPF7cZKlQPCkHMlbvXQ3wgbocE=; b=PwU/eI3gWiMbv8rCV0Uqye+GFPG76AhQmwZ2FnpaQwJ9y7M4sV6dtyY3iqO4/x+lwu ypWOQfiykvDHKN0jp9jwIoKnGcpvU+u03UdwFNoX1pyFBHTSKCg7RVmmpQz8OOe2Grdb fjIpGPyF199rb/ohsmNUCNFbcUlVv61jzvHMSZHsGGqNCqn9BZfH8Bh5NOmaI3hbzdzl 6Phl2rkqt1NxmpHW4FoEt0Q+1O9jrYeR3jDS+S6wpoAr+oicD12M53elgOux1EMVOOnq pWkxTr+/z8WB16hnrNjDu/o2FPu6cC++NZLpoQdKcmzih8yHr/iqaW0xkcEg4TvGEJ2o Jeqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689098250; x=1691690250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GIFkoFyB9SW01SkRjiPF7cZKlQPCkHMlbvXQ3wgbocE=; b=SkiQiOWOkvTkRmThybQpqlqNo7eza+hfglF3z/WfxhwxF7IbwdJ+7DVkLrj8HLxUt6 NyXsn+2rw2A6S5nzv16/LskxD1VEVHGFSDmUPQkHHC+aP+zlmIp7MS3LrRWkdk3p6duq QU8uaV7K+Qp61yKcFnRjInpKtFw2G5LvPrUJXa1EZQt5YNN25AxWelQBphzETvodhUV8 FgQopCkd921YaoVH/5CmrPDsLTVa4/5aISzzZLWN2foLDBCTQNfqlh/ZJcQiArMTXKzM f5ODnhIevBFEuGGF/47ncqIRZ21YGt1wgKTkzZFJ+dbQOCLhjYB5Sr5Yk/xtS6WvIZCF +JOQ== X-Gm-Message-State: ABy/qLbXOQ/+X6AStsCgMFbo1VzCZ9H3ZajgI7/1/mmZNKYydRxWfnZf humQ03oc1N1FeGoa5JSIawI= X-Received: by 2002:a1c:7714:0:b0:3fa:aeac:e96c with SMTP id t20-20020a1c7714000000b003faaeace96cmr14348052wmi.9.1689098250022; Tue, 11 Jul 2023 10:57:30 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id o5-20020a1c7505000000b003fbd9e390e1sm13591421wmc.47.2023.07.11.10.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 10:57:29 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Samuel Holland , Yangtao Li Cc: Yangtao Li , Thomas Gleixner , Krzysztof Kozlowski , Uwe =?ISO-8859-1?Q?Kleine=2DK=F6nig?= , 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: Re: [PATCH v4 02/21] thermal/drivers/sun8i: convert to use devm_request*_irq_probe() Date: Tue, 11 Jul 2023 19:57:26 +0200 Message-ID: <2687714.mvXUDI8C0e@jernej-laptop> In-Reply-To: <20230710095926.15614-2-frank.li@vivo.com> References: <20230710095926.15614-1-frank.li@vivo.com> <20230710095926.15614-2-frank.li@vivo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,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 Dne ponedeljek, 10. julij 2023 ob 11:59:06 CEST je Yangtao Li napisal(a): > 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. >=20 > And tglx point out that: >=20 > 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 >=20 > 519 messages total (there are probably more) >=20 > 352 unique messages >=20 > 323 unique messages after lower casing >=20 > Those 323 are mostly just variants of the same patterns with > slight modifications in formatting and information provided. >=20 > 186 of these messages do not deliver any useful information, > e.g. "no irq", " >=20 > The most useful one of all is: "could request wakeup irq: %d" >=20 > So there is certainly an argument to be made that this particular > function should print a well formatted and informative error message. >=20 > 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. >=20 > So convert to use devm_request*_irq_probe() API, which ensure that all > error handling branches print error information. >=20 > 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. >=20 > Cc: Thomas Gleixner > Cc: Krzysztof Kozlowski > Cc: "Uwe Kleine-K=F6nig" > Cc: Jonathan Cameron > Cc: AngeloGioacchino Del Regno > Signed-off-by: Yangtao Li > --- Acked-by: Jernej Skrabec Best regards, Jernej > drivers/thermal/sun8i_thermal.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_ther= mal.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 *pd= ev) > * registered yet, we deffer the registration of the interrupt to > * the end. > */ > - ret =3D devm_request_threaded_irq(dev, irq, NULL, > - sun8i_irq_thread, > - IRQF_ONESHOT, "ths", tmdev); > + ret =3D devm_request_threaded_irq_probe(dev, irq, NULL, > + sun8i_irq_thread, > + IRQF_ONESHOT, "ths", tmdev, NULL); > if (ret) > return ret; > =20 >=20