From: Grigori Goronzy <greg@chown.ath.cx>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Grigori Goronzy <greg@chown.ath.cx>
Subject: [PATCH v2 10/14] USB: ch341: fix coding style
Date: Sat, 2 Apr 2016 19:07:19 +0200 [thread overview]
Message-ID: <1459616843-23829-11-git-send-email-greg@chown.ath.cx> (raw)
In-Reply-To: <1459616843-23829-1-git-send-email-greg@chown.ath.cx>
No functional change. The following adjustments were made to be more in
line with official coding style and to be more consistent.
Stop mixing tabs and spaces for alignment. Align continuations in
function prototypes correctly. Be more consistent with indentation of
statements broken into multiple lines. Break some long lines properly.
Stop putting labels and statements into the same line. Use braces
consistently for a single statement.
v2: minor additions
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
---
drivers/usb/serial/ch341.c | 53 ++++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index d956f75..980dcea 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -108,11 +108,11 @@ static int ch341_control_out(struct usb_device *dev, u8 request,
int r;
dev_dbg(&dev->dev, "ch341_control_out(%02x,%02x,%04x,%04x)\n",
- USB_DIR_OUT|0x40, (int)request, (int)value, (int)index);
+ USB_DIR_OUT|0x40, (int)request, (int)value, (int)index);
r = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
- value, index, NULL, 0, DEFAULT_TIMEOUT);
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
+ value, index, NULL, 0, DEFAULT_TIMEOUT);
return r;
}
@@ -124,17 +124,17 @@ static int ch341_control_in(struct usb_device *dev,
int r;
dev_dbg(&dev->dev, "ch341_control_in(%02x,%02x,%04x,%04x,%p,%u)\n",
- USB_DIR_IN|0x40, (int)request, (int)value, (int)index, buf,
- (int)bufsize);
+ USB_DIR_IN|0x40, (int)request, (int)value, (int)index,
+ buf, (int)bufsize);
r = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
- value, index, buf, bufsize, DEFAULT_TIMEOUT);
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+ value, index, buf, bufsize, DEFAULT_TIMEOUT);
return r;
}
static int ch341_init_set_baudrate(struct usb_device *dev,
- struct ch341_private *priv, unsigned ctrl)
+ struct ch341_private *priv, unsigned ctrl)
{
short a, b;
int r;
@@ -158,7 +158,8 @@ static int ch341_init_set_baudrate(struct usb_device *dev,
a = (factor & 0xff00) | divisor;
b = factor & 0xff;
- r = ch341_control_out(dev, CH341_SERIAL_INIT, 0x9c | (ctrl << 8) , a | 0x80);
+ r = ch341_control_out(dev, CH341_SERIAL_INIT, 0x9c | (ctrl << 8),
+ a | 0x80);
return r;
}
@@ -189,10 +190,12 @@ static int ch341_get_status(struct usb_device *dev, struct ch341_private *priv)
spin_lock_irqsave(&priv->lock, flags);
priv->line_status = (~(*buffer)) & CH341_BITS_MODEM_STAT;
spin_unlock_irqrestore(&priv->lock, flags);
- } else
+ } else {
r = -EPROTO;
+ }
-out: kfree(buffer);
+out:
+ kfree(buffer);
return r;
}
@@ -243,7 +246,8 @@ static int ch341_configure(struct usb_device *dev, struct ch341_private *priv)
/* expect 0x9f 0xee */
r = ch341_get_status(dev, priv);
-out: kfree(buffer);
+out:
+ kfree(buffer);
return r;
}
@@ -267,7 +271,8 @@ static int ch341_port_probe(struct usb_serial_port *port)
usb_set_serial_port_data(port, priv);
return 0;
-error: kfree(priv);
+error:
+ kfree(priv);
return r;
}
@@ -329,20 +334,22 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)
r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
if (r) {
dev_err(&port->dev, "%s - failed to submit interrupt urb: %d\n",
- __func__, r);
+ __func__, r);
goto out;
}
r = usb_serial_generic_open(tty, port);
-out: return r;
+out:
+ return r;
}
/* Old_termios contains the original termios settings and
* tty->termios contains the new setting to be used.
*/
static void ch341_set_termios(struct tty_struct *tty,
- struct usb_serial_port *port, struct ktermios *old_termios)
+ struct usb_serial_port *port,
+ struct ktermios *old_termios)
{
struct ch341_private *priv = usb_get_serial_port_data(port);
unsigned baud_rate;
@@ -437,7 +444,7 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
goto out;
}
dev_dbg(&port->dev, "%s - initial ch341 break register contents - reg1: %x, reg2: %x\n",
- __func__, break_reg[0], break_reg[1]);
+ __func__, break_reg[0], break_reg[1]);
if (break_state != 0) {
dev_dbg(&port->dev, "%s - Enter break state requested\n", __func__);
break_reg[0] &= ~CH341_NBREAK_BITS_REG1;
@@ -448,7 +455,7 @@ static void ch341_break_ctl(struct tty_struct *tty, int break_state)
break_reg[1] |= CH341_LCR_ENABLE_TX;
}
dev_dbg(&port->dev, "%s - New ch341 break register contents - reg1: %x, reg2: %x\n",
- __func__, break_reg[0], break_reg[1]);
+ __func__, break_reg[0], break_reg[1]);
reg_contents = get_unaligned_le16(break_reg);
r = ch341_control_out(port->serial->dev, CH341_REQ_WRITE_REG,
ch341_break_reg, reg_contents);
@@ -483,7 +490,7 @@ static int ch341_tiocmset(struct tty_struct *tty,
}
static void ch341_update_line_status(struct usb_serial_port *port,
- unsigned char *data, size_t len)
+ unsigned char *data, size_t len)
{
struct ch341_private *priv = usb_get_serial_port_data(port);
struct tty_struct *tty;
@@ -542,11 +549,11 @@ static void ch341_read_int_callback(struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dev_dbg(&urb->dev->dev, "%s - urb shutting down: %d\n",
- __func__, urb->status);
+ __func__, urb->status);
return;
default:
dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n",
- __func__, urb->status);
+ __func__, urb->status);
goto exit;
}
@@ -556,7 +563,7 @@ exit:
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
dev_err(&urb->dev->dev, "%s - usb_submit_urb failed: %d\n",
- __func__, status);
+ __func__, status);
}
}
@@ -604,7 +611,7 @@ static struct usb_serial_driver ch341_device = {
.id_table = id_table,
.num_ports = 1,
.open = ch341_open,
- .dtr_rts = ch341_dtr_rts,
+ .dtr_rts = ch341_dtr_rts,
.carrier_raised = ch341_carrier_raised,
.close = ch341_close,
.set_termios = ch341_set_termios,
--
1.9.1
next prev parent reply other threads:[~2016-04-02 17:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 17:07 Major improvements to the ch341 driver Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 01/14] USB: ch341: improve documentation Grigori Goronzy
2016-04-06 11:58 ` One Thousand Gnomes
2016-04-02 17:07 ` [PATCH v2 02/14] USB: ch341: fix error handling on resume Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 03/14] USB: ch341: add LCR register definitions Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 04/14] USB: ch341: add definitions for modem control Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 05/14] USB: ch341: fix USB buffer allocations Grigori Goronzy
2016-04-04 7:13 ` Oliver Neukum
2016-04-02 17:07 ` [PATCH v2 06/14] USB: ch341: reinitialize chip on reconfiguration Grigori Goronzy
2016-04-10 13:24 ` Clemens Ladisch
2016-04-02 17:07 ` [PATCH v2 07/14] USB: ch341: add support for parity, frame length, stop bits Grigori Goronzy
2016-04-03 15:58 ` Karl Palsson
2016-04-06 11:59 ` One Thousand Gnomes
2016-04-02 17:07 ` [PATCH v2 08/14] USB: ch341: add debug output for chip version Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 09/14] USB: ch341: add support for RTS/CTS flow control Grigori Goronzy
2016-04-02 17:07 ` Grigori Goronzy [this message]
2016-04-02 17:29 ` [PATCH v2 10/14] USB: ch341: fix coding style Joe Perches
2016-04-06 17:58 ` Grigori Goronzy
2016-04-06 18:10 ` Johan Hovold
2016-04-07 1:11 ` Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 11/14] USB: ch341: clean up messages Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 12/14] USB: ch341: improve B0 handling Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 13/14] USB: ch341: get rid of default configuration Grigori Goronzy
2016-04-02 17:07 ` [PATCH v2 14/14] USB: ch341: implement tx_empty callback Grigori Goronzy
2016-04-03 16:03 ` Karl Palsson
2016-04-06 18:03 ` Grigori Goronzy
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=1459616843-23829-11-git-send-email-greg@chown.ath.cx \
--to=greg@chown.ath.cx \
--cc=gregkh@linuxfoundation.org \
--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
all inboxes | Powered by JetHome®