* [PATCH v3 0/3] Input: gpio-keys - clean up series @ 2014-04-25 16:22 Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Andy Shevchenko @ 2014-04-25 16:22 UTC (permalink / raw) To: Linus Walleij, Dmitry Torokhov, linux-input, linux-kernel; +Cc: Andy Shevchenko This is a 3rd iteration of the small cleanup against gpio-keys driver. Changes since v2: - append received Acks - rebase against recent linux-next - test on Intel Medfield based product Andy Shevchenko (3): Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Input: gpio_keys - convert to use devm_* Input: gpio_keys - convert struct descriptions to kernel-doc drivers/input/keyboard/gpio_keys.c | 82 +++++++++++++------------------------- include/linux/gpio_keys.h | 45 +++++++++++++++------ 2 files changed, 61 insertions(+), 66 deletions(-) -- 1.9.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() 2014-04-25 16:22 [PATCH v3 0/3] Input: gpio-keys - clean up series Andy Shevchenko @ 2014-04-25 16:22 ` Andy Shevchenko 2014-04-25 21:21 ` Dmitry Torokhov 2014-04-25 16:22 ` [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc Andy Shevchenko 2 siblings, 1 reply; 9+ messages in thread From: Andy Shevchenko @ 2014-04-25 16:22 UTC (permalink / raw) To: Linus Walleij, Dmitry Torokhov, linux-input, linux-kernel; +Cc: Andy Shevchenko The platform device is not used in gpio_keys_setup_key(). This patch substitutes it by struct device. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/input/keyboard/gpio_keys.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2db1324..209d4c6 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -424,13 +424,12 @@ out: return IRQ_HANDLED; } -static int gpio_keys_setup_key(struct platform_device *pdev, +static int gpio_keys_setup_key(struct device *dev, struct input_dev *input, struct gpio_button_data *bdata, const struct gpio_keys_button *button) { const char *desc = button->desc ? button->desc : "gpio_keys"; - struct device *dev = &pdev->dev; irq_handler_t isr; unsigned long irqflags; int irq, error; @@ -719,7 +718,7 @@ static int gpio_keys_probe(struct platform_device *pdev) input->name = pdata->name ? : pdev->name; input->phys = "gpio-keys/input0"; - input->dev.parent = &pdev->dev; + input->dev.parent = dev; input->open = gpio_keys_open; input->close = gpio_keys_close; @@ -736,7 +735,7 @@ static int gpio_keys_probe(struct platform_device *pdev) const struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; - error = gpio_keys_setup_key(pdev, input, bdata, button); + error = gpio_keys_setup_key(dev, input, bdata, button); if (error) goto fail2; -- 1.9.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() 2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko @ 2014-04-25 21:21 ` Dmitry Torokhov 2014-04-28 9:42 ` Andy Shevchenko 0 siblings, 1 reply; 9+ messages in thread From: Dmitry Torokhov @ 2014-04-25 21:21 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-input, linux-kernel On Fri, Apr 25, 2014 at 07:22:15PM +0300, Andy Shevchenko wrote: > The platform device is not used in gpio_keys_setup_key(). This patch > substitutes it by struct device. And the benefit of this is...? > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/input/keyboard/gpio_keys.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c > index 2db1324..209d4c6 100644 > --- a/drivers/input/keyboard/gpio_keys.c > +++ b/drivers/input/keyboard/gpio_keys.c > @@ -424,13 +424,12 @@ out: > return IRQ_HANDLED; > } > > -static int gpio_keys_setup_key(struct platform_device *pdev, > +static int gpio_keys_setup_key(struct device *dev, > struct input_dev *input, > struct gpio_button_data *bdata, > const struct gpio_keys_button *button) > { > const char *desc = button->desc ? button->desc : "gpio_keys"; > - struct device *dev = &pdev->dev; > irq_handler_t isr; > unsigned long irqflags; > int irq, error; > @@ -719,7 +718,7 @@ static int gpio_keys_probe(struct platform_device *pdev) > > input->name = pdata->name ? : pdev->name; > input->phys = "gpio-keys/input0"; > - input->dev.parent = &pdev->dev; > + input->dev.parent = dev; > input->open = gpio_keys_open; > input->close = gpio_keys_close; > > @@ -736,7 +735,7 @@ static int gpio_keys_probe(struct platform_device *pdev) > const struct gpio_keys_button *button = &pdata->buttons[i]; > struct gpio_button_data *bdata = &ddata->data[i]; > > - error = gpio_keys_setup_key(pdev, input, bdata, button); > + error = gpio_keys_setup_key(dev, input, bdata, button); > if (error) > goto fail2; > > -- > 1.9.2 > Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() 2014-04-25 21:21 ` Dmitry Torokhov @ 2014-04-28 9:42 ` Andy Shevchenko 0 siblings, 0 replies; 9+ messages in thread From: Andy Shevchenko @ 2014-04-28 9:42 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Linus Walleij, linux-input, linux-kernel On Fri, 2014-04-25 at 14:21 -0700, Dmitry Torokhov wrote: > On Fri, Apr 25, 2014 at 07:22:15PM +0300, Andy Shevchenko wrote: > > The platform device is not used in gpio_keys_setup_key(). This patch > > substitutes it by struct device. > > And the benefit of this is...? Probably no benefit for now. Let's drop it for good. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* 2014-04-25 16:22 [PATCH v3 0/3] Input: gpio-keys - clean up series Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko @ 2014-04-25 16:22 ` Andy Shevchenko 2014-04-26 4:43 ` Dmitry Torokhov 2014-04-25 16:22 ` [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc Andy Shevchenko 2 siblings, 1 reply; 9+ messages in thread From: Andy Shevchenko @ 2014-04-25 16:22 UTC (permalink / raw) To: Linus Walleij, Dmitry Torokhov, linux-input, linux-kernel; +Cc: Andy Shevchenko This makes the error handling much more simpler than open-coding everything and in addition makes the probe function smaller an tidier. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/input/keyboard/gpio_keys.c | 75 +++++++++++++------------------------- 1 file changed, 25 insertions(+), 50 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 209d4c6..8791d94 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -47,7 +47,7 @@ struct gpio_keys_drvdata { const struct gpio_keys_platform_data *pdata; struct input_dev *input; struct mutex disable_lock; - struct gpio_button_data data[0]; + struct gpio_button_data *data; }; /* @@ -577,25 +577,22 @@ gpio_keys_get_devtree_pdata(struct device *dev) int i; node = dev->of_node; - if (!node) { - error = -ENODEV; - goto err_out; - } + if (!node) + return ERR_PTR(-ENODEV); nbuttons = of_get_child_count(node); - if (nbuttons == 0) { - error = -ENODEV; - goto err_out; - } + if (nbuttons == 0) + return ERR_PTR(-ENODEV); - pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), - GFP_KERNEL); - if (!pdata) { - error = -ENOMEM; - goto err_out; - } + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + pdata->buttons = devm_kcalloc(dev, nbuttons, sizeof (*button), + GFP_KERNEL); + if (!pdata->buttons) + return ERR_PTR(-ENOMEM); - pdata->buttons = (struct gpio_keys_button *)(pdata + 1); pdata->nbuttons = nbuttons; pdata->rep = !!of_get_property(node, "autorepeat", NULL); @@ -618,7 +615,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) dev_err(dev, "Failed to get gpio flags, error: %d\n", error); - goto err_free_pdata; + return ERR_PTR(error); } button = &pdata->buttons[i++]; @@ -629,8 +626,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) if (of_property_read_u32(pp, "linux,code", &button->code)) { dev_err(dev, "Button without keycode: 0x%x\n", button->gpio); - error = -EINVAL; - goto err_free_pdata; + return ERR_PTR(-EINVAL); } button->desc = of_get_property(pp, "label", NULL); @@ -645,17 +641,10 @@ gpio_keys_get_devtree_pdata(struct device *dev) button->debounce_interval = 5; } - if (pdata->nbuttons == 0) { - error = -EINVAL; - goto err_free_pdata; - } + if (pdata->nbuttons == 0) + return ERR_PTR(-EINVAL); return pdata; - -err_free_pdata: - kfree(pdata); -err_out: - return ERR_PTR(error); } static struct of_device_id gpio_keys_of_match[] = { @@ -699,16 +688,18 @@ static int gpio_keys_probe(struct platform_device *pdev) return PTR_ERR(pdata); } - ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + - pdata->nbuttons * sizeof(struct gpio_button_data), - GFP_KERNEL); - input = input_allocate_device(); + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); + input = devm_input_allocate_device(dev); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); - error = -ENOMEM; - goto fail1; + return -ENOMEM; } + ddata->data = devm_kcalloc(dev, pdata->nbuttons, sizeof(*ddata->data), + GFP_KERNEL); + if (!ddata->data) + return -ENOMEM; + ddata->pdata = pdata; ddata->input = input; mutex_init(&ddata->disable_lock); @@ -767,20 +758,12 @@ static int gpio_keys_probe(struct platform_device *pdev) while (--i >= 0) gpio_remove_key(&ddata->data[i]); - fail1: - input_free_device(input); - kfree(ddata); - /* If we have no platform data, we allocated pdata dynamically. */ - if (!dev_get_platdata(&pdev->dev)) - kfree(pdata); - return error; } static int gpio_keys_remove(struct platform_device *pdev) { struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); - struct input_dev *input = ddata->input; int i; sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); @@ -790,14 +773,6 @@ static int gpio_keys_remove(struct platform_device *pdev) for (i = 0; i < ddata->pdata->nbuttons; i++) gpio_remove_key(&ddata->data[i]); - input_unregister_device(input); - - /* If we have no platform data, we allocated pdata dynamically. */ - if (!dev_get_platdata(&pdev->dev)) - kfree(ddata->pdata); - - kfree(ddata); - return 0; } -- 1.9.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* 2014-04-25 16:22 ` [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* Andy Shevchenko @ 2014-04-26 4:43 ` Dmitry Torokhov 2014-04-28 9:40 ` Andy Shevchenko 0 siblings, 1 reply; 9+ messages in thread From: Dmitry Torokhov @ 2014-04-26 4:43 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-input, linux-kernel On Fri, Apr 25, 2014 at 07:22:16PM +0300, Andy Shevchenko wrote: > This makes the error handling much more simpler than open-coding everything and > in addition makes the probe function smaller an tidier. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Acked-by: Linus Walleij <linus.walleij@linaro.org> > --- > drivers/input/keyboard/gpio_keys.c | 75 +++++++++++++------------------------- > 1 file changed, 25 insertions(+), 50 deletions(-) > > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c > index 209d4c6..8791d94 100644 > --- a/drivers/input/keyboard/gpio_keys.c > +++ b/drivers/input/keyboard/gpio_keys.c > @@ -47,7 +47,7 @@ struct gpio_keys_drvdata { > const struct gpio_keys_platform_data *pdata; > struct input_dev *input; > struct mutex disable_lock; > - struct gpio_button_data data[0]; > + struct gpio_button_data *data; > }; > > /* > @@ -577,25 +577,22 @@ gpio_keys_get_devtree_pdata(struct device *dev) > int i; > > node = dev->of_node; > - if (!node) { > - error = -ENODEV; > - goto err_out; > - } > + if (!node) > + return ERR_PTR(-ENODEV); > > nbuttons = of_get_child_count(node); > - if (nbuttons == 0) { > - error = -ENODEV; > - goto err_out; > - } > + if (nbuttons == 0) > + return ERR_PTR(-ENODEV); > > - pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), > - GFP_KERNEL); > - if (!pdata) { > - error = -ENOMEM; > - goto err_out; > - } > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > + if (!pdata) > + return ERR_PTR(-ENOMEM); > + > + pdata->buttons = devm_kcalloc(dev, nbuttons, sizeof (*button), > + GFP_KERNEL); > + if (!pdata->buttons) > + return ERR_PTR(-ENOMEM); Why are we splitting the allocation in 2? > > - pdata->buttons = (struct gpio_keys_button *)(pdata + 1); > pdata->nbuttons = nbuttons; > > pdata->rep = !!of_get_property(node, "autorepeat", NULL); > @@ -618,7 +615,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) > dev_err(dev, > "Failed to get gpio flags, error: %d\n", > error); > - goto err_free_pdata; > + return ERR_PTR(error); > } > > button = &pdata->buttons[i++]; > @@ -629,8 +626,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) > if (of_property_read_u32(pp, "linux,code", &button->code)) { > dev_err(dev, "Button without keycode: 0x%x\n", > button->gpio); > - error = -EINVAL; > - goto err_free_pdata; > + return ERR_PTR(-EINVAL); > } > > button->desc = of_get_property(pp, "label", NULL); > @@ -645,17 +641,10 @@ gpio_keys_get_devtree_pdata(struct device *dev) > button->debounce_interval = 5; > } > > - if (pdata->nbuttons == 0) { > - error = -EINVAL; > - goto err_free_pdata; > - } > + if (pdata->nbuttons == 0) > + return ERR_PTR(-EINVAL); > > return pdata; > - > -err_free_pdata: > - kfree(pdata); > -err_out: > - return ERR_PTR(error); > } > > static struct of_device_id gpio_keys_of_match[] = { > @@ -699,16 +688,18 @@ static int gpio_keys_probe(struct platform_device *pdev) > return PTR_ERR(pdata); > } > > - ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + > - pdata->nbuttons * sizeof(struct gpio_button_data), > - GFP_KERNEL); > - input = input_allocate_device(); > + ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); > + input = devm_input_allocate_device(dev); > if (!ddata || !input) { > dev_err(dev, "failed to allocate state\n"); > - error = -ENOMEM; > - goto fail1; > + return -ENOMEM; > } > > + ddata->data = devm_kcalloc(dev, pdata->nbuttons, sizeof(*ddata->data), > + GFP_KERNEL); > + if (!ddata->data) > + return -ENOMEM; > + Same here. I dropped the separate allocations and applied. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* 2014-04-26 4:43 ` Dmitry Torokhov @ 2014-04-28 9:40 ` Andy Shevchenko 0 siblings, 0 replies; 9+ messages in thread From: Andy Shevchenko @ 2014-04-28 9:40 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Linus Walleij, linux-input, linux-kernel On Fri, 2014-04-25 at 21:43 -0700, Dmitry Torokhov wrote: > On Fri, Apr 25, 2014 at 07:22:16PM +0300, Andy Shevchenko wrote: > > This makes the error handling much more simpler than open-coding everything and > > in addition makes the probe function smaller an tidier. [] > > - pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button), > > - GFP_KERNEL); > > - if (!pdata) { > > - error = -ENOMEM; > > - goto err_out; > > - } > > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > > + if (!pdata) > > + return ERR_PTR(-ENOMEM); > > + > > + pdata->buttons = devm_kcalloc(dev, nbuttons, sizeof (*button), > > + GFP_KERNEL); > > + if (!pdata->buttons) > > + return ERR_PTR(-ENOMEM); > > Why are we splitting the allocation in 2? Just for logical distinguishing, but I'm okay with one allocation. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc 2014-04-25 16:22 [PATCH v3 0/3] Input: gpio-keys - clean up series Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* Andy Shevchenko @ 2014-04-25 16:22 ` Andy Shevchenko 2014-04-26 4:41 ` Dmitry Torokhov 2 siblings, 1 reply; 9+ messages in thread From: Andy Shevchenko @ 2014-04-25 16:22 UTC (permalink / raw) To: Linus Walleij, Dmitry Torokhov, linux-input, linux-kernel; +Cc: Andy Shevchenko This patch converts descriptions of the structures defined in linux/gpio_keys.h to follow kernel-doc format. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> --- include/linux/gpio_keys.h | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index a7e977f..997134a 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -3,29 +3,50 @@ struct device; +/** + * struct gpio_keys_button - configuration parameters + * @code: input event code (KEY_*, SW_*) + * @gpio: %-1 if this key does not support gpio + * @active_low: + * @desc: + * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS) + * @wakeup: configure the button as a wake-up source + * @debounce_interval: debounce ticks interval in msecs + * @can_disable: + * @value: axis value for %EV_ABS + * @irq: Irq number in case of interrupt keys + */ struct gpio_keys_button { - /* Configuration parameters */ - unsigned int code; /* input event code (KEY_*, SW_*) */ - int gpio; /* -1 if this key does not support gpio */ + unsigned int code; + int gpio; int active_low; const char *desc; - unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ - int wakeup; /* configure the button as a wake-up source */ - int debounce_interval; /* debounce ticks interval in msecs */ + unsigned int type; + int wakeup; + int debounce_interval; bool can_disable; - int value; /* axis value for EV_ABS */ - unsigned int irq; /* Irq number in case of interrupt keys */ + int value; + unsigned int irq; }; +/** + * struct gpio_keys_platform_data - platform data for gpio_keys driver + * @buttons: + * @nbuttons: + * @poll_interval: polling interval in msecs - for polling driver only + * @rep: enable input subsystem auto repeat + * @enable: + * @disable: + * @name: input device name + */ struct gpio_keys_platform_data { struct gpio_keys_button *buttons; int nbuttons; - unsigned int poll_interval; /* polling interval in msecs - - for polling driver only */ - unsigned int rep:1; /* enable input subsystem auto repeat */ + unsigned int poll_interval; + unsigned int rep:1; int (*enable)(struct device *dev); void (*disable)(struct device *dev); - const char *name; /* input device name */ + const char *name; }; #endif -- 1.9.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc 2014-04-25 16:22 ` [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc Andy Shevchenko @ 2014-04-26 4:41 ` Dmitry Torokhov 0 siblings, 0 replies; 9+ messages in thread From: Dmitry Torokhov @ 2014-04-26 4:41 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-input, linux-kernel On Fri, Apr 25, 2014 at 07:22:17PM +0300, Andy Shevchenko wrote: > This patch converts descriptions of the structures defined in linux/gpio_keys.h > to follow kernel-doc format. > > There is no functional change. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Acked-by: Linus Walleij <linus.walleij@linaro.org> Applied, thank you. > --- > include/linux/gpio_keys.h | 45 +++++++++++++++++++++++++++++++++------------ > 1 file changed, 33 insertions(+), 12 deletions(-) > > diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h > index a7e977f..997134a 100644 > --- a/include/linux/gpio_keys.h > +++ b/include/linux/gpio_keys.h > @@ -3,29 +3,50 @@ > > struct device; > > +/** > + * struct gpio_keys_button - configuration parameters > + * @code: input event code (KEY_*, SW_*) > + * @gpio: %-1 if this key does not support gpio > + * @active_low: > + * @desc: > + * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS) > + * @wakeup: configure the button as a wake-up source > + * @debounce_interval: debounce ticks interval in msecs > + * @can_disable: > + * @value: axis value for %EV_ABS > + * @irq: Irq number in case of interrupt keys > + */ > struct gpio_keys_button { > - /* Configuration parameters */ > - unsigned int code; /* input event code (KEY_*, SW_*) */ > - int gpio; /* -1 if this key does not support gpio */ > + unsigned int code; > + int gpio; > int active_low; > const char *desc; > - unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ > - int wakeup; /* configure the button as a wake-up source */ > - int debounce_interval; /* debounce ticks interval in msecs */ > + unsigned int type; > + int wakeup; > + int debounce_interval; > bool can_disable; > - int value; /* axis value for EV_ABS */ > - unsigned int irq; /* Irq number in case of interrupt keys */ > + int value; > + unsigned int irq; > }; > > +/** > + * struct gpio_keys_platform_data - platform data for gpio_keys driver > + * @buttons: > + * @nbuttons: > + * @poll_interval: polling interval in msecs - for polling driver only > + * @rep: enable input subsystem auto repeat > + * @enable: > + * @disable: > + * @name: input device name > + */ > struct gpio_keys_platform_data { > struct gpio_keys_button *buttons; > int nbuttons; > - unsigned int poll_interval; /* polling interval in msecs - > - for polling driver only */ > - unsigned int rep:1; /* enable input subsystem auto repeat */ > + unsigned int poll_interval; > + unsigned int rep:1; > int (*enable)(struct device *dev); > void (*disable)(struct device *dev); > - const char *name; /* input device name */ > + const char *name; > }; > > #endif > -- > 1.9.2 > -- Dmitry ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-04-28 9:42 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-25 16:22 [PATCH v3 0/3] Input: gpio-keys - clean up series Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 1/3] Input: gpio_keys - use dev instead of pdev in gpio_keys_setup_key() Andy Shevchenko 2014-04-25 21:21 ` Dmitry Torokhov 2014-04-28 9:42 ` Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 2/3] Input: gpio_keys - convert to use devm_* Andy Shevchenko 2014-04-26 4:43 ` Dmitry Torokhov 2014-04-28 9:40 ` Andy Shevchenko 2014-04-25 16:22 ` [PATCH v3 3/3] Input: gpio_keys - convert struct descriptions to kernel-doc Andy Shevchenko 2014-04-26 4:41 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).