diff mbox series

[v4,6/7] pwm: lpss: Make use of bits.h macros for all masks

Message ID 20220927162421.11052-7-andriy.shevchenko@linux.intel.com
State Accepted
Headers show
Series pwm: lpss: Clean up and convert to a pure library | expand

Commit Message

Andy Shevchenko Sept. 27, 2022, 4:24 p.m. UTC
Make use of the GENMASK() (far less error-prone, far more concise).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-lpss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thierry Reding Sept. 28, 2022, 2:20 p.m. UTC | #1
On Tue, Sep 27, 2022 at 07:24:20PM +0300, Andy Shevchenko wrote:
> Make use of the GENMASK() (far less error-prone, far more concise).

Very subjective.

Thierry
Andy Shevchenko Sept. 28, 2022, 2:43 p.m. UTC | #2
On Wed, Sep 28, 2022 at 04:20:46PM +0200, Thierry Reding wrote:
> On Tue, Sep 27, 2022 at 07:24:20PM +0300, Andy Shevchenko wrote:
> > Make use of the GENMASK() (far less error-prone, far more concise).
> 
> Very subjective.

See an example why not: 0a90ed8d0cfa ("platform/x86: pmc_atom: Fix SLP_TYPx
bitfield mask").
Thierry Reding Sept. 28, 2022, 2:49 p.m. UTC | #3
On Wed, Sep 28, 2022 at 05:43:07PM +0300, Andy Shevchenko wrote:
> On Wed, Sep 28, 2022 at 04:20:46PM +0200, Thierry Reding wrote:
> > On Tue, Sep 27, 2022 at 07:24:20PM +0300, Andy Shevchenko wrote:
> > > Make use of the GENMASK() (far less error-prone, far more concise).
> > 
> > Very subjective.
> 
> See an example why not: 0a90ed8d0cfa ("platform/x86: pmc_atom: Fix SLP_TYPx
> bitfield mask").

Hardly comparable to this particular case. And really this is stuff
that's getting on my nerves. People constantly replacing perfectly fine
code with something equivalent just for the sake of it.

Thierry
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index a20915459809..accdef5dd58e 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -10,6 +10,7 @@ 
  * Author: Alan Cox <alan@linux.intel.com>
  */
 
+#include <linux/bits.h>
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
@@ -26,7 +27,7 @@ 
 #define PWM_ENABLE			BIT(31)
 #define PWM_SW_UPDATE			BIT(30)
 #define PWM_BASE_UNIT_SHIFT		8
-#define PWM_ON_TIME_DIV_MASK		0x000000ff
+#define PWM_ON_TIME_DIV_MASK		GENMASK(7, 0)
 
 /* Size of each PWM register space if multiple */
 #define PWM_SIZE			0x400