[net-next] wifi: mwifiex: Use list_count_nodes()
Commit Message
mwifiex_wmm_list_len() is the same as list_count_nodes(), so use the latter
instead of hand writing it.
Turn 'ba_stream_num' and 'ba_stream_max' in size_t to keep the same type
as what is returned by list_count_nodes().
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/wireless/marvell/mwifiex/11n.h | 4 ++--
drivers/net/wireless/marvell/mwifiex/wmm.h | 15 ---------------
2 files changed, 2 insertions(+), 17 deletions(-)
Comments
On Wed, Apr 26, 2023 at 09:32:36PM +0200, Christophe JAILLET wrote:
> mwifiex_wmm_list_len() is the same as list_count_nodes(), so use the latter
> instead of hand writing it.
>
> Turn 'ba_stream_num' and 'ba_stream_max' in size_t to keep the same type
> as what is returned by list_count_nodes().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/wireless/marvell/mwifiex/11n.h | 4 ++--
> drivers/net/wireless/marvell/mwifiex/wmm.h | 15 ---------------
> 2 files changed, 2 insertions(+), 17 deletions(-)
FWIW:
Reviewed-by: Brian Norris <briannorris@chromium.org>
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> mwifiex_wmm_list_len() is the same as list_count_nodes(), so use the latter
> instead of hand writing it.
>
> Turn 'ba_stream_num' and 'ba_stream_max' in size_t to keep the same type
> as what is returned by list_count_nodes().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Reviewed-by: Brian Norris <briannorris@chromium.org>
Patch applied to wireless-next.git, thanks.
c401bde6ead4 wifi: mwifiex: Use list_count_nodes()
@@ -102,14 +102,14 @@ static inline u8 mwifiex_space_avail_for_new_ba_stream(
{
struct mwifiex_private *priv;
u8 i;
- u32 ba_stream_num = 0, ba_stream_max;
+ size_t ba_stream_num = 0, ba_stream_max;
ba_stream_max = MWIFIEX_MAX_TX_BASTREAM_SUPPORTED;
for (i = 0; i < adapter->priv_num; i++) {
priv = adapter->priv[i];
if (priv)
- ba_stream_num += mwifiex_wmm_list_len(
+ ba_stream_num += list_count_nodes(
&priv->tx_ba_stream_tbl_ptr);
}
@@ -38,21 +38,6 @@ mwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr)
return skb->priority;
}
-/*
- * This function gets the length of a list.
- */
-static inline int
-mwifiex_wmm_list_len(struct list_head *head)
-{
- struct list_head *pos;
- int count = 0;
-
- list_for_each(pos, head)
- ++count;
-
- return count;
-}
-
/*
* This function checks if a RA list is empty or not.
*/