Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1450736 > unrolled thread

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

Started byMathieu OTHACEHE <m.othacehe@gmail.com>
First post2016-07-26 20:10 +0200
Last post2016-07-27 21:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments Mathieu OTHACEHE <m.othacehe@gmail.com> - 2016-07-26 20:10 +0200
    Re: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change  ti_write_byte function arguments Oliver Neukum <oneukum@suse.com> - 2016-07-27 10:20 +0200
      Re: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments Mathieu OTHACEHE <m.othacehe@gmail.com> - 2016-07-27 18:10 +0200
        Re: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change  ti_write_byte function arguments Oliver Neukum <oneukum@suse.com> - 2016-07-27 21:20 +0200

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

FromMathieu OTHACEHE <m.othacehe@gmail.com>
Date2016-07-26 20:10 +0200
Subject[PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments
Message-ID<rZeXM-5o9-27@gated-at.bofh.it>
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@gmail.com>
---
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

[toc] | [next] | [standalone]


#1451112 — Re: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments

FromOliver Neukum <oneukum@suse.com>
Date2016-07-27 10:20 +0200
SubjectRe: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments
Message-ID<rZsel-5j9-7@gated-at.bofh.it>
In reply to#1450736
On Tue, 2016-07-26 at 19:59 +0200, Mathieu OTHACEHE wrote:
> @@ -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;
> -- 

Hi,

this makes me think something is wrong with the data structure.
We should have a be32 there, it seems to me.

	Regards
		Oliver

[toc] | [prev] | [next] | [standalone]


#1451374

FromMathieu OTHACEHE <m.othacehe@gmail.com>
Date2016-07-27 18:10 +0200
Message-ID<rZzzc-1Cb-27@gated-at.bofh.it>
In reply to#1451112
Hi,

> this makes me think something is wrong with the data structure.
> We should have a be32 there, it seems to me.

You mean something like :

struct ti_write_data_bytes {
	u8	bAddrType;
	u8	bDataType;
	u8	bDataCounter;
	__be32	wBaseAddr;
	u8	bData[0];
} __packed;

and,

data->wBaseAddr = cpu_to_be32(addr) ?

Thanks,

Mathieu

[toc] | [prev] | [next] | [standalone]


#1451477 — Re: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments

FromOliver Neukum <oneukum@suse.com>
Date2016-07-27 21:20 +0200
SubjectRe: [PATCH v2 10/22] usb: serial: ti_usb_3410_5052: Change ti_write_byte function arguments
Message-ID<rZCx4-3zF-17@gated-at.bofh.it>
In reply to#1451374
On Wed, 2016-07-27 at 18:08 +0200, Mathieu OTHACEHE wrote:
> Hi,
> 
> > this makes me think something is wrong with the data structure.
> > We should have a be32 there, it seems to me.
> 
> You mean something like :
> 
> struct ti_write_data_bytes {
> 	u8	bAddrType;
> 	u8	bDataType;
> 	u8	bDataCounter;
> 	__be32	wBaseAddr;
> 	u8	bData[0];
> } __packed;
> 
> and,
> 
> data->wBaseAddr = cpu_to_be32(addr) ?

Yes.

	Regards
		Oliver

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web