All of lore.kernel.org
 help / color / mirror / Atom feed
* [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi
@ 2012-05-04  3:06 Lan Tianyu
  2012-05-04  3:06 ` [Resend PATCH V2 1/7] ACPI: Add _PLD support Lan Tianyu
                   ` (3 more replies)
  0 siblings, 4 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb-DgEjT+Ai2ygdnm+yROfE0A, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ

This patchset derives from following patches.
>From Matthew Garrett
[PATCH V2 2/4] ACPI: Add _PLD support
[PATCH V2 3/4] usb: Bind devices to ACPI devices when possible
[PATCH v2 4/4] usb: Set device removable state based on ACPI USB data

>From Tianyu Lan
[PATCH V3 1/4] usb: add struct usb_hub_port to store port related members
[PATCH V3 2/4] usb: move struct usb_device->children to struct usb_hub_port->child
[PATCH V3 3/4] usb/acpi: add the support of usb hub ports' acpi binding without attached devices.
[PATCH V3 4/4] usb/acpi: add usb check for the connect type of usb port

Previously those patches was blocked by [PATCH V2 1/4] ACPI: Fix up _PLD methods.
Current the final version of this patch has been integrated into ACPICA and released as:
6a99b1c94d053b3420eaa4a4bc8b2883dd90a2f9
ACPICA: Object repair code: Support to add Package wrappers

[Resend PATCH V2 1/7] ACPI: Add _PLD support (Acked by Len brown)
[Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
[Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
[Resend PATCH V2 4/7] usb: add struct usb_hub_port to store port related
[Resend PATCH V2 5/7] usb: move struct usb_device->children to struct
[Resend PATCH V2 6/7] usb/acpi: add the support of usb hub ports' acpi binding
[Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port

git diff --stat
 drivers/acpi/utils.c                 |   29 +++++++
 drivers/staging/usbip/usbip_common.c |    3 +-
 drivers/usb/core/Makefile            |    1 +
 drivers/usb/core/devices.c           |    3 +-
 drivers/usb/core/hub.c               |  133 +++++++++++++++++++++--------
 drivers/usb/core/usb-acpi.c          |  154 ++++++++++++++++++++++++++++++++++
 drivers/usb/core/usb.c               |    6 ++
 drivers/usb/core/usb.h               |   19 ++++-
 drivers/usb/host/r8a66597-hcd.c      |    3 +-
 include/acpi/acpi_bus.h              |   31 +++++++
 include/linux/usb.h                  |   10 ++-
 11 files changed, 349 insertions(+), 43 deletions(-)




--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 1/7] ACPI: Add _PLD support
  2012-05-04  3:06 [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Lan Tianyu
@ 2012-05-04  3:06 ` Lan Tianyu
  2012-05-04  6:18   ` Oliver Neukum
  2012-05-04  3:06 ` [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible Lan Tianyu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb, gregkh
  Cc: linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm, Matthew Garrett

From: Matthew Garrett <mjg@redhat.com>

Add a simple helper function to allow drivers to obtain the physical
device location data.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
 drivers/acpi/utils.c    |   29 +++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |   31 +++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index b002a47..5c320a0 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -382,3 +382,32 @@ acpi_evaluate_reference(acpi_handle handle,
 }
 
 EXPORT_SYMBOL(acpi_evaluate_reference);
+
+acpi_status
+acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld)
+{
+	acpi_status status;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *output;
+
+	status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer);
+
+	if (ACPI_FAILURE(status))
+		return status;
+
+	output = buffer.pointer;
+
+	if (!output || output->type != ACPI_TYPE_PACKAGE
+	    || !output->package.count
+	    || output->package.elements[0].type != ACPI_TYPE_BUFFER
+	    || output->package.elements[0].buffer.length > sizeof(*pld)) {
+		status = AE_TYPE;
+		goto out;
+	}
+
+	memcpy(pld, output->package.elements[0].buffer.pointer,
+	       output->package.elements[0].buffer.length);
+out:
+	kfree(buffer.pointer);
+	return status;
+}
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f1c8ca6..2642744 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -51,6 +51,37 @@ acpi_evaluate_reference(acpi_handle handle,
 			struct acpi_object_list *arguments,
 			struct acpi_handle_list *list);
 
+struct acpi_pld {
+	unsigned int revision:7; /* 0 */
+	unsigned int ignore_colour:1; /* 7 */
+	unsigned int colour:24; /* 8 */
+	unsigned int width:16; /* 32 */
+	unsigned int height:16; /* 48 */
+	unsigned int user_visible:1; /* 64 */
+	unsigned int dock:1; /* 65 */
+	unsigned int lid:1; /* 66 */
+	unsigned int panel:3; /* 67 */
+	unsigned int vertical_pos:2; /* 70 */
+	unsigned int horizontal_pos:2; /* 72 */
+	unsigned int shape:4; /* 74 */
+	unsigned int group_orientation:1; /* 78 */
+	unsigned int group_token:8; /* 79 */
+	unsigned int group_position:8; /* 87 */
+	unsigned int bay:1; /* 95 */
+	unsigned int ejectable:1; /* 96 */
+	unsigned int ospm_eject_required:1; /* 97 */
+	unsigned int cabinet_number:8; /* 98 */
+	unsigned int card_cage_number:8; /* 106 */
+	unsigned int reference:1; /* 114 */
+	unsigned int rotation:4; /* 115 */
+	unsigned int order:5; /* 119 */
+	unsigned int reserved:4; /* 124 */
+	unsigned int vertical_offset:16; /* 128 */
+	unsigned int horizontal_offset:16; /* 144 */
+};
+
+acpi_status
+acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld);
 #ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
-- 
1.7.6.rc2.8.g28eb


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
  2012-05-04  3:06 [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Lan Tianyu
  2012-05-04  3:06 ` [Resend PATCH V2 1/7] ACPI: Add _PLD support Lan Tianyu
@ 2012-05-04  3:06 ` Lan Tianyu
       [not found]   ` <1336100803-28353-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2012-05-04  3:06 ` [Resend PATCH V2 5/7] usb: move struct usb_device->children to struct usb_hub_port->child Lan Tianyu
  3 siblings, 1 reply; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb, gregkh
  Cc: linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm, Matthew Garrett

From: Matthew Garrett <mjg@redhat.com>

Built-in USB devices will typically have a representation in the system
ACPI tables. Add support for binding the two together so the USB code can
make use of the associated methods.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
 drivers/usb/core/Makefile   |    1 +
 drivers/usb/core/usb-acpi.c |   60 +++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/core/usb.c      |    6 ++++
 drivers/usb/core/usb.h      |    7 +++++
 4 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/core/usb-acpi.c

diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index 507a4e1..9268ddb 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -10,5 +10,6 @@ usbcore-y += devio.o notify.o generic.o quirks.o devices.o
 
 usbcore-$(CONFIG_PCI)		+= hcd-pci.o
 usbcore-$(CONFIG_USB_DEVICEFS)	+= inode.o
+usbcore-$(CONFIG_ACPI)		+= usb-acpi.o
 
 obj-$(CONFIG_USB)		+= usbcore.o
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
new file mode 100644
index 0000000..cab5cb7
--- /dev/null
+++ b/drivers/usb/core/usb-acpi.c
@@ -0,0 +1,60 @@
+/*
+ * USB-ACPI glue code
+ *
+ * Copyright 2012 Red Hat <mjg@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, version 2.
+ *
+ */
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/acpi.h>
+#include <linux/pci.h>
+#include <acpi/acpi_bus.h>
+
+#include "usb.h"
+
+static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
+{
+	struct usb_device *udev;
+	struct device *parent;
+	acpi_handle *parent_handle;
+
+	if (!is_usb_device(dev))
+		return -ENODEV;
+
+	udev = to_usb_device(dev);
+	parent = dev->parent;
+	parent_handle = DEVICE_ACPI_HANDLE(parent);
+
+	if (!parent_handle)
+		return -ENODEV;
+
+	*handle = acpi_get_child(parent_handle, udev->portnum);
+
+	if (!*handle)
+		return -ENODEV;
+
+	return 0;
+}
+
+static struct acpi_bus_type usb_acpi_bus = {
+	.bus = &usb_bus_type,
+	.find_bridge = NULL,
+	.find_device = usb_acpi_find_device,
+};
+
+int usb_acpi_register(void)
+{
+	return register_acpi_bus_type(&usb_acpi_bus);
+}
+
+void usb_acpi_unregister(void)
+{
+	unregister_acpi_bus_type(&usb_acpi_bus);
+}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c74ba7b..84e8c20 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1015,6 +1015,9 @@ static int __init usb_init(void)
 	if (retval)
 		goto out;
 
+	retval = usb_acpi_register();
+	if (retval)
+		goto acpi_register_failed;
 	retval = bus_register(&usb_bus_type);
 	if (retval)
 		goto bus_register_failed;
@@ -1054,6 +1057,8 @@ major_init_failed:
 bus_notifier_failed:
 	bus_unregister(&usb_bus_type);
 bus_register_failed:
+	usb_acpi_unregister();
+acpi_register_failed:
 	usb_debugfs_cleanup();
 out:
 	return retval;
@@ -1076,6 +1081,7 @@ static void __exit usb_exit(void)
 	usb_hub_cleanup();
 	bus_unregister_notifier(&usb_bus_type, &usb_bus_nb);
 	bus_unregister(&usb_bus_type);
+	usb_acpi_unregister();
 	usb_debugfs_cleanup();
 }
 
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 71648dc..5c5c538 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -156,3 +156,10 @@ 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);
 
+#ifdef CONFIG_ACPI
+extern int usb_acpi_register(void);
+extern void usb_acpi_unregister(void);
+#else
+static inline int usb_acpi_register(void) { return 0; };
+static inline void usb_acpi_unregister(void) { };
+#endif
-- 
1.7.6.rc2.8.g28eb


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2012-05-04  3:06   ` Lan Tianyu
  2012-05-04  6:24     ` Oliver Neukum
  2012-05-08 17:31     ` Greg KH
  2012-05-04  3:06   ` [Resend PATCH V2 4/7] usb: add struct usb_hub_port to store port related members Lan Tianyu
                     ` (3 subsequent siblings)
  4 siblings, 2 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb-DgEjT+Ai2ygdnm+yROfE0A, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Matthew Garrett

From: Matthew Garrett <mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

ACPI offers two methods that allow us to infer whether or not a USB port
is removable. The _PLD method gives us information on whether the port is
"user visible" or not. If that's not present then we can fall back to the
_UPC method which tells us whether or not a port is connectable.

Signed-off-by: Matthew Garrett <mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/core/usb-acpi.c |   56 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index cab5cb7..e49373a 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -19,6 +19,53 @@
 
 #include "usb.h"
 
+static int usb_acpi_check_upc(struct usb_device *udev, acpi_handle handle)
+{
+	acpi_status status;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *upc;
+	int ret = 0;
+
+	status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer);
+
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	upc = buffer.pointer;
+
+	if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if (upc->package.elements[0].integer.value)
+		udev->removable = USB_DEVICE_REMOVABLE;
+	else
+		udev->removable = USB_DEVICE_FIXED;
+
+out:
+	kfree(upc);
+	return ret;
+}
+
+static int usb_acpi_check_pld(struct usb_device *udev, acpi_handle handle)
+{
+	acpi_status status;
+	struct acpi_pld pld;
+
+	status = acpi_get_physical_device_location(handle, &pld);
+
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	if (pld.user_visible)
+		udev->removable = USB_DEVICE_REMOVABLE;
+	else
+		udev->removable = USB_DEVICE_FIXED;
+
+	return 0;
+}
+
 static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 {
 	struct usb_device *udev;
@@ -40,6 +87,15 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 	if (!*handle)
 		return -ENODEV;
 
+	/*
+	 * PLD will tell us whether a port is removable to the user or
+	 * not. If we don't get an answer from PLD (it's not present
+	 * or it's malformed) then try to infer it from UPC. If a
+	 * device isn't connectable then it's probably not removable.
+	 */
+	if (usb_acpi_check_pld(udev, *handle) != 0)
+		usb_acpi_check_upc(udev, *handle);
+
 	return 0;
 }
 
-- 
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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 4/7] usb: add struct usb_hub_port to store port related members.
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2012-05-04  3:06   ` [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data Lan Tianyu
@ 2012-05-04  3:06   ` Lan Tianyu
  2012-05-04  3:06   ` [Resend PATCH V2 6/7] usb/acpi: add the support of usb hub ports' acpi binding without attached devices Lan Tianyu
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb-DgEjT+Ai2ygdnm+yROfE0A, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Lan Tianyu

Add struct usb_hub_port pointer port_data in the struct usb_hub and allocate
struct usb_hub_port perspectively for each ports to store private data.

Signed-off-by: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/core/hub.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index ec6c97d..0c17d5a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -37,6 +37,10 @@
 #endif
 #endif
 
+struct usb_hub_port {
+	void			*port_owner;
+};
+
 struct usb_hub {
 	struct device		*intfdev;	/* the "interface" device */
 	struct usb_device	*hdev;
@@ -81,7 +85,7 @@ struct usb_hub {
 	u8			indicator[USB_MAXCHILDREN];
 	struct delayed_work	leds;
 	struct delayed_work	init_work;
-	void			**port_owners;
+	struct usb_hub_port	*port_data;
 };
 
 static inline int hub_is_superspeed(struct usb_device *hdev)
@@ -1049,8 +1053,9 @@ static int hub_configure(struct usb_hub *hub,
 
 	hdev->children = kzalloc(hdev->maxchild *
 				sizeof(struct usb_device *), GFP_KERNEL);
-	hub->port_owners = kzalloc(hdev->maxchild * sizeof(void *), GFP_KERNEL);
-	if (!hdev->children || !hub->port_owners) {
+	hub->port_data = kzalloc(hdev->maxchild * sizeof(struct usb_hub_port),
+			GFP_KERNEL);
+	if (!hub->port_data || !hdev->children) {
 		ret = -ENOMEM;
 		goto fail;
 	}
@@ -1305,7 +1310,7 @@ static void hub_disconnect(struct usb_interface *intf)
 
 	usb_free_urb(hub->urb);
 	kfree(hdev->children);
-	kfree(hub->port_owners);
+	kfree(hub->port_data);
 	kfree(hub->descriptor);
 	kfree(hub->status);
 	kfree(hub->buffer);
@@ -1437,7 +1442,7 @@ static int find_port_owner(struct usb_device *hdev, unsigned port1,
 	/* This assumes that devices not managed by the hub driver
 	 * will always have maxchild equal to 0.
 	 */
-	*ppowner = &(hdev_to_hub(hdev)->port_owners[port1 - 1]);
+	*ppowner = &(hdev_to_hub(hdev)->port_data[port1 - 1].port_owner);
 	return 0;
 }
 
@@ -1472,16 +1477,14 @@ int usb_hub_release_port(struct usb_device *hdev, unsigned port1, void *owner)
 
 void usb_hub_release_all_ports(struct usb_device *hdev, void *owner)
 {
+	struct usb_hub *hub = hdev_to_hub(hdev);
 	int n;
-	void **powner;
 
-	n = find_port_owner(hdev, 1, &powner);
-	if (n == 0) {
-		for (; n < hdev->maxchild; (++n, ++powner)) {
-			if (*powner == owner)
-				*powner = NULL;
-		}
+	for (n = 0; n < hdev->maxchild; n++) {
+		if (hub->port_data[n].port_owner == owner)
+			hub->port_data[n].port_owner = NULL;
 	}
+
 }
 
 /* The caller must hold udev's lock */
@@ -1492,7 +1495,7 @@ bool usb_device_is_owned(struct usb_device *udev)
 	if (udev->state == USB_STATE_NOTATTACHED || !udev->parent)
 		return false;
 	hub = hdev_to_hub(udev->parent);
-	return !!hub->port_owners[udev->portnum - 1];
+	return !!hub->port_data[udev->portnum - 1].port_owner;
 }
 
 
-- 
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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 5/7] usb: move struct usb_device->children to struct usb_hub_port->child
  2012-05-04  3:06 [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Lan Tianyu
                   ` (2 preceding siblings ...)
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2012-05-04  3:06 ` Lan Tianyu
  3 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb, gregkh
  Cc: linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm, Lan Tianyu

Move child's pointer to the struct usb_hub_port since the child device
is directly associated with the port. Provide usb_get_hub_child_device()
to get child's pointer.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 drivers/staging/usbip/usbip_common.c |    3 +-
 drivers/usb/core/devices.c           |    3 +-
 drivers/usb/core/hub.c               |   68 ++++++++++++++++++++--------------
 drivers/usb/host/r8a66597-hcd.c      |    3 +-
 include/linux/usb.h                  |    4 +-
 5 files changed, 47 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 70f23026..95beb76 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -157,8 +157,7 @@ static void usbip_dump_usb_device(struct usb_device *udev)
 	dev_dbg(dev, "have_langid %d, string_langid %d\n",
 		udev->have_langid, udev->string_langid);
 
-	dev_dbg(dev, "maxchild %d, children %p\n",
-		udev->maxchild, udev->children);
+	dev_dbg(dev, "maxchild %d\n", udev->maxchild);
 }
 
 static void usbip_dump_request_type(__u8 rt)
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index d956965..a83962b 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -590,7 +590,8 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
 
 	/* Now look at all of this device's children. */
 	for (chix = 0; chix < usbdev->maxchild; chix++) {
-		struct usb_device *childdev = usbdev->children[chix];
+		struct usb_device *childdev =
+			usb_get_hub_child_device(usbdev, chix + 1);
 
 		if (childdev) {
 			usb_lock_device(childdev);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0c17d5a..bdf46fb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -39,6 +39,7 @@
 
 struct usb_hub_port {
 	void			*port_owner;
+	struct usb_device	*child;
 };
 
 struct usb_hub {
@@ -93,7 +94,7 @@ static inline int hub_is_superspeed(struct usb_device *hdev)
 	return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS);
 }
 
-/* Protect struct usb_device->state and ->children members
+/* Protect struct usb_device->state and struct usb_hub_port->child members
  * Note: Both are also protected by ->dev.sem, except that ->state can
  * change to USB_STATE_NOTATTACHED even when the semaphore isn't held. */
 static DEFINE_SPINLOCK(device_state_lock);
@@ -176,7 +177,7 @@ static inline char *portspeed(struct usb_hub *hub, int portstatus)
 /* Note that hdev or one of its children must be locked! */
 static struct usb_hub *hdev_to_hub(struct usb_device *hdev)
 {
-	if (!hdev || !hdev->actconfig)
+	if (!hdev || !hdev->actconfig || !hdev->maxchild)
 		return NULL;
 	return usb_get_intfdata(hdev->actconfig->interface[0]);
 }
@@ -649,8 +650,8 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
 	struct usb_device *hdev = hub->hdev;
 	int ret = 0;
 
-	if (hdev->children[port1-1] && set_state)
-		usb_set_device_state(hdev->children[port1-1],
+	if (hub->port_data[port1-1].child && set_state)
+		usb_set_device_state(hub->port_data[port1-1].child,
 				USB_STATE_NOTATTACHED);
 	if (!hub->error && !hub_is_superspeed(hub->hdev))
 		ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE);
@@ -806,7 +807,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
 	 * which ports need attention.
 	 */
 	for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
-		struct usb_device *udev = hdev->children[port1-1];
+		struct usb_device *udev = hub->port_data[port1-1].child;
 		u16 portstatus, portchange;
 
 		portstatus = portchange = 0;
@@ -971,8 +972,8 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
 	if (type != HUB_SUSPEND) {
 		/* Disconnect all the children */
 		for (i = 0; i < hdev->maxchild; ++i) {
-			if (hdev->children[i])
-				usb_disconnect(&hdev->children[i]);
+			if (hub->port_data[i].child)
+				usb_disconnect(&hub->port_data[i].child);
 		}
 	}
 
@@ -1051,11 +1052,9 @@ static int hub_configure(struct usb_hub *hub,
 	dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild,
 		(hdev->maxchild == 1) ? "" : "s");
 
-	hdev->children = kzalloc(hdev->maxchild *
-				sizeof(struct usb_device *), GFP_KERNEL);
 	hub->port_data = kzalloc(hdev->maxchild * sizeof(struct usb_hub_port),
 			GFP_KERNEL);
-	if (!hub->port_data || !hdev->children) {
+	if (!hub->port_data) {
 		ret = -ENOMEM;
 		goto fail;
 	}
@@ -1287,7 +1286,6 @@ static unsigned highspeed_hubs;
 static void hub_disconnect(struct usb_interface *intf)
 {
 	struct usb_hub *hub = usb_get_intfdata(intf);
-	struct usb_device *hdev = interface_to_usbdev(intf);
 
 	/* Take the hub off the event list and don't let it be added again */
 	spin_lock_irq(&hub_event_lock);
@@ -1309,7 +1307,6 @@ static void hub_disconnect(struct usb_interface *intf)
 		highspeed_hubs--;
 
 	usb_free_urb(hub->urb);
-	kfree(hdev->children);
 	kfree(hub->port_data);
 	kfree(hub->descriptor);
 	kfree(hub->status);
@@ -1397,6 +1394,7 @@ static int
 hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
 {
 	struct usb_device *hdev = interface_to_usbdev (intf);
+	struct usb_hub *hub = usb_get_intfdata(intf);
 
 	/* assert ifno == 0 (part of hub spec) */
 	switch (code) {
@@ -1410,11 +1408,11 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
 		else {
 			info->nports = hdev->maxchild;
 			for (i = 0; i < info->nports; i++) {
-				if (hdev->children[i] == NULL)
+				if (hub->port_data[i].child == NULL)
 					info->port[i] = 0;
 				else
 					info->port[i] =
-						hdev->children[i]->devnum;
+						hub->port_data[i].child->devnum;
 			}
 		}
 		spin_unlock_irq(&device_state_lock);
@@ -1501,11 +1499,13 @@ bool usb_device_is_owned(struct usb_device *udev)
 
 static void recursively_mark_NOTATTACHED(struct usb_device *udev)
 {
+	struct usb_hub	*hub = hdev_to_hub(udev);
 	int i;
 
 	for (i = 0; i < udev->maxchild; ++i) {
-		if (udev->children[i])
-			recursively_mark_NOTATTACHED(udev->children[i]);
+		if (hub->port_data[i].child)
+			recursively_mark_NOTATTACHED(
+				hub->port_data[i].child);
 	}
 	if (udev->state == USB_STATE_SUSPENDED)
 		udev->active_duration -= jiffies;
@@ -1669,8 +1669,8 @@ static void hub_free_dev(struct usb_device *udev)
 void usb_disconnect(struct usb_device **pdev)
 {
 	struct usb_device	*udev = *pdev;
+	struct usb_hub      	*hub = hdev_to_hub(udev);
 	int			i;
-
 	/* mark the device as inactive, so any further urb submissions for
 	 * this device (and any of its children) will fail immediately.
 	 * this quiesces everything except pending urbs.
@@ -1683,8 +1683,8 @@ void usb_disconnect(struct usb_device **pdev)
 
 	/* Free up all the children before we remove this device */
 	for (i = 0; i < udev->maxchild; i++) {
-		if (udev->children[i])
-			usb_disconnect(&udev->children[i]);
+		if (hub->port_data[i].child)
+			usb_disconnect(&hub->port_data[i].child);
 	}
 
 	/* deallocate hcd/hardware state ... nuking all pending urbs and
@@ -2765,7 +2765,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
 	for (port1 = 1; port1 <= hdev->maxchild; port1++) {
 		struct usb_device	*udev;
 
-		udev = hdev->children [port1-1];
+		udev = hub->port_data[port1-1].child;
 		if (udev && udev->can_submit) {
 			dev_warn(&intf->dev, "port %d nyet suspended\n", port1);
 			if (PMSG_IS_AUTO(msg))
@@ -3266,7 +3266,7 @@ hub_power_remaining (struct usb_hub *hub)
 
 	remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent;
 	for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
-		struct usb_device	*udev = hdev->children[port1 - 1];
+		struct usb_device	*udev = hub->port_data[port1 - 1].child;
 		int			delta;
 
 		if (!udev)
@@ -3330,7 +3330,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 #endif
 
 	/* Try to resuscitate an existing device */
-	udev = hdev->children[port1-1];
+	udev = hub->port_data[port1-1].child;
 	if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
 			udev->state != USB_STATE_NOTATTACHED) {
 		usb_lock_device(udev);
@@ -3359,7 +3359,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 
 	/* Disconnect any existing devices under this port */
 	if (udev)
-		usb_disconnect(&hdev->children[port1-1]);
+		usb_disconnect(&hub->port_data[port1-1].child);
 	clear_bit(port1, hub->change_bits);
 
 	/* We can forget about a "removed" device when there's a physical
@@ -3474,7 +3474,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 				&& highspeed_hubs != 0)
 			check_highspeed (hub, udev, port1);
 
-		/* Store the parent's children[] pointer.  At this point
+		/* Store the hub port's child pointer.  At this point
 		 * udev becomes globally accessible, although presumably
 		 * no one will look at it until hdev is unlocked.
 		 */
@@ -3488,7 +3488,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 		if (hdev->state == USB_STATE_NOTATTACHED)
 			status = -ENOTCONN;
 		else
-			hdev->children[port1-1] = udev;
+			hub->port_data[port1-1].child = udev;
 		spin_unlock_irq(&device_state_lock);
 
 		/* Run it through the hoops (find a driver, etc) */
@@ -3496,7 +3496,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 			status = usb_new_device(udev);
 			if (status) {
 				spin_lock_irq(&device_state_lock);
-				hdev->children[port1-1] = NULL;
+				hub->port_data[port1-1].child = NULL;
 				spin_unlock_irq(&device_state_lock);
 			}
 		}
@@ -3542,7 +3542,7 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
 	int ret;
 
 	hdev = hub->hdev;
-	udev = hdev->children[port-1];
+	udev = hub->port_data[port - 1].child;
 	if (!hub_is_superspeed(hdev)) {
 		if (!(portchange & USB_PORT_STAT_C_SUSPEND))
 			return 0;
@@ -3696,7 +3696,7 @@ static void hub_events(void)
 				 */
 				if (!(portstatus & USB_PORT_STAT_ENABLE)
 				    && !connect_change
-				    && hdev->children[i-1]) {
+				    && hub->port_data[i-1].child) {
 					dev_err (hub_dev,
 					    "port %i "
 					    "disabled by hub (EMI?), "
@@ -4234,3 +4234,15 @@ void usb_queue_reset_device(struct usb_interface *iface)
 	schedule_work(&iface->reset_ws);
 }
 EXPORT_SYMBOL_GPL(usb_queue_reset_device);
+
+struct usb_device *usb_get_hub_child_device(struct usb_device *hdev,
+	int port1)
+{
+	struct usb_hub *hub = hdev_to_hub(hdev);
+
+	if (!hub || port1 > hdev->maxchild || port1 < 1)
+		return NULL;
+	return hub->port_data[port1 - 1].child;
+}
+EXPORT_SYMBOL_GPL(usb_get_hub_child_device);
+
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 2bf1320..8f4ec9f 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2040,7 +2040,8 @@ static void collect_usb_address_map(struct usb_device *udev, unsigned long *map)
 		map[udev->devnum/32] |= (1 << (udev->devnum % 32));
 
 	for (chix = 0; chix < udev->maxchild; chix++) {
-		struct usb_device *childdev = udev->children[chix];
+		struct usb_device *childdev =
+			usb_get_hub_child_device(udev, chix + 1);
 
 		if (childdev)
 			collect_usb_address_map(childdev, map);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73b68d1..5e7058d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -428,7 +428,6 @@ enum usb_device_removable {
  *	access from userspace
  * @usbfs_dentry: usbfs dentry entry for the device
  * @maxchild: number of ports if hub
- * @children: child devices - USB devices that are attached to this hub
  * @quirks: quirks of the whole device
  * @urbnum: number of URBs submitted for the whole device
  * @active_duration: total time device is not suspended
@@ -501,7 +500,6 @@ struct usb_device {
 #endif
 
 	int maxchild;
-	struct usb_device **children;
 
 	u32 quirks;
 	atomic_t urbnum;
@@ -527,6 +525,8 @@ static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
 
 extern struct usb_device *usb_get_dev(struct usb_device *dev);
 extern void usb_put_dev(struct usb_device *dev);
+extern struct usb_device *usb_get_hub_child_device(struct usb_device *hdev,
+	int port1);
 
 /* USB device locking */
 #define usb_lock_device(udev)		device_lock(&(udev)->dev)
-- 
1.7.6.rc2.8.g28eb


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 6/7] usb/acpi: add the support of usb hub ports' acpi binding without attached devices.
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2012-05-04  3:06   ` [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data Lan Tianyu
  2012-05-04  3:06   ` [Resend PATCH V2 4/7] usb: add struct usb_hub_port to store port related members Lan Tianyu
@ 2012-05-04  3:06   ` Lan Tianyu
  2012-05-04  3:06   ` [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
  2012-05-04  3:17   ` [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Matthew Garrett
  4 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb-DgEjT+Ai2ygdnm+yROfE0A, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Lan Tianyu

The usb port is a device in the acpi table but it's not in the linux
usb subsystem. USB hub port doesn't have struct device. So the acpi
glue framework only can cover the usb port connected with usb device
and store the acpi handle to struct device.archdata.acpi_handle. This
patch adds the member platform_data in the struct usb_hub_port and
gets the hub port's acpi_handle and store it in the port's platform_data
to resolve no attached device no binding problem. The acpi method "_UPC"
and "_PLD" can be accessed without attached device.

Signed-off-by: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/core/hub.c      |   20 ++++++++++++++++++++
 drivers/usb/core/usb-acpi.c |   37 ++++++++++++++++++++++++++++++++++++-
 drivers/usb/core/usb.h      |    6 ++++++
 3 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bdf46fb..5ea9618 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -40,6 +40,7 @@
 struct usb_hub_port {
 	void			*port_owner;
 	struct usb_device	*child;
+	unsigned long		platform_data;
 };
 
 struct usb_hub {
@@ -1263,6 +1264,7 @@ static int hub_configure(struct usb_hub *hub,
 	if (hub->has_indicators && blinkenlights)
 		hub->indicator [0] = INDICATOR_CYCLE;
 
+	usb_acpi_bind_hub_ports(hdev);
 	hub_activate(hub, HUB_INIT);
 	return 0;
 
@@ -4246,3 +4248,21 @@ struct usb_device *usb_get_hub_child_device(struct usb_device *hdev,
 }
 EXPORT_SYMBOL_GPL(usb_get_hub_child_device);
 
+void usb_set_hub_port_platform_data(struct usb_device *hdev, int port1,
+	unsigned long data)
+{
+	struct usb_hub *hub = hdev_to_hub(hdev);
+
+	if (!hub || port1 > hdev->maxchild || port1 < 1)
+		return;
+	hub->port_data[port1 - 1].platform_data = data;
+}
+
+unsigned long usb_get_hub_port_platform_data(struct usb_device *hdev, int port1)
+{
+	struct usb_hub *hub = hdev_to_hub(hdev);
+
+	if (!hub || port1 > hdev->maxchild || port1 < 1)
+		return 0;
+	return hub->port_data[port1 - 1].platform_data;
+}
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index e49373a..984c559 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -82,7 +82,16 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 	if (!parent_handle)
 		return -ENODEV;
 
-	*handle = acpi_get_child(parent_handle, udev->portnum);
+	/**
+	 * The root hub's acpi handle is got from acpi method.
+	 * Other device's acpi handle can be got from the usb hub
+	 * port's platform_data.
+	 */
+	if (!udev->parent)
+		*handle = acpi_get_child(parent_handle, udev->portnum);
+	else
+		*handle = (acpi_handle)usb_get_hub_port_platform_data(
+				udev->parent, udev->portnum);
 
 	if (!*handle)
 		return -ENODEV;
@@ -105,6 +114,32 @@ static struct acpi_bus_type usb_acpi_bus = {
 	.find_device = usb_acpi_find_device,
 };
 
+int usb_acpi_bind_hub_ports(struct usb_device *hdev)
+{
+	acpi_handle hub_handle = NULL;
+	acpi_handle port_handle = NULL;
+	struct device *dev = &hdev->dev;
+	int i;
+
+	hub_handle = DEVICE_ACPI_HANDLE(dev);
+	if (!hub_handle)
+		return -ENODEV;
+
+	/**
+	 * The usb hub port is not a device in the usb subsystem but it is a device
+	 * in the acpi table. Store its acpi handle in the platform data of usb
+	 * hub port.
+	 */
+	for (i = 1; i <= hdev->maxchild; i++) {
+		port_handle = acpi_get_child(hub_handle, i);
+		if (!port_handle)
+			continue;
+		usb_set_hub_port_platform_data(hdev, i,
+			(unsigned long)port_handle);
+	}
+	return 0;
+}
+
 int usb_acpi_register(void)
 {
 	return register_acpi_bus_type(&usb_acpi_bus);
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 5c5c538..d69d5f6 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -155,11 +155,17 @@ 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 unsigned long usb_get_hub_port_platform_data(struct usb_device *hdev,
+	int port1);
+extern void usb_set_hub_port_platform_data(struct usb_device *hdev,
+	int port1, unsigned long data);
 
 #ifdef CONFIG_ACPI
 extern int usb_acpi_register(void);
 extern void usb_acpi_unregister(void);
+extern int usb_acpi_bind_hub_ports(struct usb_device *hdev);
 #else
 static inline int usb_acpi_register(void) { return 0; };
 static inline void usb_acpi_unregister(void) { };
+static inline int usb_acpi_bind_hub_ports(struct usb_device *dev) { return 0; };
 #endif
-- 
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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2012-05-04  3:06   ` [Resend PATCH V2 6/7] usb/acpi: add the support of usb hub ports' acpi binding without attached devices Lan Tianyu
@ 2012-05-04  3:06   ` Lan Tianyu
  2012-05-04  6:37     ` Oliver Neukum
  2012-05-04  3:17   ` [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Matthew Garrett
  4 siblings, 1 reply; 27+ messages in thread
From: Lan Tianyu @ 2012-05-04  3:06 UTC (permalink / raw)
  To: lenb-DgEjT+Ai2ygdnm+yROfE0A, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Lan Tianyu

Check the connect type of usb port when getting the usb port's
acpi_handle and store result into connect_type in the struct
usb_hub_port.

Accoding to ACPI Spec 9.13. PLD indicates whether usb port is
user visible and _UPC indicates whether it is connectable. If
the port was visible and connectable, it could be freely connected
and disconnected with USB devices. If no visible and connectable,
a usb device is directly hard-wired to the port. If no visible and
no connectable, the port would be not used.

When a device was found on the port, if the connect_type was hot-plug,
then the device would be removable. If the connect_type was hard-wired,
the device would be non-removable.

Signed-off-by: Lan Tianyu <tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/core/hub.c      |   21 +++++++++++++
 drivers/usb/core/usb-acpi.c |   67 ++++++++++++++++++++++--------------------
 drivers/usb/core/usb.h      |    4 ++
 include/linux/usb.h         |    7 ++++
 4 files changed, 67 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5ea9618..4aa9dc7 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -41,6 +41,7 @@ struct usb_hub_port {
 	void			*port_owner;
 	struct usb_device	*child;
 	unsigned long		platform_data;
+	enum usb_port_connect_type connect_type;
 };
 
 struct usb_hub {
@@ -4266,3 +4267,23 @@ unsigned long usb_get_hub_port_platform_data(struct usb_device *hdev, int port1)
 		return 0;
 	return hub->port_data[port1 - 1].platform_data;
 }
+
+void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1,
+	enum usb_port_connect_type type)
+{
+	struct usb_hub *hub = hdev_to_hub(hdev);
+
+	if (!hub || port1 > hdev->maxchild || port1 < 1)
+		return;
+	hub->port_data[port1 - 1].connect_type = type;
+}
+
+enum usb_port_connect_type
+usb_get_hub_port_connect_type(struct usb_device *hdev,	int port1)
+{
+	struct usb_hub *hub = hdev_to_hub(hdev);
+
+	if (!hub || port1 > hdev->maxchild || port1 < 1)
+		return USB_PORT_CONNECT_TYPE_UNKNOWN;
+	return hub->port_data[port1 - 1].connect_type;
+}
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index 984c559..ef7810b 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -19,58 +19,56 @@
 
 #include "usb.h"
 
-static int usb_acpi_check_upc(struct usb_device *udev, acpi_handle handle)
+static int usb_acpi_check_port_connect_type(struct usb_device *hdev,
+	acpi_handle handle, int port1)
 {
 	acpi_status status;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *upc;
+	struct acpi_pld pld;
 	int ret = 0;
 
-	status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer);
+	/**
+	 * Accoding to ACPI Spec 9.13. PLD indicates whether usb port is
+	 * user visible and _UPC indicates whether it is connectable. If
+	 * the port was visible and connectable, it could be freely connected
+	 * and disconnected with USB devices. If no visible and connectable,
+	 * a usb device is directly hard-wired to the port. If no visible and
+	 * no connectable, the port would be not used.
+	 */
+	status = acpi_get_physical_device_location(handle, &pld);
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
 
+	status = acpi_evaluate_object(handle, "_UPC", NULL, &buffer);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
 	upc = buffer.pointer;
-
 	if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4) {
 		ret = -EINVAL;
 		goto out;
 	}
 
 	if (upc->package.elements[0].integer.value)
-		udev->removable = USB_DEVICE_REMOVABLE;
-	else
-		udev->removable = USB_DEVICE_FIXED;
+		usb_set_hub_port_connect_type(hdev, port1,
+				pld.user_visible ?
+					USB_PORT_CONNECT_TYPE_HOT_PLUG :
+					USB_PORT_CONNECT_TYPE_HARD_WIRED);
+	else if (!pld.user_visible)
+		usb_set_hub_port_connect_type(hdev, port1, USB_PORT_NOT_USED);
 
 out:
 	kfree(upc);
 	return ret;
 }
 
-static int usb_acpi_check_pld(struct usb_device *udev, acpi_handle handle)
-{
-	acpi_status status;
-	struct acpi_pld pld;
-
-	status = acpi_get_physical_device_location(handle, &pld);
-
-	if (ACPI_FAILURE(status))
-		return -ENODEV;
-
-	if (pld.user_visible)
-		udev->removable = USB_DEVICE_REMOVABLE;
-	else
-		udev->removable = USB_DEVICE_FIXED;
-
-	return 0;
-}
-
 static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 {
 	struct usb_device *udev;
 	struct device *parent;
 	acpi_handle *parent_handle;
+	enum usb_port_connect_type type;
 
 	if (!is_usb_device(dev))
 		return -ENODEV;
@@ -96,14 +94,18 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
 	if (!*handle)
 		return -ENODEV;
 
-	/*
-	 * PLD will tell us whether a port is removable to the user or
-	 * not. If we don't get an answer from PLD (it's not present
-	 * or it's malformed) then try to infer it from UPC. If a
-	 * device isn't connectable then it's probably not removable.
-	 */
-	if (usb_acpi_check_pld(udev, *handle) != 0)
-		usb_acpi_check_upc(udev, *handle);
+	type = usb_get_hub_port_connect_type(udev->parent, udev->portnum);
+	switch (type) {
+	case USB_PORT_CONNECT_TYPE_HOT_PLUG:
+		udev->removable = USB_DEVICE_REMOVABLE;
+		break;
+	case USB_PORT_CONNECT_TYPE_HARD_WIRED:
+		udev->removable = USB_DEVICE_FIXED;
+		break;
+	default:
+		udev->removable = USB_DEVICE_REMOVABLE_UNKNOWN;
+		break;
+	}
 
 	return 0;
 }
@@ -136,6 +138,7 @@ int usb_acpi_bind_hub_ports(struct usb_device *hdev)
 			continue;
 		usb_set_hub_port_platform_data(hdev, i,
 			(unsigned long)port_handle);
+		usb_acpi_check_port_connect_type(hdev, port_handle, i);
 	}
 	return 0;
 }
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index d69d5f6..26fcabc1 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -159,6 +159,10 @@ extern unsigned long usb_get_hub_port_platform_data(struct usb_device *hdev,
 	int port1);
 extern void usb_set_hub_port_platform_data(struct usb_device *hdev,
 	int port1, unsigned long data);
+extern enum usb_port_connect_type
+	usb_get_hub_port_connect_type(struct usb_device *hdev, int port1);
+extern void usb_set_hub_port_connect_type(struct usb_device *hdev, int port1,
+	enum usb_port_connect_type type);
 
 #ifdef CONFIG_ACPI
 extern int usb_acpi_register(void);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 5e7058d..848809a 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -382,6 +382,13 @@ enum usb_device_removable {
 	USB_DEVICE_FIXED,
 };
 
+enum usb_port_connect_type {
+	USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
+	USB_PORT_CONNECT_TYPE_HOT_PLUG,
+	USB_PORT_CONNECT_TYPE_HARD_WIRED,
+	USB_PORT_NOT_USED,
+};
+
 /**
  * struct usb_device - kernel's representation of a USB device
  * @devnum: device number; address on a USB bus
-- 
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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi
       [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2012-05-04  3:06   ` [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
@ 2012-05-04  3:17   ` Matthew Garrett
       [not found]     ` <20120504031720.GA6840-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
  4 siblings, 1 reply; 27+ messages in thread
From: Matthew Garrett @ 2012-05-04  3:17 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb-DgEjT+Ai2ygdnm+yROfE0A,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA, mfm-Oo0r1OC9pj9iLUuM0BA3LQ

On Fri, May 04, 2012 at 11:06:36AM +0800, Lan Tianyu wrote:
> [PATCH V2 2/4] ACPI: Add _PLD support

Greg, Len has just ACKed this.

-- 
Matthew Garrett | mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org
--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi
       [not found]     ` <20120504031720.GA6840-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
@ 2012-05-04  3:20       ` Greg KH
  0 siblings, 0 replies; 27+ messages in thread
From: Greg KH @ 2012-05-04  3:20 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Lan Tianyu, lenb-DgEjT+Ai2ygdnm+yROfE0A,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA, mfm-Oo0r1OC9pj9iLUuM0BA3LQ

On Fri, May 04, 2012 at 04:17:20AM +0100, Matthew Garrett wrote:
> On Fri, May 04, 2012 at 11:06:36AM +0800, Lan Tianyu wrote:
> > [PATCH V2 2/4] ACPI: Add _PLD support
> 
> Greg, Len has just ACKed this.

I saw, I'll queue these up tomorrow.

thanks,

greg k-h
--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 1/7] ACPI: Add _PLD support
  2012-05-04  3:06 ` [Resend PATCH V2 1/7] ACPI: Add _PLD support Lan Tianyu
@ 2012-05-04  6:18   ` Oliver Neukum
  0 siblings, 0 replies; 27+ messages in thread
From: Oliver Neukum @ 2012-05-04  6:18 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb, gregkh, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59,
	mfm, Matthew Garrett

Am Freitag, 4. Mai 2012, 05:06:37 schrieb Lan Tianyu:

> +struct acpi_pld {
> +	unsigned int revision:7; /* 0 */
> +	unsigned int ignore_colour:1; /* 7 */
> +	unsigned int colour:24; /* 8 */
> +	unsigned int width:16; /* 32 */
> +	unsigned int height:16; /* 48 */
> +	unsigned int user_visible:1; /* 64 */
> +	unsigned int dock:1; /* 65 */
> +	unsigned int lid:1; /* 66 */
> +	unsigned int panel:3; /* 67 */
> +	unsigned int vertical_pos:2; /* 70 */
> +	unsigned int horizontal_pos:2; /* 72 */
> +	unsigned int shape:4; /* 74 */
> +	unsigned int group_orientation:1; /* 78 */
> +	unsigned int group_token:8; /* 79 */
> +	unsigned int group_position:8; /* 87 */
> +	unsigned int bay:1; /* 95 */
> +	unsigned int ejectable:1; /* 96 */
> +	unsigned int ospm_eject_required:1; /* 97 */
> +	unsigned int cabinet_number:8; /* 98 */
> +	unsigned int card_cage_number:8; /* 106 */
> +	unsigned int reference:1; /* 114 */
> +	unsigned int rotation:4; /* 115 */
> +	unsigned int order:5; /* 119 */
> +	unsigned int reserved:4; /* 124 */
> +	unsigned int vertical_offset:16; /* 128 */
> +	unsigned int horizontal_offset:16; /* 144 */
> +};

Doesn't this require a __packed__ attribute?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-04  3:06   ` [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data Lan Tianyu
@ 2012-05-04  6:24     ` Oliver Neukum
  2012-05-07  1:38       ` Lan Tianyu
  2012-05-08 17:31     ` Greg KH
  1 sibling, 1 reply; 27+ messages in thread
From: Oliver Neukum @ 2012-05-04  6:24 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb, gregkh, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59,
	mfm, Matthew Garrett

Am Freitag, 4. Mai 2012, 05:06:39 schrieb Lan Tianyu:
> 
> From: Matthew Garrett <mjg@redhat.com>
> 
> ACPI offers two methods that allow us to infer whether or not a USB port
> is removable. The _PLD method gives us information on whether the port is
> "user visible" or not. If that's not present then we can fall back to the
> _UPC method which tells us whether or not a port is connectable.

How does this act on bluetooth devices that are (dis)connected by switches
on laptops?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port
  2012-05-04  3:06   ` [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
@ 2012-05-04  6:37     ` Oliver Neukum
  2012-05-07  1:37       ` Lan Tianyu
  0 siblings, 1 reply; 27+ messages in thread
From: Oliver Neukum @ 2012-05-04  6:37 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb, gregkh, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm

Am Freitag, 4. Mai 2012, 05:06:43 schrieb Lan Tianyu:
> +enum usb_port_connect_type {
> +       USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
> +       USB_PORT_CONNECT_TYPE_HOT_PLUG,
> +       USB_PORT_CONNECT_TYPE_HARD_WIRED,
> +       USB_PORT_NOT_USED,
> +};

Is this actually useful? If we have ports known to ACPI (eg. hotplugged PCcard)
we must assume the ports are fully hotpluggable.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
       [not found]   ` <1336100803-28353-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2012-05-05  0:21     ` Greg KH
  2012-05-05  5:26       ` Matthew Garrett
  0 siblings, 1 reply; 27+ messages in thread
From: Greg KH @ 2012-05-05  0:21 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb-DgEjT+Ai2ygdnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Matthew Garrett

On Fri, May 04, 2012 at 11:06:38AM +0800, Lan Tianyu wrote:
> From: Matthew Garrett <mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> Built-in USB devices will typically have a representation in the system
> ACPI tables. Add support for binding the two together so the USB code can
> make use of the associated methods.
> 
> Signed-off-by: Matthew Garrett <mjg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/usb/core/Makefile   |    1 +
>  drivers/usb/core/usb-acpi.c |   60 +++++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/core/usb.c      |    6 ++++
>  drivers/usb/core/usb.h      |    7 +++++
>  4 files changed, 74 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/usb/core/usb-acpi.c

This patch breaks the build with:
	ERROR: "unregister_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
	ERROR: "register_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!

{sigh}

Care to resend them after fixing this?

greg k-h
--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
  2012-05-05  0:21     ` Greg KH
@ 2012-05-05  5:26       ` Matthew Garrett
  2012-05-05 11:14         ` Sergei Shtylyov
  2012-05-05 14:47         ` Greg KH
  0 siblings, 2 replies; 27+ messages in thread
From: Matthew Garrett @ 2012-05-05  5:26 UTC (permalink / raw)
  To: Greg KH
  Cc: Lan Tianyu, lenb, linux-usb, linux-acpi, stern, sarah.a.sharp, mfm

On Fri, May 04, 2012 at 05:21:55PM -0700, Greg KH wrote:

> This patch breaks the build with:
> 	ERROR: "unregister_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
> 	ERROR: "register_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
> 
> {sigh}
> 
> Care to resend them after fixing this?

Does this fix it?

commit f5c5fea66ab7db94cea5a51c474ff5111ec55800
Author: Matthew Garrett <mjg@redhat.com>
Date:   Sat May 5 01:21:45 2012 -0400

    ACPI: Add stubs for (un)register_acpi_bus_type
    
    It's unreasonable to have CONFIG_ACPI for these in drivers, so add some
    stub functions.
    
    Signed-off-by: Matthew Garrett <mjg@redhat.com>

diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 30a9250..19f9483 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -431,6 +431,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
 }
 #endif
 
+#else	/* CONFIG_ACPI */
+
+static int register_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }
+static int unregister_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }
+
 #endif				/* CONFIG_ACPI */
 
 #endif /*__ACPI_BUS_H__*/

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
  2012-05-05  5:26       ` Matthew Garrett
@ 2012-05-05 11:14         ` Sergei Shtylyov
  2012-05-05 14:47         ` Greg KH
  1 sibling, 0 replies; 27+ messages in thread
From: Sergei Shtylyov @ 2012-05-05 11:14 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Greg KH, Lan Tianyu, lenb, linux-usb, linux-acpi, stern,
	sarah.a.sharp, mfm

Hello.

On 05-05-2012 9:26, Matthew Garrett wrote:

>> This patch breaks the build with:
>> 	ERROR: "unregister_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
>> 	ERROR: "register_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!

>> {sigh}

>> Care to resend them after fixing this?

> Does this fix it?

> commit f5c5fea66ab7db94cea5a51c474ff5111ec55800
> Author: Matthew Garrett<mjg@redhat.com>
> Date:   Sat May 5 01:21:45 2012 -0400

>      ACPI: Add stubs for (un)register_acpi_bus_type

>      It's unreasonable to have CONFIG_ACPI for these in drivers, so add some
>      stub functions.

>      Signed-off-by: Matthew Garrett<mjg@redhat.com>

> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 30a9250..19f9483 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -431,6 +431,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
>   }
>   #endif
>
> +#else	/* CONFIG_ACPI */
> +
> +static int register_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }
> +static int unregister_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }

    Should be no space between function name and (. Did you run thru 
checkpatch.pl?

WBR, Sergei

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
  2012-05-05  5:26       ` Matthew Garrett
  2012-05-05 11:14         ` Sergei Shtylyov
@ 2012-05-05 14:47         ` Greg KH
  2012-05-05 15:00           ` Matthew Garrett
  1 sibling, 1 reply; 27+ messages in thread
From: Greg KH @ 2012-05-05 14:47 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Lan Tianyu, lenb, linux-usb, linux-acpi, stern, sarah.a.sharp, mfm

On Sat, May 05, 2012 at 06:26:24AM +0100, Matthew Garrett wrote:
> On Fri, May 04, 2012 at 05:21:55PM -0700, Greg KH wrote:
> 
> > This patch breaks the build with:
> > 	ERROR: "unregister_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
> > 	ERROR: "register_acpi_bus_type" [drivers/usb/core/usbcore.ko] undefined!
> > 
> > {sigh}
> > 
> > Care to resend them after fixing this?
> 
> Does this fix it?
> 
> commit f5c5fea66ab7db94cea5a51c474ff5111ec55800
> Author: Matthew Garrett <mjg@redhat.com>
> Date:   Sat May 5 01:21:45 2012 -0400
> 
>     ACPI: Add stubs for (un)register_acpi_bus_type
>     
>     It's unreasonable to have CONFIG_ACPI for these in drivers, so add some
>     stub functions.
>     
>     Signed-off-by: Matthew Garrett <mjg@redhat.com>
> 
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 30a9250..19f9483 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -431,6 +431,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
>  }
>  #endif
>  
> +#else	/* CONFIG_ACPI */
> +
> +static int register_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }
> +static int unregister_acpi_bus_type (struct acpi_bus_type *bus) { return 0; }
> +
>  #endif				/* CONFIG_ACPI */
>  
>  #endif /*__ACPI_BUS_H__*/

