All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
To: Vaishali Thakkar <vthakkar1994-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	Mike Marciniszyn
	<infinipath-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Hal Rosenstock
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] IB/ipatch: Use setup_timer and mod_timer
Date: Mon, 02 Mar 2015 17:47:36 +0100	[thread overview]
Message-ID: <1425314856.3069.12.camel@opteya.com> (raw)
In-Reply-To: <20150301194637.GA3441@vaishali-Ideapad-Z570>

Le lundi 02 mars 2015 à 01:16 +0530, Vaishali Thakkar a écrit :
> Use timer API functions setup_timer and mod_timer instead
> of structure assignments as they are standard way to set
> the timer and to update the expire field of an active timer
> respectively.
> 
> This is done using Coccinelle and semantic patch used for
> this is as follows:
> 
> // <smpl>
> @@
> expression x,y,z,a,b;
> @@
> 
> -init_timer (&x);
> +setup_timer (&x, y, z);
> +mod_timer (&a, b);
> -x.function = y;
> -x.data = z;
> -x.expires = b;
> -add_timer(&a);
> // </smpl>
> 
> Signed-off-by: Vaishali Thakkar <vthakkar1994-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/ipath/ipath_driver.c    |  9 +++------
>  drivers/infiniband/hw/ipath/ipath_init_chip.c | 10 +++-------
>  drivers/infiniband/hw/ipath/ipath_verbs.c     |  7 ++-----
>  3 files changed, 8 insertions(+), 18 deletions(-)
> 
[...]
> diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
> index be2a60e..34ffb43 100644
> --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
> +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
> @@ -950,13 +950,9 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
>  		 * set up stats retrieval timer, even if we had errors
>  		 * in last portion of setup
>  		 */
> -		init_timer(&dd->ipath_stats_timer);
> -		dd->ipath_stats_timer.function = ipath_get_faststats;
> -		dd->ipath_stats_timer.data = (unsigned long) dd;
> -		/* every 5 seconds; */
> -		dd->ipath_stats_timer.expires = jiffies + 5 * HZ;
> -		/* takes ~16 seconds to overflow at full IB 4x bandwdith */
> -		add_timer(&dd->ipath_stats_timer);
> +		setup_timer(&dd->ipath_stats_timer, ipath_get_faststats,
> +			    (unsigned long)dd);
> +		mod_timer(&dd->ipath_stats_timer, jiffies + 5 * HZ);

The code seems correct, but you remove the comments, loosing some useful
information.

Regards.

-- 
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-03-02 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01 19:46 [PATCH] IB/ipatch: Use setup_timer and mod_timer Vaishali Thakkar
2015-03-02 16:47 ` Yann Droneaud [this message]
     [not found]   ` <1425314856.3069.12.camel-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2015-03-02 16:59     ` Vaishali Thakkar

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=1425314856.3069.12.camel@opteya.com \
    --to=ydroneaud-rly5vtjfyj3qt0dzr+alfa@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=infinipath-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=vthakkar1994-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 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.