[PATCH RESEND] Input: omap-keypad: dynamically handle register offsets

Felipe Balbi balbi at ti.com
Wed Apr 11 04:56:39 EDT 2012


On Wed, Apr 11, 2012 at 02:19:48PM +0530, Poddar, Sourav wrote:
> >> +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
> >> +{
> >> +     if (keypad_data->revision == KBD_REVISION_OMAP4)
> >> +             return __raw_readl(keypad_data->base + offset);
> >> +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
> >> +             return __raw_readl(keypad_data->base + offset + 0x10);
> >> +
> >> +     return -ENODEV;
> >
> > Instead do:
> >
> >        return __raw_readl(keypad_data->base + keypad_data->reg_offset +
> >                           offset);
> >> +}
> I have a couple of doubts on this:
> 1. Before using kbd_readl/kbd_write anywhere we
> need to populate the "keypad_data->reg_offset"  with the register address
> which we need to read or write.

no no... keypad_data->reg_offset would be 0 or 0x10 depending on the
scheme you decode from revision.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120411/c9cb20d9/attachment.sig>


More information about the linux-arm-kernel mailing list