linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Roman <mr.ivanroman@gmail.com>
To: johan@kernel.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ivan Roman <mr.ivanroman@gmail.com>
Subject: [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues
Date: Mon,  5 Nov 2018 00:50:09 -0800	[thread overview]
Message-ID: <20181105085009.25512-1-mr.ivanroman@gmail.com> (raw)

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


             reply	other threads:[~2018-11-05  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05  8:50 Ivan Roman [this message]
2018-11-05 12:10 ` [PATCH] USB: serial: io_ti: Replaced simple_strtoul with kstrtoul + Formatting issues kbuild test robot
2018-11-05 13:11 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181105085009.25512-1-mr.ivanroman@gmail.com \
    --to=mr.ivanroman@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).