All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: gpio-keys: Convert timers to use timer_setup()
@ 2017-10-23  8:21 stephen lu
  2017-10-23 21:50 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: stephen lu @ 2017-10-23  8:21 UTC (permalink / raw)
  To: dmitry.torokhov, linus.walleij, linux, jacek.anaszewski,
	boris.brezillon, andriy.shevchenko, alexander.stein, hdegoede,
	geert+renesas, josephl
  Cc: linux-input, linux-kernel

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Signed-off-by: Stephen Lu <lumotuwe@gmail.com>

---
 drivers/input/keyboard/gpio_keys.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c
b/drivers/input/keyboard/gpio_keys.c
index e9f0ebf..25ddc33 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -419,9 +419,9 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
        return IRQ_HANDLED;
 }

-static void gpio_keys_irq_timer(unsigned long _data)
+static void gpio_keys_irq_timer(struct timer_list *t)
 {
-       struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
+       struct gpio_button_data *bdata = from_timer(bdata, t, release_timer);
        struct input_dev *input = bdata->input;
        unsigned long flags;

@@ -584,6 +584,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
                bdata->release_delay = button->debounce_interval;
                setup_timer(&bdata->release_timer,
                            gpio_keys_irq_timer, (unsigned long)bdata);
+               timer_setup(&bdata->release_timer,
+                           gpio_keys_irq_timer, 0);

                isr = gpio_keys_irq_isr;
                irqflags = 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] input: gpio-keys: Convert timers to use timer_setup()
  2017-10-23  8:21 [PATCH] input: gpio-keys: Convert timers to use timer_setup() stephen lu
@ 2017-10-23 21:50 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-10-23 21:50 UTC (permalink / raw)
  To: stephen lu
  Cc: linus.walleij, linux, jacek.anaszewski, boris.brezillon,
	andriy.shevchenko, alexander.stein, hdegoede, geert+renesas,
	josephl, linux-input, linux-kernel

Hi Stephen,

On Mon, Oct 23, 2017 at 04:21:51PM +0800, stephen lu wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Signed-off-by: Stephen Lu <lumotuwe@gmail.com>
> 
> ---
>  drivers/input/keyboard/gpio_keys.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c
> b/drivers/input/keyboard/gpio_keys.c
> index e9f0ebf..25ddc33 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -419,9 +419,9 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
>         return IRQ_HANDLED;
>  }
> 
> -static void gpio_keys_irq_timer(unsigned long _data)
> +static void gpio_keys_irq_timer(struct timer_list *t)
>  {
> -       struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
> +       struct gpio_button_data *bdata = from_timer(bdata, t, release_timer);
>         struct input_dev *input = bdata->input;
>         unsigned long flags;
> 
> @@ -584,6 +584,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
>                 bdata->release_delay = button->debounce_interval;
>                 setup_timer(&bdata->release_timer,
>                             gpio_keys_irq_timer, (unsigned long)bdata);
> +               timer_setup(&bdata->release_timer,
> +                           gpio_keys_irq_timer, 0);

Why are you keeping the original call to setup_timer()?

Also, your patch was line-wrapped, with tabs converted to spaces. I
fixed this all up, but please make sure you do not send mangled patches
next time. Look into git send-email.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-23 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-23  8:21 [PATCH] input: gpio-keys: Convert timers to use timer_setup() stephen lu
2017-10-23 21:50 ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.