[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241023091414.18098-1-tony467913@gmail.com>
Date: Wed, 23 Oct 2024 17:14:15 +0800
From: Tony Chung <tony467913@...il.com>
To: johan@...nel.org
Cc: gregkh@...uxfoundation.org,
linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Tony Chung <tony467913@...il.com>
Subject: [PATCH] usb: serial: mos7840: Fix coding style warnings
This commit fix the coding style warnings shown by checkpatch.pl
Signed-off-by: Tony Chung <tony467913@...il.com>
---
drivers/usb/serial/mos7840.c | 50 ++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index ca3da79af..2de5974d4 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -220,7 +220,7 @@ struct moschip_port {
/*
* mos7840_set_reg_sync
- * To set the Control register by calling usb_fill_control_urb function
+ * To set the Control register by calling usb_fill_control_urb function
* by passing usb_sndctrlpipe function as parameter.
*/
@@ -228,8 +228,9 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
__u16 val)
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
- dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
+ dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
MCS_WR_RTYPE, val, reg, NULL, 0,
@@ -238,7 +239,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
/*
* mos7840_get_reg_sync
- * To set the Uart register by calling usb_fill_control_urb function by
+ * To set the Uart register by calling usb_fill_control_urb function by
* passing usb_rcvctrlpipe function as parameter.
*/
@@ -280,9 +281,11 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
/* For the UART control registers, the application number need
- to be Or'ed */
+ * to be Or'ed
+ */
if (port->serial->num_ports == 2 && port->port_number != 0)
val |= ((__u16)port->port_number + 2) << 8;
else
@@ -448,6 +451,7 @@ static void mos7840_bulk_in_callback(struct urb *urb)
if (urb->actual_length) {
struct tty_port *tport = &mos7840_port->port->port;
+
tty_insert_flip_string(tport, data, urb->actual_length);
tty_flip_buffer_push(tport);
port->icount.rx += urb->actual_length;
@@ -742,6 +746,7 @@ static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
for (i = 0; i < NUM_URBS; ++i) {
if (mos7840_port->busy[i]) {
struct urb *urb = mos7840_port->write_urb_pool[i];
+
chars += urb->transfer_buffer_length;
}
}
@@ -915,8 +920,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
if (status) {
mos7840_port->busy[i] = 0;
- dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
- "with status = %d\n", __func__, status);
+ dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
+ with status = %d\n", __func__, status);
bytes_sent = status;
goto exit;
}
@@ -943,6 +948,7 @@ static void mos7840_throttle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the stop character */
if (I_IXOFF(tty)) {
unsigned char stop_char = STOP_CHAR(tty);
+
status = mos7840_write(tty, port, &stop_char, 1);
if (status <= 0)
return;
@@ -972,6 +978,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the start character */
if (I_IXOFF(tty)) {
unsigned char start_char = START_CHAR(tty);
+
status = mos7840_write(tty, port, &start_char, 1);
if (status <= 0)
return;
@@ -1194,7 +1201,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
{
struct usb_serial_port *port = mos7840_port->port;
int baud;
- unsigned cflag;
+ unsigned int cflag;
__u8 lData;
__u8 lParity;
__u8 lStop;
@@ -1352,16 +1359,16 @@ static void mos7840_set_termios(struct tty_struct *tty,
}
}
-/*****************************************************************************
+/*
* mos7840_get_lsr_info - get line status register info
*
* Purpose: Let user call ioctl() to get info when the UART physically
- * is emptied. On bus types like RS485, the transmitter must
- * release the bus after transmitting. This must be done when
- * the transmit shift register is empty, not be done when the
- * transmit holding register is empty. This functionality
- * allows an RS485 driver to be written in user space.
- *****************************************************************************/
+ * is emptied. On bus types like RS485, the transmitter must
+ * release the bus after transmitting. This must be done when
+ * the transmit shift register is empty, not be done when the
+ * transmit holding register is empty. This functionality
+ * allows an RS485 driver to be written in user space.
+ */
static int mos7840_get_lsr_info(struct tty_struct *tty,
unsigned int __user *value)
@@ -1540,7 +1547,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
__u16 Data;
/* we set up the pointers to the endpoints in the mos7840_open *
- * function, as the structures aren't created yet. */
+ * function, as the structures aren't created yet.
+ */
pnum = port->port_number;
@@ -1551,14 +1559,16 @@ static int mos7840_port_probe(struct usb_serial_port *port)
/* Initialize all port interrupt end point to port 0 int
* endpoint. Our device has only one interrupt end point
- * common to all port */
+ * common to all port
+ */
mos7840_port->port = port;
spin_lock_init(&mos7840_port->pool_lock);
/* minor is not initialised until later by
* usb-serial.c:get_free_serial() and cannot therefore be used
- * to index device instances */
+ * to index device instances
+ */
mos7840_port->port_num = pnum + 1;
dev_dbg(&port->dev, "port->minor = %d\n", port->minor);
dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
@@ -1591,7 +1601,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status);
Data |= 0x08; /* setting driver done bit */
Data |= 0x04; /* sp1_bit to have cts change reflect in
- modem status reg */
+ * modem status reg
+ */
/* Data |= 0x20; //rx_disable bit */
status = mos7840_set_reg_sync(port,
@@ -1603,7 +1614,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status);
/* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2
- and 0x24 in DCR3 */
+ * and 0x24 in DCR3
+ */
Data = 0x01;
status = mos7840_set_reg_sync(port,
(__u16) (mos7840_port->DcrRegOffset + 0), Data);
--
2.34.1
Powered by blists - more mailing lists