From: Dan Carpenter <dan.carpenter@oracle.com>
To: Srishti Sharma <srishtishar@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
outreachy-kernel@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] Staging: rtl8188eu: core: rtw_mlme_ext: Use list_for_each_entry_safe
Date: Thu, 19 Oct 2017 11:14:39 +0300 [thread overview]
Message-ID: <20171019081439.wwu7zlxhgweapm33@mwanda> (raw)
In-Reply-To: <09469a9cece4c67261e5bd333dbfe4c741d59f4c.1508354332.git.srishtishar@gmail.com>
On Thu, Oct 19, 2017 at 01:01:39AM +0530, Srishti Sharma wrote:
> This is a cleanup patch and doesn't change runtime behaviour. It
> changes an open coded list traversal to use list_for_each_entry_safe.
> Done using the following semantic patch by coccinelle.
>
> @r@
> struct list_head* l;
> expression e;
> identifier m,list_del_init,f;
> type T1;
> T1* pos;
> iterator name list_for_each_entry_safe;
> @@
>
> f(...){
>
> +T1* tmp;
> <+...
> -while(...)
> +list_for_each_entry_safe(pos,tmp,l,m)
> {
> ...
> -pos = container_of(l,T1,m);
> ...
> -l=e;
> <+...
> list_del_init(&pos->m)
> ...+>
> }
> ...+>
>
> }
>
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> index 685c071..cf85fb4 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
> @@ -5463,6 +5463,8 @@ u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf)
>
> u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)
> {
> + struct xmit_frame *tmp;
> +
> if (send_beacon(padapter) == _FAIL) {
> DBG_88E("issue_beacon, fail!\n");
> return H2C_PARAMETERS_ERROR;
> @@ -5486,11 +5488,8 @@ u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf)
> xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
> xmitframe_plist = xmitframe_phead->next;
>
> - while (xmitframe_phead != xmitframe_plist) {
> - pxmitframe = container_of(xmitframe_plist, struct xmit_frame, list);
> -
> - xmitframe_plist = xmitframe_plist->next;
> -
> + list_for_each_entry_safe(pxmitframe, tmp,
> + xmitframe_plist, list) {
I'm pretty sure we should get rid of the xmitframe_plist variable and
use xmitframe_phead here.
regards,
dan carpenter
next prev parent reply other threads:[~2017-10-19 8:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 19:30 [PATCH 0/4] Code cleanup Srishti Sharma
2017-10-18 19:30 ` [PATCH 1/4] Staging: rtl8188eu: core: rtw_xmit: Use list_for_each_entry_safe Srishti Sharma
2017-10-18 19:31 ` [PATCH 2/4] Staging: rtl8188eu: core: rtw_ap: " Srishti Sharma
2017-10-19 8:17 ` Dan Carpenter
2017-10-18 19:31 ` [PATCH 3/4] Staging: rtl8188eu: core: rtw_mlme_ext: " Srishti Sharma
2017-10-19 8:14 ` Dan Carpenter [this message]
2017-10-18 19:32 ` [PATCH 4/4] Staging: rtl8188eu: core: Use list_entry instead of container_of Srishti Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171019081439.wwu7zlxhgweapm33@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=srishtishar@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®