[U-Boot] Fixed clock driver (clk: convert API to match reset/mailbox style)

Simon Glass sjg at chromium.org
Tue Nov 15 20:23:51 CET 2016


Hi Michal,

On 15 November 2016 at 12:07, Michal Simek <monstr at monstr.eu> wrote:
> Hi guys,
>
> I just found today with playing with clock drivers that the patch
> clk: convert API to match reset/mailbox style
> (sha1: 135aa95002646c46e89de93fa36adad1b010548f)
>
> added this part of code to fixed clock driver
> -static ulong clk_fixed_rate_get_rate(struct udevice *dev)
> +static ulong clk_fixed_rate_get_rate(struct clk *clk)
>  {
> -       return to_clk_fixed_rate(dev)->fixed_rate;
> -}
> +       if (clk->id != 0)
> +               return -EINVAL;
>
>
> which is returning -EINVAL when ulong should be returned.

This is intended - you can use IS_ERR_VALUE() to check if it is an error.

>
> The next thing I have found is that fixed clock driver has no set_rate
> function which is fine but when I was testing one driver which tries to
> set rate then error code was generated but without any useful
> information what happened.

It should return -ENOSYS, right?

> Are you ok with adding empty set_rate function with returning error
> message that set rate is not supported for fixed clocks?

What would it return that is different? If you are asking for a
printed error message, that would bloat the code. So long as the
caller checks the error we should be OK.

Regards,
Simon


More information about the U-Boot mailing list