linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
@ 2015-10-25 10:17 Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 2/4 v2] staging: ipath: ipath_init_chip: " Muhammad Falak R Wani
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Muhammad Falak R Wani @ 2015-10-25 10:17 UTC (permalink / raw)
  To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman, linux-rdma, devel, linux-kernel
  Cc: Muhammad Falak R Wani

Use the timer API function setup_timer instead of init_timer, removing
the structure field assignments.
The simplified semantic patch used is :-
<smpl>

@timer@
expression e1,e2,e3,fn_ptr;
@@
-init_timer(&e1);
+setup_timer(&e1, fn_ptr, e2);
... when != fn_ptr = e3
-e1.function = fn_ptr;
-e1.data = e2;

</smpl>

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
v2 changes:
	-> Change the subject line to a be more specific
	-> Add details about coccinelle in the commit log

mfrw

 drivers/staging/rdma/ipath/ipath_driver.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_driver.c b/drivers/staging/rdma/ipath/ipath_driver.c
index 46d9898..577704a 100644
--- a/drivers/staging/rdma/ipath/ipath_driver.c
+++ b/drivers/staging/rdma/ipath/ipath_driver.c
@@ -2307,10 +2307,9 @@ void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val)
 	 */
 	if (atomic_inc_return(&dd->ipath_led_override_timer_active) == 1) {
 		/* Need to start timer */
-		init_timer(&dd->ipath_led_override_timer);
-		dd->ipath_led_override_timer.function =
-						 ipath_run_led_override;
-		dd->ipath_led_override_timer.data = (unsigned long) dd;
+		setup_timer(&dd->ipath_led_override_timer,
+				ipath_run_led_override, (unsigned long)dd);
+
 		dd->ipath_led_override_timer.expires = jiffies + 1;
 		add_timer(&dd->ipath_led_override_timer);
 	} else
-- 
1.9.1


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