I think the problem is that these functions aren't exported to modules,
not that they aren't there for non-ACPI systems (although that too is
probably a problem...)

greg k-h

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible
  2012-05-05 14:47         ` Greg KH
@ 2012-05-05 15:00           ` Matthew Garrett
  0 siblings, 0 replies; 27+ messages in thread
From: Matthew Garrett @ 2012-05-05 15:00 UTC (permalink / raw)
  To: Greg KH
  Cc: Lan Tianyu, lenb, linux-usb, linux-acpi, stern, sarah.a.sharp, mfm

On Sat, May 05, 2012 at 07:47:43AM -0700, Greg KH wrote:

> I think the problem is that these functions aren't exported to modules,
> not that they aren't there for non-ACPI systems (although that too is
> probably a problem...)

Bleah. Of course.

commit 050f1fd505db7969efc0ca245d2c17f279f42fa2
Author: Matthew Garrett <mjg@redhat.com>
Date:   Sat May 5 01:21:45 2012 -0400

    ACPI: Add stubs for (un)register_acpi_bus_type
    
    It's unreasonable to have CONFIG_ACPI for these in drivers, so add some
    stub functions.
    
    Signed-off-by: Matthew Garrett <mjg@redhat.com>

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 29a4a5c..243ee85 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -39,6 +39,7 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
 	}
 	return -ENODEV;
 }
