Message ID | 1440176519-30102-2-git-send-email-hs@denx.de |
---|---|
State | Superseded, archived |
Delegated to: | Andreas Bießmann |
Headers | show |
Hi, Am Freitag, 21. August 2015, 19:01:56 schrieb Heiko Schocher: > introduce BIT() definition, used in at91_udc gadget > driver. > > Signed-off-by: Heiko Schocher <hs@denx.de> > > --- > > Changes in v4: None > Changes in v3: > - new in v3 > > Changes in v2: None > > include/linux/bitops.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index e724310..7d30ace 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -3,6 +3,8 @@ > > #include <asm/types.h> > > +#define BIT(nr) (1UL << (nr)) > + JFYI, a few months ago, Wolfgang Denk NAKed a similar patch: http://lists.denx.de/pipermail/u-boot/2014-February/173669.html But I don't know whether this still stands. > /* > * ffs: find first bit set. This is defined the same way as > * the libc and compiler builtin ffs routines, therefore > Best regards, Michael
On Friday, August 21, 2015 at 09:26:41 PM, Michael Heimpold wrote: > Hi, > > Am Freitag, 21. August 2015, 19:01:56 schrieb Heiko Schocher: > > introduce BIT() definition, used in at91_udc gadget > > driver. > > > > Signed-off-by: Heiko Schocher <hs@denx.de> > > > > --- > > > > Changes in v4: None > > Changes in v3: > > - new in v3 > > > > Changes in v2: None > > > > include/linux/bitops.h | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > > index e724310..7d30ace 100644 > > --- a/include/linux/bitops.h > > +++ b/include/linux/bitops.h > > @@ -3,6 +3,8 @@ > > > > #include <asm/types.h> > > > > +#define BIT(nr) (1UL << (nr)) > > + > > JFYI, a few months ago, Wolfgang Denk NAKed a similar patch: > http://lists.denx.de/pipermail/u-boot/2014-February/173669.html > > But I don't know whether this still stands. Linux also uses this BIT() macro, I think we should just run with it. Best regards, Marek Vasut
On 08/21/2015 07:01 PM, Heiko Schocher wrote: > introduce BIT() definition, used in at91_udc gadget > driver. > > Signed-off-by: Heiko Schocher <hs@denx.de> > NAK, this one breaks a lot of boards which already defined BIT() > --- > > Changes in v4: None > Changes in v3: > - new in v3 > > Changes in v2: None > > include/linux/bitops.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index e724310..7d30ace 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -3,6 +3,8 @@ > > #include <asm/types.h> > > +#define BIT(nr) (1UL << (nr)) > + > /* > * ffs: find first bit set. This is defined the same way as > * the libc and compiler builtin ffs routines, therefore >
Hello Andreas, Am 07.09.2015 um 13:20 schrieb Andreas Bießmann: > On 08/21/2015 07:01 PM, Heiko Schocher wrote: >> introduce BIT() definition, used in at91_udc gadget >> driver. >> >> Signed-off-by: Heiko Schocher <hs@denx.de> >> > > NAK, this one breaks a lot of boards which already defined BIT() Uhh... seems this BIT() macro is a big mess ... Hmm Wolfgang Denk NACKed a similiar patch: http://lists.denx.de/pipermail/u-boot/2014-February/173669.html In drivers/usb/gadget/at91_udc.c BIT(x) is used only once... So I fix it there and use (1 << x) there. Would be this OK? bye, Heiko > >> --- >> >> Changes in v4: None >> Changes in v3: >> - new in v3 >> >> Changes in v2: None >> >> include/linux/bitops.h | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/include/linux/bitops.h b/include/linux/bitops.h >> index e724310..7d30ace 100644 >> --- a/include/linux/bitops.h >> +++ b/include/linux/bitops.h >> @@ -3,6 +3,8 @@ >> >> #include <asm/types.h> >> >> +#define BIT(nr) (1UL << (nr)) >> + >> /* >> * ffs: find first bit set. This is defined the same way as >> * the libc and compiler builtin ffs routines, therefore >> >
Hi Heiko, On 2015-09-07 13:52, Heiko Schocher wrote: > Hello Andreas, > > Am 07.09.2015 um 13:20 schrieb Andreas Bießmann: >> On 08/21/2015 07:01 PM, Heiko Schocher wrote: >>> introduce BIT() definition, used in at91_udc gadget >>> driver. >>> >>> Signed-off-by: Heiko Schocher <hs@denx.de> >>> >> >> NAK, this one breaks a lot of boards which already defined BIT() > > Uhh... seems this BIT() macro is a big mess ... > > Hmm Wolfgang Denk NACKed a similiar patch: > http://lists.denx.de/pipermail/u-boot/2014-February/173669.html > > In drivers/usb/gadget/at91_udc.c BIT(x) is used only once... > So I fix it there and use (1 << x) there. Would be this OK? I'm fine with this solution. Andreas > > bye, > Heiko >> >>> --- >>> >>> Changes in v4: None >>> Changes in v3: >>> - new in v3 >>> >>> Changes in v2: None >>> >>> include/linux/bitops.h | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/include/linux/bitops.h b/include/linux/bitops.h >>> index e724310..7d30ace 100644 >>> --- a/include/linux/bitops.h >>> +++ b/include/linux/bitops.h >>> @@ -3,6 +3,8 @@ >>> >>> #include <asm/types.h> >>> >>> +#define BIT(nr) (1UL << (nr)) >>> + >>> /* >>> * ffs: find first bit set. This is defined the same way as >>> * the libc and compiler builtin ffs routines, therefore >>> >>
On Monday, September 07, 2015 at 02:01:11 PM, Andreas Bießmann wrote: > Hi Heiko, > > On 2015-09-07 13:52, Heiko Schocher wrote: > > Hello Andreas, > > > > Am 07.09.2015 um 13:20 schrieb Andreas Bießmann: > >> On 08/21/2015 07:01 PM, Heiko Schocher wrote: > >>> introduce BIT() definition, used in at91_udc gadget > >>> driver. > >>> > >>> Signed-off-by: Heiko Schocher <hs@denx.de> > >> > >> NAK, this one breaks a lot of boards which already defined BIT() > > > > Uhh... seems this BIT() macro is a big mess ... > > > > Hmm Wolfgang Denk NACKed a similiar patch: > > http://lists.denx.de/pipermail/u-boot/2014-February/173669.html > > > > In drivers/usb/gadget/at91_udc.c BIT(x) is used only once... > > So I fix it there and use (1 << x) there. Would be this OK? > > I'm fine with this solution. On the other hand, mainline Linux is moving towards GENMASK() and BIT(), so we should probably go with that as well. Best regards, Marek Vasut
On 7 September 2015 at 17:45, Marek Vasut <marex@denx.de> wrote: > On Monday, September 07, 2015 at 02:01:11 PM, Andreas Bießmann wrote: >> Hi Heiko, >> >> On 2015-09-07 13:52, Heiko Schocher wrote: >> > Hello Andreas, >> > >> > Am 07.09.2015 um 13:20 schrieb Andreas Bießmann: >> >> On 08/21/2015 07:01 PM, Heiko Schocher wrote: >> >>> introduce BIT() definition, used in at91_udc gadget >> >>> driver. >> >>> >> >>> Signed-off-by: Heiko Schocher <hs@denx.de> >> >> >> >> NAK, this one breaks a lot of boards which already defined BIT() >> > >> > Uhh... seems this BIT() macro is a big mess ... >> > >> > Hmm Wolfgang Denk NACKed a similiar patch: >> > http://lists.denx.de/pipermail/u-boot/2014-February/173669.html >> > >> > In drivers/usb/gadget/at91_udc.c BIT(x) is used only once... >> > So I fix it there and use (1 << x) there. Would be this OK? >> >> I'm fine with this solution. > > On the other hand, mainline Linux is moving towards GENMASK() and BIT(), > so we should probably go with that as well. Sent some couple of patches to use these macros, but Wolfgang Denk is not quite OK, with this move. https://patchwork.ozlabs.org/patch/470475/ https://patchwork.ozlabs.org/patch/470476/ https://patchwork.ozlabs.org/patch/470477/ https://patchwork.ozlabs.org/patch/470478/ https://patchwork.ozlabs.org/patch/470479/ thanks!
On 21 August 2015 at 22:31, Heiko Schocher <hs@denx.de> wrote: > introduce BIT() definition, used in at91_udc gadget > driver. > > Signed-off-by: Heiko Schocher <hs@denx.de> > > --- > > Changes in v4: None > Changes in v3: > - new in v3 > > Changes in v2: None > > include/linux/bitops.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index e724310..7d30ace 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -3,6 +3,8 @@ > > #include <asm/types.h> > > +#define BIT(nr) (1UL << (nr)) > + Looks like few of them are interested with this BIT macro, but I'm thinking this is not the right place just add above BIT_MASK @@ -104,6 +104,7 @@ static inline unsigned int generic_hweight8(unsigned int w) return (res & 0x0F) + ((res >> 4) & 0x0F); } +#define BIT(nr) (1UL << (nr)) #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) this will give an impression to have all BIT macro's at once like Linux. > /* > * ffs: find first bit set. This is defined the same way as > * the libc and compiler builtin ffs routines, therefore > -- > 2.1.0 thanks!
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index e724310..7d30ace 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -3,6 +3,8 @@ #include <asm/types.h> +#define BIT(nr) (1UL << (nr)) + /* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore
introduce BIT() definition, used in at91_udc gadget driver. Signed-off-by: Heiko Schocher <hs@denx.de> --- Changes in v4: None Changes in v3: - new in v3 Changes in v2: None include/linux/bitops.h | 2 ++ 1 file changed, 2 insertions(+)