Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
PATCH 1/1 Staging: rtl8192u: Use list_entry in ieee80211_wx_sync_scan_wq()
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.
--- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +3 -1
@@ -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 ;
Signature · 1 line
2.17.1
Quoted 4 lines · Madhumitha Prabakaran
Use
list_entry()instead ofcontainer_of()in function,ieee80211_wx_sync_scan_wq(), as the function to return the parent structure containing anylist_headis defined to uselist_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
Quoted 31 lines
Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +3
-2@@ -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 [email protected]. To post to this group, send email to [email protected].
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.
Quoted 10 lines · Julia Lawall
Quoted 4 lines · Madhumitha Prabakaran
Use
list_entry()instead ofcontainer_of()in function,ieee80211_wx_sync_scan_wq(), as the function to return the parent structure containing anylist_headis defined to uselist_entry()as per the definition in include/linux/list.h#L348.
list_entryis for lists. Thewx_sync_scan_wqfield has typework_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
Quoted 41 lines
julia
Quoted 31 lines
Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +3
-2@@ -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 [email protected]. To post to this group, send email to [email protected].
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.Signature · 5 lines
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 [email protected]. To post to this group, send email to [email protected]. 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.
Quoted 10 lines · Madhumthia Prabakaran
Quoted 9 lines · Julia Lawall
Quoted 4 lines · Madhumitha Prabakaran
Use
list_entry()instead ofcontainer_of()in function,ieee80211_wx_sync_scan_wq(), as the function to return the parent structure containing anylist_headis defined to uselist_entry()as per the definition in include/linux/list.h#L348.
Quoted 4 lines
Quoted 1 line
list_entryis for lists. Thewx_sync_scan_wqfield has typework_struct.Thats true. Though the
wx_sync_scan_wqhas typework_struct, the structurework_structhas a member of structlist_headin 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
Quoted 53 lines
thanks
Quoted 27 lines
julia
Quoted 24 lines
Signed-off-by Madhumitha Prabakaran <[email protected]>--- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c +3
-2@@ -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
Quoted 14 lines
Quoted 7 lines
--
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 [email protected]. To post to this group, send email to [email protected].
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 [email protected]. To post to this group, send email to [email protected].
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 [email protected]. To post to this group, send email to [email protected].
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.
Greg KH
maintainerQuoted 16 lines · Julia Lawall
Quoted 12 lines · Madhumthia Prabakaran
Quoted 10 lines · Julia Lawall
Quoted 4 lines · Madhumitha Prabakaran
Use
list_entry()instead ofcontainer_of()in function,ieee80211_wx_sync_scan_wq(), as the function to return the parent structure containing anylist_headis defined to uselist_entry()as per the definition in include/linux/list.h#L348.
list_entryis for lists. Thewx_sync_scan_wqfield has typework_struct.
Quoted 7 lines
Quoted 2 lines
Thats true. Though the
wx_sync_scan_wqhas typework_struct, the structurework_structhas a member of structlist_headin 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