[PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments

From: Mathieu OTHACEHE
Date: Tue Jul 26 2016 - 14:08:56 EST


Remove useless ti_device pointer, and change addr to u32.
Change size variable in function from int to size_t.

Also fix minor style issue.

Signed-off-by: Mathieu OTHACEHE <m.othacehe@xxxxxxxxx>
---
Changelog:
v2:
* Do not delete prototype and move function declaration

drivers/usb/serial/ti_usb_3410_5052.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 5f0d010..7f53432 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -348,8 +348,8 @@ static void ti_handle_new_msr(struct ti_port *tport, u8 msr);
static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty);
static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty);

-static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev,
- unsigned long addr, u8 mask, u8 byte);
+static int ti_write_byte(struct usb_serial_port *port, u32 addr,
+ u8 mask, u8 byte);

static int ti_download_firmware(struct ti_device *tdev);

@@ -1185,10 +1185,9 @@ static void ti_break(struct tty_struct *tty, int break_state)

dev_dbg(&port->dev, "%s - state = %d\n", __func__, break_state);

- status = ti_write_byte(port, tport->tp_tdev,
+ status = ti_write_byte(port,
tport->tp_uart_base_addr + TI_UART_OFFSET_LCR,
TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0);
-
if (status)
dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status);
}
@@ -1447,7 +1446,7 @@ static int ti_set_mcr(struct ti_port *tport, unsigned int mcr)
unsigned long flags;
int status;

- status = ti_write_byte(tport->tp_port, tport->tp_tdev,
+ status = ti_write_byte(tport->tp_port,
tport->tp_uart_base_addr + TI_UART_OFFSET_MCR,
TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr);

@@ -1607,16 +1606,15 @@ static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty)
return status;
}

-static int ti_write_byte(struct usb_serial_port *port,
- struct ti_device *tdev, unsigned long addr,
+static int ti_write_byte(struct usb_serial_port *port, u32 addr,
u8 mask, u8 byte)
{
int status;
- unsigned int size;
+ size_t size;
struct ti_write_data_bytes *data;

- dev_dbg(&port->dev, "%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X\n", __func__,
- addr, mask, byte);
+ dev_dbg(&port->dev, "%s - addr 0x%08X, mask 0x%02X, byte 0x%02X\n",
+ __func__, addr, mask, byte);

size = sizeof(struct ti_write_data_bytes) + 2;
data = kmalloc(size, GFP_KERNEL);
@@ -1626,7 +1624,7 @@ static int ti_write_byte(struct usb_serial_port *port,
data->bAddrType = TI_RW_DATA_ADDR_XDATA;
data->bDataType = TI_RW_DATA_BYTE;
data->bDataCounter = 1;
- data->wBaseAddrHi = cpu_to_be16(addr>>16);
+ data->wBaseAddrHi = cpu_to_be16(addr >> 16);
data->wBaseAddrLo = cpu_to_be16(addr);
data->bData[0] = mask;
data->bData[1] = byte;
--
2.9.0