linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues
       [not found] <57593890.2060800@mev.co.uk>
@ 2016-06-09 19:39 ` Chris Cesare
  2016-06-09 19:39   ` [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue Chris Cesare
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Cesare @ 2016-06-09 19:39 UTC (permalink / raw)
  To: abbotti; +Cc: hsweeten, gregkh, devel, linux-kernel, 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(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue
  2016-06-09 19:39 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Chris Cesare
@ 2016-06-09 19:39   ` Chris Cesare
  2016-06-09 19:39   ` [PATCH v2 2/2] staging: comedi: serial2002: Fix unnecessary cast " Chris Cesare
  2016-06-10 10:40   ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Ian Abbott
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Cesare @ 2016-06-09 19:39 UTC (permalink / raw)
  To: abbotti; +Cc: hsweeten, gregkh, devel, linux-kernel, Chris Cesare

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

Signed-off-by Chris Cesare <chris.cesare@gmail.com>
---
 drivers/staging/comedi/drivers/serial2002.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index 7a1defc..b777946 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] staging: comedi: serial2002: Fix unnecessary cast styling issue
  2016-06-09 19:39 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Chris Cesare
  2016-06-09 19:39   ` [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue Chris Cesare
@ 2016-06-09 19:39   ` Chris Cesare
  2016-06-10 10:40   ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Ian Abbott
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Cesare @ 2016-06-09 19:39 UTC (permalink / raw)
  To: abbotti; +Cc: hsweeten, gregkh, devel, linux-kernel, 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 <chris.cesare@gmail.com>
---
 drivers/staging/comedi/drivers/serial2002.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index b777946..0d33e52 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -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++;
 		}
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues
  2016-06-09 19:39 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Chris Cesare
  2016-06-09 19:39   ` [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue Chris Cesare
  2016-06-09 19:39   ` [PATCH v2 2/2] staging: comedi: serial2002: Fix unnecessary cast " Chris Cesare
@ 2016-06-10 10:40   ` Ian Abbott
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2016-06-10 10:40 UTC (permalink / raw)
  To: Chris Cesare; +Cc: hsweeten, gregkh, devel, linux-kernel

On 09/06/16 20:39, Chris Cesare wrote:
> 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!

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-10 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <57593890.2060800@mev.co.uk>
2016-06-09 19:39 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Chris Cesare
2016-06-09 19:39   ` [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue Chris Cesare
2016-06-09 19:39   ` [PATCH v2 2/2] staging: comedi: serial2002: Fix unnecessary cast " Chris Cesare
2016-06-10 10:40   ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).