* [PATCH] mac80211: bss_tim_clear must use ~ instead of !
@ 2007-09-26 19:08 Michael Buesch
2007-09-26 19:15 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: Michael Buesch @ 2007-09-26 19:08 UTC (permalink / raw)
To: John Linville; +Cc: Johannes Berg, Michael Wu, linux-wireless
We need to use bitwise NOT.
This also cleans up the code a little bit to make it more readable.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: wireless-2.6/net/mac80211/ieee80211_i.h
===================================================================
--- wireless-2.6.orig/net/mac80211/ieee80211_i.h 2007-09-26 21:04:03.000000000 +0200
+++ wireless-2.6/net/mac80211/ieee80211_i.h 2007-09-26 21:04:05.000000000 +0200
@@ -648,34 +648,34 @@ struct sta_attribute {
ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
};
-static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
+static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid)
{
/*
- * This format has ben mandated by the IEEE specifications,
+ * This format has been mandated by the IEEE specifications,
* so this line may not be changed to use the __set_bit() format.
*/
- bss->tim[(aid)/8] |= 1<<((aid) % 8);
+ bss->tim[aid / 8] |= (1 << (aid % 8));
}
static inline void bss_tim_set(struct ieee80211_local *local,
- struct ieee80211_if_ap *bss, int aid)
+ struct ieee80211_if_ap *bss, u16 aid)
{
read_lock_bh(&local->sta_lock);
__bss_tim_set(bss, aid);
read_unlock_bh(&local->sta_lock);
}
-static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
+static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid)
{
/*
- * This format has ben mandated by the IEEE specifications,
+ * This format has been mandated by the IEEE specifications,
* so this line may not be changed to use the __clear_bit() format.
*/
- bss->tim[(aid)/8] &= !(1<<((aid) % 8));
+ bss->tim[aid / 8] &= ~(1 << (aid % 8));
}
static inline void bss_tim_clear(struct ieee80211_local *local,
- struct ieee80211_if_ap *bss, int aid)
+ struct ieee80211_if_ap *bss, u16 aid)
{
read_lock_bh(&local->sta_lock);
__bss_tim_clear(bss, aid);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mac80211: bss_tim_clear must use ~ instead of !
2007-09-26 19:08 [PATCH] mac80211: bss_tim_clear must use ~ instead of ! Michael Buesch
@ 2007-09-26 19:15 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2007-09-26 19:15 UTC (permalink / raw)
To: Michael Buesch; +Cc: John Linville, Michael Wu, linux-wireless
On Wed, 2007-09-26 at 21:08 +0200, Michael Buesch wrote:
> We need to use bitwise NOT.
> This also cleans up the code a little bit to make it more readable.
>
> Signed-off-by: Michael Buesch <mb@bu3sch.de>
Looks good, thanks
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> Index: wireless-2.6/net/mac80211/ieee80211_i.h
> ===================================================================
> --- wireless-2.6.orig/net/mac80211/ieee80211_i.h 2007-09-26 21:04:03.000000000 +0200
> +++ wireless-2.6/net/mac80211/ieee80211_i.h 2007-09-26 21:04:05.000000000 +0200
> @@ -648,34 +648,34 @@ struct sta_attribute {
> ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
> };
>
> -static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
> +static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid)
> {
> /*
> - * This format has ben mandated by the IEEE specifications,
> + * This format has been mandated by the IEEE specifications,
> * so this line may not be changed to use the __set_bit() format.
> */
> - bss->tim[(aid)/8] |= 1<<((aid) % 8);
> + bss->tim[aid / 8] |= (1 << (aid % 8));
> }
>
> static inline void bss_tim_set(struct ieee80211_local *local,
> - struct ieee80211_if_ap *bss, int aid)
> + struct ieee80211_if_ap *bss, u16 aid)
> {
> read_lock_bh(&local->sta_lock);
> __bss_tim_set(bss, aid);
> read_unlock_bh(&local->sta_lock);
> }
>
> -static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
> +static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid)
> {
> /*
> - * This format has ben mandated by the IEEE specifications,
> + * This format has been mandated by the IEEE specifications,
> * so this line may not be changed to use the __clear_bit() format.
> */
> - bss->tim[(aid)/8] &= !(1<<((aid) % 8));
> + bss->tim[aid / 8] &= ~(1 << (aid % 8));
> }
>
> static inline void bss_tim_clear(struct ieee80211_local *local,
> - struct ieee80211_if_ap *bss, int aid)
> + struct ieee80211_if_ap *bss, u16 aid)
> {
> read_lock_bh(&local->sta_lock);
> __bss_tim_clear(bss, aid);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-26 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 19:08 [PATCH] mac80211: bss_tim_clear must use ~ instead of ! Michael Buesch
2007-09-26 19:15 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox