All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 6/9] clk: Update drivers to use -EINVAL
Date: Tue, 23 Mar 2021 00:23:07 -0400	[thread overview]
Message-ID: <de6e29f5-5dd6-ee5b-7660-51aaefc74084@gmail.com> (raw)
In-Reply-To: <20210323041427.3252184-7-sjg@chromium.org>

On 3/23/21 12:14 AM, Simon Glass wrote:
> At present some drivers use -ENOSUPP to indicate that an unknown or
> unsupported clock is used. Most use -EINVAL, indicating an invalid value,
> so convert everything to that.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v2:
> - Add new patch to update clk drivers to use -EINVAL
> 
>   drivers/clk/aspeed/clk_ast2600.c       | 2 +-
>   drivers/clk/clk-hsdk-cgu.c             | 4 ++--
>   drivers/clk/imx/clk-imx8.c             | 4 ++--
>   drivers/clk/imx/clk-imx8qm.c           | 6 +++---
>   drivers/clk/imx/clk-imx8qxp.c          | 6 +++---
>   drivers/clk/imx/clk-pllv3.c            | 2 +-
>   drivers/clk/kendryte/bypass.c          | 2 +-
>   drivers/clk/kendryte/clk.c             | 2 +-
>   drivers/clk/mvebu/armada-37xx-periph.c | 6 +++---
>   9 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/clk/aspeed/clk_ast2600.c b/drivers/clk/aspeed/clk_ast2600.c
> index acb7eca7414..3a92739f5cf 100644
> --- a/drivers/clk/aspeed/clk_ast2600.c
> +++ b/drivers/clk/aspeed/clk_ast2600.c
> @@ -1140,7 +1140,7 @@ int soc_clk_dump(void)
>   
>   		clk_free(&clk);
>   
> -		if (ret == -ENOTSUPP) {
> +		if (ret == -EINVAL) {
>   			printf("clk ID %lu not supported yet\n",
>   			       aspeed_clk_names[i].id);
>   			continue;
> diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c
> index 449b430e230..26b0aa9a26f 100644
> --- a/drivers/clk/clk-hsdk-cgu.c
> +++ b/drivers/clk/clk-hsdk-cgu.c
> @@ -718,7 +718,7 @@ static ulong hsdk_cgu_set_rate(struct clk *sclk, ulong rate)
>   	if (clk->map[sclk->id].set_rate)
>   		return clk->map[sclk->id].set_rate(sclk, rate);
>   
> -	return -ENOTSUPP;
> +	return -EINVAL;
>   }
>   
>   static int hsdk_cgu_disable(struct clk *sclk)
> @@ -731,7 +731,7 @@ static int hsdk_cgu_disable(struct clk *sclk)
>   	if (clk->map[sclk->id].disable)
>   		return clk->map[sclk->id].disable(sclk);
>   
> -	return -ENOTSUPP;
> +	return -EINVAL;
>   }
>   
>   static const struct clk_ops hsdk_cgu_ops = {
> diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c
> index 8484613eed5..b3dc138c4bb 100644
> --- a/drivers/clk/imx/clk-imx8.c
> +++ b/drivers/clk/imx/clk-imx8.c
> @@ -29,7 +29,7 @@ __weak ulong imx8_clk_set_rate(struct clk *clk, unsigned long rate)
>   
>   __weak int __imx8_clk_enable(struct clk *clk, bool enable)
>   {
> -	return -ENOTSUPP;
> +	return -EINVAL;
>   }
>   
>   static int imx8_clk_disable(struct clk *clk)
> @@ -70,7 +70,7 @@ int soc_clk_dump(void)
>   
>   		clk_free(&clk);
>   
> -		if (ret == -ENOTSUPP) {
> +		if (ret == -EINVAL) {
>   			printf("clk ID %lu not supported yet\n",
>   			       imx8_clk_names[i].id);
>   			continue;
> diff --git a/drivers/clk/imx/clk-imx8qm.c b/drivers/clk/imx/clk-imx8qm.c
> index 7e466d630a0..7759dc63ee1 100644
> --- a/drivers/clk/imx/clk-imx8qm.c
> +++ b/drivers/clk/imx/clk-imx8qm.c
> @@ -133,7 +133,7 @@ ulong imx8_clk_get_rate(struct clk *clk)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	};
>   
>   	ret = sc_pm_get_clock_rate(-1, resource, pm_clk,
> @@ -237,7 +237,7 @@ ulong imx8_clk_set_rate(struct clk *clk, unsigned long rate)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	};
>   
>   	ret = sc_pm_set_clock_rate(-1, resource, pm_clk, &new_rate);
> @@ -337,7 +337,7 @@ int __imx8_clk_enable(struct clk *clk, bool enable)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	}
>   
>   	ret = sc_pm_clock_enable(-1, resource, pm_clk, enable, 0);
> diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
> index e6b2fb40da2..ffa2fcee0b2 100644
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -126,7 +126,7 @@ ulong imx8_clk_get_rate(struct clk *clk)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	};
>   
>   	ret = sc_pm_get_clock_rate(-1, resource, pm_clk,
> @@ -221,7 +221,7 @@ ulong imx8_clk_set_rate(struct clk *clk, unsigned long rate)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	};
>   
>   	ret = sc_pm_set_clock_rate(-1, resource, pm_clk, &new_rate);
> @@ -311,7 +311,7 @@ int __imx8_clk_enable(struct clk *clk, bool enable)
>   			       __func__, clk->id);
>   			return -EINVAL;
>   		}
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   	}
>   
>   	ret = sc_pm_clock_enable(-1, resource, pm_clk, enable, 0);
> diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c
> index feacaee1c42..b5cbf800543 100644
> --- a/drivers/clk/imx/clk-pllv3.c
> +++ b/drivers/clk/imx/clk-pllv3.c
> @@ -290,7 +290,7 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
>   		break;
>   	default:
>   		kfree(pll);
> -		return ERR_PTR(-ENOTSUPP);
> +		return ERR_PTR(-EINVAL);
>   	}
>   
>   	pll->base = base;
> diff --git a/drivers/clk/kendryte/bypass.c b/drivers/clk/kendryte/bypass.c
> index 5f1986f2cb8..bbdbd9a10de 100644
> --- a/drivers/clk/kendryte/bypass.c
> +++ b/drivers/clk/kendryte/bypass.c
> @@ -157,7 +157,7 @@ static int k210_bypass_set_parent(struct clk *clk, struct clk *parent)
>   	if (ops->set_parent)
>   		return ops->set_parent(bypass->bypassee, parent);
>   	else
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   }