+EXPORT_SYMBOL_GPL(register_acpi_bus_type);
 
 int unregister_acpi_bus_type(struct acpi_bus_type *type)
 {
@@ -54,6 +55,7 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
 	}
 	return -ENODEV;
 }
+EXPORT_SYMBOL_GPL(unregister_acpi_bus_type);
 
 static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type)
 {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 30a9250..714b7d7 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -431,6 +431,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
 }
 #endif
 
+#else	/* CONFIG_ACPI */
+
+static int register_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
+static int unregister_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
+
 #endif				/* CONFIG_ACPI */
 
 #endif /*__ACPI_BUS_H__*/

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port
  2012-05-04  6:37     ` Oliver Neukum
@ 2012-05-07  1:37       ` Lan Tianyu
  0 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-07  1:37 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: lenb, gregkh, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm

On 2012年05月04日 14:37, Oliver Neukum wrote:
> Am Freitag, 4. Mai 2012, 05:06:43 schrieb Lan Tianyu:
>> +enum usb_port_connect_type {
>> +       USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
>> +       USB_PORT_CONNECT_TYPE_HOT_PLUG,
>> +       USB_PORT_CONNECT_TYPE_HARD_WIRED,
>> +       USB_PORT_NOT_USED,
>> +};
>
> Is this actually useful? If we have ports known to ACPI (eg. hotplugged PCcard)
> we must assume the ports are fully hotpluggable.
Yeah. I think we can treat these three type ports differently. For example,
the port is hard wired and we don't need to concern about hot plug since
the device will not be removed physically.
>
> 	Regards
> 		Oliver

