On Mon, Nov 15, 2010 at 02:07:50PM -0500, Ben Gardiner wrote:
> diff --git a/drivers/input/keyboard/gpio_keys.c 
> b/drivers/input/keyboard/gpio_keys.c
> index 6069abe..477802a 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -44,6 +48,26 @@ struct gpio_keys_drvdata {
>       struct gpio_button_data data[0];
>  };
>  
> +#if !defined(CONFIG_INPUT_POLLDEV) && !defined(CONFIG_INPUT_POLLDEV_MODULE)
> +inline struct input_polled_dev *input_allocate_polled_device(void)
> +{
> +     return NULL;
> +}
> +
> +inline void input_free_polled_device(struct input_polled_dev *poll_dev)
> +{
> +}
> +
> +inline int input_register_polled_device(struct input_polled_dev *dev)
> +{
> +     return -ENXIO;
> +}
> +
> +inline void input_unregister_polled_device(struct input_polled_dev *poll_dev)
> +{
> +}
> +#endif
> +

Wouldn't these be better off in linux/input-polldev.h?

> +#if !defined(CONFIG_INPUT_POLLDEV) && !defined(CONFIG_INPUT_POLLDEV_MODULE)
> +     if (pdata->poll_interval) {
> +             dev_err(dev, "device needs polling (enable INPUT_POLLDEV)\n");
> +             return -EINVAL;
> +     }
> +#endif
> +
This you could probably just shove in to..

>       ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
>                       pdata->nbuttons * sizeof(struct gpio_button_data),
>                       GFP_KERNEL);
> -     input = input_allocate_device();
> +     if (pdata->poll_interval) {
> +             poll_dev = input_allocate_polled_device();
> +             input = poll_dev ? poll_dev->input : 0;
> +     } else
> +             input = input_allocate_device();
>       if (!ddata || !input) {
>               dev_err(dev, "failed to allocate state\n");
>               error = -ENOMEM;
>               goto fail1;

this. Then just get rid of the ifdefs, as the
input_allocate_polled_device() case will have already NULL'ed out.

The rest is obviously fine with me!
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to