All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS
@ 2017-03-18  0:37 Wei Yang
  2017-05-02 13:28 ` Wei Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yang @ 2017-03-18  0:37 UTC (permalink / raw)
  To: shli, neilb; +Cc: linux-kernel, Wei Yang

The second parameter is the number of bits for type "long", which is
already defined in header file.

This patch replace the calculation with macro to make it more readable.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 include/linux/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a83c822c35c2..923fe72d31e3 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,7 +10,7 @@
 #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_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
 #endif
 
 /*
-- 
2.11.0

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

* Re: [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS
  2017-03-18  0:37 [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS Wei Yang
@ 2017-05-02 13:28 ` Wei Yang
  2017-05-02 21:45   ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yang @ 2017-05-02 13:28 UTC (permalink / raw)
  To: Wei Yang; +Cc: shli, neilb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

Hi, masters

Not sure this one is acceptable?

On Sat, Mar 18, 2017 at 08:37:43AM +0800, Wei Yang wrote:
>The second parameter is the number of bits for type "long", which is
>already defined in header file.
>
>This patch replace the calculation with macro to make it more readable.
>
>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>---
> include/linux/bitops.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/include/linux/bitops.h b/include/linux/bitops.h
>index a83c822c35c2..923fe72d31e3 100644
>--- a/include/linux/bitops.h
>+++ b/include/linux/bitops.h
>@@ -10,7 +10,7 @@
> #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_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
> #endif
> 
> /*
>-- 
>2.11.0

-- 
Wei Yang
Help you, Help me

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS
  2017-05-02 13:28 ` Wei Yang
@ 2017-05-02 21:45   ` NeilBrown
  2017-05-03  1:06     ` Wei Yang
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2017-05-02 21:45 UTC (permalink / raw)
  To: Wei Yang, Wei Yang; +Cc: shli, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

On Tue, May 02 2017, Wei Yang wrote:

> Hi, masters
>
> Not sure this one is acceptable?

You'd have better luck getting a response if you post things like this
to akpm - he tends to collect miscellaneous bits and pieces.
I don't think the patch makes more that a tiny improvement and I
wouldn't bother with it, but maybe Andrew will.

NeilBrown

>
> On Sat, Mar 18, 2017 at 08:37:43AM +0800, Wei Yang wrote:
>>The second parameter is the number of bits for type "long", which is
>>already defined in header file.
>>
>>This patch replace the calculation with macro to make it more readable.
>>
>>Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>>---
>> include/linux/bitops.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>diff --git a/include/linux/bitops.h b/include/linux/bitops.h
>>index a83c822c35c2..923fe72d31e3 100644
>>--- a/include/linux/bitops.h
>>+++ b/include/linux/bitops.h
>>@@ -10,7 +10,7 @@
>> #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_TO_LONGS(nr)	DIV_ROUND_UP(nr, BITS_PER_LONG)
>> #endif
>> 
>> /*
>>-- 
>>2.11.0
>
> -- 
> Wei Yang
> Help you, Help me

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS
  2017-05-02 21:45   ` NeilBrown
@ 2017-05-03  1:06     ` Wei Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yang @ 2017-05-03  1:06 UTC (permalink / raw)
  To: NeilBrown; +Cc: Wei Yang, shli, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

On Wed, May 03, 2017 at 07:45:12AM +1000, NeilBrown wrote:
>On Tue, May 02 2017, Wei Yang wrote:
>
>> Hi, masters
>>
>> Not sure this one is acceptable?
>
>You'd have better luck getting a response if you post things like this
>to akpm - he tends to collect miscellaneous bits and pieces.
>I don't think the patch makes more that a tiny improvement and I
>wouldn't bother with it, but maybe Andrew will.
>
>NeilBrown
>

Yep, thanks for your comment :-)

-- 
Wei Yang
Help you, Help me

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-05-03  1:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-18  0:37 [PATCH] bitops.h: use BITS_PER_LONG to simplify BITS_TO_LONGS Wei Yang
2017-05-02 13:28 ` Wei Yang
2017-05-02 21:45   ` NeilBrown
2017-05-03  1:06     ` Wei Yang

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.