-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-04  6:24     ` Oliver Neukum
@ 2012-05-07  1:38       ` Lan Tianyu
  2012-05-07 16:57         ` Greg KH
  0 siblings, 1 reply; 27+ messages in thread
From: Lan Tianyu @ 2012-05-07  1:38 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: lenb, gregkh, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59,
	mfm, Matthew Garrett

On 2012年05月04日 14:24, Oliver Neukum wrote:
> Am Freitag, 4. Mai 2012, 05:06:39 schrieb Lan Tianyu:
>>
>> From: Matthew Garrett<mjg@redhat.com>
>>
>> ACPI offers two methods that allow us to infer whether or not a USB port
>> is removable. The _PLD method gives us information on whether the port is
>> "user visible" or not. If that's not present then we can fall back to the
>> _UPC method which tells us whether or not a port is connectable.
>
> How does this act on bluetooth devices that are (dis)connected by switches
> on laptops?
This depends on the bios. From my opinion, the bluetooth is device on the
motherboard so it belongs to hard-wired type.
>
> 	Regards
> 		Oliver
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-07  1:38       ` Lan Tianyu
@ 2012-05-07 16:57         ` Greg KH
       [not found]           ` <20120507165744.GA28045-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: Greg KH @ 2012-05-07 16:57 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Oliver Neukum, lenb, linux-usb, linux-acpi, stern, sarah.a.sharp,
	mjg59, mfm, Matthew Garrett

