On Sat, 2014-02-01 at 15:39 -0500, Alan Stern wrote: > On Sat, 1 Feb 2014, Dan Williams wrote: > > > Unfortunate that what goes for net/, or drivers/md/ doesn't go for > > drivers/usb/... sounds like checkpatch needs subsystem specific style > > rules to avoid this thrash. > > Yeah, this is all stuff that checkpatch ignores. > > > If it's just the style I'll put those changes on a git branch and > > spare the list if you're ok doing a pull... otherwise I'll hold off > > until you have a chance to take a closer look. > > Sure. Give me a chance to look through it some. At first glance, it > seems basically okay. Ok, if it helps: git://git.kernel.org/pub/scm/linux/kernel/git/djbw/usb usb3-port-power-v4 ...is the same patchset with the following changes: diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 243cf5767433..5f94e3180b88 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2697,7 +2697,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1, goto done; if (!hub_port_warm_reset_required(hub, port1, - portstatus)) + portstatus)) goto done; /* @@ -2772,7 +2772,7 @@ static int check_port_resume_type(struct usb_device *udev, { /* Is a warm reset needed to recover the connection? */ if (udev->reset_resume - && hub_port_warm_reset_required(hub, port1, portstatus)) { + && hub_port_warm_reset_required(hub, port1, portstatus)) { /* pass */; } /* Is the device still present? */ @@ -4403,7 +4403,7 @@ hub_power_remaining (struct usb_hub *hub) * always unlocked on exit */ static void hub_port_connect_change_unlock(struct usb_hub *hub, int port1, - u16 portstatus, u16 portchange) + u16 portstatus, u16 portchange) { struct usb_device *hdev = hub->hdev; struct device *hub_dev = hub->intfdev; @@ -4459,7 +4459,8 @@ static void hub_port_connect_change_unlock(struct usb_hub *hub, int port1, } } - /* from this point forward we no longer need synchronization + /* + * From this point forward we no longer need synchronization * with usb_port_{suspend|resume} because we are about to * disconnect / reconnect */ @@ -4719,7 +4720,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_ENABLE) { if (!connect_change) dev_dbg(hub_dev, "port%d: enable change, status %08x\n", - port1, portstatus); + port1, portstatus); usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); /* @@ -4741,13 +4742,13 @@ static void port_event(struct usb_hub *hub, int port1) dev_dbg(hub_dev, "port%d: over-current change\n", port1); usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_OVER_CURRENT); + USB_PORT_FEAT_C_OVER_CURRENT); msleep(100); /* Cool down */ hub_power_on(hub, true); hub_port_status(hub, port1, &status, &unused); if (status & USB_PORT_STAT_OVERCURRENT) dev_err(hub_dev, "port%d: over-current condition\n", - port1); + port1); } if (portchange & USB_PORT_STAT_C_RESET) { @@ -4758,17 +4759,17 @@ static void port_event(struct usb_hub *hub, int port1) && hub_is_superspeed(hdev)) { dev_dbg(hub_dev, "port%d: warm reset change\n", port1); usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_BH_PORT_RESET); + USB_PORT_FEAT_C_BH_PORT_RESET); } if (portchange & USB_PORT_STAT_C_LINK_STATE) { dev_dbg(hub_dev, "port%d: link state change\n", port1); usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_PORT_LINK_STATE); + USB_PORT_FEAT_C_PORT_LINK_STATE); } if (portchange & USB_PORT_STAT_C_CONFIG_ERROR) { dev_warn(hub_dev, "port%d: config error\n", port1); usb_clear_port_feature(hdev, port1, - USB_PORT_FEAT_C_PORT_CONFIG_ERROR); + USB_PORT_FEAT_C_PORT_CONFIG_ERROR); } /* take port actions that require the port to be powered on */ @@ -4777,7 +4778,8 @@ static void port_event(struct usb_hub *hub, int port1) usb_lock_port(port_dev); do if (pm_runtime_active(&port_dev->dev)) { - /* service child resume requests on behalf of + /* + * Service child resume requests on behalf of * usb_port_runtime_resume() */ if (port_dev->resume_child && udev) { @@ -4793,16 +4795,18 @@ static void port_event(struct usb_hub *hub, int port1) } port_dev->resume_child = 0; - /* re-read portstatus now that we are in-sync with + /* + * Re-read portstatus now that we are in-sync with * usb_port_{suspend|resume} */ if (hub_port_status(hub, port1, &portstatus, &portchange) < 0) break; if (hub_handle_remote_wakeup(hub, port1, - portstatus, portchange)) + portstatus, portchange)) connect_change = 1; - /* Warm reset a USB3 protocol port if it's in + /* + * Warm reset a USB3 protocol port if it's in * SS.Inactive state. */ if (hub_port_warm_reset_required(hub, port1, portstatus)) { @@ -4810,7 +4814,7 @@ static void port_event(struct usb_hub *hub, int port1) dev_dbg(hub_dev, "port%d: do warm reset\n", port1); if (!udev || !(portstatus & USB_PORT_STAT_CONNECTION) - || udev->state == USB_STATE_NOTATTACHED) { + || udev->state == USB_STATE_NOTATTACHED) { status = hub_port_reset(hub, port1, NULL, HUB_BH_RESET_TIME, true); @@ -4828,7 +4832,7 @@ static void port_event(struct usb_hub *hub, int port1) if (connect_change) { hub_port_connect_change_unlock(hub, port1, - portstatus, portchange); + portstatus, portchange); usb_lock_port(port_dev); } } while (0); diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 630964a23b72..a0de3f18e5d0 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -84,7 +84,8 @@ static int usb_port_runtime_resume(struct device *dev) if (!hub) return -EINVAL; - /* power on our usb3 peer before this usb2 port to prevent a usb3 + /* + * Power on our usb3 peer before this usb2 port to prevent a usb3 * device from degrading to its usb2 connection */ if (!hub_is_superspeed(hdev) && peer) @@ -97,7 +98,8 @@ static int usb_port_runtime_resume(struct device *dev) if (port_dev->child && !retval) { u16 portstatus; - /* Our preference is to simply wait for the port to reconnect. + /* + * Our preference is to simply wait for the port to reconnect. * However, there are cases where toggling port power results in * the host port being stuck in SS.Polling. This is likely the * caused by the hub failing to trigger warm reset on exiting @@ -107,17 +109,18 @@ static int usb_port_runtime_resume(struct device *dev) */ portstatus = hub_port_debounce_be_connected(hub, port1); if (!(portstatus & USB_PORT_STAT_CONNECTION) - && hub_is_superspeed(hdev) - && (portstatus & USB_SS_PORT_LS_POLLING)) { + && hub_is_superspeed(hdev) + && (portstatus & USB_SS_PORT_LS_POLLING)) { dev_dbg(&hdev->dev, "port%d %s requires warm reset\n", - port1, __func__); + port1, __func__); set_bit(port1, hub->warm_reset_bits); } else if (!(portstatus & USB_PORT_STAT_CONNECTION)) { dev_dbg(&hdev->dev, "port%d %s failed reconnect\n", - port1, __func__); + port1, __func__); } - /* keep this port awake until we have had a chance to recover + /* + * Keep this port awake until we have had a chance to recover * the child. If warm reset was flagged above it will be * carried out by the child resume reset */ @@ -130,7 +133,8 @@ static int usb_port_runtime_resume(struct device *dev) clear_bit(port1, hub->busy_bits); usb_autopm_put_interface(intf); - /* usb3 peer is marked active so we can drop the reference we took to + /* + * USB3 peer is marked active so we can drop the reference we took to * ensure ordering above */ if (!hub_is_superspeed(hdev) && peer) @@ -156,11 +160,12 @@ static int usb_port_runtime_suspend(struct device *dev) == PM_QOS_FLAGS_ALL) return -EAGAIN; - /* block poweroff of superspeed ports while highspeed peer is on */ + /* Block poweroff of superspeed ports while highspeed peer is on */ dev_WARN_ONCE(&hdev->dev, hub_is_superspeed(hdev) && !peer, - "port%d missing peer info\n", port1); + "port%d missing peer info\n", port1); - /* prevent a usb3 port from powering off while its usb2 peer is + /* + * Prevent a usb3 port from powering off while its usb2 peer is * powered on */ if (hub_is_superspeed(hdev) && (!peer || peer->power_is_on)) @@ -175,7 +180,8 @@ static int usb_port_runtime_suspend(struct device *dev) clear_bit(port1, hub->busy_bits); usb_autopm_put_interface(intf); - /* Our peer usb3 port may now be able to suspend, asynchronously + /* + * Our peer usb3 port may now be able to suspend, asynchronously * queue a suspend request to observe that this usb2 peer port * is now off. There is a small race since there is no way to * flush this suspend, userspace is advised to order suspends. @@ -212,7 +218,8 @@ static struct usb_port *find_peer_port(struct usb_hub *hub, int port1) if (!hub) return NULL; - /* set the default peer port for root hubs. Platform firmware + /* + * Set the default peer port for root hubs. Platform firmware * can later fix this up if tier-mismatch is present. Assumes * the primary_hcd is usb2.0 and registered first */ @@ -221,7 +228,7 @@ static struct usb_port *find_peer_port(struct usb_hub *hub, int port1) struct usb_hcd *peer_hcd = hcd->primary_hcd; if (!hub_is_superspeed(hdev) - || WARN_ON_ONCE(!peer_hcd || hcd == peer_hcd)) + || WARN_ON_ONCE(!peer_hcd || hcd == peer_hcd)) return NULL; peer_hdev = peer_hcd->self.root_hub; @@ -272,7 +279,8 @@ static void reset_peer(struct usb_port *port_dev, struct usb_port *peer) mutex_unlock(&peer_lock); } -/* assumes that location data is only set for external connectors and that +/* + * Assumes that location data is only set for external connectors and that * external hubs never have tier mismatch */ static int redo_find_peer_port(struct device *dev, void *data) @@ -298,14 +306,15 @@ static int pair_port(struct device *dev, void *data) struct usb_port *port_dev = to_usb_port(dev); if (!is_usb_port(dev) - || port_dev->location.cookie != peer->location.cookie) + || port_dev->location.cookie != peer->location.cookie) return device_for_each_child(dev, peer, pair_port); dev_dbg(dev->parent->parent, "port%d peer = %s port%d (by location)\n", port_dev->portnum, dev_name(peer->dev.parent->parent), peer->portnum); if (port_dev->peer != peer) { - /* Sigh, tier mismatch has invalidated our ancestry. + /* + * Sigh, tier mismatch has invalidated our ancestry. * This should not be too onerous even in deep hub * topologies as we will discover tier mismatch early * (after platform internal hubs have been enumerated), @@ -319,7 +328,7 @@ static int pair_port(struct device *dev, void *data) } void usb_set_hub_port_location(struct usb_device *hdev, int port1, - u32 cookie) + u32 cookie) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); struct usb_hcd *hcd = bus_to_hcd(hdev->bus); @@ -368,8 +377,8 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) mutex_init(&port_dev->status_lock); peer = find_peer_port(hub, port1); - dev_dbg(&hub->hdev->dev, "port%d peer = %s\n", - port1, peer ? dev_name(peer->dev.parent->parent) : "[none]"); + dev_dbg(&hub->hdev->dev, "port%d peer = %s\n", port1, + peer ? dev_name(peer->dev.parent->parent) : "[none]"); if (peer) { mutex_lock(&peer_lock); get_device(&peer->dev); @@ -388,11 +397,11 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) peer = port_dev->peer; do if (peer) { retval = sysfs_create_link(&port_dev->dev.kobj, - &peer->dev.kobj, "peer"); + &peer->dev.kobj, "peer"); if (retval) break; retval = sysfs_create_link(&peer->dev.kobj, - &port_dev->dev.kobj, "peer"); + &port_dev->dev.kobj, "peer"); } while (0); mutex_unlock(&peer_lock); if (retval) diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 8a466438bff7..f38636c6734e 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -43,16 +43,14 @@ bool usb_acpi_power_manageable(struct usb_device *hdev, int index) EXPORT_SYMBOL_GPL(usb_acpi_power_manageable); static void usb_acpi_check_port_peer(struct usb_device *hdev, - acpi_handle *handle, int port1, - struct acpi_pld_info *pld) + acpi_handle *handle, int port1, struct acpi_pld_info *pld) { if (!pld) return; #define USB_ACPI_LOCATION_VALID (1 << 31) usb_set_hub_port_location(hdev, port1, USB_ACPI_LOCATION_VALID - | pld->group_token << 8 - | pld->group_position); + | pld->group_token << 8 | pld->group_position); } /** diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index b80785106b27..749747eb23d1 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -185,7 +185,7 @@ extern enum usb_port_connect_type extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1, enum usb_port_connect_type type); extern void usb_set_hub_port_location(struct usb_device *hdev, int port1, - u32 cookie); + u32 cookie); extern void usb_hub_adjust_deviceremovable(struct usb_device *hdev, struct usb_hub_descriptor *desc); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html