All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Patrice Chotard <patrice.chotard@foss.st.com>, u-boot@lists.denx.de
Cc: Patrick DELAUNAY <patrick.delaunay@foss.st.com>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH 1/2] usb: host: ehci-generic: Make usage of clock/reset bulk() API
Date: Thu, 5 May 2022 15:44:50 +0200	[thread overview]
Message-ID: <40514ed1-9899-059f-0010-eb6b972c217a@denx.de> (raw)
In-Reply-To: <20220505151756.1.Ia5711b14a17cf1d042bdab9d3f28437d5c53272c@changeid>

On 5/5/22 15:17, Patrice Chotard wrote:

[...]

> @@ -81,68 +79,31 @@ static int ehci_usb_probe(struct udevice *dev)
>   	struct generic_ehci *priv = dev_get_priv(dev);
>   	struct ehci_hccr *hccr;
>   	struct ehci_hcor *hcor;
> -	int i, err, ret, clock_nb, reset_nb;
> +	int err, ret;
>   
>   	err = 0;
> -	priv->clock_count = 0;
> -	clock_nb = ofnode_count_phandle_with_args(dev_ofnode(dev), "clocks",
> -						  "#clock-cells", 0);
> -	if (clock_nb > 0) {
> -		priv->clocks = devm_kcalloc(dev, clock_nb, sizeof(struct clk),
> -					    GFP_KERNEL);
> -		if (!priv->clocks)
> -			return -ENOMEM;
> -
> -		for (i = 0; i < clock_nb; i++) {
> -			err = clk_get_by_index(dev, i, &priv->clocks[i]);
> -
> -			if (err < 0)
> -				break;
> -			err = clk_enable(&priv->clocks[i]);
> -			if (err && err != -ENOSYS) {
> -				dev_err(dev, "failed to enable clock %d\n", i);
> -				clk_free(&priv->clocks[i]);
> -				goto clk_err;
> -			}
> -			priv->clock_count++;
> -		}
> -	} else {
> -		if (clock_nb != -ENOENT) {
> -			dev_err(dev, "failed to get clock phandle(%d)\n",
> -				clock_nb);
> -			return clock_nb;
> -		}
> +	ret = clk_get_bulk(dev, &priv->clocks);
> +	if (ret) {
> +		dev_err(dev, "Failed to get clocks\n");

Print the error code in the error message, so the user can immediately 
determine what went wrong without rebuilding the code with extra debug 
prints (and that goes for other messages and other drivers too, the 
error code is useful there).

dev_err(dev, "Failed to get clocks (ret=%d)\n", ret);

[...]

  parent reply	other threads:[~2022-05-05 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 13:17 [PATCH 1/2] usb: host: ehci-generic: Make usage of clock/reset bulk() API Patrice Chotard
2022-05-05 13:17 ` [PATCH 2/2] usb: host: ehci-generic: Remove DM_REGULATOR flag Patrice Chotard
2022-05-05 13:45   ` Marek Vasut
2022-05-05 14:58     ` Patrice CHOTARD
2022-05-05 17:07       ` Marek Vasut
2022-05-05 13:44 ` Marek Vasut [this message]
2022-05-05 14:48   ` [PATCH 1/2] usb: host: ehci-generic: Make usage of clock/reset bulk() API Patrice CHOTARD

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=40514ed1-9899-059f-0010-eb6b972c217a@denx.de \
    --to=marex@denx.de \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.