From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 431FDEB64DC for ; Tue, 11 Jul 2023 08:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjGKIFD (ORCPT ); Tue, 11 Jul 2023 04:05:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbjGKIFC (ORCPT ); Tue, 11 Jul 2023 04:05:02 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C3092; Tue, 11 Jul 2023 01:05:00 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id E9BB2660700B; Tue, 11 Jul 2023 09:04:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1689062698; bh=/V0I7v/mPKMX5r0sk/NMla2fyPgsaDd1OqBwVtFEoZk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Pkmw4Hc/+NkfN79HurY+KiRwaqNw3dKK7n3YLe5y160Aj3rw+tSbq6R2k3hKKZgYs aP1mzJXB2R/rK95018uNp57dc9UfNal5nM3VPnZrkd0dpJyAPDG3SlrDjfW/Q7ur+w 1Ov3kCIuvfjkqkITTUUfV3Rq5fywVV/u1YSfEvx7HlrOUn7mX1qXWL+5wBkoe28d8C uswFPnlhWKIRNRD7uY1ygbNCSdCH0JBKZsoxkm2I1LyRuwqNU1havi5OOxn91j03zv 6SwJLA0eo0mAN8zM69V8TYyQelOhr0m2YddzkLfJGmW6idOhZiadnetmbTY/mK8yHD tJMGSfz8X+NuQ== Message-ID: <44d70b15-2929-1a2d-4ea0-f61b2294d72b@collabora.com> Date: Tue, 11 Jul 2023 10:04:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 14/21] thermal/drivers/mediatek/lvts_thermal: convert to use devm_request*_irq_probe() To: Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Matthias Brugger Cc: Thomas Gleixner , Krzysztof Kozlowski , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Jonathan Cameron , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20230710095926.15614-1-frank.li@vivo.com> <20230710095926.15614-14-frank.li@vivo.com> Content-Language: en-US From: AngeloGioacchino Del Regno In-Reply-To: <20230710095926.15614-14-frank.li@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Il 10/07/23 11:59, Yangtao Li ha scritto: > 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 Reviewed-by: AngeloGioacchino Del Regno