Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354703
b: refs/heads/master
c: 88bb965
h: refs/heads/master
i:
  354701: bb7ec84
  354699: c77b962
  354695: e888fdf
  354687: 2702aa0
v: v3
  • Loading branch information
Lan Tianyu authored and Greg Kroah-Hartman committed Jan 25, 2013
1 parent 7ebb7fd commit 604d891
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8eae0fb7efa99d55afa9e94ce95d101af0830ca6
refs/heads/master: 88bb965ed711e8a5984e70208ebc901a6ff4141f
5 changes: 5 additions & 0 deletions trunk/drivers/usb/core/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ static void usb_port_device_release(struct device *dev)
{
struct usb_port *port_dev = to_usb_port(dev);

usb_acpi_unregister_power_resources(dev);
kfree(port_dev);
}

Expand Down Expand Up @@ -95,6 +96,10 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
if (retval)
goto error_register;

retval = usb_acpi_register_power_resources(&port_dev->dev);
if (retval && retval != -ENODEV)
dev_warn(&port_dev->dev, "the port can't register its ACPI power resource.\n");

return 0;

error_register:
Expand Down
18 changes: 18 additions & 0 deletions trunk/drivers/usb/core/usb-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,24 @@ static struct acpi_bus_type usb_acpi_bus = {
.find_device = usb_acpi_find_device,
};

int usb_acpi_register_power_resources(struct device *dev)
{
acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);

if (!port_handle)
return -ENODEV;

return acpi_power_resource_register_device(dev, port_handle);
}

void usb_acpi_unregister_power_resources(struct device *dev)
{
acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);

if (port_handle)
acpi_power_resource_unregister_device(dev, port_handle);
}

int usb_acpi_register(void)
{
return register_acpi_bus_type(&usb_acpi_bus);
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/usb/core/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ extern int usb_acpi_register(void);
extern void usb_acpi_unregister(void);
extern acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
int port1);
extern int usb_acpi_register_power_resources(struct device *dev);
extern void usb_acpi_unregister_power_resources(struct device *dev);
#else
static inline int usb_acpi_register(void) { return 0; };
static inline void usb_acpi_unregister(void) { };
static inline int usb_acpi_register_power_resources(struct device *dev)
{ return 0; };
static inline void usb_acpi_unregister_power_resources(struct device *dev)
{ };
#endif

0 comments on commit 604d891

Please sign in to comment.