On Mon, May 07, 2012 at 09:38:15AM +0800, Lan Tianyu wrote:
> On 2012年05月04日 14:24, Oliver Neukum wrote:
> >Am Freitag, 4. Mai 2012, 05:06:39 schrieb Lan Tianyu:
> >>
> >>From: Matthew Garrett<mjg@redhat.com>
> >>
> >>ACPI offers two methods that allow us to infer whether or not a USB port
> >>is removable. The _PLD method gives us information on whether the port is
> >>"user visible" or not. If that's not present then we can fall back to the
> >>_UPC method which tells us whether or not a port is connectable.
> >
> >How does this act on bluetooth devices that are (dis)connected by switches
> >on laptops?
> This depends on the bios. From my opinion, the bluetooth is device on the
> motherboard so it belongs to hard-wired type.

That's nice, but it's not what is happening in lots of different laptops
out there today.

Oliver is right, how does this handle bluetooth USB controllers that are
turned on/off from magic function-key presses?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
       [not found]           ` <20120507165744.GA28045-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
@ 2012-05-08  2:58             ` Matthew Garrett
  2012-05-08  8:52               ` Lan Tianyu
  0 siblings, 1 reply; 27+ messages in thread
From: Matthew Garrett @ 2012-05-08  2:58 UTC (permalink / raw)
  To: Greg KH
  Cc: Lan Tianyu, Oliver Neukum, lenb-DgEjT+Ai2ygdnm+yROfE0A,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA, mfm-Oo0r1OC9pj9iLUuM0BA3LQ

On Mon, May 07, 2012 at 09:57:44AM -0700, Greg KH wrote:
> On Mon, May 07, 2012 at 09:38:15AM +0800, Lan Tianyu wrote:
> > This depends on the bios. From my opinion, the bluetooth is device on the
> > motherboard so it belongs to hard-wired type.
> 
> That's nice, but it's not what is happening in lots of different laptops
> out there today.
> 
> Oliver is right, how does this handle bluetooth USB controllers that are
> turned on/off from magic function-key presses?

I /believe/ that such devices will be indicated as fixed rather than 
removable. The variable indicates the physical state rather than the 
logical one - fixed doesn't mean that a device will never go away, it 
means that a user can't physically unplug it.

-- 
Matthew Garrett | mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org
--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-08  2:58             ` Matthew Garrett
@ 2012-05-08  8:52               ` Lan Tianyu
  2012-05-08 20:23                 ` Len Brown
  0 siblings, 1 reply; 27+ messages in thread
