Skip to contentSkip to conversation

usb serial compile error.

PATCH In review Stelian Pop 2 participants 2 messages Sep 28, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb serial compile error.

When compiling a USB serial driver (mct_u232 in my case) without USB generic serial support, the compile process stops because of undefined 'vendor' and 'product' symbols.

The attached patch corrects this issue.

Stelian.

drivers/usb/serial/usbserial.c renamed from drivers/usb/serial/usbserial.c.orig +1 -2
@@ -323,11 +323,10 @@
 static void generic_write_bulk_callback	(struct urb *urb);
 static void generic_shutdown		(struct usb_serial *serial);
 
-
-#ifdef CONFIG_USB_SERIAL_GENERIC
 static __u16	vendor	= 0x05f9;
 static __u16	product	= 0xffff;
 
+#ifdef CONFIG_USB_SERIAL_GENERIC
 static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
 
 /* All of the device info needed for the Generic Serial Converter */
Signature · 4 lines
Stelian Pop <[email protected]>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|
#1 lore raw
Quoted 6 lines · Stelian Pop

When compiling a USB serial driver (mct_u232 in my case) without USB generic serial support, the compile process stops because of undefined 'vendor' and 'product' symbols.

The attached patch corrects this issue.

Here's a bit nicer patch, which has been sent to Alan.

thanks,

greg k-h

drivers/usb/serial/usbserial.c +10 -7
diff --minimal -Nru a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c
@@ -307,7 +307,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.3"
+#define DRIVER_VERSION "v1.4"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman, [email protected], http://www.kroah.com/linux-usb/"
 #define DRIVER_DESC "USB Serial Driver core"
 
@@ -343,6 +343,13 @@
 	num_ports:		1,
 	shutdown:		generic_shutdown,
 };
+
+#define if_generic_do(x)					\
+	if ((serial->dev->descriptor.idVendor == vendor) &&	\
+	    (serial->dev->descriptor.idProduct == product))	\
+	                x
+#else
+#define if_generic_do(x)
 #endif
 
 
@@ -765,9 +772,7 @@
 		return -ENODEV;
 
 	/* only increment our usage count, if this device is _really_ a generic device */
-	if ((serial->dev->descriptor.idVendor == vendor) &&
-	    (serial->dev->descriptor.idProduct == product))
-		MOD_INC_USE_COUNT;
+	if_generic_do(MOD_INC_USE_COUNT);
 
 	dbg(__FUNCTION__ " - port %d", port->number);
 
@@ -829,9 +834,7 @@
 	up (&port->sem);
 
 	/* only decrement our usage count, if this device is _really_ a generic device */
-	if ((serial->dev->descriptor.idVendor == vendor) &&
-	    (serial->dev->descriptor.idProduct == product))
-		MOD_DEC_USE_COUNT;
+	if_generic_do(MOD_DEC_USE_COUNT);
 }