Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp197902lqt; Thu, 6 Jun 2024 00:20:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUe/A/+EoFsySJ/IekIugs8I+9TEX+lfhxreLBjgfuFb+cw5KTyITJIDivelnAX/oqMQNXtyh0uAnL2dxmf4R0fgjq7gTl/56ixNdZL6A== X-Google-Smtp-Source: AGHT+IFCREikskBx+9Nt1sUh3+ePYdUZ7X2rBmd+ctG8Wruvet1OmbTkQ4oS8o+IWPKOW5OeVIwN X-Received: by 2002:a05:6359:223:b0:19f:367:aef0 with SMTP id e5c5f4694b2df-19f0367b096mr65974155d.1.1717658449184; Thu, 06 Jun 2024 00:20:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717658449; cv=pass; d=google.com; s=arc-20160816; b=yPj22+d4Uajff7yCqbaJWnq1Y0Q8IV5dCul8mjKYU74S7yKw5RbqWLdj89SeEC6/a+ 0w9JmHEtcFbZQ8ftcMeaJzKxlnGg2wfFR5mpNU0l0Q0fFO9ho5HIQe7u1G1Nq0fUFFC9 aRPaQ4ZmT9D5hWpgGL5Z1DXDha47YQ6Vnu/Hu11gw0SVkkfzQecgfxTxjNLHvproleRd H6pvmHb7OQTAqL+gYbfwdPT3yHiwuixnP64i1dRcLeBx8hJMZxNf3119y4wCPsDwtkxw iATTrQPlNA3humJUXy5w8PXUfjL2Fd/AM2UDTC8tcHDv2yOvHM/crphBt8KOMgdx5znQ umJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=+gfp6a3Kz7W6AXuY8SswixfHIH2hVyHaa0nt0Pi7GM4=; fh=ET1r5CJhIaoJZTGTWiA1356F7s7pFL/kXVVpLEkpmC8=; b=i+qUlfX3iYvvhQvkY2ijamzNmp5PNY6EqrGqHWUGGrnRZpa4OfONMc7Y7KIBwDT0wn EHo7e+KlENGxp48wlOfngaGdVqhI4eFKNnfeioxkb6vK7Pz+B1T9z2w+vo1OgamT4iJu MyX8yLD2KSNy2QDF0+1NiUWrSZQEhuf2ZSekLsdZ7xkW79Bvk6W6EDPyw2w33NfQkKla IXSQnesTP2QSD8URhgfnwuqXDPZlOWKjFlCbEiyrzOY102p6sEC6bfDHCl7DLhDkf0TO CprRCIUg4IRTwkazepFDRE4/rlk/g0DuPyRoSsb1CN3hFGFMybLyMDSSdPw6qonueuOy 7/oQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=mswvoYCF; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-203719-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203719-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de29120974si721122a12.657.2024.06.06.00.20.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 00:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203719-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=mswvoYCF; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-203719-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203719-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B690287DD2 for ; Thu, 6 Jun 2024 07:20:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D168213C9AF; Thu, 6 Jun 2024 07:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="mswvoYCF" Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 9193543173; Thu, 6 Jun 2024 07:20:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717658403; cv=none; b=SsIxVIrNjt6Cf4G+vhZWCx/mb53tISX8yF82rcpP5+FhcyHC1PL33fjeSVQye8eiBaab9gG2ZlrwO3fjdHvZHVIsibY41PVeQAOtM4dm57TsBEftp1uk/E/EhHu81z0evLzEMAH3CAh95T9xV0VbiBTXWNxNY9axm1yqRGjSjjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717658403; c=relaxed/simple; bh=KJK3SBHG4M30EhZ3riJ+DmdxwA2mWKKSmKq/Yal9JGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=h2pXROpKI0m3urpDd4p7mg60cuwatbg23M7k3TtYATOJgWZKy8BIsgTDIfv31GfckDAIUhNsVy+IWdV5JjxbtSHfDq07JMKhSdiTWByLhkbZxYRDfl6kNgAIjkcDFn0VYhKQRLyjWqRggnB6PAmCArnvy1H8vLJdtnhSa6KQT8c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=mswvoYCF; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4566moH0015468; Thu, 6 Jun 2024 03:19:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=+gfp6 a3Kz7W6AXuY8SswixfHIH2hVyHaa0nt0Pi7GM4=; b=mswvoYCF03BJ6evhNqAph rNQ1BVjCO/2FlvMpRHL/p2veRIn6edOdkZoxmkW5Q1ARIqYUX3vw4cjt+tEp5gSV 1YiPucn6JRkVCqR8yw8IU5O3Fp+3SIYjkAnMqP2qocIXUMBAK3F1BSxv9B1TWLPl TcoJxLhg+VqHNj9+tZaEnkw9RMjsAWsal9430LWSrn7eeHC4Vayps5zPliTXnC3j tld7ejjaIeccZaknCxM6VPP7m3+QOAyTJJnbg80JeICReeYnU2+paxRRsp04LsPQ NBgB8fZ3mz3d6NpZNSnGg7JbP/2nrnz0z6dARBAi1gioA0U8JgJD2Cp+5qne8iz8 g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3yj0hvgrfq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Jun 2024 03:19:19 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 4567JHgh030124 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 6 Jun 2024 03:19:17 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 6 Jun 2024 03:19:16 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Thu, 6 Jun 2024 03:19:16 -0400 Received: from [127.0.0.1] ([10.44.3.54]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 4567ItBc025782; Thu, 6 Jun 2024 03:19:11 -0400 From: Nuno Sa Date: Thu, 6 Jun 2024 09:22:37 +0200 Subject: [PATCH v3 1/4] dev_printk: add new dev_err_probe() helpers 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="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240606-dev-add_dev_errp_probe-v3-1-51bb229edd79@analog.com> References: <20240606-dev-add_dev_errp_probe-v3-0-51bb229edd79@analog.com> In-Reply-To: <20240606-dev-add_dev_errp_probe-v3-0-51bb229edd79@analog.com> To: Petr Mladek , Jonathan Cameron , Lars-Peter Clausen , Olivier Moysan , Jyoti Bhayana , Andy Shevchenko , Chris Down , John Ogness , Greg Kroah-Hartman , Andi Shyti CC: , X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717658563; l=1147; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=KJK3SBHG4M30EhZ3riJ+DmdxwA2mWKKSmKq/Yal9JGc=; b=qB0ADqkAY1DbSRbNVSmIVXBYoZLvWqVYYgHw2RnNmnh2RUhEUOhN/XL2U6UV599pMGmKeF6Z6 0cR5esuubnhARnkhf4USoATHUlQT7whUp0hkOC6SZXfdvED/fwSWdCI X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: VcZc7b1AyPnLelhtntjs3k5BkuC5_nVv X-Proofpoint-ORIG-GUID: VcZc7b1AyPnLelhtntjs3k5BkuC5_nVv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-06_01,2024-06-06_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406060052 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 --- 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_ */ -- 2.45.2