linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Bing Zhao <bzhao@marvell.com>
Cc: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	Amitkumar Karwar <akarwar@marvell.com>,
	Kiran Divekar <dkiran@marvell.com>,
	Frank Huang <frankh@marvell.com>
Subject: Re: [PATCH v2] mwifiex: remove linked list implementation
Date: Thu, 13 Jan 2011 10:19:40 +0100	[thread overview]
Message-ID: <1294910380.3725.2.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1294895783-26539-1-git-send-email-bzhao@marvell.com>

On Wed, 2011-01-12 at 21:16 -0800, Bing Zhao wrote:

Better,

> +	list_del((struct list_head *) tx_ba_tsr_tbl);

but you shouldn't be casting at all. Do list_del(&tx_ba_tsr_tbl->list);
or so instead, so that this works when the list_head isn't the first
item in the struct.
 
> -	mwifiex_util_init_list((struct mwifiex_linked_list *) &priv->
> -			       tx_ba_stream_tbl_ptr);
> +	INIT_LIST_HEAD((struct list_head *) &priv->tx_ba_stream_tbl_ptr);

Same here. Try to get rid of all casts. If you have any specific ones
that you don't know how to get rid of, feel free to ask.

> -	while (ra_list != (struct mwifiex_ra_list_tbl *) ra_list_hhead) {
> -		if (mwifiex_util_peek_list(&ra_list->buf_head, true))
> +	int is_list_empty;
> +	unsigned long flags;
> +
> +	list_for_each_entry(ra_list, ra_list_hhead, list) {
> +		spin_lock_irqsave(&ra_list->ra_list_tbl_lock, flags);
> +		is_list_empty = list_empty(&ra_list->buf_head);
> +		spin_unlock_irqrestore(&ra_list->ra_list_tbl_lock, flags);
> +		if (!is_list_empty)
>  			return false;
> -
> -		ra_list = (struct mwifiex_ra_list_tbl *) ra_list->next;
>  	}

This seems rather dubious. If the list is empty, the for_each_entry
won't do anything? Or is that some other list?

johannes


  reply	other threads:[~2011-01-13  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13  5:16 [PATCH v2] mwifiex: remove linked list implementation Bing Zhao
2011-01-13  9:19 ` Johannes Berg [this message]
2011-01-13 22:58   ` Bing Zhao

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=1294910380.3725.2.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=akarwar@marvell.com \
    --cc=bzhao@marvell.com \
    --cc=dkiran@marvell.com \
    --cc=frankh@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).