Skip to contentSkip to conversation

staging: comedi: serial2002: Fix two styling issues

PATCH In review Chris Cesare 2 participants 4 messages Jun 9, 2016 – Jun 10, 2016 1 message not in the archive Staging

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

v2 cover staging: comedi: serial2002: Fix two styling issues

checkpatch.pl warns about a bare unsigned and an unnecessary cast. Patchset splits fixes for these into two separate patches.

Chris Cesare (2):
staging: comedi: serial2002: Fix bare unsigned styling issue
staging: comedi: serial2002: Fix unnecessary cast styling issue

 drivers/staging/comedi/drivers/serial2002.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/2 staging: comedi: serial2002: Fix bare unsigned styling issue

checkpatch.pl warns about a bare unsigned. Add type int to make explicit and suit the coding style.

Signed-off-by Chris Cesare <[email protected]>

---
 drivers/staging/comedi/drivers/serial2002.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/serial2002.c +1 -1
index 7a1defc..b777946 100644
@@ -95,7 +95,7 @@ struct serial_data {
 #define S2002_CFG_SIGN(x)		(((x) >> 13) & 0x1)
 #define S2002_CFG_BASE(x)		(((x) >> 14) & 0xfffff)
 
-static long serial2002_tty_ioctl(struct file *f, unsigned op,
+static long serial2002_tty_ioctl(struct file *f, unsigned int op,
 				 unsigned long param)
 {
 	if (f->f_op->unlocked_ioctl)
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 2/2 staging: comedi: serial2002: Fix unnecessary cast styling issue

In reply to Chris Cesare

checkpatch.pl warns that a cast of 1 to (long long) is unnecessary. Remove the cast and also add code to check and make sure that maxdata_list[chan] is not shifted too far, as suggested by Ian Abbott.

Signed-off-by Chris Cesare <[email protected]>

---
 drivers/staging/comedi/drivers/serial2002.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/serial2002.c +4 -1
index b777946..0d33e52 100644
@@ -379,7 +379,10 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s,
 				range_table_list[chan] =
 				    (const struct comedi_lrange *)&range[j];
 			}
-			maxdata_list[chan] = ((long long)1 << cfg[j].bits) - 1;
+			if (cfg[j].bits < 32)
+				maxdata_list[chan] = (1u << cfg[j].bits) - 1;
+			else
+				maxdata_list[chan] = 0xffffffff;
 			chan++;
 		}
 	}
Signature · 1 line
2.7.4
Reviewed-by on the v2 series
#4 lore raw
In reply to Chris Cesare
Quoted 10 lines · Chris Cesare

checkpatch.pl warns about a bare unsigned and an unnecessary cast. Patchset splits fixes for these into two separate patches.

Chris Cesare (2):
staging: comedi: serial2002: Fix bare unsigned styling issue
staging: comedi: serial2002: Fix unnecessary cast styling issue

  drivers/staging/comedi/drivers/serial2002.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

Looks good. Thanks!

Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]> )=-
-=(                          Web: http://www.mev.co.uk/  )=-