All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 4/6] clk: Return -ENOSYS when system call is not available
Date: Tue, 23 Mar 2021 17:08:19 +1300	[thread overview]
Message-ID: <CAPnjgZ29MKQsCBhFbW+i+EupJLGpT+d8CEiE=67YnvFwK1BFtA@mail.gmail.com> (raw)
In-Reply-To: <ede85f17-4816-13fb-53c8-2506648dd5c7@gmail.com>

Hi Seam,

On Sun, 21 Mar 2021 at 17:37, Sean Anderson <seanga2@gmail.com> wrote:
>
>
> On 3/20/21 11:18 PM, Simon Glass wrote:
> > Update clk_composite_set_parent() to use -ENOSYS, which is the correct
> > error code for U-Boot. Also rearrange the code so that the error condition
> > is clearly indicated and the function runs to the end in the normal case,
> > since this is the common style in U-Boot.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >   drivers/clk/clk-composite.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
> > index 7e99c5b910d..bb5351ebc0b 100644
> > --- a/drivers/clk/clk-composite.c
> > +++ b/drivers/clk/clk-composite.c
> > @@ -37,10 +37,10 @@ static int clk_composite_set_parent(struct clk *clk, struct clk *parent)
> >       const struct clk_ops *mux_ops = composite->mux_ops;
> >       struct clk *mux = composite->mux;
> >
> > -     if (mux && mux_ops)
> > -             return mux_ops->set_parent(mux, parent);
> > -     else
> > -             return -ENOTSUPP;
> > +     if (!mux || !mux_ops)
> > +             return -ENOSYS;
> > +
> > +     return mux_ops->set_parent(mux, parent);
> >   }
> >
> >   static unsigned long clk_composite_recalc_rate(struct clk *clk)
> >
>
> Reviewed-by: Sean Anderson <seanga2@gmail.com>
>
> Will this be applied to the whole clock subsystem? From what I can tell,
> the clock subsystem returns ENOSYS in these situations, and drivers
> return ENOTSUPP. It would be great if we could unified all these so
> callers could check for one return value.

Most drivers use -EINVAL for an invalid / unknown clock, whereas
-ENOSYS is for an unimplemented method or sub-method.

So I'll add a patch to use -EINVAL consistently.

Regards,
Simon

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

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21  3:18 [PATCH 0/6] Use -ENOSYS consistently Simon Glass
2021-03-21  3:18 ` [PATCH 1/6] usb: Return -ENOSYS when system call is not available Simon Glass
2021-03-21  4:09   ` Marek Vasut
2021-03-21  4:12     ` Simon Glass
2021-03-21 18:29       ` Marek Vasut
2021-03-21  3:18 ` [PATCH 2/6] spi: " Simon Glass
2021-03-21  3:18 ` [PATCH 3/6] tlv_eeprom: " Simon Glass
2021-03-21  3:18 ` [PATCH 4/6] clk: " Simon Glass
2021-03-21  4:37   ` Sean Anderson
2021-03-23  4:08     ` Simon Glass [this message]
2021-03-21  3:18 ` [PATCH 5/6] simple-pm-bus: Use -ENOSYS for checking missing system call Simon Glass
2021-03-21  4:39   ` Sean Anderson
2021-03-21  3:18 ` [PATCH 6/6] pinctrl: Return -ENOSYS when system call is not available Simon Glass
2021-03-21 16:38 ` [PATCH 0/6] Use -ENOSYS consistently Tom Rini

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='CAPnjgZ29MKQsCBhFbW+i+EupJLGpT+d8CEiE=67YnvFwK1BFtA@mail.gmail.com' \
    --to=sjg@chromium.org \
    --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.