diff options
| author | Johan Hovold <jhovold@gmail.com> | 2012-05-30 06:25:00 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-13 18:23:53 -0400 |
| commit | 378fac2a46decbcd16b42044303ba8a1a3f8001e (patch) | |
| tree | 55f2e980d10fa302fc80c2d3eec8942d2af50a87 | |
| parent | e17f8af316525c2a795bb314dfcc23201fb51ef4 (diff) | |
USB: option: clean up probe coding style
Clean up option probe by introducing intermediate variables and fixing
up comments.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/usb/serial/option.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 6ff37e67adfa..ccf7f3c9a7c6 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -1306,33 +1306,41 @@ static int option_probe(struct usb_serial *serial, | |||
| 1306 | const struct usb_device_id *id) | 1306 | const struct usb_device_id *id) |
| 1307 | { | 1307 | { |
| 1308 | struct usb_wwan_intf_private *data; | 1308 | struct usb_wwan_intf_private *data; |
| 1309 | struct usb_interface_descriptor *iface_desc = | ||
| 1310 | &serial->interface->cur_altsetting->desc; | ||
| 1311 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; | ||
| 1309 | 1312 | ||
| 1310 | /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ | 1313 | /* |
| 1311 | if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && | 1314 | * D-Link DWM 652 still exposes CD-Rom emulation interface in modem |
| 1312 | serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && | 1315 | * mode. |
| 1313 | serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8) | 1316 | */ |
| 1317 | if (dev_desc->idVendor == DLINK_VENDOR_ID && | ||
| 1318 | dev_desc->idProduct == DLINK_PRODUCT_DWM_652 && | ||
| 1319 | iface_desc->bInterfaceClass == 0x08) | ||
| 1314 | return -ENODEV; | 1320 | return -ENODEV; |
| 1315 | 1321 | ||
| 1316 | /* Bandrich modem and AT command interface is 0xff */ | 1322 | /* Bandrich modem and AT command interface is 0xff */ |
| 1317 | if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID || | 1323 | if ((dev_desc->idVendor == BANDRICH_VENDOR_ID || |
| 1318 | serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) && | 1324 | dev_desc->idVendor == PIRELLI_VENDOR_ID) && |
| 1319 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) | 1325 | iface_desc->bInterfaceClass != 0xff) |
| 1320 | return -ENODEV; | 1326 | return -ENODEV; |
| 1321 | 1327 | /* | |
| 1322 | /* Don't bind reserved interfaces (like network ones) which often have | 1328 | * Don't bind reserved interfaces (like network ones) which often have |
| 1323 | * the same class/subclass/protocol as the serial interfaces. Look at | 1329 | * the same class/subclass/protocol as the serial interfaces. Look at |
| 1324 | * the Windows driver .INF files for reserved interface numbers. | 1330 | * the Windows driver .INF files for reserved interface numbers. |
| 1325 | */ | 1331 | */ |
| 1326 | if (is_blacklisted( | 1332 | if (is_blacklisted( |
| 1327 | serial->interface->cur_altsetting->desc.bInterfaceNumber, | 1333 | iface_desc->bInterfaceNumber, |
| 1328 | OPTION_BLACKLIST_RESERVED_IF, | 1334 | OPTION_BLACKLIST_RESERVED_IF, |
| 1329 | (const struct option_blacklist_info *) id->driver_info)) | 1335 | (const struct option_blacklist_info *) id->driver_info)) |
| 1330 | return -ENODEV; | 1336 | return -ENODEV; |
| 1331 | 1337 | /* | |
| 1332 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ | 1338 | * Don't bind network interface on Samsung GT-B3730, it is handled by |
| 1333 | if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && | 1339 | * a separate module. |
| 1334 | serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 && | 1340 | */ |
| 1335 | serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA) | 1341 | if (dev_desc->idVendor == SAMSUNG_VENDOR_ID && |
| 1342 | dev_desc->idProduct == SAMSUNG_PRODUCT_GT_B3730 && | ||
| 1343 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) | ||
| 1336 | return -ENODEV; | 1344 | return -ENODEV; |
| 1337 | 1345 | ||
| 1338 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1346 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
