From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] treewide: use dev_err_probe instead of comparisons against EPROBE_DEFER
Date: Tue, 20 Feb 2024 08:28:10 +0100 [thread overview]
Message-ID: <ZdRUitBFuHWVkSwl@pengutronix.de> (raw)
In-Reply-To: <20240219172659.3796647-1-a.fatoum@pengutronix.de>
On Mon, Feb 19, 2024 at 06:26:59PM +0100, Ahmad Fatoum wrote:
> Drivers should not need to compare an error value against EPROBE_DEFER.
> We have a number of drivers doing that though to decide whether to print
> an error or not. This error message will be lost if the probe is
> deferred, so use dev_err_probe to store the error in that case.
>
> While at it, we shorten the error messages a bit. dev_err_probe will
> already print the string 'error' before the error code string.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> drivers/led/led-gpio.c | 5 +----
> drivers/phy/phy-stm32-usbphyc.c | 5 +----
> drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 9 ++-------
> .../phy/rockchip/phy-rockchip-naneng-combphy.c | 10 ++--------
> drivers/power/reset/nvmem-reboot-mode.c | 8 ++------
> drivers/soc/rockchip/io-domain.c | 4 +---
> drivers/sound/pwm-beeper.c | 18 ++++--------------
> drivers/spi/gpio_spi.c | 9 +++------
> drivers/usb/musb/musb_core.c | 4 +---
> drivers/w1/masters/w1-gpio.c | 6 ++----
> 10 files changed, 19 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c
> index 4b282c788679..c0d14256d3a1 100644
> --- a/drivers/led/led-gpio.c
> +++ b/drivers/led/led-gpio.c
> @@ -214,10 +214,7 @@ static int led_gpio_of_probe(struct device *dev)
>
> gpio = of_get_named_gpio_flags(child, "gpios", 0, &flags);
> if (gpio < 0) {
> - if (gpio != -EPROBE_DEFER)
> - dev_err(dev, "failed to get gpio for %pOF: %d\n",
> - child, gpio);
> - ret = gpio;
> + ret = dev_err_probe(dev, gpio, "getting gpio for %pOF\n", child);
> goto err;
> }
>
> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
> index 91f4e7f7e08d..6bac5e1e594a 100644
> --- a/drivers/phy/phy-stm32-usbphyc.c
> +++ b/drivers/phy/phy-stm32-usbphyc.c
> @@ -693,10 +693,7 @@ static int stm32_usbphyc_probe(struct device *dev)
>
> phy = phy_create(phydev, child, &stm32_usbphyc_phy_ops);
> if (IS_ERR(phy)) {
> - ret = PTR_ERR(phy);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "failed to create phy%d: %d\n",
> - port, ret);
> + ret = dev_errp_probe(dev, phy, "creating phy%d\n", port);
> goto clk_disable;
> }
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 7349a92d567c..08b5eabf7b90 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -453,13 +453,8 @@ static int rockchip_usb2phy_probe(struct device *dev)
> of_platform_device_dummy_drv(phydev);
>
> phy = phy_create(phydev, child, &rockchip_usb2phy_ops);
> - if (IS_ERR(phy)) {
> - ret = PTR_ERR(phy);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "failed to create phy%d: %d\n",
> - port, ret);
> - return ret;
> - }
> + if (IS_ERR(phy))
> + return dev_errp_probe(dev, phy, "creating phy%d\n", port);
>
> p = xzalloc(sizeof(*p));
>
> diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
> index 9e52beed1bbb..8a9f9cbeb75f 100644
> --- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
> +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
> @@ -321,14 +321,8 @@ static int rockchip_combphy_parse_dt(struct device *dev,
> true);
>
> priv->phy_rst = reset_control_get(dev, NULL);
> - if (IS_ERR(priv->phy_rst)) {
> - ret = PTR_ERR(priv->phy_rst);
> -
> - if (ret != -EPROBE_DEFER)
> - dev_warn(dev, "failed to get phy reset\n");
> -
> - return ret;
> - }
> + if (IS_ERR(priv->phy_rst))
> + dev_errp_probe(dev, priv->phy_rst, "getting phy reset\n");
Should be return dev_errp_probe(...)
Fixed that while applying.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2024-02-20 7:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 17:26 Ahmad Fatoum
2024-02-20 7:27 ` Sascha Hauer
2024-02-20 7:28 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZdRUitBFuHWVkSwl@pengutronix.de \
--to=sha@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox