From patchwork Fri Dec 15 17:45:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 179483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9460169dys; Fri, 15 Dec 2023 09:50:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6PZIkRrmu1R9eMeCBAzJ1HUV7LANkugjKfrCaGckKzL1y0f6K2TXZffaxXdD665pQfvJU X-Received: by 2002:a17:906:1783:b0:a19:329c:55d5 with SMTP id t3-20020a170906178300b00a19329c55d5mr6173358eje.64.1702662658303; Fri, 15 Dec 2023 09:50:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702662658; cv=none; d=google.com; s=arc-20160816; b=JjaoFb8CFCdMIuSpLbBrqps8pKeqFuV2oUfgTSnng/tGLi994vmjj+5MekbOIiKIrU IV6th1o0kZTWdni2AugC18XwcWlAx63Yi0CtJL2l6o38HjSKgWzWB45SldCcYiZ6Ybmk ix+XM+4tb5wDfTld+2MnP/czSNYwdiuDgkWEwzoVJ2JoIQQSAkbZ48kRO5NCaxBPAokZ f46b3C2uolF4gMDOvEWm90G+O9at+mCfkCdXCSR5axRRYvSLHVzmCMtyzDA9TzhkIvdh W1ICeibfkjdbYzHKpefzoXNAxAfjWrLP7lpsXpsLI4oW3zxBR8sti2l8ItGQVJvqrI5p BiSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=QWibZEpfbeabFahovaSNNM6OBUefjczgNDJDM5NQMic=; fh=CMQ95DPNv2dlaWOiHciJ5P2HnOQKYGL0piEu1swyGoE=; b=BbU1q+xEtyoH4fmZ8QMQgjI8T6Ptd1SvyPFMDqa17rtGytpMq7pKynjU+kOgD20SCo xUwMs0Z9Si16DypFA4lMO8r9RMxfyta94GSF2CuugbeiZ58zStu+tubsaYJnE/ut6tdk NIoXBjEwIQKeY04pfIadp7DGn6XsMACKr4RQS24BEnPS8d+IzeGsn5Hp/uqFoYWSTkdh G3nSUj3BOe7H8N/Hv37AprPfdzkg1jI+FqyArBsQpmmVAbsEaI0ioPP21Unro1t+m4EO kYlxGfNFh6KoxA/Aq79UK/06es+DfPa5wfY5zvNr99xLAeZGh9axYguWywU7APuNWLBS hXsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1465-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1465-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m10-20020a1709062b8a00b00a22f1120795si3174129ejg.183.2023.12.15.09.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1465-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1465-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1465-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 16F151F24A0B for ; Fri, 15 Dec 2023 17:50:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DB394596A; Fri, 15 Dec 2023 17:45:54 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EDAC66AC1 for ; Fri, 15 Dec 2023 17:45:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rECFt-00078x-RH; Fri, 15 Dec 2023 18:45:45 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rECFt-00G4sN-2I; Fri, 15 Dec 2023 18:45:45 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rECFs-003jeH-PP; Fri, 15 Dec 2023 18:45:44 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Thierry Reding , kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH v2] driver core: Better advertise dev_err_probe() Date: Fri, 15 Dec 2023 18:45:41 +0100 Message-ID: <20231215174540.2438601-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1800; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9nyC3qBbV3EnvPBE3VWr39wTOEdZ5bBIM7SZSN6E+Nc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlfJDFtb2z0TS2epzNttDfkspZ9CB6UVzEyC7bO hY2NlaZb++JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZXyQxQAKCRCPgPtYfRL+ ThrICACsNn0rrAtPsgnVcJ8gyfhCCMdsW63WMJMv3/s7rLcN/RUMbMudTA31KGvsc9Hr6L60kmj 52fVk+6gALEDEK9FREE5RysR6OQdS8BIne9D100cT2vFXMyMGzGPe8MNp2Csxs8u9FFvs32x72u 9HWwErAu8JfuTLjhHFKO+6fX8Q880SgKBpQwKeFizUhS3LS/FRqVHEVXZ52dqECxpPh2rGRL8Vl LcMfvkhbRzB/wI4AYE8lDyjEobmWt70YNhE0gN7il/QNsWYq1MwJ5OzhAto6ti4MzuhjSqWxz7Z PGPYnbrGkH92RZxli96w9k7u6C4Py4KSdXqJGqCrY5OvOV9q X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785371199470526162 X-GMAIL-MSGID: 1785371199470526162 Describing the usage of dev_err_probe() as being (only?) "deemed acceptable" has a bad connotation. In fact dev_err_probe() fulfills three tasks: - handling of EPROBE_DEFER (even more than degrading to dev_dbg()) - symbolic output of the error code - return err for compact error code paths Advertise these better and claim the usage to be "fine" to get rid of the bad connotation. Acked-by: Rafael J. Wysocki Signed-off-by: Uwe Kleine-König --- Changes since (implicit) v1: - Send it to a public mailing list (how embarrassing I failed to do that for v1 already) - Fix a wrong word in the commit log - Add Rafael's Ack. drivers/base/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 6736c1de3ba4..14d46af40f9a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4944,13 +4944,14 @@ define_dev_printk_level(_dev_info, KERN_INFO); * * return dev_err_probe(dev, err, ...); * - * Note that it is deemed acceptable to use this function for error - * prints during probe even if the @err is known to never be -EPROBE_DEFER. + * Using this helper in your probe function is totally fine even if @err is + * known to never be -EPROBE_DEFER. * The benefit compared to a normal dev_err() is the standardized format - * of the error code and the fact that the error code is returned. + * of the error code, it being emitted symbolically (i.e. you get "EAGAIN" + * instead of "-35") and the fact that the error code is returned which allows + * more compact error paths. * * Returns @err. - * */ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) {