Thread (10 messages) flat view 10 messages, 5 authors, 2007-08-16

Re: [PATCH v2] powerpc: add setmaskedbits macros

From: Timur Tabi <hidden>
Date: 2007-08-16 15:18:23

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);

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help