From: Kalle Valo <kvalo@qca.qualcomm.com>
To: greearb@candelatech.com
Cc: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org
Subject: Re: [PATCH] ath10k: improve vdev map handling.
Date: Fri, 16 May 2014 16:37:27 +0300 [thread overview]
Message-ID: <878uq16e08.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1398882179-17100-1-git-send-email-greearb@candelatech.com> (greearb@candelatech.com's message of "Wed, 30 Apr 2014 11:22:59 -0700")
greearb@candelatech.com writes:
> From: Ben Greear <greearb@candelatech.com>
>
> Check vdev map has space before calling ffs,
> fix invalid cleanup in failure to create vdev
> case.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
[...]
> @@ -594,14 +594,14 @@ static int ath10k_monitor_vdev_create(struct ath10k *ar)
>
> lockdep_assert_held(&ar->conf_mutex);
>
> - bit = ffs(ar->free_vdev_map);
> - if (bit == 0) {
> + if (!ar->free_vdev_map) {
As we are using ar->free_vdev_map as a bitmap, I think !foo is just
confusing. Wouldn't '== 0' make more sense here?
> @@ -638,7 +632,7 @@ static int ath10k_monitor_vdev_delete(struct ath10k *ar)
> return ret;
> }
>
> - ar->free_vdev_map |= 1 << (ar->monitor_vdev_id);
> + ar->free_vdev_map |= (1 << ar->monitor_vdev_id);
Aren't the parentheses useless here?
> @@ -2622,11 +2616,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
> INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
> INIT_LIST_HEAD(&arvif->list);
>
> - bit = ffs(ar->free_vdev_map);
> - if (bit == 0) {
> + if (!ar->free_vdev_map) {
Ditto about '==0'.
> + ath10k_warn("Free vdev map is empty, no more interfaces allowed.\n");
> ret = -EBUSY;
> goto err;
> }
> + bit = ffs(ar->free_vdev_map);
Empty line after '}', please.
> @@ -2669,7 +2664,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
> goto err;
> }
>
> - ar->free_vdev_map &= ~BIT(arvif->vdev_id);
> + ar->free_vdev_map &= ~(1 << arvif->vdev_id);
Why remove the BIT()? Not that it matters much, I just think it's easier
to read when BIT() macro is used. Would be good to convert all cases to
use BIT anyway, but that's for a separate patch.
> err_vdev_delete:
> ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
> - ar->free_vdev_map &= ~BIT(arvif->vdev_id);
> + ar->free_vdev_map |= (1 << arvif->vdev_id);
Again why remove BIT()?
> @@ -2792,7 +2787,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
> }
> spin_unlock_bh(&ar->data_lock);
>
> - ar->free_vdev_map |= 1 << (arvif->vdev_id);
> + ar->free_vdev_map |= (1 << arvif->vdev_id);
Do we need the parenthesis?
--
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: <greearb@candelatech.com>
Cc: <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] ath10k: improve vdev map handling.
Date: Fri, 16 May 2014 16:37:27 +0300 [thread overview]
Message-ID: <878uq16e08.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1398882179-17100-1-git-send-email-greearb@candelatech.com> (greearb@candelatech.com's message of "Wed, 30 Apr 2014 11:22:59 -0700")
greearb@candelatech.com writes:
> From: Ben Greear <greearb@candelatech.com>
>
> Check vdev map has space before calling ffs,
> fix invalid cleanup in failure to create vdev
> case.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
[...]
> @@ -594,14 +594,14 @@ static int ath10k_monitor_vdev_create(struct ath10k *ar)
>
> lockdep_assert_held(&ar->conf_mutex);
>
> - bit = ffs(ar->free_vdev_map);
> - if (bit == 0) {
> + if (!ar->free_vdev_map) {
As we are using ar->free_vdev_map as a bitmap, I think !foo is just
confusing. Wouldn't '== 0' make more sense here?
> @@ -638,7 +632,7 @@ static int ath10k_monitor_vdev_delete(struct ath10k *ar)
> return ret;
> }
>
> - ar->free_vdev_map |= 1 << (ar->monitor_vdev_id);
> + ar->free_vdev_map |= (1 << ar->monitor_vdev_id);
Aren't the parentheses useless here?
> @@ -2622,11 +2616,12 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
> INIT_WORK(&arvif->wep_key_work, ath10k_tx_wep_key_work);
> INIT_LIST_HEAD(&arvif->list);
>
> - bit = ffs(ar->free_vdev_map);
> - if (bit == 0) {
> + if (!ar->free_vdev_map) {
Ditto about '==0'.
> + ath10k_warn("Free vdev map is empty, no more interfaces allowed.\n");
> ret = -EBUSY;
> goto err;
> }
> + bit = ffs(ar->free_vdev_map);
Empty line after '}', please.
> @@ -2669,7 +2664,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
> goto err;
> }
>
> - ar->free_vdev_map &= ~BIT(arvif->vdev_id);
> + ar->free_vdev_map &= ~(1 << arvif->vdev_id);
Why remove the BIT()? Not that it matters much, I just think it's easier
to read when BIT() macro is used. Would be good to convert all cases to
use BIT anyway, but that's for a separate patch.
> err_vdev_delete:
> ath10k_wmi_vdev_delete(ar, arvif->vdev_id);
> - ar->free_vdev_map &= ~BIT(arvif->vdev_id);
> + ar->free_vdev_map |= (1 << arvif->vdev_id);
Again why remove BIT()?
> @@ -2792,7 +2787,7 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,
> }
> spin_unlock_bh(&ar->data_lock);
>
> - ar->free_vdev_map |= 1 << (arvif->vdev_id);
> + ar->free_vdev_map |= (1 << arvif->vdev_id);
Do we need the parenthesis?
--
Kalle Valo
next prev parent reply other threads:[~2014-05-16 13:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 18:22 [PATCH] ath10k: improve vdev map handling greearb
2014-04-30 18:22 ` greearb
2014-05-16 13:18 ` Kalle Valo
2014-05-16 13:18 ` Kalle Valo
2014-05-16 13:26 ` Ben Greear
2014-05-16 13:26 ` Ben Greear
2014-05-16 13:37 ` Kalle Valo [this message]
2014-05-16 13:37 ` Kalle Valo
2014-05-16 14:01 ` Ben Greear
2014-05-16 14:01 ` Ben Greear
2014-05-16 14:06 ` Kalle Valo
2014-05-16 14:06 ` Kalle Valo
2014-05-16 14:11 ` Ben Greear
2014-05-16 14:11 ` Ben Greear
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=878uq16e08.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@qca.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=greearb@candelatech.com \
--cc=linux-wireless@vger.kernel.org \
/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 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.