linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Use setup_timer instead of init_timer
@ 2017-03-03 12:45 Jiri Slaby
  2017-03-06 12:23 ` Johannes Berg
  2017-03-06 12:25 ` Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: Jiri Slaby @ 2017-03-03 12:45 UTC (permalink / raw)
  To: johannes
  Cc: linux-kernel, Ondřej Lysoněk, Jiri Slaby,
	David S. Miller, linux-wireless, netdev

From: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>

Use setup_timer() and setup_deferrable_timer() to set the data and
function timer fields. It makes the code cleaner and will allow for
easier change of the timer struct internals.

Signed-off-by: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <linux-wireless@vger.kernel.org>
Cc: <netdev@vger.kernel.org>
---
 net/mac80211/agg-rx.c | 12 ++++++------
 net/mac80211/agg-tx.c | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 4456559cb056..1b7a4daf283c 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -357,14 +357,14 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
 	spin_lock_init(&tid_agg_rx->reorder_lock);
 
 	/* rx timer */
-	tid_agg_rx->session_timer.function = sta_rx_agg_session_timer_expired;
-	tid_agg_rx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid];
-	init_timer_deferrable(&tid_agg_rx->session_timer);
+	setup_deferrable_timer(&tid_agg_rx->session_timer,
+			       sta_rx_agg_session_timer_expired,
+			       (unsigned long)&sta->timer_to_tid[tid]);
 
 	/* rx reorder timer */
-	tid_agg_rx->reorder_timer.function = sta_rx_agg_reorder_timer_expired;
-	tid_agg_rx->reorder_timer.data = (unsigned long)&sta->timer_to_tid[tid];
-	init_timer(&tid_agg_rx->reorder_timer);
+	setup_timer(&tid_agg_rx->reorder_timer,
+		    sta_rx_agg_reorder_timer_expired,
+		    (unsigned long)&sta->timer_to_tid[tid]);
 
 	/* prepare reordering buffer */
 	tid_agg_rx->reorder_buf =
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 45319cc01121..60e2a62f7bef 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -670,14 +670,14 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
 	tid_tx->timeout = timeout;
 
 	/* response timer */
-	tid_tx->addba_resp_timer.function = sta_addba_resp_timer_expired;
-	tid_tx->addba_resp_timer.data = (unsigned long)&sta->timer_to_tid[tid];
-	init_timer(&tid_tx->addba_resp_timer);
+	setup_timer(&tid_tx->addba_resp_timer,
+		    sta_addba_resp_timer_expired,
+		    (unsigned long)&sta->timer_to_tid[tid]);
 
 	/* tx timer */
-	tid_tx->session_timer.function = sta_tx_agg_session_timer_expired;
-	tid_tx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid];
-	init_timer_deferrable(&tid_tx->session_timer);
+	setup_deferrable_timer(&tid_tx->session_timer,
+			       sta_tx_agg_session_timer_expired,
+			       (unsigned long)&sta->timer_to_tid[tid]);
 
 	/* assign a dialog token */
 	sta->ampdu_mlme.dialog_token_allocator++;
-- 
2.12.0

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

* Re: [PATCH] mac80211: Use setup_timer instead of init_timer
  2017-03-03 12:45 [PATCH] mac80211: Use setup_timer instead of init_timer Jiri Slaby
@ 2017-03-06 12:23 ` Johannes Berg
  2017-03-06 12:25 ` Johannes Berg
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2017-03-06 12:23 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Ondřej Lysoněk, David S. Miller,
	linux-wireless, netdev

On Fri, 2017-03-03 at 13:45 +0100, Jiri Slaby wrote:
> From: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>
> 
> Use setup_timer() and setup_deferrable_timer() to set the data and
> function timer fields. It makes the code cleaner and will allow for
> easier change of the timer struct internals.

Applied.

johannes

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

* Re: [PATCH] mac80211: Use setup_timer instead of init_timer
  2017-03-03 12:45 [PATCH] mac80211: Use setup_timer instead of init_timer Jiri Slaby
  2017-03-06 12:23 ` Johannes Berg
@ 2017-03-06 12:25 ` Johannes Berg
  2017-03-06 12:26   ` Johannes Berg
  2017-03-06 12:35   ` Jiri Slaby
  1 sibling, 2 replies; 6+ messages in thread
