[PATCH] mxc/gpio: make _set_value work with values != 0/1

Peter Korsgaard jacmet at sunsite.dk
Mon Oct 11 08:23:00 EDT 2010


>>>>> "Baruch" == Baruch Siach <baruch at tkos.co.il> writes:

Hi,

 >> +

 Baruch> Unneeded empty line.

Yeah, just noticed as well.

 >> spin_lock_irqsave(&port->lock, flags);
 >> -	l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
 >> +	l = __raw_readl(reg);
 >> +	if (value)
 >> +		l |= 1 << offset;
 >> +	else
 >> +		l &= ~(1 << offset);

 Baruch> Alternative shorter version:

 Baruch> l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset);

Well, what do you know - I seem to be outnumbered ;)

Sasha, do you want the !! version instead? Then I'll resend.

-- 
Bye, Peter Korsgaard



More information about the linux-arm-kernel mailing list