netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: Use to_delayed_work()
@ 2016-02-17 12:33 Amitoj Kaur Chawla
  2016-02-18  0:55 ` Julian Calaby
  2016-03-07 12:23 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-17 12:33 UTC (permalink / raw)
  To: akarwar, nishants, kvalo, linux-wireless, netdev, linux-kernel
  Cc: julia.lawall

Introduce the use of to_delayed_work() helper function instead of open
coding it with container_of()

A simplified version of the Coccinelle semantic patch used to make
this change is:

//<smpl>
@@
expression a;
symbol work;
@@
- container_of(a, struct delayed_work, work)
+ to_delayed_work(a)
//</smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/11h.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c
index 71a1b58..81c60d0 100644
--- a/drivers/net/wireless/marvell/mwifiex/11h.c
+++ b/drivers/net/wireless/marvell/mwifiex/11h.c
@@ -123,8 +123,7 @@ void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
 void mwifiex_dfs_cac_work_queue(struct work_struct *work)
 {
 	struct cfg80211_chan_def chandef;
-	struct delayed_work *delayed_work =
-			container_of(work, struct delayed_work, work);
+	struct delayed_work *delayed_work = to_delayed_work(work);
 	struct mwifiex_private *priv =
 			container_of(delayed_work, struct mwifiex_private,
 				     dfs_cac_work);
@@ -289,8 +288,7 @@ int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
 void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
 {
 	struct mwifiex_uap_bss_param *bss_cfg;
-	struct delayed_work *delayed_work =
-			container_of(work, struct delayed_work, work);
+	struct delayed_work *delayed_work = to_delayed_work(work);
 	struct mwifiex_private *priv =
 			container_of(delayed_work, struct mwifiex_private,
 				     dfs_chan_sw_work);
-- 
1.9.1

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

* Re: [PATCH] mwifiex: Use to_delayed_work()
  2016-02-17 12:33 [PATCH] mwifiex: Use to_delayed_work() Amitoj Kaur Chawla
@ 2016-02-18  0:55 ` Julian Calaby
  2016-03-07 12:23 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Julian Calaby @ 2016-02-18  0:55 UTC (permalink / raw)
  To: Amitoj Kaur Chawla
  Cc: Amitkumar Karwar, Nishant Sarmukadam, Kalle Valo, linux-wireless,
	netdev, linux-kernel@vger.kernel.org, Julia Lawall

Hi All,

On Wed, Feb 17, 2016 at 11:33 PM, Amitoj Kaur Chawla
<amitoj1606@gmail.com> wrote:
> Introduce the use of to_delayed_work() helper function instead of open
> coding it with container_of()
>
> A simplified version of the Coccinelle semantic patch used to make
> this change is:
>
> //<smpl>
> @@
> expression a;
> symbol work;
> @@
> - container_of(a, struct delayed_work, work)
> + to_delayed_work(a)
> //</smpl>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

Looks right to me.

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

Thanks,

> ---
>  drivers/net/wireless/marvell/mwifiex/11h.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c
> index 71a1b58..81c60d0 100644
> --- a/drivers/net/wireless/marvell/mwifiex/11h.c
> +++ b/drivers/net/wireless/marvell/mwifiex/11h.c
> @@ -123,8 +123,7 @@ void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer,
>  void mwifiex_dfs_cac_work_queue(struct work_struct *work)
>  {
>         struct cfg80211_chan_def chandef;
> -       struct delayed_work *delayed_work =
> -                       container_of(work, struct delayed_work, work);
> +       struct delayed_work *delayed_work = to_delayed_work(work);
>         struct mwifiex_private *priv =
>                         container_of(delayed_work, struct mwifiex_private,
>                                      dfs_cac_work);
> @@ -289,8 +288,7 @@ int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
>  void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
>  {
>         struct mwifiex_uap_bss_param *bss_cfg;
> -       struct delayed_work *delayed_work =
> -                       container_of(work, struct delayed_work, work);
> +       struct delayed_work *delayed_work = to_delayed_work(work);
>         struct mwifiex_private *priv =
>                         container_of(delayed_work, struct mwifiex_private,
>                                      dfs_chan_sw_work);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: mwifiex: Use to_delayed_work()
  2016-02-17 12:33 [PATCH] mwifiex: Use to_delayed_work() Amitoj Kaur Chawla
  2016-02-18  0:55 ` Julian Calaby
@ 2016-03-07 12:23 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2016-03-07 12:23 UTC (permalink / raw)
  To: Amitoj Kaur Chawla
  Cc: akarwar, nishants, linux-wireless, netdev, linux-kernel,
	julia.lawall


> Introduce the use of to_delayed_work() helper function instead of open
> coding it with container_of()
> 
> A simplified version of the Coccinelle semantic patch used to make
> this change is:
> 
> //<smpl>
> @@
> expression a;
> symbol work;
> @@
> - container_of(a, struct delayed_work, work)
> + to_delayed_work(a)
> //</smpl>
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

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

end of thread, other threads:[~2016-03-07 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 12:33 [PATCH] mwifiex: Use to_delayed_work() Amitoj Kaur Chawla
2016-02-18  0:55 ` Julian Calaby
2016-03-07 12:23 ` Kalle Valo

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