4 * Copyright 2012 Red Hat <mjg@redhat.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation, version 2.
11 #include <linux/module.h>
12 #include <linux/usb.h>
13 #include <linux/device.h>
14 #include <linux/errno.h>
15 #include <linux/kernel.h>
16 #include <linux/acpi.h>
17 #include <linux/pci.h>
18 #include <acpi/acpi_bus.h>
22 static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
24 struct usb_device *udev;
25 struct device *parent;
26 acpi_handle *parent_handle;
28 if (!is_usb_device(dev))
31 udev = to_usb_device(dev);
33 parent_handle = DEVICE_ACPI_HANDLE(parent);
38 *handle = acpi_get_child(parent_handle, udev->portnum);
46 static struct acpi_bus_type usb_acpi_bus = {
49 .find_device = usb_acpi_find_device,
52 int usb_acpi_register(void)
54 return register_acpi_bus_type(&usb_acpi_bus);
57 void usb_acpi_unregister(void)
59 unregister_acpi_bus_type(&usb_acpi_bus);