Re: pinctrl: Add pinctrl-s3c24xx driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

Am Donnerstag, 31. Juli 2014, 13:39:36 schrieb Dan Carpenter:
> Hello Heiko Stuebner,
> 
> The patch af99a7507469: "pinctrl: Add pinctrl-s3c24xx driver" from
> May 21, 2013, leads to the following static checker warning:
> 
> 	drivers/pinctrl/samsung/pinctrl-s3c24xx.c:188 s3c24xx_eint_type()
> 	warn: are you sure the precedence is correct here?
> 
> drivers/pinctrl/samsung/pinctrl-s3c24xx.c
>    186          /* Set up interrupt trigger */
>    187          reg = d->virt_base + EINT_REG(index);
>    188          shift = EINT_OFFS(index);
>    189
> 
> EINT_OFFS() is defined with two different precedences.  One of them is
> probably wrong and it's probably this one here that does the MOD
> operation first followed by the multiply.
> 
> #define EINT_OFFS(i) ((i) % EINT_MAX_PER_GROUP * 4)
> #define EINT_OFFS(i) ((i) % (2 * EINT_MAX_PER_GROUP))

I suppose the other EINT_OFFS definition 
	((i) % (2 * EINT_MAX_PER_GROUP))
is from pinctrl-64xx.c, right?

On the s3c24xx, the eints are arranged in a set of registers:
eint0 bits [2:0]
eint1 bits [6:4]
...
eint7 bits [30:28]

(next register):
eint8 bits [2:0]
...
eint15 bits [30:28]
...

EINT_MAX_PER_GROUP is of course 8, so for example
eint15 % 8 = 7
7 * 4 = 28 ... the correct bit offset in the register.


The eint layout on the s3c64xx is slightly different, so the offset calculation 
is likely too.


Heiko
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux