linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues
@ 2018-11-05  8:50 Ivan Roman
  2018-11-05 12:10 ` kbuild test robot
  2018-11-05 13:11 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Roman @ 2018-11-05  8:50 UTC (permalink / raw)
  To: johan; +Cc: linux-usb, linux-kernel, Ivan Roman

Replaced simple_strtoul with kstrtoul since simple_strtoul is obsolete. 
Also fixed several formatting issues.

Signed-off-by: Ivan Roman <mr.ivanroman@gmail.com>
---
 drivers/usb/serial/io_ti.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c327d4cf7928..5c61fb479354 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -341,9 +341,8 @@ static int read_download_mem(struct usb_device *dev, int start_address,
 		else
 			read_length = (__u8)length;
 
-		if (read_length > 1) {
+		if (read_length > 1)
 			dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length);
-		}
 		/*
 		 * NOTE: Must use swab as wIndex is sent in little-endian
 		 *       byte order regardless of host byte order.
@@ -820,7 +819,7 @@ static int build_i2c_fw_hdr(u8 *header, const struct firmware *fw)
 	 * Allocate a 15.5k buffer + 2 bytes for version number (Firmware
 	 * Record)
 	 */
-	buffer_size = (((1024 * 16) - 512 ) +
+	buffer_size = (((1024 * 16) - 512) +
 			sizeof(struct ti_i2c_firmware_rec));
 
 	buffer = kmalloc(buffer_size, GFP_KERNEL);
@@ -843,7 +842,7 @@ static int build_i2c_fw_hdr(u8 *header, const struct firmware *fw)
 		&fw->data[4 + sizeof(struct ti_i2c_image_header)],
 		le16_to_cpu(img_header->Length));
 
-	for (i=0; i < buffer_size; i++) {
+	for (i = 0; i < buffer_size; i++) {
 		cs = (__u8)(cs + buffer[i]);
 	}
 
@@ -851,7 +850,7 @@ static int build_i2c_fw_hdr(u8 *header, const struct firmware *fw)
 
 	/* Build new header */
 	i2c_header =  (struct ti_i2c_desc *)header;
-	firmware_rec =  (struct ti_i2c_firmware_rec*)i2c_header->Data;
+	firmware_rec =  (struct ti_i2c_firmware_rec *)i2c_header->Data;
 
 	i2c_header->Type	= I2C_DESC_TYPE_FIRMWARE_BLANK;
 	i2c_header->Size	= cpu_to_le16(buffer_size);
@@ -2147,9 +2146,8 @@ static void edge_throttle(struct tty_struct *tty)
 	if (I_IXOFF(tty)) {
 		unsigned char stop_char = STOP_CHAR(tty);
 		status = edge_write(tty, port, &stop_char, 1);
-		if (status <= 0) {
+		if (status <= 0)
 			dev_err(&port->dev, "%s - failed to write stop character, %d\n", __func__, status);
-		}
 	}
 
 	/*
@@ -2174,9 +2172,8 @@ static void edge_unthrottle(struct tty_struct *tty)
 	if (I_IXOFF(tty)) {
 		unsigned char start_char = START_CHAR(tty);
 		status = edge_write(tty, port, &start_char, 1);
-		if (status <= 0) {
+		if (status <= 0)
 			dev_err(&port->dev, "%s - failed to write start character, %d\n", __func__, status);
-		}
 	}
 	/*
 	 * if we are implementing RTS/CTS, restart reads
@@ -2231,11 +2228,11 @@ static void change_port_settings(struct tty_struct *tty,
 	struct device *dev = &edge_port->port->dev;
 	struct ump_uart_config *config;
 	int baud;
-	unsigned cflag;
+	unsigned int cflag;
 	int status;
 	int port_number = edge_port->port->port_number;
 
-	config = kmalloc (sizeof (*config), GFP_KERNEL);
+	config = kmalloc(sizeof (*config), GFP_KERNEL);
 	if (!config) {
 		tty->termios = *old_termios;
 		return;
@@ -2423,12 +2420,12 @@ static int edge_tiocmget(struct tty_struct *tty)
 
 	msr = edge_port->shadow_msr;
 	mcr = edge_port->shadow_mcr;
-	result = ((mcr & MCR_DTR)	? TIOCM_DTR: 0)	  /* 0x002 */
-		  | ((mcr & MCR_RTS)	? TIOCM_RTS: 0)   /* 0x004 */
-		  | ((msr & EDGEPORT_MSR_CTS)	? TIOCM_CTS: 0)   /* 0x020 */
-		  | ((msr & EDGEPORT_MSR_CD)	? TIOCM_CAR: 0)   /* 0x040 */
-		  | ((msr & EDGEPORT_MSR_RI)	? TIOCM_RI:  0)   /* 0x080 */
-		  | ((msr & EDGEPORT_MSR_DSR)	? TIOCM_DSR: 0);  /* 0x100 */
+	result = ((mcr & MCR_DTR)	? TIOCM_DTR : 0)	  /* 0x002 */
+		  | ((mcr & MCR_RTS)	? TIOCM_RTS : 0)   /* 0x004 */
+		  | ((msr & EDGEPORT_MSR_CTS)	? TIOCM_CTS : 0)   /* 0x020 */
+		  | ((msr & EDGEPORT_MSR_CD)	? TIOCM_CAR : 0)   /* 0x040 */
+		  | ((msr & EDGEPORT_MSR_RI)	? TIOCM_RI :  0)   /* 0x080 */
+		  | ((msr & EDGEPORT_MSR_DSR)	? TIOCM_DSR : 0);  /* 0x100 */
 
 
 	dev_dbg(&port->dev, "%s -- %x\n", __func__, result);
@@ -2442,7 +2439,7 @@ static int get_serial_info(struct tty_struct *tty,
 {
 	struct usb_serial_port *port = tty->driver_data;
 	struct edgeport_port *edge_port = usb_get_serial_port_data(port);
-	unsigned cwait;
+	unsigned int cwait;
 
 	cwait = edge_port->port->port.closing_wait;
 	if (cwait != ASYNC_CLOSING_WAIT_NONE)
@@ -2656,7 +2653,7 @@ static ssize_t uart_mode_store(struct device *dev,
 {
 	struct usb_serial_port *port = to_usb_serial_port(dev);
 	struct edgeport_port *edge_port = usb_get_serial_port_data(port);
-	unsigned int v = simple_strtoul(valbuf, NULL, 0);
+	unsigned int v = kstrtoul(valbuf, NULL, 0);
 
 	dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v);
 
-- 
2.17.1


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

* Re: [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues
  2018-11-05  8:50 [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues Ivan Roman
@ 2018-11-05 12:10 ` kbuild test robot
  2018-11-05 13:11 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-05 12:10 UTC (permalink / raw)
  To: Ivan Roman; +Cc: kbuild-all, johan, linux-usb, linux-kernel, Ivan Roman

