* [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
@ 2019-04-01 16:58 Madhumitha Prabakaran
2019-04-01 19:39 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Madhumitha Prabakaran @ 2019-04-01 16:58 UTC (permalink / raw)
To: gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran
Use list_entry() instead of container_of() in function,
ieee80211_wx_sync_scan_wq(), as the function to return the
parent structure containing any list_head is defined to use
list_entry() as per the definition in include/linux/list.h#L348.
Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
---
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index 81020fbcdc20..76daec98212e 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -300,7 +300,9 @@ EXPORT_SYMBOL(ieee80211_wx_set_mode);
void ieee80211_wx_sync_scan_wq(struct work_struct *work)
{
- struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+ struct ieee80211_device *ieee = list_entry(work,
+ struct ieee80211_device,
+ wx_sync_scan_wq);
short chan;
enum ht_extension_chan_offset chan_offset = 0;
enum ht_channel_width bandwidth = 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
2019-04-01 16:58 [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq() Madhumitha Prabakaran
@ 2019-04-01 19:39 ` Julia Lawall
2019-04-01 21:53 ` Madhumthia Prabakaran
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-04-01 19:39 UTC (permalink / raw)
To: Madhumitha Prabakaran; +Cc: gregkh, outreachy-kernel
On Mon, 1 Apr 2019, Madhumitha Prabakaran wrote:
> Use list_entry() instead of container_of() in function,
> ieee80211_wx_sync_scan_wq(), as the function to return the
> parent structure containing any list_head is defined to use
> list_entry() as per the definition in include/linux/list.h#L348.
list_entry is for lists. The wx_sync_scan_wq field has type work_struct.
julia
>
> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> ---
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> index 81020fbcdc20..76daec98212e 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> @@ -300,7 +300,9 @@ EXPORT_SYMBOL(ieee80211_wx_set_mode);
>
> void ieee80211_wx_sync_scan_wq(struct work_struct *work)
> {
> - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
> + struct ieee80211_device *ieee = list_entry(work,
> + struct ieee80211_device,
> + wx_sync_scan_wq);
> short chan;
> enum ht_extension_chan_offset chan_offset = 0;
> enum ht_channel_width bandwidth = 0;
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190401165827.18731-1-madhumithabiw%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
2019-04-01 19:39 ` [Outreachy kernel] " Julia Lawall
@ 2019-04-01 21:53 ` Madhumthia Prabakaran
2019-04-02 5:43 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Madhumthia Prabakaran @ 2019-04-01 21:53 UTC (permalink / raw)
To: Julia Lawall, outreachy-kernel
On Mon, Apr 01, 2019 at 09:39:32PM +0200, Julia Lawall wrote:
>
>
> On Mon, 1 Apr 2019, Madhumitha Prabakaran wrote:
>
> > Use list_entry() instead of container_of() in function,
> > ieee80211_wx_sync_scan_wq(), as the function to return the
> > parent structure containing any list_head is defined to use
> > list_entry() as per the definition in include/linux/list.h#L348.
>
> list_entry is for lists. The wx_sync_scan_wq field has type work_struct.
Thats true. Though the wx_sync_scan_wq has type work_struct, the structure
work_struct has a member of struct list_head in it.
thanks
>
> julia
>
> >
> > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > ---
> > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > index 81020fbcdc20..76daec98212e 100644
> > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > @@ -300,7 +300,9 @@ EXPORT_SYMBOL(ieee80211_wx_set_mode);
> >
> > void ieee80211_wx_sync_scan_wq(struct work_struct *work)
> > {
> > - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
> > + struct ieee80211_device *ieee = list_entry(work,
> > + struct ieee80211_device,
> > + wx_sync_scan_wq);
> > short chan;
> > enum ht_extension_chan_offset chan_offset = 0;
> > enum ht_channel_width bandwidth = 0;
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190401165827.18731-1-madhumithabiw%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1904012138510.2530%40hadrien.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
2019-04-01 21:53 ` Madhumthia Prabakaran
@ 2019-04-02 5:43 ` Julia Lawall
2019-04-02 5:47 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-04-02 5:43 UTC (permalink / raw)
To: Madhumthia Prabakaran; +Cc: outreachy-kernel
On Mon, 1 Apr 2019, Madhumthia Prabakaran wrote:
> On Mon, Apr 01, 2019 at 09:39:32PM +0200, Julia Lawall wrote:
> >
> >
> > On Mon, 1 Apr 2019, Madhumitha Prabakaran wrote:
> >
> > > Use list_entry() instead of container_of() in function,
> > > ieee80211_wx_sync_scan_wq(), as the function to return the
> > > parent structure containing any list_head is defined to use
> > > list_entry() as per the definition in include/linux/list.h#L348.
> >
> > list_entry is for lists. The wx_sync_scan_wq field has type work_struct.
>
> Thats true. Though the wx_sync_scan_wq has type work_struct, the structure
> work_struct has a member of struct list_head in it.
The field name itself should have type list_head. You can write your
Coccinelle script to check for this. Since structure types are often
defined in header files, you may need to use the command line argument
--all-includes (try to include all mentioned header files).
julia
>
> thanks
>
>
> >
> > julia
> >
> > >
> > > Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
> > > ---
> > > drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > > index 81020fbcdc20..76daec98212e 100644
> > > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
> > > @@ -300,7 +300,9 @@ EXPORT_SYMBOL(ieee80211_wx_set_mode);
> > >
> > > void ieee80211_wx_sync_scan_wq(struct work_struct *work)
> > > {
> > > - struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
> > > + struct ieee80211_device *ieee = list_entry(work,
> > > + struct ieee80211_device,
> > > + wx_sync_scan_wq);
> > > short chan;
> > > enum ht_extension_chan_offset chan_offset = 0;
> > > enum ht_channel_width bandwidth = 0;
> > > --
> > > 2.17.1
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190401165827.18731-1-madhumithabiw%40gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1904012138510.2530%40hadrien.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190401215305.GB11046%40madhuleo.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
2019-04-02 5:43 ` Julia Lawall
@ 2019-04-02 5:47 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2019-04-02 5:47 UTC (permalink / raw)
To: Julia Lawall; +Cc: Madhumthia Prabakaran, outreachy-kernel
On Tue, Apr 02, 2019 at 07:43:44AM +0200, Julia Lawall wrote:
>
>
> On Mon, 1 Apr 2019, Madhumthia Prabakaran wrote:
>
> > On Mon, Apr 01, 2019 at 09:39:32PM +0200, Julia Lawall wrote:
> > >
> > >
> > > On Mon, 1 Apr 2019, Madhumitha Prabakaran wrote:
> > >
> > > > Use list_entry() instead of container_of() in function,
> > > > ieee80211_wx_sync_scan_wq(), as the function to return the
> > > > parent structure containing any list_head is defined to use
> > > > list_entry() as per the definition in include/linux/list.h#L348.
> > >
> > > list_entry is for lists. The wx_sync_scan_wq field has type work_struct.
> >
> > Thats true. Though the wx_sync_scan_wq has type work_struct, the structure
> > work_struct has a member of struct list_head in it.
>
> The field name itself should have type list_head. You can write your
> Coccinelle script to check for this. Since structure types are often
> defined in header files, you may need to use the command line argument
> --all-includes (try to include all mentioned header files).
Yes, do not use list_entry() for things that are not a list. I'll go
drop this patch from my tree now.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-02 5:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 16:58 [PATCH] Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq() Madhumitha Prabakaran
2019-04-01 19:39 ` [Outreachy kernel] " Julia Lawall
2019-04-01 21:53 ` Madhumthia Prabakaran
2019-04-02 5:43 ` Julia Lawall
2019-04-02 5:47 ` Greg KH
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.