[PATCH] staging: octeon-usb: fix misspelled "re-enable"

2019-02-20 Thread Sumit Pundir
Fixes misspelled "re-enable" in comment. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/octeon-usb/octeon-hcd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.h 
b/drivers/staging/octeon-usb/octeon-hcd.h
index 769c36cf6614..ae7ae50071ae 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.h
+++ b/drivers/staging/octeon-usb/octeon-hcd.h
@@ -1797,7 +1797,7 @@ union cvmx_usbnx_usbp_ctl_status {
 *  This is a test signal. When the USB Core is
 *  powered up (not in Susned Mode), an automatic
 *  tester can use this to disable phy_clock and
-*  free_clk, then re-eanable them with an aligned
+*  free_clk, then re-enable them with an aligned
 *  phase.
 *  '1': The phy_clk and free_clk outputs are
 *  disabled. "0": The phy_clock and free_clk outputs
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: gasket: fix code indent for conditional statement

2018-08-07 Thread Sumit Pundir
Fixed a coding style issue related to indentation. Reported by
checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/gasket/gasket_page_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index ed6ab3c5f038..d4c5f8aa7dd3 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -1311,7 +1311,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
gasket_dev->coherent_buffer.virt_base = mem;
 
*dma_address = driver_desc->coherent_buffer_description.base;
-   for (j = 0; j < num_pages; j++) {
+   for (j = 0; j < num_pages; j++) {
gasket_dev->page_table[index]->coherent_pages[j].paddr =
handle + j * PAGE_SIZE;
gasket_dev->page_table[index]->coherent_pages[j].kernel_virt =
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-mmc: place a check for sscanf

2018-08-10 Thread Sumit Pundir
Placed a check for the return value of sscanf. -EINVAL is returned if
the value is anything other than expected. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/mt7621-mmc/dbg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c
index 6e518dce9029..4fe4d2fd111e 100644
--- a/drivers/staging/mt7621-mmc/dbg.c
+++ b/drivers/staging/mt7621-mmc/dbg.c
@@ -249,7 +249,9 @@ static ssize_t msdc_debug_proc_write(struct file *file,
cmd_buf[count] = '\0';
pr_debug("msdc Write %s\n", cmd_buf);
 
-   sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2);
+   ret = sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2);
+   if (ret != 3)
+   return -EINVAL;
 
if (cmd == SD_TOOL_ZONE) {
id = p1;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: vt6656: fix unnecessary parantheses

2017-12-22 Thread Sumit Pundir
This patch fixes a coding style issue as noted by
checkpatch.pl related to unnecessary parentheses.

This patch fixes the following checkpatch.pl warning:

WARNING: Unnecessary parentheses around 'priv->basic_rates'.

Signed-off-by: Sumit Pundir 
---
 drivers/staging/vt6656/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 501f482..811602e 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -443,7 +443,7 @@ int vnt_ofdm_min_rate(struct vnt_private *priv)
int ii;

for (ii = RATE_54M; ii >= RATE_6M; ii--) {
-   if ((priv->basic_rates) & ((u16)BIT(ii)))
+   if (priv->basic_rates & ((u16)BIT(ii)))
return true;
}

--
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: vt6656: Fix unnecessary 'out of memory' message

2017-12-24 Thread Sumit Pundir
This patch fixes one of the warnings as noted by checkpatch.pl related
to unnecessary 'out of memory' message.

This patch fixes the following checkpatch.pl error:

WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Sumit Pundir 
---
 drivers/staging/vt6656/main_usb.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 1b51b83..ccafcc2 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -427,11 +427,8 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 
for (ii = 0; ii < priv->num_rcb; ii++) {
priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
-   if (!priv->rcb[ii]) {
-   dev_err(&priv->usb->dev,
-   "failed to allocate rcb no %d\n", ii);
+   if (!priv->rcb[ii])
goto free_rx_tx;
-   }
 
rcb = priv->rcb[ii];
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: vt6656: Fix unnecessary parantheses

2017-12-24 Thread Sumit Pundir
This patch fixes a few coding style issues as noted by checkpatch.pl
related to unnecessary parantheses.

This patch fixes the following checkpatch.pl warnings:

WARNING: Unnecessary parentheses around 'priv->eeprom[EEP_OFS_MAJOR_VER] == 0x1'
WARNING: Unnecessary parentheses around 'priv->eeprom[EEP_OFS_MINOR_VER] >= 0x4'

Signed-off-by: Sumit Pundir 
---
 drivers/staging/vt6656/main_usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 1b51b83..c15ae72 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -266,8 +266,8 @@ static int vnt_init_registers(struct vnt_private *priv)
 
/* load vt3266 calibration parameters in EEPROM */
if (priv->rf_type == RF_VT3226D0) {
-   if ((priv->eeprom[EEP_OFS_MAJOR_VER] == 0x1) &&
-   (priv->eeprom[EEP_OFS_MINOR_VER] >= 0x4)) {
+   if (priv->eeprom[EEP_OFS_MAJOR_VER] == 0x1 &&
+   priv->eeprom[EEP_OFS_MINOR_VER] >= 0x4) {
calib_tx_iq = priv->eeprom[EEP_OFS_CALIB_TX_IQ];
calib_tx_dc = priv->eeprom[EEP_OFS_CALIB_TX_DC];
calib_rx_iq = priv->eeprom[EEP_OFS_CALIB_RX_IQ];
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: greybus: audio_codec.h: Change uint32_t to u32

2018-01-03 Thread Sumit Pundir
This patch fixes the following checkpatch.pl issues:

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+   uint32_t format, rate;

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+  uint32_t *rate, u8 *channels,

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+      uint32_t rate, u8 channels,

Signed-off-by: Sumit Pundir 
---
 drivers/staging/greybus/audio_codec.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.h 
b/drivers/staging/greybus/audio_codec.h
index 161b37c..fd7b893 100644
--- a/drivers/staging/greybus/audio_codec.h
+++ b/drivers/staging/greybus/audio_codec.h
@@ -53,7 +53,7 @@ enum gbaudio_codec_state {
 struct gbaudio_stream_params {
int state;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
 };
 
 struct gbaudio_codec_dai {
@@ -183,12 +183,12 @@ extern int gb_audio_gb_enable_widget(struct gb_connection 
*connection,
 extern int gb_audio_gb_disable_widget(struct gb_connection *connection,
  u8 widget_id);
 extern int gb_audio_gb_get_pcm(struct gb_connection *connection,
-  u16 data_cport, uint32_t *format,
-  uint32_t *rate, u8 *channels,
+  u16 data_cport, u32 *format,
+  u32 *rate, u8 *channels,
   u8 *sig_bits);
 extern int gb_audio_gb_set_pcm(struct gb_connection *connection,
-  u16 data_cport, uint32_t format,
-  uint32_t rate, u8 channels,
+  u16 data_cport, u32 format,
+  u32 rate, u8 channels,
   u8 sig_bits);
 extern int gb_audio_gb_set_tx_data_size(struct gb_connection *connection,
u16 data_cport, u16 size);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: greybus: audio_codec.c: Change uint32_t to u32

2018-01-03 Thread Sumit Pundir
This patch fixes the following checkpatch.pl issue at multiple lines:

CHECK: Prefer kernel type 'u32' over 'uint32_t'
+   uint32_t format, rate;

Signed-off-by: Sumit Pundir 
---
 drivers/staging/greybus/audio_codec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.c 
b/drivers/staging/greybus/audio_codec.c
index fdb9e83..d81cdc9 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -47,7 +47,7 @@ static int gbaudio_module_enable_tx(struct gbaudio_codec_info 
*codec,
int module_state, ret = 0;
u16 data_cport, i2s_port, cportid;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_data_connection *data;
struct gbaudio_stream_params *params;
 
@@ -182,7 +182,7 @@ static int gbaudio_module_enable_rx(struct 
gbaudio_codec_info *codec,
int module_state, ret = 0;
u16 data_cport, i2s_port, cportid;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_data_connection *data;
struct gbaudio_stream_params *params;
 
@@ -412,7 +412,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream 
*substream,
 {
int ret;
u8 sig_bits, channels;
-   uint32_t format, rate;
+   u32 format, rate;
struct gbaudio_module_info *module;
struct gbaudio_data_connection *data;
struct gb_bundle *bundle;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: iio: Prefer using BIT macro

2018-01-04 Thread Sumit Pundir
This patch fixes the following checkpatch.pl error at multiple lines:

CHECK: Prefer using the BIT macro

Signed-off-by: Sumit Pundir 
---
 drivers/staging/iio/cdc/ad7152.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index 59d1b35..b2b15b9 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -47,24 +47,24 @@
 #define AD7152_STATUS_PWDN BIT(7)
 
 /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
-#define AD7152_SETUP_CAPDIFF   (1 << 5)
+#define AD7152_SETUP_CAPDIFF   BIT(5)
 #define AD7152_SETUP_RANGE_2pF (0 << 6)
-#define AD7152_SETUP_RANGE_0_5pF   (1 << 6)
+#define AD7152_SETUP_RANGE_0_5pF   BIT(6)
 #define AD7152_SETUP_RANGE_1pF (2 << 6)
 #define AD7152_SETUP_RANGE_4pF (3 << 6)
 #define AD7152_SETUP_RANGE(x)  ((x) << 6)
 
 /* Config Register Bit Designations (AD7152_REG_CFG) */
-#define AD7152_CONF_CH2EN  (1 << 3)
-#define AD7152_CONF_CH1EN  (1 << 4)
+#define AD7152_CONF_CH2EN  BIT(3)
+#define AD7152_CONF_CH1EN  BIT(4)
 #define AD7152_CONF_MODE_IDLE  (0 << 0)
-#define AD7152_CONF_MODE_CONT_CONV (1 << 0)
+#define AD7152_CONF_MODE_CONT_CONV BIT(0)
 #define AD7152_CONF_MODE_SINGLE_CONV   (2 << 0)
 #define AD7152_CONF_MODE_OFFS_CAL  (5 << 0)
 #define AD7152_CONF_MODE_GAIN_CAL  (6 << 0)
 
 /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */
-#define AD7152_CAPDAC_DACEN(1 << 7)
+#define AD7152_CAPDAC_DACENBIT(7)
 #define AD7152_CAPDAC_DACP(x)  ((x) & 0x1F)
 
 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: irda: Prefer 'unsigned int' to bare use of 'unsigned'

2018-01-05 Thread Sumit Pundir
This patch fixes the following checkpatch.pl issue at multiple lines:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Sumit Pundir 
---
 drivers/staging/irda/drivers/act200l-sir.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/irda/drivers/act200l-sir.c 
b/drivers/staging/irda/drivers/act200l-sir.c
index e891751..62a02e5 100644
--- a/drivers/staging/irda/drivers/act200l-sir.c
+++ b/drivers/staging/irda/drivers/act200l-sir.c
@@ -29,7 +29,7 @@
 static int act200l_reset(struct sir_dev *dev);
 static int act200l_open(struct sir_dev *dev);
 static int act200l_close(struct sir_dev *dev);
-static int act200l_change_speed(struct sir_dev *dev, unsigned speed);
+static int act200l_change_speed(struct sir_dev *dev, unsigned int speed);
 
 /* Regsiter 0: Control register #1 */
 #define ACT200L_REG00x00
@@ -134,7 +134,7 @@ static int act200l_close(struct sir_dev *dev)
  *Set the speed for the ACTiSYS ACT-IR200L type dongle.
  *
  */
-static int act200l_change_speed(struct sir_dev *dev, unsigned speed)
+static int act200l_change_speed(struct sir_dev *dev, unsigned int speed)
 {
u8 control[3];
int ret = 0;
@@ -191,8 +191,8 @@ static int act200l_change_speed(struct sir_dev *dev, 
unsigned speed)
 
 static int act200l_reset(struct sir_dev *dev)
 {
-   unsigned state = dev->fsm.substate;
-   unsigned delay = 0;
+   unsigned int state = dev->fsm.substate;
+   unsigned int delay = 0;
static const u8 control[9] = {
ACT200L_REG15,
ACT200L_REG13 | ACT200L_SHDW,
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: irda: Prefer 'unsigned int' to bare use of 'unsigned'

2018-01-05 Thread Sumit Pundir
On Fri, Jan 5, 2018 at 4:14 PM, Shyam Saini  wrote:
> Hi,
>
> Did you read this?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/irda/TODO
>
>
> Thanks,
> Shyam

Hi Shyam,

Thanks for the update. Totally forgot to read it.

Thanks,
Sumit

On Fri, Jan 5, 2018 at 4:14 PM, Shyam Saini  wrote:
> Hi,
>
> Did you read this?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/irda/TODO
>
>
> Thanks,
> Shyam
>
>
>> This patch fixes the following checkpatch.pl issue at multiple lines:
>>
>> WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
>>
>> Signed-off-by: Sumit Pundir 
>> ---
>>  drivers/staging/irda/drivers/act200l-sir.c | 8 
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/irda/drivers/act200l-sir.c 
>> b/drivers/staging/irda/drivers/act200l-sir.c
>> index e891751..62a02e5 100644
>> --- a/drivers/staging/irda/drivers/act200l-sir.c
>> +++ b/drivers/staging/irda/drivers/act200l-sir.c
>> @@ -29,7 +29,7 @@
>>  static int act200l_reset(struct sir_dev *dev);
>>  static int act200l_open(struct sir_dev *dev);
>>  static int act200l_close(struct sir_dev *dev);
>> -static int act200l_change_speed(struct sir_dev *dev, unsigned speed);
>> +static int act200l_change_speed(struct sir_dev *dev, unsigned int speed);
>>
>>  /* Regsiter 0: Control register #1 */
>>  #define ACT200L_REG00x00
>> @@ -134,7 +134,7 @@ static int act200l_close(struct sir_dev *dev)
>>   *Set the speed for the ACTiSYS ACT-IR200L type dongle.
>>   *
>>   */
>> -static int act200l_change_speed(struct sir_dev *dev, unsigned speed)
>> +static int act200l_change_speed(struct sir_dev *dev, unsigned int speed)
>>  {
>> u8 control[3];
>> int ret = 0;
>> @@ -191,8 +191,8 @@ static int act200l_change_speed(struct sir_dev *dev, 
>> unsigned speed)
>>
>>  static int act200l_reset(struct sir_dev *dev)
>>  {
>> -   unsigned state = dev->fsm.substate;
>> -   unsigned delay = 0;
>> +   unsigned int state = dev->fsm.substate;
>> +   unsigned int delay = 0;
>> static const u8 control[9] = {
>> ACT200L_REG15,
>> ACT200L_REG13 | ACT200L_SHDW,
>> --
>> 2.7.4
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: lustre: Fix prefer seq_puts to seq_printf

2018-01-05 Thread Sumit Pundir
Use seq_puts() for strings without format specifiers instead of
seq_printf(). Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index fdd27ce..b900747 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -510,13 +510,13 @@ locks: .. .. .. .. .. [.. .. 
.. .. ..]
  */
lu_site_stats_print(&site->cs_lu, m);
cache_stats_print(&site->cs_pages, m, 1);
-   seq_printf(m, " [");
+   seq_puts(m, " [");
for (i = 0; i < ARRAY_SIZE(site->cs_pages_state); ++i)
seq_printf(m, "%s: %u ", pstate[i],
   atomic_read(&site->cs_pages_state[i]));
-   seq_printf(m, "]\n");
+   seq_puts(m, "]\n");
cache_stats_print(&cl_env_stats, m, 0);
-   seq_printf(m, "\n");
+   seq_puts(m, "\n");
return 0;
 }
 EXPORT_SYMBOL(cl_site_stats_print);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: lustre: Fix prefer kcalloc over kzalloc with multiply

2018-01-05 Thread Sumit Pundir
Use kcalloc for allocating an array instead of kzalloc with
multiply. kcalloc is the preferred API. Issue reported by
checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c 
b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index fdd27ce..4b10e2f 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -1017,7 +1017,7 @@ int cl_global_init(void)
 {
int result;
 
-   cl_envs = kzalloc(sizeof(*cl_envs) * num_possible_cpus(), GFP_KERNEL);
+   cl_envs = kcalloc(num_possible_cpus(), sizeof(*cl_envs), GFP_KERNEL);
if (!cl_envs) {
result = -ENOMEM;
goto out;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: iio: Prefer using BIT macro

2018-01-06 Thread Sumit Pundir
On Sat, Jan 6, 2018 at 6:12 PM, Jonathan Cameron  wrote:
> On Thu,  4 Jan 2018 22:06:31 +0530
> Sumit Pundir  wrote:
>
> Patch title needs to mention the specific driver being changed.
>
>> This patch fixes the following checkpatch.pl error at multiple lines:
>>
>> CHECK: Prefer using the BIT macro
>>
>> Signed-off-by: Sumit Pundir 
>
> The BIT Macros is just fine if they are actually a single bit field.
> Some of these are not. See below.
>
> You really have to check the datasheet to be sure on these though
> in the cases here it's obvious from the surrounding lines.
>
> Changing those ones to BIT will actively hurt readability.
>
> Anyhow, the other cases are good so if you can prepare a patch
> changing just that and ensd it that would be great.
>> ---
>>  drivers/staging/iio/cdc/ad7152.c | 12 ++--
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/iio/cdc/ad7152.c 
>> b/drivers/staging/iio/cdc/ad7152.c
>> index 59d1b35..b2b15b9 100644
>> --- a/drivers/staging/iio/cdc/ad7152.c
>> +++ b/drivers/staging/iio/cdc/ad7152.c
>> @@ -47,24 +47,24 @@
>>  #define AD7152_STATUS_PWDN   BIT(7)
>>
>>  /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
>> -#define AD7152_SETUP_CAPDIFF (1 << 5)
>> +#define AD7152_SETUP_CAPDIFF BIT(5)
>
> This is indeed a 1 bit field so fine.
>
>>  #define AD7152_SETUP_RANGE_2pF   (0 << 6)
>> -#define AD7152_SETUP_RANGE_0_5pF (1 << 6)
>> +#define AD7152_SETUP_RANGE_0_5pF BIT(6)
> This is clearly putting the value 1 in a 2 bit field within
> the register - BIT macro obscures this compeltely.
>>  #define AD7152_SETUP_RANGE_1pF   (2 << 6)
>>  #define AD7152_SETUP_RANGE_4pF   (3 << 6)
>>  #define AD7152_SETUP_RANGE(x)((x) << 6)
>>
>>  /* Config Register Bit Designations (AD7152_REG_CFG) */
>> -#define AD7152_CONF_CH2EN(1 << 3)
>> -#define AD7152_CONF_CH1EN(1 << 4)
>> +#define AD7152_CONF_CH2ENBIT(3)
>> +#define AD7152_CONF_CH1ENBIT(4)
>
> These two are valid I think.
>
>>  #define AD7152_CONF_MODE_IDLE(0 << 0)
>> -#define AD7152_CONF_MODE_CONT_CONV   (1 << 0)
>> +#define AD7152_CONF_MODE_CONT_CONV   BIT(0)
>
> This one is not. Again clear from the code let alone checking the
> datasheet. We write 6 to the same location.
>
>>  #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0)
>>  #define AD7152_CONF_MODE_OFFS_CAL(5 << 0)
>>  #define AD7152_CONF_MODE_GAIN_CAL(6 << 0)
>>
>>  /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */
>> -#define AD7152_CAPDAC_DACEN  (1 << 7)
>> +#define AD7152_CAPDAC_DACEN  BIT(7)
>
> This one is a 1 bit field so fine.
>

Hi Jonathan,

I will send a v2 of this patch with all the prescribed changes.

Thanks,
Sumit

On Sat, Jan 6, 2018 at 6:12 PM, Jonathan Cameron  wrote:
> On Thu,  4 Jan 2018 22:06:31 +0530
> Sumit Pundir  wrote:
>
> Patch title needs to mention the specific driver being changed.
>
>> This patch fixes the following checkpatch.pl error at multiple lines:
>>
>> CHECK: Prefer using the BIT macro
>>
>> Signed-off-by: Sumit Pundir 
>
> The BIT Macros is just fine if they are actually a single bit field.
> Some of these are not. See below.
>
> You really have to check the datasheet to be sure on these though
> in the cases here it's obvious from the surrounding lines.
>
> Changing those ones to BIT will actively hurt readability.
>
> Anyhow, the other cases are good so if you can prepare a patch
> changing just that and ensd it that would be great.
>> ---
>>  drivers/staging/iio/cdc/ad7152.c | 12 ++--
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/staging/iio/cdc/ad7152.c 
>> b/drivers/staging/iio/cdc/ad7152.c
>> index 59d1b35..b2b15b9 100644
>> --- a/drivers/staging/iio/cdc/ad7152.c
>> +++ b/drivers/staging/iio/cdc/ad7152.c
>> @@ -47,24 +47,24 @@
>>  #define AD7152_STATUS_PWDN   BIT(7)
>>
>>  /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
>> -#define AD7152_SETUP_CAPDIFF (1 << 5)
>> +#define AD7152_SETUP_CAPDIFF BIT(5)
>
> This is indeed a 1 bit field so fine.
>
>>  #define AD7152_SETUP_RANGE_2pF   (0 << 6)
>> -#define AD7152_SETUP_RANGE_0_5pF (1 << 6)
>> +#define AD7152_SETUP_RANGE_0_5pF 

[PATCH v2] Staging: iio: cdc: Prefer using BIT macro

2018-01-06 Thread Sumit Pundir
This patch fixes the following checkpatch.pl issue at multiple lines:

CHECK: Prefer using the BIT macro

Signed-off-by: Sumit Pundir 
---
v2:
 Added the specific driver being changed to the patch title
 and the appropriate fixes as suggested.

 drivers/staging/iio/cdc/ad7152.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c
index 59d1b35..19dc896 100644
--- a/drivers/staging/iio/cdc/ad7152.c
+++ b/drivers/staging/iio/cdc/ad7152.c
@@ -47,7 +47,7 @@
 #define AD7152_STATUS_PWDN BIT(7)
 
 /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */
-#define AD7152_SETUP_CAPDIFF   (1 << 5)
+#define AD7152_SETUP_CAPDIFF   BIT(5)
 #define AD7152_SETUP_RANGE_2pF (0 << 6)
 #define AD7152_SETUP_RANGE_0_5pF   (1 << 6)
 #define AD7152_SETUP_RANGE_1pF (2 << 6)
@@ -55,8 +55,8 @@
 #define AD7152_SETUP_RANGE(x)  ((x) << 6)
 
 /* Config Register Bit Designations (AD7152_REG_CFG) */
-#define AD7152_CONF_CH2EN  (1 << 3)
-#define AD7152_CONF_CH1EN  (1 << 4)
+#define AD7152_CONF_CH2EN  BIT(3)
+#define AD7152_CONF_CH1EN  BIT(4)
 #define AD7152_CONF_MODE_IDLE  (0 << 0)
 #define AD7152_CONF_MODE_CONT_CONV (1 << 0)
 #define AD7152_CONF_MODE_SINGLE_CONV   (2 << 0)
@@ -64,7 +64,7 @@
 #define AD7152_CONF_MODE_GAIN_CAL  (6 << 0)
 
 /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */
-#define AD7152_CAPDAC_DACEN(1 << 7)
+#define AD7152_CAPDAC_DACENBIT(7)
 #define AD7152_CAPDAC_DACP(x)  ((x) & 0x1F)
 
 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: greybus: Fix multiple checks for null pointers

2018-01-07 Thread Sumit Pundir
Fixes the following coding style issue as noted by checkpatch.pl
at multiple lines:

Comparison to NULL could be written "!token"

Signed-off-by: Sumit Pundir 
---
 drivers/staging/greybus/camera.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index f13f16b..07ebfb8 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -918,7 +918,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* Retrieve number of streams to configure */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
 
ret = kstrtouint(token, 10, &nstreams);
@@ -929,7 +929,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
return -EINVAL;
 
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
 
ret = kstrtouint(token, 10, &flags);
@@ -946,7 +946,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* width */
token = strsep(&buf, ";");
-   if (token == NULL) {
+   if (!token) {
ret = -EINVAL;
goto done;
}
@@ -956,7 +956,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* height */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
goto done;
 
ret = kstrtouint(token, 10, &stream->height);
@@ -965,7 +965,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* Image format code */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
goto done;
 
ret = kstrtouint(token, 16, &stream->format);
@@ -1009,7 +1009,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* Request id */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 10, &request_id);
if (ret < 0)
@@ -1017,7 +1017,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* Stream mask */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 16, &streams_mask);
if (ret < 0)
@@ -1025,7 +1025,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* number of frames */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 10, &num_frames);
if (ret < 0)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: greybus: Fix multiple checks for null pointers

2018-01-08 Thread Sumit Pundir
On Mon, Jan 8, 2018 at 8:15 PM, Johan Hovold  wrote:

> Since you're not really fixing anything here, besides silencing a
> checkpatch suggestion when run with the --strict option (or on staging
> code), I suggest you reword you commit summary (Subject) to, for
> example:
>
> staging: greybus: camera: clean up NULL checks
>
> or similar.
>
> Note that I also added "camera" as a module prefix above.
>
Hi Johan,

I will send a v2 of this patch with all the prescribed changes.

Thanks,
Sumit
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: greybus: camera: cleanup multiple checks for null pointers

2018-01-08 Thread Sumit Pundir
Fixed coding style issue regarding null comparison at multiple lines.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
v2:
 Updated the patch title and description.

 drivers/staging/greybus/camera.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index f13f16b..07ebfb8 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -918,7 +918,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* Retrieve number of streams to configure */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
 
ret = kstrtouint(token, 10, &nstreams);
@@ -929,7 +929,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
return -EINVAL;
 
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
 
ret = kstrtouint(token, 10, &flags);
@@ -946,7 +946,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* width */
token = strsep(&buf, ";");
-   if (token == NULL) {
+   if (!token) {
ret = -EINVAL;
goto done;
}
@@ -956,7 +956,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* height */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
goto done;
 
ret = kstrtouint(token, 10, &stream->height);
@@ -965,7 +965,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct 
gb_camera *gcam,
 
/* Image format code */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
goto done;
 
ret = kstrtouint(token, 16, &stream->format);
@@ -1009,7 +1009,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* Request id */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 10, &request_id);
if (ret < 0)
@@ -1017,7 +1017,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* Stream mask */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 16, &streams_mask);
if (ret < 0)
@@ -1025,7 +1025,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera 
*gcam,
 
/* number of frames */
token = strsep(&buf, ";");
-   if (token == NULL)
+   if (!token)
return -EINVAL;
ret = kstrtouint(token, 10, &num_frames);
if (ret < 0)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rts5208: sd: fix misspelled constant

2018-01-10 Thread Sumit Pundir
Fixes the misspelled constant to 'SWITCH_NO_ERR'.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/rts5208/sd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.h b/drivers/staging/rts5208/sd.h
index 55764e1..900be44 100644
--- a/drivers/staging/rts5208/sd.h
+++ b/drivers/staging/rts5208/sd.h
@@ -118,7 +118,7 @@
 #defineSUPPORT_MAX_POWER_PERMANCE  0x1000
 #defineSUPPORT_1V8 0x0100
 
-#defineSWTICH_NO_ERR   0x00
+#defineSWITCH_NO_ERR   0x00
 #defineCARD_NOT_EXIST  0x01
 #defineSPEC_NOT_SUPPORT0x02
 #defineCHECK_MODE_ERR  0x03
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lmv: prefer kstrto to single variable sscanf

2018-01-12 Thread Sumit Pundir
A kstrto should be preferred for a single variable instead
of sscanf to convert string to the the required datatype.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index c2c57f6..09ed154 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1319,14 +1319,16 @@ static int lmv_process_config(struct obd_device *obd, 
u32 len, void *buf)
 
obd_str2uuid(&obd_uuid,  lustre_cfg_buf(lcfg, 1));
 
-   if (sscanf(lustre_cfg_buf(lcfg, 2), "%u", &index) != 1) {
-   rc = -EINVAL;
+   rc = kstrtou32(lustre_cfg_buf(lcfg, 2), 0, &index);
+
+   if (rc)
goto out;
-   }
-   if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1) {
-   rc = -EINVAL;
+
+   rc = kstrtoint(lustre_cfg_buf(lcfg, 3), 0, &gen);
+
+   if (rc)
goto out;
-   }
+
rc = lmv_add_target(obd, &obd_uuid, index, gen);
goto out;
default:
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lnet: prefer kcalloc over kzalloc with multiply

2018-01-19 Thread Sumit Pundir
Use kcalloc for allocating an array instead of kzalloc with
multiply. kcalloc is the preferred API. Issue reported by
checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lnet/lnet/config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/config.c 
b/drivers/staging/lustre/lnet/lnet/config.c
index 1516ac6..0aea268 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -1146,7 +1146,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
if (nif <= 0)
return nif;
 
-   ipaddrs = kzalloc(nif * sizeof(*ipaddrs), GFP_KERNEL);
+   ipaddrs = kcalloc(nif, sizeof(*ipaddrs), GFP_KERNEL);
if (!ipaddrs) {
CERROR("Can't allocate ipaddrs[%d]\n", nif);
lnet_ipif_free_enumeration(ifnames, nif);
@@ -1179,7 +1179,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
*ipaddrsp = ipaddrs;
} else {
if (nip > 0) {
-   ipaddrs2 = kzalloc(nip * sizeof(*ipaddrs2),
+   ipaddrs2 = kcalloc(nip, sizeof(*ipaddrs2),
   GFP_KERNEL);
if (!ipaddrs2) {
CERROR("Can't allocate ipaddrs[%d]\n", nip);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lnet: remove null check before kfree

2018-01-20 Thread Sumit Pundir
Since kfree(NULL) is safe there is no need to place a check before it.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lnet/lnet/lib-move.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c 
b/drivers/staging/lustre/lnet/lnet/lib-move.c
index d724c4c..c673037 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-move.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-move.c
@@ -2146,8 +2146,7 @@ lnet_create_reply_msg(struct lnet_ni *ni, struct lnet_msg 
*getmsg)
the_lnet.ln_counters[cpt]->drop_length += getmd->md_length;
lnet_net_unlock(cpt);
 
-   if (msg)
-   kfree(msg);
+   kfree(msg);
 
return NULL;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lnet: return of an error code should be negative

2018-01-27 Thread Sumit Pundir
Return value of error codes should typically be negative.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/lustre/lnet/selftest/framework.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c 
b/drivers/staging/lustre/lnet/selftest/framework.c
index c7697f6..0ca1e3a 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -187,7 +187,7 @@ sfw_del_session_timer(void)
return 0;
}
 
-   return EBUSY; /* racing with sfw_session_expired() */
+   return -EBUSY; /* racing with sfw_session_expired() */
 }
 
 static void
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel