linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype
@ 2015-05-30 13:17 Abhishek Bist
  2015-06-01 14:30 ` Johan Hovold
  0 siblings, 1 reply; 4+ messages in thread
From: Abhishek Bist @ 2015-05-30 13:17 UTC (permalink / raw)
  To: johan; +Cc: gregkh, linux-usb, linux-kernel, 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 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);

Signed-off-by: Abhishek Bist <ishubist@gmail.com>
---
 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(-)

diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 1532cde..663297a 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -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",
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 15bc718..1925e1b 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -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);
 
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index c73808f..6893e65 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -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;
 }
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 84ce2d7..95fb901 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -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)
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 972f5a5..ad89623 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -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;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8eb68a3..9079b61 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -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)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 54e170d..5917dea 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -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;
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index f51a5d5..b0e50cf 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -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)
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 73956d4..718c3ba 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -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,
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index e020ad2..06e2606 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -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;
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index f6c6900..32146ac 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -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
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 4b7bfb3..e42a792 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -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;
 
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 829604d..1b81aac 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -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;
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index ef0dbf0..51eb234 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -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,
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index 70a098d..bc04ea3 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -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,
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index bf2bd40..4ce5631 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -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;
 
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 6c3734d..139e24d 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -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);
diff --git a/drivers/usb/serial/wishbone-serial.c b/drivers/usb/serial/wishbone-serial.c
index 4fed4a0..07b1ba1 100644
--- a/drivers/usb/serial/wishbone-serial.c
+++ b/drivers/usb/serial/wishbone-serial.c
@@ -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);
 
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 704a1ab..c8ed44a 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -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,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype
  2015-05-30 13:17 [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype Abhishek Bist
@ 2015-06-01 14:30 ` Johan Hovold
  2015-06-02  9:19   ` Abhishek bist
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2015-06-01 14:30 UTC (permalink / raw)
  To: Abhishek Bist; +Cc: johan, gregkh, linux-usb, linux-kernel

On Sat, May 30, 2015 at 06:47:20PM +0530, Abhishek Bist wrote:
> 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);
> 
> Signed-off-by: Abhishek Bist <ishubist@gmail.com>
 
> diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
> index 704a1ab..c8ed44a 100644
> --- a/include/linux/usb/serial.h
> +++ b/include/linux/usb/serial.h
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype
  2015-06-01 14:30 ` Johan Hovold
@ 2015-06-02  9:19   ` Abhishek bist
  2015-06-02  9:28     ` Johan Hovold
  0 siblings, 1 reply; 4+ messages in thread
From: Abhishek bist @ 2015-06-02  9:19 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel

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

On 1 June 2015 at 20:00, Johan Hovold <johan@kernel.org> wrote:
> On Sat, May 30, 2015 at 06:47:20PM +0530, Abhishek Bist wrote:
>> 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);
>>
>> Signed-off-by: Abhishek Bist <ishubist@gmail.com>
>
>> diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
>> index 704a1ab..c8ed44a 100644
>> --- a/include/linux/usb/serial.h
>> +++ b/include/linux/usb/serial.h
>> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype
  2015-06-02  9:19   ` Abhishek bist
@ 2015-06-02  9:28     ` Johan Hovold
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2015-06-02  9:28 UTC (permalink / raw)
  To: Abhishek bist; +Cc: Johan Hovold, linux-usb, linux-kernel

[ Please avoid top-posting. ]

On Tue, Jun 02, 2015 at 02:49:30PM +0530, Abhishek bist wrote:
> 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.

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. ;)

>       Anyways i got your point .

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-02  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-30 13:17 [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype Abhishek Bist
2015-06-01 14:30 ` Johan Hovold
2015-06-02  9:19   ` Abhishek bist
2015-06-02  9:28     ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).