aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:36:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:48:26 -0400
commitc3452f5e444446fad9bb1957d22a25334798f94c (patch)
tree81e8b8cf8078fddc56af977d6e656747ad6c5606 /drivers/usb/serial/usb-serial.c
parent79b80b8a1141ba0605e917a6fc12d44383ab29b8 (diff)
USB: serial: clean up generic-operation handling
Most USB serial drivers are, and should be, using as much of the generic implementation as possible. Rename the fixup_generic function to a more descriptive name. Reword the related debug message in a more neutral tone (and remember to add the missing newline). Finally, move the operations initialisation to after the initial sanity checks. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4819fd9a639a..3eb4d06e49be 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1291,12 +1291,12 @@ module_exit(usb_serial_exit);
1291 do { \ 1291 do { \
1292 if (!type->function) { \ 1292 if (!type->function) { \
1293 type->function = usb_serial_generic_##function; \ 1293 type->function = usb_serial_generic_##function; \
1294 pr_debug("Had to override the " #function \ 1294 pr_debug("%s: using generic " #function "\n", \
1295 " usb serial operation with the generic one.");\ 1295 type->driver.name); \
1296 } \ 1296 } \
1297 } while (0) 1297 } while (0)
1298 1298
1299static void fixup_generic(struct usb_serial_driver *device) 1299static void usb_serial_operations_init(struct usb_serial_driver *device)
1300{ 1300{
1301 set_to_generic_if_null(device, open); 1301 set_to_generic_if_null(device, open);
1302 set_to_generic_if_null(device, write); 1302 set_to_generic_if_null(device, write);
@@ -1316,8 +1316,6 @@ static int usb_serial_register(struct usb_serial_driver *driver)
1316 if (usb_disabled()) 1316 if (usb_disabled())
1317 return -ENODEV; 1317 return -ENODEV;
1318 1318
1319 fixup_generic(driver);
1320
1321 if (!driver->description) 1319 if (!driver->description)
1322 driver->description = driver->driver.name; 1320 driver->description = driver->driver.name;
1323 if (!driver->usb_driver) { 1321 if (!driver->usb_driver) {
@@ -1326,6 +1324,8 @@ static int usb_serial_register(struct usb_serial_driver *driver)
1326 return -EINVAL; 1324 return -EINVAL;
1327 } 1325 }
1328 1326
1327 usb_serial_operations_init(driver);
1328
1329 /* Add this device to our list of devices */ 1329 /* Add this device to our list of devices */
1330 mutex_lock(&table_lock); 1330 mutex_lock(&table_lock);
1331 list_add(&driver->driver_list, &usb_serial_driver_list); 1331 list_add(&driver->driver_list, &usb_serial_driver_list);