Benjamin Herrenschmidt wrote:
>> The second example is actually a trick that lets me set some bits and clear
>> others in one shot, so for the gumr_h register, all of the above values are
>> single bits. I guess that's not a good example.
>
> Such tricks deserve at least a comment.
Would it b
On Thu, 2007-08-16 at 10:26 -0500, Timur Tabi wrote:
> Kumar Gala wrote:
>
> >> setmaskedbits_be32(&uccp->gumr_l,
> >> UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
> >> UCC_SLOW_GUMR_L_RDCR_16,
> >> UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK |
Michael Ellerman wrote:
> And if you're going to the trouble of making a macro, why not make it a
> bit more useful and have it check that the value and the mask match, ie:
>
> (v & ~m == 0)
What should I do if it fails this check?
> Final random thought, you could make the size/endian an argum
Kumar Gala wrote:
>> setmaskedbits_be32(&uccp->gumr_l,
>> UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
>> UCC_SLOW_GUMR_L_RDCR_16,
>> UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK |
>> UCC_SLOW_GUMR_L_RDCR_MASK);
>>
>> setmaskedbits_be
On Aug 16, 2007, at 10:18 AM, Timur Tabi wrote:
> Kumar Gala wrote:
>
>> Can you post a driver that uses this. I'm interested in seeing
>> what the readability is really like using these macros.
>
> I do not yet have any drivers ready, but I can give you an example:
>
> setmaskedbits_be3
Kumar Gala wrote:
> Can you post a driver that uses this. I'm interested in seeing what the
> readability is really like using these macros.
I do not yet have any drivers ready, but I can give you an example:
setmaskedbits_be32(&uccp->gumr_l,
UCC_SLOW_GUMR_L_MODE_QMC |
On Thu, 16 Aug 2007, Michael Ellerman wrote:
> Can you extract the masking logic, rather than repeating it 7 times:
>
> #define maskbits(a, v, m) ((a) & ~(m) | (v))
>
> And if you're going to the trouble of making a macro, why not make it a
> bit more useful and have it check that the value a
On Wed, 2007-08-15 at 16:30 -0500, Timur Tabi wrote:
> This patch adds the setmaskedbits_xxx() macros, which are used to set a
> multiple-bit bit pattern in a register. The macros include a mask, which
> zeros the respective bits before applying the value via a bitwise-OR.
> There are big-endian a
On Aug 15, 2007, at 4:30 PM, Timur Tabi wrote:
> This patch adds the setmaskedbits_xxx() macros, which are used to
> set a
> multiple-bit bit pattern in a register. The macros include a mask,
> which
> zeros the respective bits before applying the value via a bitwise-OR.
> There are big-endi