* [PATCH 2/4 v2] staging: ipath: ipath_init_chip: Use setup_timer
  2015-10-25 10:17 [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer Muhammad Falak R Wani
@ 2015-10-25 10:17 ` Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 3/4 v2] staging: ipath: ipath_sdma: " Muhammad Falak R Wani
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Muhammad Falak R Wani @ 2015-10-25 10:17 UTC (permalink / raw)
  To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman, linux-rdma, devel, linux-kernel
  Cc: Muhammad Falak R Wani

Use of the timer API function setup_timer instead of init_timer, removing
the structure field assignments, and make the codeflow more readable.
The simplified sematic patch used is :-
<smpl>

@timer@
expression e1,e2,e3,fn_ptr;
@@
-init_timer(&e1);
+setup_timer(&e1, fn_ptr, e2);
... when != fn_ptr = e3
-e1.function = fn_ptr;
-e1.data = e2;

</smpl>

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
v2 changes:
	-> Change the subject line to a be more specific

mfrw

 drivers/staging/rdma/ipath/ipath_init_chip.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_init_chip.c b/drivers/staging/rdma/ipath/ipath_init_chip.c
index 4aea99c..a5eea19 100644
--- a/drivers/staging/rdma/ipath/ipath_init_chip.c
+++ b/drivers/staging/rdma/ipath/ipath_init_chip.c
@@ -950,9 +950,8 @@ 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;
+		setup_timer(&dd->ipath_stats_timer, ipath_get_faststats,
+				(unsigned long)dd);
 		/* every 5 seconds; */
 		dd->ipath_stats_timer.expires = jiffies + 5 * HZ;
 		/* takes ~16 seconds to overflow at full IB 4x bandwdith */
@@ -965,9 +964,8 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
 		ret = setup_sdma(dd);
 
 	/* Set up HoL state */
-	init_timer(&dd->ipath_hol_timer);
-	dd->ipath_hol_timer.function = ipath_hol_event;
-	dd->ipath_hol_timer.data = (unsigned long)dd;
+	setup_timer(&dd->ipath_hol_timer, ipath_hol_event, (unsigned long)dd);
+
 	dd->ipath_hol_state = IPATH_HOL_UP;
 
 done:
@@ -988,11 +986,9 @@ done:
 			 * to an alternate if necessary and possible
 			 */
 			if (!reinit) {
-				init_timer(&dd->ipath_intrchk_timer);
-				dd->ipath_intrchk_timer.function =
-					verify_interrupt;
-				dd->ipath_intrchk_timer.data =
-					(unsigned long) dd;
+				setup_timer(&dd->ipath_intrchk_timer,
+						verify_interrupt,
+						(unsigned long)dd);
 			}
 			dd->ipath_intrchk_timer.expires = jiffies + HZ/2;
 			add_timer(&dd->ipath_intrchk_timer);
-- 
1.9.1


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

* [PATCH 3/4 v2] staging: ipath: ipath_sdma: Use setup_timer
  2015-10-25 10:17 [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 2/4 v2] staging: ipath: ipath_init_chip: " Muhammad Falak R Wani
@ 2015-10-25 10:17 ` Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 4/4 v2] staging: ipath: ipath_verbs: " Muhammad Falak R Wani
  2015-10-25 11:21 ` [PATCH 1/4 v2] staging: ipath: ipath_driver: " Leon Romanovsky
  3 siblings, 0 replies; 9+ messages in thread
From: Muhammad Falak R Wani @ 2015-10-25 10:17 UTC (permalink / raw)
  To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman, linux-rdma, devel, linux-kernel
  Cc: Muhammad Falak R Wani

Use the timer API function setup_timer instead of init_timer, removing
the structure field assignments.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
v2 changes:
	-> Change the subject line to a be more specific

mfrw

 drivers/staging/rdma/ipath/ipath_sdma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_sdma.c b/drivers/staging/rdma/ipath/ipath_sdma.c
index 17a5177..1ffc06a 100644
--- a/drivers/staging/rdma/ipath/ipath_sdma.c
+++ b/drivers/staging/rdma/ipath/ipath_sdma.c
@@ -400,9 +400,9 @@ static int alloc_sdma(struct ipath_devdata *dd)
 	}
 	dd->ipath_sdma_head_dma[0] = 0;
 
-	init_timer(&dd->ipath_sdma_vl15_timer);
-	dd->ipath_sdma_vl15_timer.function = vl15_watchdog_timeout;
-	dd->ipath_sdma_vl15_timer.data = (unsigned long)dd;
+	setup_timer(&dd->ipath_sdma_vl15_timer, vl15_watchdog_timeout,
+			(unsigned long)dd);
+
 	atomic_set(&dd->ipath_sdma_vl15_count, 0);
 
 	goto done;
-- 
1.9.1


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

* [PATCH 4/4 v2] staging: ipath: ipath_verbs: Use setup_timer
  2015-10-25 10:17 [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 2/4 v2] staging: ipath: ipath_init_chip: " Muhammad Falak R Wani
  2015-10-25 10:17 ` [PATCH 3/4 v2] staging: ipath: ipath_sdma: " Muhammad Falak R Wani
@ 2015-10-25 10:17 ` Muhammad Falak R Wani
  2015-10-25 11:21 ` [PATCH 1/4 v2] staging: ipath: ipath_driver: " Leon Romanovsky
  3 siblings, 0 replies; 9+ messages in thread
From: Muhammad Falak R Wani @ 2015-10-25 10:17 UTC (permalink / raw)
  To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman, linux-rdma, devel, linux-kernel
  Cc: Muhammad Falak R Wani

Use the timer API function setup_timer instead of init_timer, removing
the structure field assignments.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
v2 changes:
	-> Change the subject line to a be more specific

mfrw

 drivers/staging/rdma/ipath/ipath_verbs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rdma/ipath/ipath_verbs.c b/drivers/staging/rdma/ipath/ipath_verbs.c
