Loading drivers/usb/core/hub.c +16 −7 Original line number Diff line number Diff line Loading @@ -718,18 +718,18 @@ static void hub_tt_work(struct work_struct *work) /** * usb_hub_set_port_power - control hub port's power state * @hdev: target hub * @hdev: USB device belonging to the usb hub * @hub: target hub * @port1: port index * @set: expected status * * call this function to control port's power via setting or * clearing the port's PORT_POWER feature. */ int usb_hub_set_port_power(struct usb_device *hdev, int port1, bool set) int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, int port1, bool set) { int ret; struct usb_hub *hub = usb_hub_to_struct_hub(hdev); struct usb_port *port_dev = hub->ports[port1 - 1]; if (set) Loading Loading @@ -1779,15 +1779,17 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) static int find_port_owner(struct usb_device *hdev, unsigned port1, struct dev_state ***ppowner) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (hdev->state == USB_STATE_NOTATTACHED) return -ENODEV; if (port1 == 0 || port1 > hdev->maxchild) return -EINVAL; /* This assumes that devices not managed by the hub driver /* Devices not managed by the hub driver * will always have maxchild equal to 0. */ *ppowner = &(usb_hub_to_struct_hub(hdev)->ports[port1 - 1]->port_owner); *ppowner = &(hub->ports[port1 - 1]->port_owner); return 0; } Loading Loading @@ -5416,6 +5418,7 @@ void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1, { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (hub) hub->ports[port1 - 1]->connect_type = type; } Loading @@ -5432,6 +5435,9 @@ usb_get_hub_port_connect_type(struct usb_device *hdev, int port1) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (!hub) return USB_PORT_CONNECT_TYPE_UNKNOWN; return hub->ports[port1 - 1]->connect_type; } Loading Loading @@ -5490,6 +5496,9 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (!hub) return NULL; return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev); } #endif drivers/usb/core/hub.h +1 −1 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ extern int usb_hub_create_port_device(struct usb_hub *hub, int port1); extern void usb_hub_remove_port_device(struct usb_hub *hub, int port1); extern int usb_hub_set_port_power(struct usb_device *hdev, extern int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, int port1, bool set); extern struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev); extern int hub_port_debounce(struct usb_hub *hub, int port1, Loading drivers/usb/core/port.c +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ static int usb_port_runtime_resume(struct device *dev) usb_autopm_get_interface(intf); set_bit(port1, hub->busy_bits); retval = usb_hub_set_port_power(hdev, port1, true); retval = usb_hub_set_port_power(hdev, hub, port1, true); if (port_dev->child && !retval) { /* * Wait for usb hub port to be reconnected in order to make Loading Loading @@ -128,7 +128,7 @@ static int usb_port_runtime_suspend(struct device *dev) usb_autopm_get_interface(intf); set_bit(port1, hub->busy_bits); retval = usb_hub_set_port_power(hdev, port1, false); retval = usb_hub_set_port_power(hdev, hub, port1, false); usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); clear_bit(port1, hub->busy_bits); Loading Loading
drivers/usb/core/hub.c +16 −7 Original line number Diff line number Diff line Loading @@ -718,18 +718,18 @@ static void hub_tt_work(struct work_struct *work) /** * usb_hub_set_port_power - control hub port's power state * @hdev: target hub * @hdev: USB device belonging to the usb hub * @hub: target hub * @port1: port index * @set: expected status * * call this function to control port's power via setting or * clearing the port's PORT_POWER feature. */ int usb_hub_set_port_power(struct usb_device *hdev, int port1, bool set) int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, int port1, bool set) { int ret; struct usb_hub *hub = usb_hub_to_struct_hub(hdev); struct usb_port *port_dev = hub->ports[port1 - 1]; if (set) Loading Loading @@ -1779,15 +1779,17 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) static int find_port_owner(struct usb_device *hdev, unsigned port1, struct dev_state ***ppowner) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (hdev->state == USB_STATE_NOTATTACHED) return -ENODEV; if (port1 == 0 || port1 > hdev->maxchild) return -EINVAL; /* This assumes that devices not managed by the hub driver /* Devices not managed by the hub driver * will always have maxchild equal to 0. */ *ppowner = &(usb_hub_to_struct_hub(hdev)->ports[port1 - 1]->port_owner); *ppowner = &(hub->ports[port1 - 1]->port_owner); return 0; } Loading Loading @@ -5416,6 +5418,7 @@ void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1, { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (hub) hub->ports[port1 - 1]->connect_type = type; } Loading @@ -5432,6 +5435,9 @@ usb_get_hub_port_connect_type(struct usb_device *hdev, int port1) { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (!hub) return USB_PORT_CONNECT_TYPE_UNKNOWN; return hub->ports[port1 - 1]->connect_type; } Loading Loading @@ -5490,6 +5496,9 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, { struct usb_hub *hub = usb_hub_to_struct_hub(hdev); if (!hub) return NULL; return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev); } #endif
drivers/usb/core/hub.h +1 −1 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ extern int usb_hub_create_port_device(struct usb_hub *hub, int port1); extern void usb_hub_remove_port_device(struct usb_hub *hub, int port1); extern int usb_hub_set_port_power(struct usb_device *hdev, extern int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, int port1, bool set); extern struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev); extern int hub_port_debounce(struct usb_hub *hub, int port1, Loading
drivers/usb/core/port.c +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ static int usb_port_runtime_resume(struct device *dev) usb_autopm_get_interface(intf); set_bit(port1, hub->busy_bits); retval = usb_hub_set_port_power(hdev, port1, true); retval = usb_hub_set_port_power(hdev, hub, port1, true); if (port_dev->child && !retval) { /* * Wait for usb hub port to be reconnected in order to make Loading Loading @@ -128,7 +128,7 @@ static int usb_port_runtime_suspend(struct device *dev) usb_autopm_get_interface(intf); set_bit(port1, hub->busy_bits); retval = usb_hub_set_port_power(hdev, port1, false); retval = usb_hub_set_port_power(hdev, hub, port1, false); usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); clear_bit(port1, hub->busy_bits); Loading