Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1189889 > unrolled thread

Re: [PATCH v5 1/8] clk: divider: switch to GENMASK()

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-07-22 15:10 +0200
Last post2015-07-22 15:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v5 1/8] clk: divider: switch to GENMASK() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-07-22 15:10 +0200

#1189889 — Re: [PATCH v5 1/8] clk: divider: switch to GENMASK()

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-07-22 15:10 +0200
SubjectRe: [PATCH v5 1/8] clk: divider: switch to GENMASK()
Message-ID<pP1Wy-7Id-27@gated-at.bofh.it>
On Tue, 2015-07-21 at 16:48 -0700, Stephen Boyd wrote:
> On 07/13, Andy Shevchenko wrote:
> > Convert the code to use GENMASK() helper instead of div_mask() 
> > macro.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/clk/clk-divider.c | 18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> > index 706b578..3bde790 100644
> > --- a/drivers/clk/clk-divider.c
> > +++ b/drivers/clk/clk-divider.c
> > @@ -30,8 +30,6 @@
> >  
> 
> #include <linux/bitops.h> ?

In clk-provider.h? It already is using BIT() macro. That's why I didn't
add the header inclusion.

> 
> > @@ -391,10 +389,10 @@ static int clk_divider_set_rate(struct clk_hw 
> > *hw, unsigned long rate,
> >  		spin_lock_irqsave(divider->lock, flags);
> >  
> >  	if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
> > -		val = div_mask(divider->width) << (divider->shift 
> > + 16);
> > +		val = GENMASK(divider->width - 1, 0) << (divider
> > ->shift + 16);
> >  	} else {
> >  		val = clk_readl(divider->reg);
> > -		val &= ~(div_mask(divider->width) << divider
> > ->shift);
> > +		val &= ~(GENMASK(divider->width - 1, 0) << divider
> > ->shift);
> 
> Shouldn't this be doing the shift in the GENMASK?

It shouldn't. I checked an assembly and it's far complex from the
proposed form.

> 
> 	start = divider->width - 1 + divider->shift;
> 	end = divider->shift;
> 
> 	...
> 
> 		val &= ~GENMASK(start, end);
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web