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

Poddar, Sourav sourav.poddar at ti.com
Wed Apr 11 05:04:47 EDT 2012


Hi Felipe,

On Wed, Apr 11, 2012 at 2:26 PM, Felipe Balbi <balbi at ti.com> wrote:
> 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.
Ohk. Got it. Will make the necessary changes.
Thanks.

~Sourav
>
> --
> balbi



More information about the linux-arm-kernel mailing list