|
|
|
[RFC PATCH 2/4] usb: add platform_data in the struct usb_hub_port | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
Add the member platform_data in the usb_hub_port to store port's
platform related data. Provide usb_set_hub_port_platform_data() and
usb_get_hub_port_platform_data() to access the member.
Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
---
drivers/usb/core/hub.c | 23 +++++++++++++++++++++++
drivers/usb/core/usb.h | 4 ++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 4c20c34..af391cb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -39,6 +39,7 @@
struct usb_hub_port {
void *port_owner;
+ unsigned long platform_data;
};
struct usb_hub {
@@ -4150,3 +4151,25 @@ void usb_queue_reset_device(struct usb_interface *iface)
schedule_work(&iface->reset_ws);
}
EXPORT_SYMBOL_GPL(usb_queue_reset_device);
+
+int usb_set_hub_port_platform_data(struct usb_device *udev, int port,
+ unsigned long data)
+{
+ struct usb_hub *hub = hdev_to_hub(udev);
+
+ if (port > hub->descriptor->bNbrPorts || port < 1)
+ return -EINVAL;
+ hub->port_data[port - 1].platform_data = data;
+ return 0;
+}
+
+int usb_get_hub_port_platform_data(struct usb_device *udev, int port,
+ unsigned long *data)
+{
+ struct usb_hub *hub = hdev_to_hub(udev);
+
+ if (port > hub->descriptor->bNbrPorts || port < 1)
+ return -EINVAL;
+ *data = hub->port_data[port - 1].platform_data;
+ return 0;
+}
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 636d98e..3e70565 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -154,6 +154,10 @@ extern void usb_notify_add_device(struct usb_device *udev);
extern void usb_notify_remove_device(struct usb_device *udev);
extern void usb_notify_add_bus(struct usb_bus *ubus);
extern void usb_notify_remove_bus(struct usb_bus *ubus);
+extern int usb_get_hub_port_platform_data(struct usb_device *udev,
+ int port, unsigned long *data);
+extern int usb_set_hub_port_platform_data(struct usb_device *udev,
+ int port, unsigned long data);
#ifdef CONFIG_ACPI
extern int usb_acpi_register(void);
--
1.7.6.rc2.8.g28eb
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Site Home] [Linux IBM ACPI] [Linux Power Management] [Linux Kernel] [Linux Laptop] [Kernel Newbies] [Share Photos] [Security] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite Photos] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Samba] [Video 4 Linux] [Device Mapper] [Linux Resources]
![]() |