From: Lan Tianyu @ 2012-05-08  8:52 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Oliver Neukum, lenb, linux-usb, linux-acpi, stern, sarah.a.sharp,
	mfm, Greg KH

Hi all:

Following is the usb port descriptor in the DSDT of Thinkpad T410.
The port is attached with bluetooth on the board.

                       Device (PRTB)
                        {     
                            Name (_ADR, 0x04) 
                            Name (_UPC, Package (0x04)
                            {     
                                0xFF, 
                                0xFF, 
                                0x00, 
                                0x00  
                            })    
                            Name (_PLD, Buffer (0x10)
                            {     
                                /* 0000 */    0x81, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00,
                                /* 0008 */    0x30, 0x1C, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00
                            })    
                        }
_PLD buffer show the device internal port.     
Bit 64 – User Visible: Set if the device connection point can be seen 
by the user without disassembly.

于2012年05月08日 星期二 10时58分17秒,Matthew Garrett写到:
> On Mon, May 07, 2012 at 09:57:44AM -0700, Greg KH wrote:
>> On Mon, May 07, 2012 at 09:38:15AM +0800, Lan Tianyu wrote:
>>> This depends on the bios. From my opinion, the bluetooth is device on the
>>> motherboard so it belongs to hard-wired type.
>>
>> That's nice, but it's not what is happening in lots of different laptops
>> out there today.
>>
>> Oliver is right, how does this handle bluetooth USB controllers that are
>> turned on/off from magic function-key presses?
>
> I /believe/ that such devices will be indicated as fixed rather than
> removable. The variable indicates the physical state rather than the
> logical one - fixed doesn't mean that a device will never go away, it
> means that a user can't physically unplug it.
>



