Re: [PATCH 1/1] USB-SERIAL : Changing usb_serial_generic_open prototype

From: Abhishek bist
Date: Tue Jun 02 2015 - 05:19:41 EST


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@xxxxxxxxxx> 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@xxxxxxxxx>
>
>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/