For kendryte drivers:

Acked-by: Sean Anderson <seanga2@gmail.com>

>   /*
> diff --git a/drivers/clk/kendryte/clk.c b/drivers/clk/kendryte/clk.c
> index 4b959401a63..3b674a998e3 100644
> --- a/drivers/clk/kendryte/clk.c
> +++ b/drivers/clk/kendryte/clk.c
> @@ -495,7 +495,7 @@ static int k210_clk_probe(struct udevice *dev)
>   	 * could fix this, but it's Probably Not Worth It (TM).
>   	 */
>   	if (probed)
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   
>   	base = dev_read_addr_ptr(dev_get_parent(dev));
>   	if (!base)
> diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
> index 0132fcb7e61..b0f47c33b3f 100644
> --- a/drivers/clk/mvebu/armada-37xx-periph.c
> +++ b/drivers/clk/mvebu/armada-37xx-periph.c
> @@ -340,7 +340,7 @@ static int periph_clk_enable(struct clk *clk, int enable)
>   		return -EINVAL;
>   
>   	if (!periph_clk->can_gate)
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   
>   	if (enable)
>   		clrbits_le32(priv->reg + CLK_DIS, periph_clk->disable_bit);
> @@ -408,7 +408,7 @@ static ulong armada_37xx_periph_clk_set_rate(struct clk *clk, ulong req_rate)
>   		return old_rate;
>   
>   	if (!periph_clk->can_gate || !periph_clk->dividers)
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   
>   	parent_rate = get_parent_rate(priv, clk->id);
>   	if (parent_rate == -EINVAL)
> @@ -445,7 +445,7 @@ static int armada_37xx_periph_clk_set_parent(struct clk *clk,
>   		return -EINVAL;
>   
>   	if (!periph_clk->can_mux || !periph_clk->can_gate)
> -		return -ENOTSUPP;
> +		return -EINVAL;
>   
>   	ret = clk_get_by_index(clk->dev, 0, &check_parent);
>   	if (ret < 0)
> 

  reply	other threads:[~2021-03-23  4:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  4:14 [PATCH v2 0/9] Use -ENOSYS consistently Simon Glass
2021-03-23  4:14 ` [PATCH v2 1/9] dm: core: Document the common error codes Simon Glass
2021-03-23  4:45   ` Sean Anderson
2021-03-23  5:40     ` Simon Glass
2021-03-24 16:00       ` Sean Anderson
2021-03-24 20:59         ` Simon Glass
2021-03-23  4:14 ` [PATCH v2 2/9] dm: core: Use -ENOSPC in acpi_get_path() Simon Glass
2021-03-23  4:14 ` [PATCH v2 3/9] usb: Return -ENOSYS when system call is not available Simon Glass
2021-03-23  4:14 ` [PATCH v2 4/9] spi: " Simon Glass
2021-03-23  4:14 ` [PATCH v2 5/9] tlv_eeprom: " Simon Glass
2021-03-23  4:14 ` [PATCH v2 6/9] clk: Update drivers to use -EINVAL Simon Glass
2021-03-23  4:23   ` Sean Anderson [this message]
2021-03-24  5:59   ` Stefan Roese
2021-03-23  4:14 ` [PATCH v2 7/9] clk: Return -ENOSYS when system call is not available Simon Glass
2021-03-23  4:14 ` [PATCH v2 8/9] simple-pm-bus: Use -ENOSYS for checking missing system call Simon Glass
2021-03-23  4:23   ` Sean Anderson
2021-03-23  4:14 ` [PATCH v2 9/9] pinctrl: Return -ENOSYS when system call is not available Simon Glass

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=de6e29f5-5dd6-ee5b-7660-51aaefc74084@gmail.com \
    --to=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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.