All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Randy Dunlap <rdunlap@infradead.org>, linux-kernel@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Andy Gospodarek <gospo@broadcom.com>,
	"David S . Miller" <davem@davemloft.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] bitops: Introduce BITS_PER_TYPE
Date: Fri, 06 Jul 2018 18:51:01 +0100	[thread overview]
Message-ID: <153089946144.7594.5374061827926275070@cwilso3-mobl.ger.corp.intel.com> (raw)
In-Reply-To: <48904284-14d7-45c2-cf41-0c0b311ccf7e@infradead.org>

Quoting Randy Dunlap (2018-07-06 18:48:55)
> 
> On 07/06/18 02:44, Chris Wilson wrote:
> > net_dim.h has a rather useful extension to BITS_PER_BYTE to compute the
> > number of bits in a type (BITS_PER_BYTE * sizeof(T)), so promote the
> > macro to bitops.h, alongside BITS_PER_BYTE, for wider usage.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Andy Gospodarek <gospo@broadcom.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Ingo Molnar <mingo@kernel.org>
> > ---
> >  include/linux/bitops.h  | 3 ++-
> >  include/linux/net_dim.h | 1 -
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> > index 4cac4e1a72ff..091cb17d1a9b 100644
> > --- a/include/linux/bitops.h
> > +++ b/include/linux/bitops.h
> > @@ -11,7 +11,8 @@
> >  #define BIT_ULL_MASK(nr)     (1ULL << ((nr) % BITS_PER_LONG_LONG))
> >  #define BIT_ULL_WORD(nr)     ((nr) / BITS_PER_LONG_LONG)
> >  #define BITS_PER_BYTE                8
> > -#define BITS_TO_LONGS(nr)    DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
> > +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
> > +#define BITS_TO_LONGS(nr)    DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
> >  #endif
> >  
> >  /*
> 
> doesn't <linux/net_dim.h> need to #include <linux/bitops.h> ?

It already has to in order to obtain BITS_PER_BYTE. Just doesn't do so
directly.
-Chris

  reply	other threads:[~2018-07-06 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06  9:44 [PATCH] bitops: Introduce BITS_PER_TYPE Chris Wilson
2018-07-06 10:03 ` Jani Nikula
2018-07-06 17:48 ` Randy Dunlap
2018-07-06 17:51   ` Chris Wilson [this message]
2018-07-06 17:55     ` Randy Dunlap
2018-07-06 18:00       ` Chris Wilson
2018-07-06 18:38         ` Randy Dunlap
2018-07-06 21:57 ` Andrew Morton

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=153089946144.7594.5374061827926275070@cwilso3-mobl.ger.corp.intel.com \
    --to=chris@chris-wilson.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=gospo@broadcom.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    /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.