[PATCH 05/17] ARM: pxa/raumfeld: add rotary encoder support
Russell King - ARM Linux
linux at arm.linux.org.uk
Wed Nov 25 11:59:45 EST 2009
On Wed, Nov 25, 2009 at 05:26:38PM +0200, Mike Rapoport wrote:
> Daniel Mack wrote:
> > @@ -174,6 +197,12 @@ static void __init raumfeld_common_init(void)
> >
> > static void __init raumfeld_controller_init(void)
> > {
> > + struct platform_device *raumfeld_controller_devices[] = {
> > + &rotary_encoder_device,
> > + };
>
> Any reason to keep the devices array inside the function? I think it makes the
> code less readable.
Also, non-static initialized structures and arrays inside functions are
a waste of space. You might as well write it like this, because the
following is exactly what the compiler will be doing for you:
static const struct platform_device *__raumfeld_controller_devices[] = {
&rotary_encoder_device,
};
static void __init raumfeld_controller_init(void)
{
struct platform_device *raumfeld_controller_devices[ARRAY_SIZE(__raumfeld_controller_devices)];
memcpy(raumfeld_controller_devices, __raumfeld_controller_devices, sizeof(__raumfeld_controller_devices));
...
}
More information about the linux-arm-kernel
mailing list