USB-SERIAL : Changing usb_serial_generic_open prototype
Subsystems (2)
PATCH 1/1 USB-SERIAL : Changing usb_serial_generic_open prototype
While designing a usb to uart converter driver open function I am using usb_serial_generic_open, but wouldn't find need to pass tty as an argument. As it is not performing any task for further significance.
So, This patch proposed a change in usb_serial_generic_open
function prototype which has struct tty_struct as a first argument.
usb_serial_generic_open(struct tty_struct *tty,
struct usb_serial_port *port);
--- drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/belkin_sa.c | 2 +- drivers/usb/serial/ch341.c | 2 +- drivers/usb/serial/cp210x.c | 2 +- drivers/usb/serial/f81232.c | 2 +- drivers/usb/serial/ftdi_sio.c | 2 +- drivers/usb/serial/generic.c | 2 +- drivers/usb/serial/ipaq.c | 2 +- drivers/usb/serial/ir-usb.c | 2 +- drivers/usb/serial/kl5kusb105.c | 2 +- drivers/usb/serial/omninet.c | 2 +- drivers/usb/serial/opticon.c | 2 +- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 2 +- drivers/usb/serial/visor.c | 2 +- drivers/usb/serial/whiteheat.c | 2 +- drivers/usb/serial/wishbone-serial.c | 2 +- include/linux/usb/serial.h | 3 +-- 19 files changed, 19 insertions(+), 20 deletions(-)
drivers/usb/serial/ark3116.c +1 -1
@@ -361,7 +361,7 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)if (buf ==NULL )return -ENOMEM ; - result =usb_serial_generic_open (tty, port); + result =usb_serial_generic_open (port);if (result) { dev_dbg(&port->dev, "%s - usb_serial_generic_open failed: %d\n",
drivers/usb/serial/belkin_sa.c +1 -1
@@ -159,7 +159,7 @@ static int belkin_sa_open(struct tty_struct *tty,return retval; } - retval =usb_serial_generic_open (tty, port); + retval =usb_serial_generic_open (port);if (retval)usb_kill_urb (port->interrupt_in_urb);
drivers/usb/serial/ch341.c +1 -1
@@ -328,7 +328,7 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) goto out; } - r =usb_serial_generic_open (tty, port); + r =usb_serial_generic_open (port); out:return r; }
drivers/usb/serial/cp210x.c +1 -1
@@ -467,7 +467,7 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)if (tty)cp210x_change_speed (tty, port,NULL ); -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); }static void cp210x_close (struct usb_serial_port *port)
drivers/usb/serial/f81232.c +1 -1
@@ -549,7 +549,7 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)return result; } - result =usb_serial_generic_open (tty, port); + result =usb_serial_generic_open (port);if (result) {usb_kill_urb (port->interrupt_in_urb);return result;
drivers/usb/serial/ftdi_sio.c +1 -1
@@ -1947,7 +1947,7 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)if (tty)ftdi_set_termios (tty, port,NULL ); -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); }static void ftdi_dtr_rts (struct usb_serial_port *port,int on)
drivers/usb/serial/generic.c +1 -1
@@ -77,7 +77,7 @@ void usb_serial_generic_deregister(void)#endif } -int usb_serial_generic_open (struct tty_struct *tty,struct usb_serial_port *port) +int usb_serial_generic_open (struct usb_serial_port *port) {int result =0 ;unsigned long flags;
drivers/usb/serial/ipaq.c +1 -1
@@ -546,7 +546,7 @@ static int ipaq_open(struct tty_struct *tty,return result; } -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); }static int ipaq_calc_num_ports (struct usb_serial *serial)
drivers/usb/serial/ir-usb.c +1 -1
@@ -260,7 +260,7 @@ static int ir_open(struct tty_struct *tty, struct usb_serial_port *port) port->write_urbs[i]->transfer_flags =URB_ZERO_PACKET ;/* Start reading from the device */ -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); } static int ir_prepare_write_buffer(struct usb_serial_port *port,
drivers/usb/serial/kl5kusb105.c +1 -1
@@ -293,7 +293,7 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)spin_unlock_irqrestore (&priv->lock, flags);/* READ_ON and urb submission */ - rc =usb_serial_generic_open (tty, port); + rc =usb_serial_generic_open (port);if (rc) { retval = rc; goto exit;
drivers/usb/serial/omninet.c +1 -1
@@ -135,7 +135,7 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port) wport = serial->port[1 ];tty_port_tty_set (&wport->port, tty); -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); }#define OMNINET_HEADERLEN 4
drivers/usb/serial/opticon.c +1 -1
@@ -141,7 +141,7 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)/* clear the halt status of the endpoint */ usb_clear_halt (port->serial->dev, port->read_urb->pipe); - res =usb_serial_generic_open (tty, port); + res =usb_serial_generic_open (port);if (!res)return res;
drivers/usb/serial/pl2303.c +1 -1
@@ -645,7 +645,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)return result; } - result =usb_serial_generic_open (tty, port); + result =usb_serial_generic_open (port);if (result) {usb_kill_urb (port->interrupt_in_urb);return result;
drivers/usb/serial/spcp8x5.c +1 -1
@@ -409,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)if (tty)spcp8x5_set_termios (tty, port,NULL ); -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); } static int spcp8x5_tiocmset(struct tty_struct *tty,
drivers/usb/serial/ssu100.c +1 -1
@@ -310,7 +310,7 @@ static int ssu100_open(struct tty_struct *tty, struct usb_serial_port *port)if (tty)ssu100_set_termios (tty, port, &tty->termios); -return usb_serial_generic_open (tty, port); +return usb_serial_generic_open (port); } static int get_serial_info(struct usb_serial_port *port,
drivers/usb/serial/visor.c +1 -1
@@ -235,7 +235,7 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port) }/* Start reading from the device */ - result =usb_serial_generic_open (tty, port); + result =usb_serial_generic_open (port);if (result) goto exit;
drivers/usb/serial/whiteheat.c +1 -1
@@ -385,7 +385,7 @@ static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port)usb_clear_halt (port->serial->dev, port->read_urb->pipe);usb_clear_halt (port->serial->dev, port->write_urb->pipe); - retval =usb_serial_generic_open (tty, port); + retval =usb_serial_generic_open (port);if (retval) {firm_close (port);stop_command_port (port->serial);
drivers/usb/serial/wishbone-serial.c +1 -1
@@ -59,7 +59,7 @@ static int wishbone_serial_open(struct tty_struct *tty,return retval; } - retval =usb_serial_generic_open (tty, port); + retval =usb_serial_generic_open (port);if (retval)usb_gsi_openclose (port,0 );
include/linux/usb/serial.h +1 -2
@@ -318,8 +318,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}/* Functions needed by other parts of the usbserial core */ extern struct usb_serial_port *usb_serial_port_get_by_minor (unsigned int minor);extern void usb_serial_put (struct usb_serial *serial); -extern int usb_serial_generic_open (struct tty_struct *tty, -struct usb_serial_port *port); +extern int usb_serial_generic_open (struct usb_serial_port *port);extern int usb_serial_generic_write_start (struct usb_serial_port *port,gfp_t mem_flags); extern int usb_serial_generic_write(struct tty_struct *tty,
Signature · 1 line
1.8.3.1
Johan Hovold
maintainerQuoted 16 lines · Abhishek Bist
While designing a usb to uart converter driver open function I am using
usb_serial_generic_open, but wouldn't find need to pass tty as an argument. As it is not performing any task for further significance.
So, This patch proposed a change inusb_serial_generic_open
function prototype which has structtty_structas a first argument.usb_serial_generic_open(struct
tty_struct*tty,struct usb_serial_port *port);Signed-off-by Abhishek Bist <[email protected]>include/linux/usb/serial.h +0
-0
include/linux/usb/serial.h static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} · line 324
Quoted 9 lines
include/linux/usb/serial.h +1
-2@@ -318,8 +318,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}/* Functions needed by other parts of the usbserial core */ extern struct usb_serial_port *usb_serial_port_get_by_minor (unsigned int minor);extern void usb_serial_put (struct usb_serial *serial); -extern int usb_serial_generic_open (struct tty_struct *tty, -struct usb_serial_port *port); +extern int usb_serial_generic_open (struct usb_serial_port *port);extern int usb_serial_generic_write_start (struct usb_serial_port *port,gfp_t mem_flags); extern int usb_serial_generic_write(struct tty_struct *tty,
This does not work as usb_serial_generic_open is the default driver callback.
If you had compile tested your patch you would have seen the following warning:
linux/drivers/usb/serial/usb-serial.c: In function 'usb_serial_operations_init':linux/drivers/usb/serial/usb-serial.c:1318:19: warning: assignment from incompatible pointer type
type->function = usb_serial_generic_##function; \
^linux/drivers/usb/serial/usb-serial.c:1326:2: note: in expansion of macro 'set_to_generic_if_null'
set_to_generic_if_null(device, open);
^
Johan
Yes, I gone through this warning. It is because if i want to make this compilation warning free
than i have to change the prototype of a open function pointer described in usb_serial_driver
and changing the prototype over there would affect all the device driver lying in usb-serial
category , which is definitely not recommended.
Anyways i got your point .
Thanks
Abhishek-bist
Quoted 42 lines · Johan Hovold
Quoted 16 lines · Abhishek Bist
While designing a usb to uart converter driver open function I am using
usb_serial_generic_open, but wouldn't find need to pass tty as an argument. As it is not performing any task for further significance.
So, This patch proposed a change inusb_serial_generic_open
function prototype which has structtty_structas a first argument.usb_serial_generic_open(struct
tty_struct*tty,struct usb_serial_port *port);Signed-off-by Abhishek Bist <[email protected]>include/linux/usb/serial.h +0
-0include/linux/usb/serial.h static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} · line 324
Quoted 9 lines
include/linux/usb/serial.h +1
-2@@ -318,8 +318,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}/* Functions needed by other parts of the usbserial core */ extern struct usb_serial_port *usb_serial_port_get_by_minor (unsigned int minor);extern void usb_serial_put (struct usb_serial *serial); -extern int usb_serial_generic_open (struct tty_struct *tty, -struct usb_serial_port *port); +extern int usb_serial_generic_open (struct usb_serial_port *port);extern int usb_serial_generic_write_start (struct usb_serial_port *port,gfp_t mem_flags); extern int usb_serial_generic_write(struct tty_struct *tty,This does not work as
usb_serial_generic_openis the default driver callback.If you had compile tested your patch you would have seen the following warning:
linux/drivers/usb/serial/usb-serial.c: In function 'usb_serial_operations_init':linux/drivers/usb/serial/usb-serial.c:1318:19: warning: assignment from incompatible pointer typetype->function = usb_serial_generic_##function; \ ^
linux/drivers/usb/serial/usb-serial.c:1326:2: note: in expansion of macro 'set_to_generic_if_null'
set_to_generic_if_null(device, open);
^Johan
Johan Hovold
maintainer[ Please avoid top-posting. ]
Quoted 7 lines · Abhishek bist
Yes, I gone through this warning. It is because if i want to make this compilation warning free
than i have to change the prototype of a open function pointer described inusb_serial_driver
and changing the prototype over there would affect all the device driver lying in usb-serial
category , which is definitely not recommended.
Exactly. My point was that this change is neither correct or desired. And that you need to pay attention to any compilation warning that your changes cause. ;)
Quoted 1 line
Anyways i got your point .
Johan