[PATCH v2] staging: greybus: Convert timers to use timer_setup()
Bryan O'Donoghue
bryan.odonoghue at linaro.org
Tue Oct 24 15:54:59 UTC 2017
On 24/10/17 15:49, Kees Cook 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.
>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: "Bryan O'Donoghue" <pure.logic at nexus-software.ie>
> Cc: Johan Hovold <johan at kernel.org>
> Cc: Alex Elder <elder at kernel.org>
> Cc: greybus-dev at lists.linaro.org
> Cc: devel at driverdev.osuosl.org
> Signed-off-by: Kees Cook <keescook at chromium.org>
> ---
> v2: Added back "get" in timer code, thanks to Bryan. :)
> ---
> drivers/staging/greybus/loopback.c | 19 +++++++++----------
> drivers/staging/greybus/operation.c | 7 +++----
> 2 files changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index 08e255884206..1c0bafeb7ea5 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -572,16 +572,16 @@ static void gb_loopback_async_operation_work(struct work_struct *work)
> gb_loopback_async_operation_put(op_async);
> }
>
> -static void gb_loopback_async_operation_timeout(unsigned long data)
> +static void gb_loopback_async_operation_timeout(struct timer_list *t)
> {
> - struct gb_loopback_async_operation *op_async;
> - u16 id = data;
> + struct gb_loopback_async_operation *op_async =
> + from_timer(op_async, t, timer);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&gb_dev.lock, flags);
> + gb_loopback_async_operation_get(op_async);
> + spin_unlock_irqrestore(&gb_dev.lock, flags);
Damnit I'm just wrong (I hate that).
The pointer can already have gone away by the time the timer runs - my
bad...
see attached for update - with my Signed-off added.
---
bod
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-staging-greybus-Convert-timers-to-use-timer_setup.patch
Type: text/x-patch
Size: 4038 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20171024/95c7ee21/attachment.bin>
More information about the devel
mailing list