Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp184683lqp; Sat, 8 Jun 2024 11:08:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyvjTdVKzIh6rL+a0A0QAh/VFqrVlCDgMTEBBwAD0jlvIaRukQLXowLCRV3atLTpf2RXdLPDj16MBaKK54mDYo9VAGeBvyhSokEwJWNA== X-Google-Smtp-Source: AGHT+IHq0I6dIeFfleVT0OSuqP67O5PL6G062WZ+zdBwmhgqv6lNAJpOO2EO8bjzT+9Fu5yxn98U X-Received: by 2002:a05:620a:17a8:b0:795:1fee:7209 with SMTP id af79cd13be357-7952f0d64famr1474936285a.9.1717870099904; Sat, 08 Jun 2024 11:08:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717870099; cv=pass; d=google.com; s=arc-20160816; b=wvJ2SQgIxw15oLOHS9ON02PxQLdD42MxnhB2b/GrOuJFsXS1Y0H2VfuMyNlTJdIR5T 1/NA83HwyNHim7U6cLQN4oCRnk/QTNk7pV7XZ0wdFpJJd8kBwq9shwqdunqfN6Gm6GRI mFl6XXgoBJhnkE3R6nrpcaaIEaHEY0dSq6nQmEBWmyg2gbyj3r6Wd0qQM4g2iqkQz0T/ m0g83pksNQ1B9y0YGwiBXx3G8Sse/RgUVGRtNQSj0oXdyRKnhVetA30NwnzrAm3rSZSF sOWZsjmS0L8HnTr7s27mmEdEgjXc1y6yqN3vyApPinfDONPeZPsT3p133EtUEl+85Kpg nUiA== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=SHx/5ZY5ffBfJliaEEzv/bBPUcp47hnLhmmLmMK0Qqw=; fh=ltq8OmmaCNbs67e1wXYEji+W/CDmTWVwXciDtlX77Io=; b=gI3qdafB7ta2Xwg8Id2Urv1PjIyyKmctiVv4Cz+EeT/LzPv507Yrqx5G8u4Z/fDaOj i1IBvOjYNU/MpWauBHsvUEB4ZMXre9GuWnbsdHV9TD1hK9gpfe4b7FrSGsOyXTwO1fXL k/pTI9XALvdM16+GDYgmIElIMvmBIu7K7SW69GVmotVPcoNC27m8SOaTHN8SnnepmBF6 nQaPRI2l5OZRDXXZlO5rFwjUxrkm28ImGAKbzY4ADssANEN2GP/t1PxbxapZaCfQef3V CtaNmqJ72JhmH6CL7WxDOkteL52dPasJ2AKohFXubHcTu1DRLg+8u15PKQJab45aj2wJ 2lUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5LiJqJH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207169-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-795331c9338si709685185a.264.2024.06.08.11.08.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 11:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207169-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5LiJqJH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207169-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C41F31C20F7C for ; Sat, 8 Jun 2024 18:08:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A15791CD39; Sat, 8 Jun 2024 18:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U5LiJqJH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C4AC86FC6; Sat, 8 Jun 2024 18:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717870079; cv=none; b=crrLVDf6yHz3UR2py7zcAzuVb1wnOddP0G/ziaUW1pLBKcdJZdYpEHbH6jkri/vL+IeQ0a53SnWx/6vluNx/VyuwSjaxA9nm1fsoUmeiului4KFlnuFPGxWJiRaI1QoHosEbCF/I21q6olyd5vdHZ3308D3UxFpZ/P7zPtko2To= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717870079; c=relaxed/simple; bh=jUcNYbh3MGIEFUYqd8dowXXVHvZCOM7pzgqnGK70whs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DVfjc0OZV9mqv7Gi1SukmX/JnMi0a4I3W0bviQEKUcO3zDcMKqpbIAU8WJuwAx35Q/dLlhp1/KPn5TItPJv6/enKJx3F2wGV7TYrID1eMhNzY/tGC17OyUgPtJE9I0dC/Tr5tQ3IWMAzCbvM1kFqCOHcByyaS4JFyMh7whdr76Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U5LiJqJH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3CFFC2BD11; Sat, 8 Jun 2024 18:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717870079; bh=jUcNYbh3MGIEFUYqd8dowXXVHvZCOM7pzgqnGK70whs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U5LiJqJHFA+Z7aRvnS8KASzYe3jtUKkWOEblVjh1z03u30nlw3XchIiYaGR+mZnrn MyMdLaeL/5P1wSlB+oUqEz4y1SCWG+qpBTKoIt/OzdTQmLvwnUVR1Hks5KXgYWuHcu yoT5iO+Y+K63DupEyJ7O0VFKb7Tu+yyFRHdN9c+Kxyzqg28VMACZTfRFqonHtjaPRg fZPH2AnJTEcxu0K2FGl8/3wgmc8oih36uSsgljRvRvo18W0ETlsR356JZ0lTGcrjcg 9JtaBQv0t7cyE5OtcYGqxpMsJl3r20ntdJaWXkWBpnLUni9+iR1igja06AjNRykP3u Eyfk/mgn1/3gg== Date: Sat, 8 Jun 2024 19:07:48 +0100 From: Jonathan Cameron To: Nuno Sa Cc: Petr Mladek , Lars-Peter Clausen , Olivier Moysan , Jyoti Bhayana , Andy Shevchenko , Chris Down , John Ogness , Greg Kroah-Hartman , Andi Shyti , , Subject: Re: [PATCH v3 1/4] dev_printk: add new dev_err_probe() helpers Message-ID: <20240608190748.2577b8a5@jic23-huawei> In-Reply-To: <20240606-dev-add_dev_errp_probe-v3-1-51bb229edd79@analog.com> References: <20240606-dev-add_dev_errp_probe-v3-0-51bb229edd79@analog.com> <20240606-dev-add_dev_errp_probe-v3-1-51bb229edd79@analog.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 6 Jun 2024 09:22:37 +0200 Nuno Sa wrote: > This is similar to dev_err_probe() but for cases where an ERR_PTR() or > ERR_CAST() is to be returned simplifying patterns like: > > dev_err_probe(dev, ret, ...); > return ERR_PTR(ret) > or > dev_err_probe(dev, PTR_ERR(ptr), ...); > return ERR_CAST(ptr) > > Signed-off-by: Nuno Sa I'm convinced this is worth doing but would like inputs from others before I pick this series up. Jonathan > --- > include/linux/dev_printk.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h > index ae80a303c216..ca32b5bb28eb 100644 > --- a/include/linux/dev_printk.h > +++ b/include/linux/dev_printk.h > @@ -277,4 +277,12 @@ do { \ > > __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); > > +/* Simple helper for dev_err_probe() when ERR_PTR() is to be returned. */ > +#define dev_err_ptr_probe(dev, ___err, fmt, ...) \ > + ERR_PTR(dev_err_probe(dev, ___err, fmt, ##__VA_ARGS__)) > + > +/* Simple helper for dev_err_probe() when ERR_CAST() is to be returned. */ > +#define dev_err_cast_probe(dev, ___err_ptr, fmt, ...) \ > + ERR_PTR(dev_err_probe(dev, PTR_ERR(___err_ptr), fmt, ##__VA_ARGS__)) > + > #endif /* _DEVICE_PRINTK_H_ */ >