2017-12-08 08:14:03

by Dhaval Shah

[permalink] [raw]
Subject: [PATCH 0/3] misc: ad525x_dpot: Different type of warnings are resolved.

Three types of checkpatch warning are resolved.
* First patch : Prefer 'unsigned int' to bare use of 'unsigned'
* Second patch : please, no space before tabs
* third patch : macros should not use a trailing semicolon

Issue found by checkpatch.
./scripts/checkpatch.pl -f --strict drivers/misc/ad525x_dpot.c

Dhaval Shah (3):
misc: ad525x_dpot: Prefer 'unsigned int' to bare use of 'unsigned'
misc: ad525x_dpot: please, no space before tabs
misc: ad525x_dpot: macros should not use a trailing semicolon

drivers/misc/ad525x_dpot.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

--
2.11.0


2017-12-08 08:13:29

by Dhaval Shah

[permalink] [raw]
Subject: [PATCH 1/3] misc: ad525x_dpot: Prefer 'unsigned int' to bare use of 'unsigned'

Resolved all the Prefer 'unsigned int' to bare use of 'unsigned'
checkpatch warnings. Issue found by checkpatch.

Signed-off-by: Dhaval Shah <[email protected]>
---
drivers/misc/ad525x_dpot.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index fe1672747bc1..1c6b55655f52 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -84,12 +84,12 @@
struct dpot_data {
struct ad_dpot_bus_data bdata;
struct mutex update_lock;
- unsigned rdac_mask;
- unsigned max_pos;
+ unsigned int rdac_mask;
+ unsigned int max_pos;
unsigned long devid;
- unsigned uid;
- unsigned feat;
- unsigned wipers;
+ unsigned int uid;
+ unsigned int feat;
+ unsigned int wipers;
u16 rdac_cache[MAX_RDACS];
DECLARE_BITMAP(otp_en_mask, MAX_RDACS);
};
@@ -126,7 +126,7 @@ static inline int dpot_write_r8d16(struct dpot_data *dpot, u8 reg, u16 val)

static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg)
{
- unsigned ctrl = 0;
+ unsigned int ctrl = 0;
int value;

if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD))) {
@@ -175,7 +175,7 @@ static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg)
static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)
{
int value;
- unsigned ctrl = 0;
+ unsigned int ctrl = 0;

switch (dpot->uid) {
case DPOT_UID(AD5246_ID):
@@ -238,7 +238,7 @@ static s32 dpot_read(struct dpot_data *dpot, u8 reg)

static s32 dpot_write_spi(struct dpot_data *dpot, u8 reg, u16 value)
{
- unsigned val = 0;
+ unsigned int val = 0;

if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD | DPOT_ADDR_OTP))) {
if (dpot->feat & F_RDACS_WONLY)
@@ -328,7 +328,7 @@ static s32 dpot_write_spi(struct dpot_data *dpot, u8 reg, u16 value)
static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value)
{
/* Only write the instruction byte for certain commands */
- unsigned tmp = 0, ctrl = 0;
+ unsigned int tmp = 0, ctrl = 0;

switch (dpot->uid) {
case DPOT_UID(AD5246_ID):
@@ -636,7 +636,7 @@ static const struct attribute_group ad525x_group_commands = {
};

static int ad_dpot_add_files(struct device *dev,
- unsigned features, unsigned rdac)
+ unsigned int features, unsigned int rdac)
{
int err = sysfs_create_file(&dev->kobj,
dpot_attrib_wipers[rdac]);
@@ -661,7 +661,7 @@ static int ad_dpot_add_files(struct device *dev,
}

static inline void ad_dpot_remove_files(struct device *dev,
- unsigned features, unsigned rdac)
+ unsigned int features, unsigned int rdac)
{
sysfs_remove_file(&dev->kobj,
dpot_attrib_wipers[rdac]);
--
2.11.0

2017-12-08 08:13:34

by Dhaval Shah

[permalink] [raw]
Subject: [PATCH 3/3] misc: ad525x_dpot: macros should not use a trailing semicolon

Resolved all the macros should not use a trailing semicolon
checkpatch warnings. Issue found by checkpatch.

Signed-off-by: Dhaval Shah <[email protected]>
---
drivers/misc/ad525x_dpot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 577f5e76c8a8..bc591b7168db 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -515,11 +515,11 @@ set_##_name(struct device *dev, \
#define DPOT_DEVICE_SHOW_SET(name, reg) \
DPOT_DEVICE_SHOW(name, reg) \
DPOT_DEVICE_SET(name, reg) \
-static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name);
+static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name)

