[PATCH v2] powerpc: add setmaskedbits macros

Kumar Gala galak at kernel.crashing.org
Fri Aug 17 01:21:54 EST 2007


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_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_be32(&uccp->gumr_h,
> 		UCC_SLOW_GUMR_H_SUART | UCC_SLOW_GUMR_H_TRX |
> 		UCC_SLOW_GUMR_H_TTX, UCC_SLOW_GUMR_H_RFW);

Can you also show what the UCC_SLOW* values look like.

> The alternative to using a macro like this is to do this:
>
> 	reg = in_be32(p);
> 	reg &= ~some-mask-bits;
> 	reg |= some-other-bits;
> 	out_be32(p, reg);
>
> -- 
> Timur Tabi
> Linux Kernel Developer @ Freescale




More information about the Linuxppc-dev mailing list