From: Pavel Roskin <proski@gnu.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Antonio Quartulli <ordex@autistici.org>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] nl/cfg/mac80211: use BIT(x) instead of (1 << x)
Date: Mon, 9 Jul 2012 11:56:43 -0400 [thread overview]
Message-ID: <20120709115643.19699ca0@mj> (raw)
In-Reply-To: <1341825724.4455.16.camel@jlt3.sipsolutions.net>
On Mon, 09 Jul 2012 11:22:04 +0200
Johannes Berg <johannes@sipsolutions.net> wrote:
>
> > --- a/net/mac80211/iface.c
> > +++ b/net/mac80211/iface.c
> > @@ -1432,7 +1432,7 @@ int ieee80211_if_add(struct ieee80211_local
> > *local, const char *name, struct ieee80211_supported_band *sband;
> > sband = local->hw.wiphy->bands[i];
> > sdata->rc_rateidx_mask[i] =
> > - sband ? (1 << sband->n_bitrates) - 1 : 0;
> > + sband ? BIT(sband->n_bitrates) - 1 : 0;
>
> I don't like the BIT()-1 pattern, "(1 << x) - 1" seems like a more
> regular pattern. Arguably, there should be a define for it, but I
> can't seem to come up with a good name.
>From drivers/mfd/dbx500-prcmu-regs.h:
#define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end))
So it would be
BITS(0, sband->n_bitrates - 1)
Perhaps BITS could be made safer and more generic when moved to a
common header.
--
Regards,
Pavel Roskin
prev parent reply other threads:[~2012-07-09 16:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-08 16:10 [PATCH] nl/cfg/mac80211: use BIT(x) instead of (1 << x) Antonio Quartulli
2012-07-09 9:22 ` Johannes Berg
2012-07-09 9:56 ` Antonio Quartulli
2012-07-09 15:56 ` Pavel Roskin [this message]
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=20120709115643.19699ca0@mj \
--to=proski@gnu.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=ordex@autistici.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 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).