diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/hub.c | 22 | ||||
-rw-r--r-- | drivers/usb/core/usb-acpi.c | 34 |
2 files changed, 23 insertions, 33 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 653f80c52486..291292508774 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2305,6 +2305,22 @@ static void set_usb_port_removable(struct usb_device *udev) | |||
2305 | udev->removable = USB_DEVICE_REMOVABLE; | 2305 | udev->removable = USB_DEVICE_REMOVABLE; |
2306 | else | 2306 | else |
2307 | udev->removable = USB_DEVICE_FIXED; | 2307 | udev->removable = USB_DEVICE_FIXED; |
2308 | |||
2309 | /* | ||
2310 | * Platform firmware may have populated an alternative value for | ||
2311 | * removable. If the parent port has a known connect_type use | ||
2312 | * that instead. | ||
2313 | */ | ||
2314 | switch (hub->ports[udev->portnum - 1]->connect_type) { | ||
2315 | case USB_PORT_CONNECT_TYPE_HOT_PLUG: | ||
2316 | udev->removable = USB_DEVICE_REMOVABLE; | ||
2317 | break; | ||
2318 | case USB_PORT_CONNECT_TYPE_HARD_WIRED: | ||
2319 | udev->removable = USB_DEVICE_FIXED; | ||
2320 | break; | ||
2321 | default: /* use what was set above */ | ||
2322 | break; | ||
2323 | } | ||
2308 | } | 2324 | } |
2309 | 2325 | ||
2310 | /** | 2326 | /** |
@@ -2374,11 +2390,7 @@ int usb_new_device(struct usb_device *udev) | |||
2374 | 2390 | ||
2375 | device_enable_async_suspend(&udev->dev); | 2391 | device_enable_async_suspend(&udev->dev); |
2376 | 2392 | ||
2377 | /* | 2393 | /* check whether the hub or firmware marks this port as non-removable */ |
2378 | * check whether the hub marks this port as non-removable. Do it | ||
2379 | * now so that platform-specific data can override it in | ||
2380 | * device_add() | ||
2381 | */ | ||
2382 | if (udev->parent) | 2394 | if (udev->parent) |
2383 | set_usb_port_removable(udev); | 2395 | set_usb_port_removable(udev); |
2384 | 2396 | ||
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index f91ef0220066..d3e7e1b4125e 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c | |||
@@ -136,8 +136,8 @@ out: | |||
136 | 136 | ||
137 | static struct acpi_device *usb_acpi_find_companion(struct device *dev) | 137 | static struct acpi_device *usb_acpi_find_companion(struct device *dev) |
138 | { | 138 | { |
139 | int port1; | ||
140 | struct usb_device *udev; | 139 | struct usb_device *udev; |
140 | struct acpi_device *adev; | ||
141 | acpi_handle *parent_handle; | 141 | acpi_handle *parent_handle; |
142 | 142 | ||
143 | /* | 143 | /* |
@@ -155,40 +155,18 @@ static struct acpi_device *usb_acpi_find_companion(struct device *dev) | |||
155 | */ | 155 | */ |
156 | if (is_usb_device(dev)) { | 156 | if (is_usb_device(dev)) { |
157 | udev = to_usb_device(dev); | 157 | udev = to_usb_device(dev); |
158 | port1 = udev->portnum; | 158 | if (udev->parent) |
159 | if (udev->parent) { | ||
160 | struct usb_hub *hub; | ||
161 | |||
162 | hub = usb_hub_to_struct_hub(udev->parent); | ||
163 | /* | ||
164 | * According usb port's connect type to set usb device's | ||
165 | * removability. | ||
166 | */ | ||
167 | switch (hub->ports[port1 - 1]->connect_type) { | ||
168 | case USB_PORT_CONNECT_TYPE_HOT_PLUG: | ||
169 | udev->removable = USB_DEVICE_REMOVABLE; | ||
170 | break; | ||
171 | case USB_PORT_CONNECT_TYPE_HARD_WIRED: | ||
172 | udev->removable = USB_DEVICE_FIXED; | ||
173 | break; | ||
174 | default: | ||
175 | udev->removable = USB_DEVICE_REMOVABLE_UNKNOWN; | ||
176 | break; | ||
177 | } | ||
178 | |||
179 | return NULL; | 159 | return NULL; |
180 | } | ||
181 | 160 | ||
182 | /* root hub's parent is the usb hcd. */ | 161 | /* root hub is only child (_ADR=0) under its parent, the HC */ |
183 | return acpi_find_child_device(ACPI_COMPANION(dev->parent), | 162 | adev = ACPI_COMPANION(dev->parent); |
184 | port1, false); | 163 | return acpi_find_child_device(adev, 0, false); |
185 | } else if (is_usb_port(dev)) { | 164 | } else if (is_usb_port(dev)) { |
186 | struct usb_port *port_dev = to_usb_port(dev); | 165 | struct usb_port *port_dev = to_usb_port(dev); |
187 | struct acpi_device *adev = NULL; | 166 | int port1 = port_dev->portnum; |
188 | 167 | ||
189 | /* Get the struct usb_device point of port's hub */ | 168 | /* Get the struct usb_device point of port's hub */ |
190 | udev = to_usb_device(dev->parent->parent); | 169 | udev = to_usb_device(dev->parent->parent); |
191 | port1 = port_dev->portnum; | ||
192 | 170 | ||
193 | /* | 171 | /* |
194 | * The root hub ports' parent is the root hub. The non-root-hub | 172 | * The root hub ports' parent is the root hub. The non-root-hub |