diff options
author | Mathieu OTHACEHE <m.othacehe@gmail.com> | 2016-05-12 10:48:36 +0200 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2016-07-15 12:40:28 +0200 |
commit | d8d841e8332779fae2b18420d39ef407ea3729da (patch) | |
tree | ec6f53b01fa37dc55bb2c5c154389d8354cb2f34 /drivers/usb | |
parent | 4ab0e0da94865f5f58ec856fe4b4304a45ce7713 (diff) | |
download | linux-d8d841e8332779fae2b18420d39ef407ea3729da.tar.bz2 |
USB: serial: ti_usb_3410_5052: use functions rather than macros
Functions are preferable to macros resembling functions.
Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
[johan: drop inline keyword, move above calling function ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 6002e8bfc9ac..07b4bf01061d 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -248,8 +248,6 @@ struct ti_interrupt { } __packed; /* Interrupt codes */ -#define TI_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) -#define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) #define TI_CODE_HARDWARE_ERROR 0xFF #define TI_CODE_DATA_ERROR 0x03 #define TI_CODE_MODEM_STATUS 0x04 @@ -1168,6 +1166,15 @@ static void ti_break(struct tty_struct *tty, int break_state) dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status); } +static int ti_get_port_from_code(unsigned char code) +{ + return (code >> 4) - 3; +} + +static int ti_get_func_from_code(unsigned char code) +{ + return code & 0x0f; +} static void ti_interrupt_callback(struct urb *urb) { @@ -1209,8 +1216,8 @@ static void ti_interrupt_callback(struct urb *urb) goto exit; } - port_number = TI_GET_PORT_FROM_CODE(data[0]); - function = TI_GET_FUNC_FROM_CODE(data[0]); + port_number = ti_get_port_from_code(data[0]); + function = ti_get_func_from_code(data[0]); dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n", __func__, port_number, function, data[1]); |