-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-04  3:06   ` [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data Lan Tianyu
  2012-05-04  6:24     ` Oliver Neukum
@ 2012-05-08 17:31     ` Greg KH
  2012-05-09  2:49       ` Lan Tianyu
  1 sibling, 1 reply; 27+ messages in thread
From: Greg KH @ 2012-05-08 17:31 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: lenb, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm,
	Matthew Garrett

On Fri, May 04, 2012 at 11:06:39AM +0800, Lan Tianyu wrote:
> From: Matthew Garrett <mjg@redhat.com>
> 
> ACPI offers two methods that allow us to infer whether or not a USB port
> is removable. The _PLD method gives us information on whether the port is
> "user visible" or not. If that's not present then we can fall back to the
> _UPC method which tells us whether or not a port is connectable.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/usb/core/usb-acpi.c |   56 +++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 56 insertions(+), 0 deletions(-)

This is getting frustrating...

After this patch I get the following build error:
	ERROR: "acpi_get_physical_device_location" [drivers/usb/core/usbcore.ko] undefined!

Lan, please retest these, and resend them, with Matthew's other ACPI
patch, after it's all working properly, and you have fixed this all up.
I've dropped all of these from my mailboxes now, you need to start over.

Also, when you forward on a patch like this, and the others, please also
sign-off-by: on it, or at least Ack: it, to keep you in the chain of bug
reporting and stuff.

