linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: fix clk_mux_val_to_index() error value
Date: Tue, 04 Dec 2018 20:55:10 +0100	[thread overview]
Message-ID: <38e17678c713c2bde0967ac34349436fffe033dd.camel@baylibre.com> (raw)
In-Reply-To: <154394899913.88331.6973889205055781649@swboyd.mtv.corp.google.com>

On Tue, 2018-12-04 at 10:43 -0800, Stephen Boyd wrote:
> Quoting Jerome Brunet (2018-12-04 08:34:03)
> > clk_mux_val_to_index() is meant to be used by .get_parent(), which
> > returns a u8, so when the value provided does not map to any valid index,
> > it is not a good idea to return a negative error value.
> > 
> > Instead, return num_parents which we know is an invalid index and let
> > CCF deal with it.
> > 
> > Fixes: 77deb66d262f ("clk: mux: add helper function for index/value
> > translation")
> > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> > ---
> 
> Thanks!
> 
> > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> > index 60c51871b04b..fc20886ef069 100644
> > --- a/include/linux/clk-provider.h
> > +++ b/include/linux/clk-provider.h
> > @@ -550,8 +550,8 @@ struct clk_hw *clk_hw_register_mux_table(struct device
> > *dev, const char *name,
> >                 void __iomem *reg, u8 shift, u32 mask,
> >                 u8 clk_mux_flags, u32 *table, spinlock_t *lock);
> >  
> > -int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int
> > flags,
> > -                        unsigned int val);
> > +u8 clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int
> > flags,
> 
> I wonder if we should just make this unsigned int? Does it hurt at all
> to have it be a wider type even though it doesn't match the CCF decision
> to make this a u8 for the parent index number space?
> 

I also wondered about this but since the target is get_parent(), I just
aligned the two.

In the end, I don't really care, as you prefer. Just let me know if you would
like a v2 with this change


  reply	other threads:[~2018-12-04 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 16:34 [PATCH] clk: fix clk_mux_val_to_index() error value Jerome Brunet
2018-12-04 18:43 ` Stephen Boyd
2018-12-04 19:55   ` Jerome Brunet [this message]
2018-12-04 22:34     ` Stephen Boyd

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=38e17678c713c2bde0967ac34349436fffe033dd.camel@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.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;
as well as URLs for NNTP newsgroup(s).