lkml.org 
[lkml]   [2018]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND PATCH v4 1/8] bitops: Introduce the for_each_set_clump macro
On Thu, Oct 04, 2018 at 07:36:20PM +0900, William Breathitt Gray wrote:
> On Wed, Oct 03, 2018 at 02:48:04PM +0300, Andy Shevchenko wrote:
> > On Tue, Oct 02, 2018 at 11:21:42AM +0300, Andy Shevchenko wrote:
> >
> > > I would rather go with two prototypes to get()/set() a clump in the bitmap
> > > in a way when it's aligned and BITS_PER_LONG % clump_size == 0.
> >
> > To make things much easier, restrict clump_size to the one
> > from the following set:
> >
> > 1, 2, 4, 8, 16, 32 even on 64-bit platforms.
> >
> > If it would be simpler solution to add 64 here (implying 32-bit platform),
> > I would vote for that.
> >
> > For the generic case we might need something like:
> >
> > unsigned long bitmap_get_bits(unsigned long *src, unsigned int start, unsigned int nbits)
> > {
> > assert(nbits > BITS_PER_LONG);
> >
> > /* Something like Rasmus proposed earlier */
> > }
> >
> > And similar to setter.
> >
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
>
> I have no objections to have a simplier macro for these common clump
> sizes -- afterall, I suspect most drivers will likely use clump sizes
> that are powers of 2 anyway. It would be nice to have a more versatile
> macro though for those drivers that would benefit from odd clump sizes,
> but we can perhaps postpone that until the need arises (the GPIO drivers
> in this patchset all use a power of 2).

Yes, this is my point of view: don't produce additional complexity to some
which has no users (yet).

When we would really have groups out of an odd bit number, we may reconsider.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2018-10-04 14:12    [W:0.070 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site