[PATCH] amba: consolidate PrimeCell magic

Jassi Brar jaswinder.singh at linaro.org
Tue Aug 16 04:38:18 EDT 2011


On 16 August 2011 14:05, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Tue, Aug 16, 2011 at 01:57:08PM +0530, Jassi Brar wrote:
>> On Mon, Aug 15, 2011 at 3:25 PM, Linus Walleij
>> <linus.walleij at stericsson.com> wrote:
>> > +static inline u32 amba_get_magic(void __iomem *base, u32 size, u8 offset)
>> > +{
>> > +       u32 magic;
>> > +       int i;
>> > +
>> > +       for (magic = 0, i = 0; i < 4; i++)
>> > +               magic |= (readl(base + size - offset + 4 * i) & 255)
>> > +                       << (i * 8);
>> 0xff looks much better than 255, esp when we play with bits.
>> Also you might simply use readb and drop the sieve ?
>
> You're making the assumption that using byte reads are permitted.  Given
> that these are described as 32-bit registers, and some primecells require
> reads of certain sizes, I believe the code to be the most correct solution.
>
If you notice the '?'
I already doubt that, so I simply asked Linus to ponder the possibility.



More information about the linux-arm-kernel mailing list