greg k-h

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-08  8:52               ` Lan Tianyu
@ 2012-05-08 20:23                 ` Len Brown
       [not found]                   ` <4FA980C9.4020107-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 27+ messages in thread
From: Len Brown @ 2012-05-08 20:23 UTC (permalink / raw)
  To: Lan Tianyu
  Cc: Matthew Garrett, Oliver Neukum, linux-usb, linux-acpi, stern,
	sarah.a.sharp, mfm, Greg KH

On 05/08/2012 04:52 AM, Lan Tianyu wrote:

> Hi all:
> 
> Following is the usb port descriptor in the DSDT of Thinkpad T410.
> The port is attached with bluetooth on the board.


>  Name (_UPC, Package (0x04) { 0xFF, 0xFF, 0x00, 0x00 })


_UPC 1st byte says "connectable"
_UPC 2nd byte says "proprietary connector"


 Name (_PLD, Buffer (0x10)
> { /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>   /* 0008 */    0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
>                            })                           }
> _PLD buffer show the device internal port.     Bit 64 – User Visible:
> Set if the device connection point can be seen by the user without
> disassembly.


According to the decoding from Bob Moore,
bit 64 is not set, and thus this I/F is NOT user visible.
Are we decoding this correctly?

    81 6:0 = 1 (revision)
         7 = 1 (ignore color)
    00 15:8 (color red = 0)
    00 23:16 (color green = 0)
    00 31:24 (color blue = 0)
    00 47:32 (width = 0)
    00
    00 63:48 (Height = 0)
    00
    30 64 (user visible = 0)
       65 (dock = 0)
       66 (lid = 0)
       67:69 (Panel = b110 = 6 = unknown)
       71:70 (vertical = 0 = upper)
    1c 73:72 (horizontal = b00 = 0 = left)
       77:74 (shape = b0111 = 7 = unknown)
    00
    00
    00
    00
    00
    00


-Len


> 
> 于2012年05月08日 星期二 10时58分17秒,Matthew Garrett写到:
>> On Mon, May 07, 2012 at 09:57:44AM -0700, Greg KH wrote:
>>> On Mon, May 07, 2012 at 09:38:15AM +0800, Lan Tianyu wrote:
>>>> This depends on the bios. From my opinion, the bluetooth is device
>>>> on the
>>>> motherboard so it belongs to hard-wired type.
>>>
>>> That's nice, but it's not what is happening in lots of different laptops
>>> out there today.
>>>
>>> Oliver is right, how does this handle bluetooth USB controllers that are
>>> turned on/off from magic function-key presses?
>>
>> I /believe/ that such devices will be indicated as fixed rather than
>> removable. The variable indicates the physical state rather than the
>> logical one - fixed doesn't mean that a device will never go away, it
>> means that a user can't physically unplug it.
>>
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
       [not found]                   ` <4FA980C9.4020107-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2012-05-09  1:00                     ` Lan Tianyu
  0 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-09  1:00 UTC (permalink / raw)
  To: Len Brown
  Cc: Matthew Garrett, Oliver Neukum, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA, mfm-Oo0r1OC9pj9iLUuM0BA3LQ,
	Greg KH

Thanks, len and Bob. You are right. You make my explain more clear.
于2012年05月09日 星期三 04时23分37秒,Len Brown写到:
> On 05/08/2012 04:52 AM, Lan Tianyu wrote:
>
>> Hi all:
>>
>> Following is the usb port descriptor in the DSDT of Thinkpad T410.
>> The port is attached with bluetooth on the board.
>
>
>>   Name (_UPC, Package (0x04) { 0xFF, 0xFF, 0x00, 0x00 })
>
>
> _UPC 1st byte says "connectable"
> _UPC 2nd byte says "proprietary connector"
>
>
>   Name (_PLD, Buffer (0x10)
>> { /* 0000 */    0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>>    /* 0008 */    0x30, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
>>                             })                           }
>> _PLD buffer show the device internal port.     Bit 64 – User Visible:
>> Set if the device connection point can be seen by the user without
>> disassembly.
>
>
> According to the decoding from Bob Moore,
> bit 64 is not set, and thus this I/F is NOT user visible.
> Are we decoding this correctly?
>
>      81 6:0 = 1 (revision)
>           7 = 1 (ignore color)
>      00 15:8 (color red = 0)
>      00 23:16 (color green = 0)
>      00 31:24 (color blue = 0)
>      00 47:32 (width = 0)
>      00
>      00 63:48 (Height = 0)
>      00
>      30 64 (user visible = 0)
>         65 (dock = 0)
>         66 (lid = 0)
>         67:69 (Panel = b110 = 6 = unknown)
>         71:70 (vertical = 0 = upper)
>      1c 73:72 (horizontal = b00 = 0 = left)
>         77:74 (shape = b0111 = 7 = unknown)
>      00
>      00
>      00
>      00
>      00
>      00
>
>
> -Len
>
>
>>
>> 于2012年05月08日 星期二 10时58分17秒,Matthew Garrett写到:
>>> On Mon, May 07, 2012 at 09:57:44AM -0700, Greg KH wrote:
>>>> On Mon, May 07, 2012 at 09:38:15AM +0800, Lan Tianyu wrote:
>>>>> This depends on the bios. From my opinion, the bluetooth is device
>>>>> on the
>>>>> motherboard so it belongs to hard-wired type.
>>>>
>>>> That's nice, but it's not what is happening in lots of different laptops
>>>> out there today.
>>>>
>>>> Oliver is right, how does this handle bluetooth USB controllers that are
>>>> turned on/off from magic function-key presses?
>>>
>>> I /believe/ that such devices will be indicated as fixed rather than
>>> removable. The variable indicates the physical state rather than the
>>> logical one - fixed doesn't mean that a device will never go away, it
>>> means that a user can't physically unplug it.
>>>
>>
>>
>>
>
>



-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data
  2012-05-08 17:31     ` Greg KH
@ 2012-05-09  2:49       ` Lan Tianyu
  0 siblings, 0 replies; 27+ messages in thread
From: Lan Tianyu @ 2012-05-09  2:49 UTC (permalink / raw)
  To: Greg KH
  Cc: lenb, linux-usb, linux-acpi, stern, sarah.a.sharp, mjg59, mfm,
	Matthew Garrett

On 2012年05月09日 01:31, Greg KH wrote:
> On Fri, May 04, 2012 at 11:06:39AM +0800, Lan Tianyu wrote:
>> From: Matthew Garrett<mjg@redhat.com>
>>
>> ACPI offers two methods that allow us to infer whether or not a USB port
>> is removable. The _PLD method gives us information on whether the port is
>> "user visible" or not. If that's not present then we can fall back to the
>> _UPC method which tells us whether or not a port is connectable.
>>
>> Signed-off-by: Matthew Garrett<mjg@redhat.com>
>> ---
>>   drivers/usb/core/usb-acpi.c |   56 +++++++++++++++++++++++++++++++++++++++++++
>>   1 files changed, 56 insertions(+), 0 deletions(-)
>
> This is getting frustrating...
Oh. So sorry to bring trouble with you. I found problem that we just tested
the patchset with usbcore built in kernel rather than as a module. So
carelessness.
>
> After this patch I get the following build error:
> 	ERROR: "acpi_get_physical_device_location" [drivers/usb/core/usbcore.ko] undefined!
>
> Lan, please retest these, and resend them, with Matthew's other ACPI
> patch, after it's all working properly, and you have fixed this all up.
> I've dropped all of these from my mailboxes now, you need to start over.
>
> Also, when you forward on a patch like this, and the others, please also
> sign-off-by: on it, or at least Ack: it, to keep you in the chain of bug
> reporting and stuff.
Thanks for remind. I will do that.
>
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Best Regards
Tianyu Lan
linux kernel enabling team
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2012-05-09  2:54 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04  3:06 [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Lan Tianyu
2012-05-04  3:06 ` [Resend PATCH V2 1/7] ACPI: Add _PLD support Lan Tianyu
2012-05-04  6:18   ` Oliver Neukum
2012-05-04  3:06 ` [Resend PATCH V2 2/7] usb: Bind devices to ACPI devices when possible Lan Tianyu
     [not found]   ` <1336100803-28353-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-05-05  0:21     ` Greg KH
2012-05-05  5:26       ` Matthew Garrett
2012-05-05 11:14         ` Sergei Shtylyov
2012-05-05 14:47         ` Greg KH
2012-05-05 15:00           ` Matthew Garrett
     [not found] ` <1336100803-28353-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-05-04  3:06   ` [Resend PATCH V2 3/7] usb: Set device removable state based on ACPI USB data Lan Tianyu
2012-05-04  6:24     ` Oliver Neukum
2012-05-07  1:38       ` Lan Tianyu
2012-05-07 16:57         ` Greg KH
     [not found]           ` <20120507165744.GA28045-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-08  2:58             ` Matthew Garrett
2012-05-08  8:52               ` Lan Tianyu
2012-05-08 20:23                 ` Len Brown
     [not found]                   ` <4FA980C9.4020107-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-05-09  1:00                     ` Lan Tianyu
2012-05-08 17:31     ` Greg KH
2012-05-09  2:49       ` Lan Tianyu
2012-05-04  3:06   ` [Resend PATCH V2 4/7] usb: add struct usb_hub_port to store port related members Lan Tianyu
2012-05-04  3:06   ` [Resend PATCH V2 6/7] usb/acpi: add the support of usb hub ports' acpi binding without attached devices Lan Tianyu
2012-05-04  3:06   ` [Resend PATCH V2 7/7] usb/acpi: add usb check for the connect type of usb port Lan Tianyu
2012-05-04  6:37     ` Oliver Neukum
2012-05-07  1:37       ` Lan Tianyu
2012-05-04  3:17   ` [Resend PATCH V2 0/7] usb/acpi: Add binding usb device with acpi Matthew Garrett
     [not found]     ` <20120504031720.GA6840-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2012-05-04  3:20       ` Greg KH
2012-05-04  3:06 ` [Resend PATCH V2 5/7] usb: move struct usb_device->children to struct usb_hub_port->child Lan Tianyu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.