#define DPOT_DEVICE_SHOW_ONLY(name, reg) \
DPOT_DEVICE_SHOW(name, reg) \
-static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, NULL);
+static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, NULL)

DPOT_DEVICE_SHOW_SET(rdac0, DPOT_ADDR_RDAC | DPOT_RDAC0);
DPOT_DEVICE_SHOW_SET(eeprom0, DPOT_ADDR_EEPROM | DPOT_RDAC0);
@@ -616,7 +616,7 @@ set_##_name(struct device *dev, \
{ \
return sysfs_do_cmd(dev, attr, buf, count, _cmd); \
} \
-static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, NULL, set_##_name);
+static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, NULL, set_##_name)

DPOT_DEVICE_DO_CMD(inc_all, DPOT_INC_ALL);
DPOT_DEVICE_DO_CMD(dec_all, DPOT_DEC_ALL);
--
2.11.0

2017-12-08 08:14:01

by Dhaval Shah

[permalink] [raw]
Subject: [PATCH 2/3] misc: ad525x_dpot: please, no space before tabs

Resolved the please, no space beofore tabs checkpatch
warning. Issue found by checkpatch.

Signed-off-by: Dhaval Shah <[email protected]>
---
drivers/misc/ad525x_dpot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 1c6b55655f52..577f5e76c8a8 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -3,7 +3,7 @@
* Copyright (c) 2009-2010 Analog Devices, Inc.
* Author: Michael Hennerich <[email protected]>
*
- * DEVID #Wipers #Positions Resistor Options (kOhm)
+ * DEVID #Wipers #Positions Resistor Options (kOhm)
* AD5258 1 64 1, 10, 50, 100
* AD5259 1 256 5, 10, 50, 100
* AD5251 2 64 1, 10, 50, 100
--
2.11.0

2017-12-18 15:01:59

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/3] misc: ad525x_dpot: macros should not use a trailing semicolon

On Fri, Dec 08, 2017 at 01:43:05PM +0530, Dhaval Shah wrote:
> Resolved all the macros should not use a trailing semicolon
> checkpatch warnings. Issue found by checkpatch.
>
> Signed-off-by: Dhaval Shah <[email protected]>
> ---
> drivers/misc/ad525x_dpot.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
> index 577f5e76c8a8..bc591b7168db 100644
> --- a/drivers/misc/ad525x_dpot.c
> +++ b/drivers/misc/ad525x_dpot.c
> @@ -515,11 +515,11 @@ set_##_name(struct device *dev, \
> #define DPOT_DEVICE_SHOW_SET(name, reg) \
> DPOT_DEVICE_SHOW(name, reg) \
> DPOT_DEVICE_SET(name, reg) \
> -static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name);
> +static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name)

This should be using DEVICE_ATTR_RW() instead of DEVICE_ATTR(), care to
fix that up in a follow-on patch for this driver?

thanks,

greg k-h

2017-12-19 05:18:48

by Dhaval Shah

[permalink] [raw]
Subject: Re: [PATCH 3/3] misc: ad525x_dpot: macros should not use a trailing semicolon

Hi Greg k-h,

________________________________________
> From: Greg KH <[email protected]>
> Sent: Monday, December 18, 2017 8:32 PM
> To: Dhaval Shah
> Cc: [email protected]; [email protected]
> Subject: Re: [PATCH 3/3] misc: ad525x_dpot: macros should not use a trailing semicolon
>
> On Fri, Dec 08, 2017 at 01:43:05PM +0530, Dhaval Shah wrote:
> > Resolved all the macros should not use a trailing semicolon
> > checkpatch warnings. Issue found by checkpatch.
> >
> > Signed-off-by: Dhaval Shah <[email protected]>
> > ---
> > drivers/misc/ad525x_dpot.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
> > index 577f5e76c8a8..bc591b7168db 100644
> > --- a/drivers/misc/ad525x_dpot.c
> > +++ b/drivers/misc/ad525x_dpot.c
> > @@ -515,11 +515,11 @@ set_##_name(struct device *dev, \
> > #define DPOT_DEVICE_SHOW_SET(name, reg) \
> > DPOT_DEVICE_SHOW(name, reg) \
> > DPOT_DEVICE_SET(name, reg) \
> > -static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name);
> > +static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name)
>
> This should be using DEVICE_ATTR_RW() instead of DEVICE_ATTR(), care to
> fix that up in a follow-on patch for this driver?
>
Sure. I will update this change in follow-on patch for this driver once this patch set merged.

Thanks,
Dhaval
> thanks,
>
> greg k-h