public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org
Cc: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sarah.a.sharp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: [RFC PATCH 2/4] usb: add platform_data in the struct usb_hub_port
Date: Mon, 19 Mar 2012 22:33:44 +0800	[thread overview]
Message-ID: <1332167626-5806-2-git-send-email-tianyu.lan@intel.com> (raw)
In-Reply-To: <1332167626-5806-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-03-19 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 14:33 [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members Lan Tianyu
     [not found] ` <1332167626-5806-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-03-19 14:33   ` Lan Tianyu [this message]
2012-03-19 16:07     ` [RFC PATCH 2/4] usb: add platform_data in the struct usb_hub_port Alan Stern
2012-03-19 14:33 ` [RFC PATCH 3/4] usb/acpi: add the support of usb hub ports' acpi binding without attached devices Lan Tianyu
2012-03-19 16:10   ` Alan Stern
2012-03-19 14:33 ` [RFC PATCH 4/4] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
2012-03-19 16:13   ` Alan Stern
2012-03-19 16:04 ` [RFC PATCH 1/4] usb: add struct usb_hub_port to store port related members Alan Stern
2012-03-20  6:16   ` Lan Tianyu
2012-03-20 14:04     ` Alan Stern
2012-03-21  8:53       ` Lan Tianyu
     [not found]         ` <4F699725.3080404-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-03-21 14:38           ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332167626-5806-2-git-send-email-tianyu.lan@intel.com \
    --to=tianyu.lan-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sarah.a.sharp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox