Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-07 Thread Kalle Valo
Sebastian Frias writes: > Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with > continuous bitfields, just as BIT(x) does for single bits. > > SETBITFIELD_ULL(msb, lsb, value) macro is also added. > > Signed-off-by: Sebastian Frias > --- > > Code protected with "#ifdef __KERNEL__"

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-06 Thread Sebastian Frias
Hi Geert, On 06/12/16 12:12, Geert Uytterhoeven wrote: >>> ... which means "generate a value"?? >>> >> >> Yes. >> Although I'm not sure if I understood the essence of your point. >> Are you suggesting that the name should be GENERATE_A_VALUE? > > No. I mean that "value" is a way too generic name.

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-06 Thread Geert Uytterhoeven
Hi Sebastian, On Tue, Dec 6, 2016 at 12:03 PM, Sebastian Frias wrote: > On 06/12/16 11:42, Geert Uytterhoeven wrote: >> On Tue, Dec 6, 2016 at 11:31 AM, Sebastian Frias wrote: >>> On 05/12/16 18:48, Geert Uytterhoeven wrote: On Mon, Dec 5, 2016 at 2:36 PM, Sebastian Frias wrote: > Intr

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-06 Thread Sebastian Frias
On 06/12/16 11:42, Geert Uytterhoeven wrote: > On Tue, Dec 6, 2016 at 11:31 AM, Sebastian Frias wrote: >> On 05/12/16 18:48, Geert Uytterhoeven wrote: >>> On Mon, Dec 5, 2016 at 2:36 PM, Sebastian Frias wrote: Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with continuous

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-06 Thread Geert Uytterhoeven
On Tue, Dec 6, 2016 at 11:31 AM, Sebastian Frias wrote: > On 05/12/16 18:48, Geert Uytterhoeven wrote: >> On Mon, Dec 5, 2016 at 2:36 PM, Sebastian Frias wrote: >>> Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with >>> continuous bitfields, just as BIT(x) does for single bits. >>

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-06 Thread Sebastian Frias
On 05/12/16 18:48, Geert Uytterhoeven wrote: > On Mon, Dec 5, 2016 at 2:36 PM, Sebastian Frias wrote: >> Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with >> continuous bitfields, just as BIT(x) does for single bits. > > If it's a bitfield, why not calling it that way? > I don't

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Geert Uytterhoeven
On Mon, Dec 5, 2016 at 2:36 PM, Sebastian Frias wrote: > Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with > continuous bitfields, just as BIT(x) does for single bits. If it's a bitfield, why not calling it that way? So what about BITFIELD(start ,size), like arch/tile/kernel/tile

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Sebastian Frias
On 05/12/16 18:13, Linus Torvalds wrote: > On Mon, Dec 5, 2016 at 5:36 AM, Sebastian Frias wrote: >> Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with >> continuous bitfields, just as BIT(x) does for single bits. >> >> SETBITFIELD_ULL(msb, lsb, value) macro is also added. > > No.

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Sebastian Frias
On 05/12/16 16:34, Borislav Petkov wrote: > On Mon, Dec 05, 2016 at 02:36:07PM +0100, Sebastian Frias wrote: >> + * Equivalent of BIT(x) but for contiguous bitfields >> + * SETBITFIELD(1, 0,0xff) = 0x0003 >> + * SETBITFIELD(3, 0,0xff) = 0x000f >> + * SETBITFIELD(15,8,0xff) = 0xff00 >> +

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Linus Torvalds
On Mon, Dec 5, 2016 at 5:36 AM, Sebastian Frias wrote: > Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with > continuous bitfields, just as BIT(x) does for single bits. > > SETBITFIELD_ULL(msb, lsb, value) macro is also added. No. No, no, no. Didn't we have this discussion already

Re: [PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Borislav Petkov
On Mon, Dec 05, 2016 at 02:36:07PM +0100, Sebastian Frias wrote: > + * Equivalent of BIT(x) but for contiguous bitfields > + * SETBITFIELD(1, 0,0xff) = 0x0003 > + * SETBITFIELD(3, 0,0xff) = 0x000f > + * SETBITFIELD(15,8,0xff) = 0xff00 > + * SETBITFIELD(6, 6, 1) = 0x0040 == BIT(6)

[PATCH] bitops: add equivalent of BIT(x) for bitfields

2016-12-05 Thread Sebastian Frias
Introduce SETBITFIELD(msb, lsb, value) macro to ease dealing with continuous bitfields, just as BIT(x) does for single bits. SETBITFIELD_ULL(msb, lsb, value) macro is also added. Signed-off-by: Sebastian Frias --- Code protected with "#ifdef __KERNEL__" just as the BIT(x) macros. I would have