[-- Attachment #1: Type: text/plain, Size: 3694 bytes --]

Hi Ivan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.20-rc1 next-20181105]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ivan-Roman/USB-serial-io_ti-Replaced-simple_strtoul-with-kstrtoul-Formatting-issues/20181105-194308
config: x86_64-randconfig-x018-201844 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/posix_types.h:5:0,
                    from include/uapi/linux/types.h:14,
                    from include/linux/compiler.h:163,
                    from include/linux/export.h:45,
                    from include/linux/linkage.h:7,
                    from include/linux/kernel.h:7,
                    from drivers/usb/serial/io_ti.c:16:
   drivers/usb/serial/io_ti.c: In function 'uart_mode_store':
>> include/linux/stddef.h:8:14: warning: passing argument 2 of 'kstrtoul' makes integer from pointer without a cast [-Wint-conversion]
    #define NULL ((void *)0)
                 ^
>> drivers/usb/serial/io_ti.c:2656:36: note: in expansion of macro 'NULL'
     unsigned int v = kstrtoul(valbuf, NULL, 0);
                                       ^~~~
   In file included from drivers/usb/serial/io_ti.c:16:0:
   include/linux/kernel.h:366:32: note: expected 'unsigned int' but argument is of type 'void *'
    static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
                                   ^~~~~~~~
--
   In file included from include/uapi/linux/posix_types.h:5:0,
                    from include/uapi/linux/types.h:14,
                    from include/linux/compiler.h:163,
                    from include/linux/export.h:45,
                    from include/linux/linkage.h:7,
                    from include/linux/kernel.h:7,
                    from drivers/usb//serial/io_ti.c:16:
   drivers/usb//serial/io_ti.c: In function 'uart_mode_store':
>> include/linux/stddef.h:8:14: warning: passing argument 2 of 'kstrtoul' makes integer from pointer without a cast [-Wint-conversion]
    #define NULL ((void *)0)
                 ^
   drivers/usb//serial/io_ti.c:2656:36: note: in expansion of macro 'NULL'
     unsigned int v = kstrtoul(valbuf, NULL, 0);
                                       ^~~~
   In file included from drivers/usb//serial/io_ti.c:16:0:
   include/linux/kernel.h:366:32: note: expected 'unsigned int' but argument is of type 'void *'
    static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
                                   ^~~~~~~~

vim +/NULL +2656 drivers/usb/serial/io_ti.c

  2650	
  2651	static ssize_t uart_mode_store(struct device *dev,
  2652		struct device_attribute *attr, const char *valbuf, size_t count)
  2653	{
  2654		struct usb_serial_port *port = to_usb_serial_port(dev);
  2655		struct edgeport_port *edge_port = usb_get_serial_port_data(port);
> 2656		unsigned int v = kstrtoul(valbuf, NULL, 0);
  2657	
  2658		dev_dbg(dev, "%s: setting uart_mode = %d\n", __func__, v);
  2659	
  2660		if (v < 256)
  2661			edge_port->bUartMode = v;
  2662		else
  2663			dev_err(dev, "%s - uart_mode %d is invalid\n", __func__, v);
  2664	
  2665		return count;
  2666	}
  2667	static DEVICE_ATTR_RW(uart_mode);
  2668	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30970 bytes --]

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

* Re: [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues
  2018-11-05  8:50 [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues Ivan Roman
  2018-11-05 12:10 ` kbuild test robot
@ 2018-11-05 13:11 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-11-05 13:11 UTC (permalink / raw)
  To: Ivan Roman; +Cc: johan, linux-usb, linux-kernel

On Mon, Nov 05, 2018 at 12:50:09AM -0800, Ivan Roman wrote:
> Replaced simple_strtoul with kstrtoul since simple_strtoul is obsolete. 
> Also fixed several formatting issues.
> 
> Signed-off-by: Ivan Roman <mr.ivanroman@gmail.com>
> ---
>  drivers/usb/serial/io_ti.c | 35 ++++++++++++++++-------------------
>  1 file changed, 16 insertions(+), 19 deletions(-)
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch breaks the build.

- Your patch did many different things all at once, making it difficult
  to review.  All Linux kernel patches need to only do one thing at a
  time.  If you need to do multiple things (such as clean up all coding
  style issues in a file/driver), do it in a sequence of patches, each
  one doing only one thing.  This will make it easier to review the
  patches to ensure that they are correct, and to help alleviate any
  merge issues that larger patches can cause.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

end of thread, other threads:[~2018-11-05 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05  8:50 [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues Ivan Roman
2018-11-05 12:10 ` kbuild test robot
2018-11-05 13:11 ` Greg KH

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).