mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
To: Kees Cook <keescook@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
Date: Tue, 24 Oct 2017 10:35:11 +0100	[thread overview]
Message-ID: <3caa07a1-4f46-d879-cfec-586addc006af@nexus-software.ie> (raw)
In-Reply-To: <20171024082550.GA142933@beast>

On 24/10/17 09:25, 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@linuxfoundation.org>
> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Alex Elder <elder@kernel.org>
> Cc: greybus-dev@lists.linaro.org
> Cc: devel@driverdev.osuosl.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>   drivers/staging/greybus/loopback.c  | 14 ++++----------
>   drivers/staging/greybus/operation.c |  7 +++----
>   2 files changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index 08e255884206..045aaf81113a 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -572,16 +572,11 @@ 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);
>   
> -	op_async = gb_loopback_operation_find(id);
> -	if (!op_async) {
> -		pr_err("operation %d not found - time out ?\n", id);
> -		return;
> -	}

Hi Kees, you need to add

	gb_loopback_async_operation_get(op_async); when dropping the 
gb_loopback_operation_find() call here.

>   	schedule_work(&op_async->work);
>   }
>   
> @@ -631,8 +626,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type,
>   	if (ret)
>   		goto error;
>   
> -	setup_timer(&op_async->timer, gb_loopback_async_operation_timeout,
> -			(unsigned long)operation->id);
> +	timer_setup(&op_async->timer, gb_loopback_async_operation_timeout, 0);
>   	op_async->timer.expires = jiffies + gb->jiffy_timeout;
>   	add_timer(&op_async->timer);
>   
> diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
> index 3023012808d9..ee4ba3f23bef 100644
> --- a/drivers/staging/greybus/operation.c
> +++ b/drivers/staging/greybus/operation.c
> @@ -294,9 +294,9 @@ static void gb_operation_work(struct work_struct *work)
>   	gb_operation_put(operation);
>   }
>   
> -static void gb_operation_timeout(unsigned long arg)
> +static void gb_operation_timeout(struct timer_list *t)
>   {
> -	struct gb_operation *operation = (void *)arg;
> +	struct gb_operation *operation = from_timer(operation, t, timer);
>   
>   	if (gb_operation_result_set(operation, -ETIMEDOUT)) {
>   		/*
> @@ -541,8 +541,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type,
>   			goto err_request;
>   		}
>   
> -		setup_timer(&operation->timer, gb_operation_timeout,
> -			    (unsigned long)operation);
> +		timer_setup(&operation->timer, gb_operation_timeout, 0);
>   	}
>   
>   	operation->flags = op_flags;
> 

Other than that, the rest looks good to me and you can add my

Reviewed-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>

  reply	other threads:[~2017-10-24  9:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  8:25 Kees Cook
2017-10-24  9:35 ` Bryan O'Donoghue [this message]
2017-10-24  9:40   ` Bryan O'Donoghue
2017-10-24 12:47     ` Kees Cook
2017-10-24 12:52       ` Bryan O'Donoghue
2017-10-24 13:14         ` Kees Cook
2017-10-24 13:30           ` Bryan O'Donoghue
2017-10-24 14:36             ` Kees Cook
2017-10-24 10:03 ` Dan Carpenter
2017-10-24 10:07   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3caa07a1-4f46-d879-cfec-586addc006af@nexus-software.ie \
    --to=pure.logic@nexus-software.ie \
    --cc=devel@driverdev.osuosl.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®