From nobody Sat Feb 7 15:11:18 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 7E4694AEC7 for ; Thu, 29 Feb 2024 15:55:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222118; cv=none; b=KZqRXEyY0TMoqVdXPfqirkAM/Rh4l3kz+xHAST/LXCFan1S+cHwI/TgUvF4OAa0UAZscSEbiK7W/rryaz+myB48Iey+hvKwPnggN6aoXGukVqlGLJAwvE6pwG3sYz04OelKDxcU45YHsM3TiqNQBhfKar2/BLqtPwioXtGaDGmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222118; c=relaxed/simple; bh=1t6+gvF/y1g4r3/uIO4V9puoZcuC9KmFRjleUIoiJJg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TG6tpE4+6s1OI2Wa3fcimSlVWdlsBSmVQddezBKqnri7QsDEp/kl6pbMDWUI2p5AV/9NDE8l2VwVn1Vs9PSfPNyvDQ8otjgSdCc6a5vvhD/0GK7JRraIqouZkmPuteYFCbKgrII+VCEO03OkFwrEM8nAYmHnOMR0aZSAmVD5aoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CeJYU+0P; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CeJYU+0P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709222117; x=1740758117; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1t6+gvF/y1g4r3/uIO4V9puoZcuC9KmFRjleUIoiJJg=; b=CeJYU+0PmF98m1ZDgTv85dncJEAFxO1njmBE1JabwShN+arLE2jw25/E Ze6LvBlI/htKmzOZ+gNalb9vlXS4+waLNRtFW/w6grfwJdMv1BCL1oEzp UL/76H8y9ut7l/U9WQtZVfB0E3Q6WSvtftDVpIolCPZ9yRDA047Ix9zbg Sgcjdiei+Q2h9ZzHTystqAt4QHJSF2g6o6IdAwCBuECbmexZhSj1hRLEj nL62bosV5fjCt/PMay8TjN3ZhbFh5SyS0yAAtxVGB+WvBUEeQxSemXR7Y JxV5n98yfGRut+JWPH/9CEak9g08RAvjtah0zwtWWOX53G+dWLxN3Tdv+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="7479283" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="7479283" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 07:55:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="937036109" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="937036109" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Feb 2024 07:55:13 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A9EFC3BC; Thu, 29 Feb 2024 17:55:12 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Philipp Stanner , linux-kernel@vger.kernel.org Cc: Andrew Morton , Rasmus Villemoes Subject: [PATCH v2 1/2] devres: Switch to use dev_err_probe() for unification Date: Thu, 29 Feb 2024 17:53:39 +0200 Message-ID: <20240229155507.3853059-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240229155507.3853059-1-andriy.shevchenko@linux.intel.com> References: <20240229155507.3853059-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The devm_*() APIs are supposed to be called during the ->probe() stage. Many drivers (especially new ones) have switched to use dev_err_probe() for error messaging for the sake of unification. Let's do the same in the devres APIs. Signed-off-by: Andy Shevchenko Reviewed-by: Philipp Stanner --- lib/devres.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/devres.c b/lib/devres.c index fe0c63caeb68..27f280a39dca 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -125,12 +125,13 @@ __devm_ioremap_resource(struct device *dev, const str= uct resource *res, resource_size_t size; void __iomem *dest_ptr; char *pretty_name; + int ret; =20 BUG_ON(!dev); =20 if (!res || resource_type(res) !=3D IORESOURCE_MEM) { - dev_err(dev, "invalid resource %pR\n", res); - return IOMEM_ERR_PTR(-EINVAL); + ret =3D dev_err_probe(dev, -EINVAL, "invalid resource %pR\n", res); + return IOMEM_ERR_PTR(ret); } =20 if (type =3D=3D DEVM_IOREMAP && res->flags & IORESOURCE_MEM_NONPOSTED) @@ -144,20 +145,20 @@ __devm_ioremap_resource(struct device *dev, const str= uct resource *res, else pretty_name =3D devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); if (!pretty_name) { - dev_err(dev, "can't generate pretty name for resource %pR\n", res); - return IOMEM_ERR_PTR(-ENOMEM); + ret =3D dev_err_probe(dev, -ENOMEM, "can't generate pretty name for reso= urce %pR\n", res); + return IOMEM_ERR_PTR(ret); } =20 if (!devm_request_mem_region(dev, res->start, size, pretty_name)) { - dev_err(dev, "can't request region for resource %pR\n", res); - return IOMEM_ERR_PTR(-EBUSY); + ret =3D dev_err_probe(dev, -EBUSY, "can't request region for resource %p= R\n", res); + return IOMEM_ERR_PTR(ret); } =20 dest_ptr =3D __devm_ioremap(dev, res->start, size, type); if (!dest_ptr) { - dev_err(dev, "ioremap failed for resource %pR\n", res); devm_release_mem_region(dev, res->start, size); - dest_ptr =3D IOMEM_ERR_PTR(-ENOMEM); + ret =3D dev_err_probe(dev, -ENOMEM, "ioremap failed for resource %pR\n",= res); + return IOMEM_ERR_PTR(ret); } =20 return dest_ptr; --=20 2.43.0.rc1.1.gbec44491f096 From nobody Sat Feb 7 15:11:18 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 314B84AECB for ; Thu, 29 Feb 2024 15:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222118; cv=none; b=Nit8FjKGc2Ao6MqWwMSO7zPnrm3VPru/0wzcwhzROQWJ9Q6yxpeB/hTyNC3xdXY/sR4ZE5WP9JA3sB+O71QC3JOt1aZ+p7pdXMqG+xVdJXkk0TCafX35g+Nhd9oWlZLbDhOXgb53C24Fh+NnOkIIM8y7QB/uVPkRDmU3y0qyFjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222118; c=relaxed/simple; bh=qjXLbtPJOtzcFmiEigBlQuXlreS7DVmZQkZxpCejSHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DLPZIZAU3yqpki+tBNNQ1wY1dHEv7xKy9O6Oc+/mA6lWgkejdIffckh6a/GXeEFlcCMNQeD9kSX30KpakP13S8iAo9axgCyT/wLfyoNyMVphG5ql9W9gtD4ImgRH51gT6UkYQBQs6gc3Cqlp2/sD6w1NqSFn9yHXFjX7qrymivY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hoyazW9/; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hoyazW9/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709222117; x=1740758117; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qjXLbtPJOtzcFmiEigBlQuXlreS7DVmZQkZxpCejSHc=; b=hoyazW9/vDaDAFlON50p0H38HVP/C05jjMIzbIdQW8x+YDTwmOHw5Wgv hv915nQgSDcLVImfnWeAd2nE6tJexQY19nf1pDUoIxos1qBh3vnDCcqz4 gebtI7G+2jLm8Uom+NdxTW3XFFdOb0/PI6PsJaGHNphpNX/b22cdX3I5j 58wh6IUW45xCG40HaacUSqWBg2yVNCAtUFOv6CRggR40bjFopxhd9oNqL S0r7K8yNTjQ/DPgIvvClbn3vqztdqWUokCHcGUgcC/dYCM2znPk5WpqJf eATqrTe73wGXMzqQL55QCQyn4kmOl/GdhmifdENrQ1B9s65yu/q7Rd8Jy w==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="7479288" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="7479288" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 07:55:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="937036110" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="937036110" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 29 Feb 2024 07:55:14 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 41291476; Thu, 29 Feb 2024 17:55:13 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Philipp Stanner , linux-kernel@vger.kernel.org Cc: Andrew Morton , Rasmus Villemoes Subject: [PATCH v2 2/2] devres: Don't use "proxy" headers Date: Thu, 29 Feb 2024 17:53:40 +0200 Message-ID: <20240229155507.3853059-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240229155507.3853059-1-andriy.shevchenko@linux.intel.com> References: <20240229155507.3853059-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update header inclusions to follow IWYU (Include What You Use) principle. Signed-off-by: Andy Shevchenko --- lib/devres.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/devres.c b/lib/devres.c index 27f280a39dca..4fc152de6d8b 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -1,10 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include -#include -#include -#include +#include #include +#include +#include +#include #include +#include =20 enum devm_ioremap_type { DEVM_IOREMAP =3D 0, --=20 2.43.0.rc1.1.gbec44491f096