diff mbox

[04/10] pwm: core: use bitops

Message ID 1445895161-2317-5-git-send-email-o.schinagl@ultimaker.com
State Rejected
Headers show

Commit Message

Olliver Schinagl Oct. 26, 2015, 9:32 p.m. UTC
From: Olliver Schinagl <oliver@schinagl.nl>

The pwm header defines bits manually while there is a nice bitops.h with
a BIT() macro. Use the BIT() macro to set bits in pwm.h

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
 include/linux/pwm.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Thierry Reding Nov. 6, 2015, 2:46 p.m. UTC | #1
On Mon, Oct 26, 2015 at 10:32:35PM +0100, Olliver Schinagl wrote:
> From: Olliver Schinagl <oliver@schinagl.nl>
> 
> The pwm header defines bits manually while there is a nice bitops.h with
> a BIT() macro. Use the BIT() macro to set bits in pwm.h
> 
> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> ---
>  include/linux/pwm.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

I don't think this is a useful change. The BIT() macro needs the same
number of characters to type at the expense of requiring an additional
include.

Thierry
Olliver Schinagl Nov. 6, 2015, 2:49 p.m. UTC | #2
Hey Thierry,

but why have the bit macro at all then :)

But that choice I guess I leave to you, as it's your section, I know 
some submaintainers prefer it and want it to be used, so I guess it's 
something in general kernel wide that should be desided on, BIT() macro 
preferred or not.

Olliver

On 06-11-15 15:46, Thierry Reding wrote:
> On Mon, Oct 26, 2015 at 10:32:35PM +0100, Olliver Schinagl wrote:
>> From: Olliver Schinagl <oliver@schinagl.nl>
>>
>> The pwm header defines bits manually while there is a nice bitops.h with
>> a BIT() macro. Use the BIT() macro to set bits in pwm.h
>>
>> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
>> ---
>>   include/linux/pwm.h | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
> I don't think this is a useful change. The BIT() macro needs the same
> number of characters to type at the expense of requiring an additional
> include.
>
> Thierry
Andy Shevchenko Nov. 6, 2015, 9:36 p.m. UTC | #3
On Fri, Nov 6, 2015 at 4:49 PM, Olliver Schinagl
<o.schinagl@ultimaker.com> wrote:
> Hey Thierry,
>
> but why have the bit macro at all then :)

For my opinion, it's good to use in new code, or when you have this
change as a continuation of bigger series.
Though, others might have a different one :-)

>
> But that choice I guess I leave to you, as it's your section, I know some
> submaintainers prefer it and want it to be used, so I guess it's something
> in general kernel wide that should be desided on, BIT() macro preferred or
> not.
>
> Olliver
>
>
> On 06-11-15 15:46, Thierry Reding wrote:
>>
>> On Mon, Oct 26, 2015 at 10:32:35PM +0100, Olliver Schinagl wrote:
>>>
>>> From: Olliver Schinagl <oliver@schinagl.nl>
>>>
>>> The pwm header defines bits manually while there is a nice bitops.h with
>>> a BIT() macro. Use the BIT() macro to set bits in pwm.h
>>>
>>> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
>>> ---
>>>   include/linux/pwm.h | 7 ++++---
>>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> I don't think this is a useful change. The BIT() macro needs the same
>> number of characters to type at the expense of requiring an additional
>> include.
>>
>> Thierry
>
>
> --
> Met vriendelijke groeten, Kind regards, 与亲切的问候
>
> Olliver Schinagl
> Software Engineer
> Research & Development
> Ultimaker B.V.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index d681f68..29315ad 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -1,6 +1,7 @@ 
 #ifndef __LINUX_PWM_H
 #define __LINUX_PWM_H
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/of.h>
 
@@ -74,9 +75,9 @@  enum pwm_polarity {
 };
 
 enum {
-	PWMF_REQUESTED = 1 << 0,
-	PWMF_ENABLED = 1 << 1,
-	PWMF_EXPORTED = 1 << 2,
+	PWMF_REQUESTED = BIT(0),
+	PWMF_ENABLED = BIT(1),
+	PWMF_EXPORTED = BIT(2),
 };
 
 /**