index 40f7f05..fa8d02b 100644
--- a/drivers/staging/rdma/ipath/ipath_verbs.c
+++ b/drivers/staging/rdma/ipath/ipath_verbs.c
@@ -1956,9 +1956,8 @@ static int enable_timer(struct ipath_devdata *dd)
 				 dd->ipath_gpio_mask);
 	}
 
-	init_timer(&dd->verbs_timer);
-	dd->verbs_timer.function = __verbs_timer;
-	dd->verbs_timer.data = (unsigned long)dd;
+	setup_timer(&dd->verbs_timer, __verbs_timer, (unsigned long)dd);
+
 	dd->verbs_timer.expires = jiffies + 1;
 	add_timer(&dd->verbs_timer);
 
-- 
1.9.1


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

* Re: [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
  2015-10-25 10:17 [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer Muhammad Falak R Wani
                   ` (2 preceding siblings ...)
  2015-10-25 10:17 ` [PATCH 4/4 v2] staging: ipath: ipath_verbs: " Muhammad Falak R Wani
@ 2015-10-25 11:21 ` Leon Romanovsky
  2015-10-27  9:19   ` Dan Carpenter
  3 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2015-10-25 11:21 UTC (permalink / raw)
  To: Muhammad Falak R Wani
  Cc: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
	Greg Kroah-Hartman, linux-rdma, devel, linux-kernel

On Sun, Oct 25, 2015 at 12:17 PM, Muhammad Falak R Wani
<falakreyaz@gmail.com> wrote:
Please follow standard naming convention for the patches.
It should be [PATCH v2 1/4] and not [PATCH 1/4 v2].

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

* Re: [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
  2015-10-25 11:21 ` [PATCH 1/4 v2] staging: ipath: ipath_driver: " Leon Romanovsky
@ 2015-10-27  9:19   ` Dan Carpenter
  2015-10-27  9:45     ` Leon Romanovsky
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2015-10-27  9:19 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Muhammad Falak R Wani, devel, linux-rdma, Greg Kroah-Hartman,
	linux-kernel, Mike Marciniszyn, Doug Ledford, Sean Hefty,
	Hal Rosenstock

On Sun, Oct 25, 2015 at 01:21:11PM +0200, Leon Romanovsky wrote:
> On Sun, Oct 25, 2015 at 12:17 PM, Muhammad Falak R Wani
> <falakreyaz@gmail.com> wrote:
> Please follow standard naming convention for the patches.
> It should be [PATCH v2 1/4] and not [PATCH 1/4 v2].

Does this matter?  It's in a thread so it sorts fine either way.

regards,
dan carpenter


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

* Re: [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
  2015-10-27  9:19   ` Dan Carpenter
@ 2015-10-27  9:45     ` Leon Romanovsky
  2015-10-27 11:10       ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2015-10-27  9:45 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Muhammad Falak R Wani, devel, linux-rdma, Greg Kroah-Hartman,
	linux-kernel, Mike Marciniszyn, Doug Ledford, Sean Hefty,
	Hal Rosenstock

On Tue, Oct 27, 2015 at 11:19 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> On Sun, Oct 25, 2015 at 01:21:11PM +0200, Leon Romanovsky wrote:
>> On Sun, Oct 25, 2015 at 12:17 PM, Muhammad Falak R Wani
>> <falakreyaz@gmail.com> wrote:
>> Please follow standard naming convention for the patches.
>> It should be [PATCH v2 1/4] and not [PATCH 1/4 v2].
>
> Does this matter?  It's in a thread so it sorts fine either way.
It will be wise if people read guides and follow examples.

[1] https://www.kernel.org/doc/Documentation/SubmittingPatches


>
> regards,
> dan carpenter
>

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

* Re: [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
  2015-10-27  9:45     ` Leon Romanovsky
@ 2015-10-27 11:10       ` Dan Carpenter
  2015-10-27 14:12         ` Muhammad Falak R Wani
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2015-10-27 11:10 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: devel, linux-rdma, Greg Kroah-Hartman, linux-kernel,
	Mike Marciniszyn, Doug Ledford, Muhammad Falak R Wani,
	Sean Hefty, Hal Rosenstock

On Tue, Oct 27, 2015 at 11:45:18AM +0200, Leon Romanovsky wrote:
> On Tue, Oct 27, 2015 at 11:19 AM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > On Sun, Oct 25, 2015 at 01:21:11PM +0200, Leon Romanovsky wrote:
> >> On Sun, Oct 25, 2015 at 12:17 PM, Muhammad Falak R Wani
> >> <falakreyaz@gmail.com> wrote:
> >> Please follow standard naming convention for the patches.
> >> It should be [PATCH v2 1/4] and not [PATCH 1/4 v2].
> >
> > Does this matter?  It's in a thread so it sorts fine either way.
> It will be wise if people read guides and follow examples.
> 
> [1] https://www.kernel.org/doc/Documentation/SubmittingPatches

That document doesn't really specify one way or the other.  And even if
it did then why would you care?  Stop being so picky for no reason.

regards,
dan carpenter


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

* Re: [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer
  2015-10-27 11:10       ` Dan Carpenter
@ 2015-10-27 14:12         ` Muhammad Falak R Wani
  0 siblings, 0 replies; 9+ messages in thread
From: Muhammad Falak R Wani @ 2015-10-27 14:12 UTC (permalink / raw)
  To: Dan Carpenter, Leon Romanovsky
  Cc: devel, linux-rdma, Greg Kroah-Hartman, linux-kernel,
	Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock



On October 27, 2015 4:40:42 PM GMT+05:30, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>On Tue, Oct 27, 2015 at 11:45:18AM +0200, Leon Romanovsky wrote:
>> On Tue, Oct 27, 2015 at 11:19 AM, Dan Carpenter
>> <dan.carpenter@oracle.com> wrote:
>> > On Sun, Oct 25, 2015 at 01:21:11PM +0200, Leon Romanovsky wrote:
>> >> On Sun, Oct 25, 2015 at 12:17 PM, Muhammad Falak R Wani
>> >> <falakreyaz@gmail.com> wrote:
>> >> Please follow standard naming convention for the patches.
>> >> It should be [PATCH v2 1/4] and not [PATCH 1/4 v2].
>> >
>> > Does this matter?  It's in a thread so it sorts fine either way.
>> It will be wise if people read guides and follow examples.
>> 
>> [1] https://www.kernel.org/doc/Documentation/SubmittingPatches
>
>That document doesn't really specify one way or the other.  And even if
>it did then why would you care?  Stop being so picky for no reason.
>
>regards,
>dan carpenter

Sorry, my bad . Won't repeat such mistakes.
-- 
mfrw

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

end of thread, other threads:[~2015-10-27 14:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-25 10:17 [PATCH 1/4 v2] staging: ipath: ipath_driver: Use setup_timer Muhammad Falak R Wani
2015-10-25 10:17 ` [PATCH 2/4 v2] staging: ipath: ipath_init_chip: " Muhammad Falak R Wani
2015-10-25 10:17 ` [PATCH 3/4 v2] staging: ipath: ipath_sdma: " Muhammad Falak R Wani
2015-10-25 10:17 ` [PATCH 4/4 v2] staging: ipath: ipath_verbs: " Muhammad Falak R Wani
2015-10-25 11:21 ` [PATCH 1/4 v2] staging: ipath: ipath_driver: " Leon Romanovsky
2015-10-27  9:19   ` Dan Carpenter
2015-10-27  9:45     ` Leon Romanovsky
2015-10-27 11:10       ` Dan Carpenter
2015-10-27 14:12         ` Muhammad Falak R Wani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).