Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] WIRELESS:  Use more obvious "is_power_of_2" macro.
@ 2007-11-06 14:47 Robert P. J. Day
  2007-11-08  8:56 ` Zhu Yi
  0 siblings, 1 reply; 3+ messages in thread
From: Robert P. J. Day @ 2007-11-06 14:47 UTC (permalink / raw)
  To: linux-wireless


Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

 drivers/net/wireless/iwlwifi/iwl3945-base.c |    3 ++-
 drivers/net/wireless/iwlwifi/iwl4965-base.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4f22a71..53b4b4e 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -50,6 +50,7 @@
 #include <linux/firmware.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <linux/log2.h>

 #include <net/ieee80211_radiotap.h>
 #include <net/mac80211.h>
@@ -343,7 +344,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,

 	/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
 	 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
-	BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
+	BUILD_BUG_ON(!is_power_of_2(TFD_QUEUE_SIZE_MAX));
 	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);

 	iwl_hw_tx_queue_init(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d60adcb..5f3bcb3 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -50,6 +50,7 @@
 #include <linux/firmware.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <linux/log2.h>

 #include <net/ieee80211_radiotap.h>
 #include <net/mac80211.h>
@@ -342,7 +343,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,

 	/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
 	 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
-	BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
+	BUILD_BUG_ON(!is_power_of_2(TFD_QUEUE_SIZE_MAX));
 	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);

 	iwl_hw_tx_queue_init(priv, txq);

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] WIRELESS:  Use more obvious "is_power_of_2" macro.
  2007-11-06 14:47 [PATCH] WIRELESS: Use more obvious "is_power_of_2" macro Robert P. J. Day
@ 2007-11-08  8:56 ` Zhu Yi
  2007-11-08 11:38   ` Robert P. J. Day
  0 siblings, 1 reply; 3+ messages in thread
From: Zhu Yi @ 2007-11-08  8:56 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: linux-wireless


On Tue, 2007-11-06 at 09:47 -0500, Robert P. J. Day wrote:
> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
> 

NACK. is_power_of_2() cannot do compile time check for
TFD_QUEUE_SIZE_MAX. Furthermore, the runtime check for
TFD_QUEUE_SIZE_MAX is already done by iwl_queue_init().

Thanks,
-yi

> ---
> 
>  drivers/net/wireless/iwlwifi/iwl3945-base.c |    3 ++-
>  drivers/net/wireless/iwlwifi/iwl4965-base.c |    3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
> index 4f22a71..53b4b4e 100644
> --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
> +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
> @@ -50,6 +50,7 @@
>  #include <linux/firmware.h>
>  #include <linux/etherdevice.h>
>  #include <linux/if_arp.h>
> +#include <linux/log2.h>
> 
>  #include <net/ieee80211_radiotap.h>
>  #include <net/mac80211.h>
> @@ -343,7 +344,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
> 
>  	/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
>  	 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
> -	BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
> +	BUILD_BUG_ON(!is_power_of_2(TFD_QUEUE_SIZE_MAX));
>  	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
> 
>  	iwl_hw_tx_queue_init(priv, txq);
> diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
> index d60adcb..5f3bcb3 100644
> --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
> +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
> @@ -50,6 +50,7 @@
>  #include <linux/firmware.h>
>  #include <linux/etherdevice.h>
>  #include <linux/if_arp.h>
> +#include <linux/log2.h>
> 
>  #include <net/ieee80211_radiotap.h>
>  #include <net/mac80211.h>
> @@ -342,7 +343,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
> 
>  	/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
>  	 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
> -	BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
> +	BUILD_BUG_ON(!is_power_of_2(TFD_QUEUE_SIZE_MAX));
>  	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
> 
>  	iwl_hw_tx_queue_init(priv, txq);
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] WIRELESS:  Use more obvious "is_power_of_2" macro.
  2007-11-08  8:56 ` Zhu Yi
@ 2007-11-08 11:38   ` Robert P. J. Day
  0 siblings, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2007-11-08 11:38 UTC (permalink / raw)
  To: Zhu Yi; +Cc: linux-wireless

On Thu, 8 Nov 2007, Zhu Yi wrote:

>
> On Tue, 2007-11-06 at 09:47 -0500, Robert P. J. Day wrote:
> > Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
> >
>
> NACK. is_power_of_2() cannot do compile time check for
> TFD_QUEUE_SIZE_MAX. Furthermore, the runtime check for
> TFD_QUEUE_SIZE_MAX is already done by iwl_queue_init().
>
> Thanks,
> -yi

right, sorry.

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-08 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06 14:47 [PATCH] WIRELESS: Use more obvious "is_power_of_2" macro Robert P. J. Day
2007-11-08  8:56 ` Zhu Yi
2007-11-08 11:38   ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox