mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] USB: serial: fix stringify operator in usb-serial-simple
@ 2013-08-18 19:29 Yann Droneaud
  2013-08-18 19:40 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Yann Droneaud @ 2013-08-18 19:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Yann Droneaud, Wei Shuai, Frans Klaver, linux-usb, linux-kernel

From: Yann Droneaud <ydroneaud@opteya.com>

usb-serial-simple uses an unknown stringify macro that make
all drivers being named "stringify(vendor)".

This can be a problem when two drivers have the same (wrong) name:

    kernel: usbcore: registered new interface driver usb_serial_simple
    kernel: usbserial: USB Serial support registered for stringify(vendor)
    kernel Error: Driver 'stringify(vendor)' is already registered, aborting...
    kernel: usbserial: problem -16 when registering driver stringify(vendor)
    kernel: usbserial: USB Serial deregistering driver stringify(vendor)
    kernel: usbcore: deregistering interface driver usb_serial_simple

Before the fix:

    $ strings drivers/usb/serial/usb-serial-simple.o
    usb_serial_simple
    stringify(vendor)

After the fix:

    $ strings drivers/usb/serial/usb-serial-simple.o
    usb_serial_simple
    funsoft
    flashloader
    vivopay
    moto_modem
    hp4x
    suunto
    siemens_mpi

This patch makes usb-serial-simple use the correct stringify operator.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
---
 drivers/usb/serial/usb-serial-simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
index 6a06131..677c08c 100644
--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -29,7 +29,7 @@ static const struct usb_device_id vendor##_id_table[] = {	\
 static struct usb_serial_driver vendor##_device = {		\
 	.driver = {						\
 		.owner =	THIS_MODULE,			\
-		.name =		"stringify(vendor)",		\
+		.name =		#vendor,		\
 	},							\
 	.id_table =		vendor##_id_table,		\
 	.num_ports =		1,				\
-- 
1.8.1.4


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

* Re: [PATCH] USB: serial: fix stringify operator in usb-serial-simple
  2013-08-18 19:29 [PATCH] USB: serial: fix stringify operator in usb-serial-simple Yann Droneaud
@ 2013-08-18 19:40 ` Greg Kroah-Hartman
  2013-08-18 19:52   ` Yann Droneaud
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2013-08-18 19:40 UTC (permalink / raw)
  To: Yann Droneaud
  Cc: Yann Droneaud, Wei Shuai, Frans Klaver, linux-usb, linux-kernel

On Sun, Aug 18, 2013 at 09:29:00PM +0200, Yann Droneaud wrote:
> From: Yann Droneaud <ydroneaud@opteya.com>
> 
> usb-serial-simple uses an unknown stringify macro that make
> all drivers being named "stringify(vendor)".
> 
> This can be a problem when two drivers have the same (wrong) name:
> 
>     kernel: usbcore: registered new interface driver usb_serial_simple
>     kernel: usbserial: USB Serial support registered for stringify(vendor)
>     kernel Error: Driver 'stringify(vendor)' is already registered, aborting...
>     kernel: usbserial: problem -16 when registering driver stringify(vendor)
>     kernel: usbserial: USB Serial deregistering driver stringify(vendor)
>     kernel: usbcore: deregistering interface driver usb_serial_simple
> 

Ugh, sorry about that, I thought there used to be a stringify() macro
that used to do this.  Nice patch, I'll queue it up.

greg k-h

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

* Re: [PATCH] USB: serial: fix stringify operator in usb-serial-simple
  2013-08-18 19:40 ` Greg Kroah-Hartman
@ 2013-08-18 19:52   ` Yann Droneaud
  0 siblings, 0 replies; 3+ messages in thread
From: Yann Droneaud @ 2013-08-18 19:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel

Le 18.08.2013 21:40, Greg Kroah-Hartman a écrit :
> On Sun, Aug 18, 2013 at 09:29:00PM +0200, Yann Droneaud wrote:
> 
> Ugh, sorry about that, I thought there used to be a stringify() macro
> that used to do this.  Nice patch, I'll queue it up.
> 

That's __stringify() which is defined in <linux/stringify.h> but:
1) inside a string (eg "__stringify(vendor)") it's gonna never work;
2) it's not required here, __stringify(vendor) would be needed
    if vendor was itself a macro and the macro content was to be
    converted to a string.

Regards.

-- 
Yann Droneaud
OPTEYA


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

end of thread, other threads:[~2013-08-18 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-18 19:29 [PATCH] USB: serial: fix stringify operator in usb-serial-simple Yann Droneaud
2013-08-18 19:40 ` Greg Kroah-Hartman
2013-08-18 19:52   ` Yann Droneaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®