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 <[email protected]> > --- > 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