From: Johannes Berg @ 2017-03-06 12:25 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Ondřej Lysoněk, David S. Miller,
	linux-wireless, netdev

On Fri, 2017-03-03 at 13:45 +0100, Jiri Slaby wrote:
> From: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>
> 
> Use setup_timer() and setup_deferrable_timer() to set the data and
> function timer fields. It makes the code cleaner and will allow for
> easier change of the timer struct internals.

Btw, I suspect you generated this with coccinelle and didn't put enough
"..." there, because you missed one in mesh_path_new() :)

Care to send a patch for that one too?

johannes

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

* Re: [PATCH] mac80211: Use setup_timer instead of init_timer
  2017-03-06 12:25 ` Johannes Berg
@ 2017-03-06 12:26   ` Johannes Berg
  2017-03-06 12:35   ` Jiri Slaby
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2017-03-06 12:26 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Ondřej Lysoněk, David S. Miller,
	linux-wireless, netdev

On Mon, 2017-03-06 at 13:25 +0100, Johannes Berg wrote:
> On Fri, 2017-03-03 at 13:45 +0100, Jiri Slaby wrote:
> > From: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>
> > 
> > Use setup_timer() and setup_deferrable_timer() to set the data and
> > function timer fields. It makes the code cleaner and will allow for
> > easier change of the timer struct internals.
> 
> Btw, I suspect you generated this with coccinelle and didn't put
> enough
> "..." there, because you missed one in mesh_path_new() :)
> 
and perhaps mesh_plink_timer_set()?

johannes

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

* Re: [PATCH] mac80211: Use setup_timer instead of init_timer
  2017-03-06 12:25 ` Johannes Berg
  2017-03-06 12:26   ` Johannes Berg
@ 2017-03-06 12:35   ` Jiri Slaby
  2017-03-06 12:36     ` Johannes Berg
  1 sibling, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2017-03-06 12:35 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-kernel, Ondřej Lysoněk, David S. Miller,
	linux-wireless, netdev

On 03/06/2017, 01:25 PM, Johannes Berg wrote:
> On Fri, 2017-03-03 at 13:45 +0100, Jiri Slaby wrote:
>> From: Ondřej Lysoněk <ondrej.lysonek@seznam.cz>
>>
>> Use setup_timer() and setup_deferrable_timer() to set the data and
>> function timer fields. It makes the code cleaner and will allow for
>> easier change of the timer struct internals.
> 
> Btw, I suspect you generated this with coccinelle and didn't put enough
> "..." there, because you missed one in mesh_path_new() :)

Not really. This is one of assignments for students I lead, so this is
done by hand every end of winter semester (Note the From line.)

> Care to send a patch for that one too?

I am just a forwarder, he received this request too, so you can try to
persuade him :).

thanks,
-- 
js
suse labs

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

* Re: [PATCH] mac80211: Use setup_timer instead of init_timer
  2017-03-06 12:35   ` Jiri Slaby
@ 2017-03-06 12:36     ` Johannes Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2017-03-06 12:36 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: linux-kernel, Ondřej Lysoněk, David S. Miller,
	linux-wireless, netdev


> Not really. This is one of assignments for students I lead, so this
> is done by hand every end of winter semester (Note the From line.)

You really should teach them about coccinelle then :-)

> > Care to send a patch for that one too?
> 
> I am just a forwarder, he received this request too, so you can try
> to persuade him :).

Hah ok. I thought you actually cared about the end result ;)

johannes

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

end of thread, other threads:[~2017-03-06 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 12:45 [PATCH] mac80211: Use setup_timer instead of init_timer Jiri Slaby
2017-03-06 12:23 ` Johannes Berg
2017-03-06 12:25 ` Johannes Berg
2017-03-06 12:26   ` Johannes Berg
2017-03-06 12:35   ` Jiri Slaby
2017-03-06 12:36     ` Johannes Berg

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).