USB: rearrange code in usb_probe_interface
This patch (as1322) reverses the two outcomes of an "if" statement in usb_probe_interface(), to avoid an unnecessary level of indentation. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d837e219da
commit
0f3dda9f7f
@@ -274,56 +274,55 @@ static int usb_probe_interface(struct device *dev)
|
|||||||
intf->needs_binding = 0;
|
intf->needs_binding = 0;
|
||||||
|
|
||||||
if (usb_device_is_owned(udev))
|
if (usb_device_is_owned(udev))
|
||||||
return -ENODEV;
|
return error;
|
||||||
|
|
||||||
if (udev->authorized == 0) {
|
if (udev->authorized == 0) {
|
||||||
dev_err(&intf->dev, "Device is not authorized for usage\n");
|
dev_err(&intf->dev, "Device is not authorized for usage\n");
|
||||||
return -ENODEV;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = usb_match_id(intf, driver->id_table);
|
id = usb_match_id(intf, driver->id_table);
|
||||||
if (!id)
|
if (!id)
|
||||||
id = usb_match_dynamic_id(intf, driver);
|
id = usb_match_dynamic_id(intf, driver);
|
||||||
if (id) {
|
if (!id)
|
||||||
dev_dbg(dev, "%s - got id\n", __func__);
|
return error;
|
||||||
|
|
||||||
error = usb_autoresume_device(udev);
|
dev_dbg(dev, "%s - got id\n", __func__);
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
/* Interface "power state" doesn't correspond to any hardware
|
error = usb_autoresume_device(udev);
|
||||||
* state whatsoever. We use it to record when it's bound to
|
if (error)
|
||||||
* a driver that may start I/0: it's not frozen/quiesced.
|
return error;
|
||||||
*/
|
|
||||||
mark_active(intf);
|
|
||||||
intf->condition = USB_INTERFACE_BINDING;
|
|
||||||
|
|
||||||
/* The interface should always appear to be in use
|
/* Interface "power state" doesn't correspond to any hardware
|
||||||
* unless the driver suports autosuspend.
|
* state whatsoever. We use it to record when it's bound to
|
||||||
*/
|
* a driver that may start I/0: it's not frozen/quiesced.
|
||||||
atomic_set(&intf->pm_usage_cnt, !driver->supports_autosuspend);
|
*/
|
||||||
|
mark_active(intf);
|
||||||
|
intf->condition = USB_INTERFACE_BINDING;
|
||||||
|
|
||||||
/* Carry out a deferred switch to altsetting 0 */
|
/* The interface should always appear to be in use
|
||||||
if (intf->needs_altsetting0) {
|
* unless the driver suports autosuspend.
|
||||||
error = usb_set_interface(udev, intf->altsetting[0].
|
*/
|
||||||
desc.bInterfaceNumber, 0);
|
atomic_set(&intf->pm_usage_cnt, !driver->supports_autosuspend);
|
||||||
if (error < 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
intf->needs_altsetting0 = 0;
|
/* Carry out a deferred switch to altsetting 0 */
|
||||||
}
|
if (intf->needs_altsetting0) {
|
||||||
|
error = usb_set_interface(udev, intf->altsetting[0].
|
||||||
error = driver->probe(intf, id);
|
desc.bInterfaceNumber, 0);
|
||||||
if (error)
|
if (error < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
intf->needs_altsetting0 = 0;
|
||||||
intf->condition = USB_INTERFACE_BOUND;
|
|
||||||
usb_autosuspend_device(udev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = driver->probe(intf, id);
|
||||||
|
if (error)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
intf->condition = USB_INTERFACE_BOUND;
|
||||||
|
usb_autosuspend_device(udev);
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
mark_quiesced(intf);
|
mark_quiesced(intf);
|
||||||
intf->needs_remote_wakeup = 0;
|
intf->needs_remote_wakeup = 0;
|
||||||
intf->condition = USB_INTERFACE_UNBOUND;
|
intf->condition = USB_INTERFACE_UNBOUND;
|
||||||
|
Reference in New Issue
Block a user