Re: [PATCH v2] Input: Fix force feedback documentation capability query example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 10, 2011 at 11:26:20AM -0800, Randy Dunlap wrote:
> On Mon, 10 Jan 2011 20:00:27 +0100 Alexander Stein wrote:
> 
> > features is a bit array, not byte array
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxxxxxxxxxxxx>
> > Acked-by: Anssi Hannula <anssi.hannula@xxxxxx>
> > ---
> > Changes in v2:
> > * Added proposed space char
> > 
> >  Documentation/input/ff.txt |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Documentation/input/ff.txt b/Documentation/input/ff.txt
> > index ded4d5f..d3e046b 100644
> > --- a/Documentation/input/ff.txt
> > +++ b/Documentation/input/ff.txt
> > @@ -49,7 +49,7 @@ This information is subject to change.
> >  #include <linux/input.h>
> >  #include <sys/ioctl.h>
> >  
> > -unsigned long features[1 + FF_MAX/sizeof(unsigned long)];
> > +unsigned long features[1 + FF_MAX / (8 * sizeof(unsigned long))];
> 
> How about:
> 
> unsigned long features[FF_CNT / (8 * sizeof(unsigned long))];
> 

No, if FF_CNT less than 32 it will cause size of the features array to
become 0.

I think we should do what input.h does and express the size in
BITS_PER_LONGS, like:

#define BITS_PER_LONGS(x) \
  (((x) + 8 * sizeof(unsigned long) - 1) / (8 * sizeof(unsigned long)))

unsigned long features[BITS_PER_LONGS(FF_CNT)];

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux