rpms/kernel/devel linux-2.6-autoload-wmi.patch, NONE, 1.1 linux-2.6-enable-btusb-autosuspend.patch, NONE, 1.1 linux-2.6-fix-btusb-autosuspend.patch, NONE, 1.1 kernel.spec, 1.1874, 1.1875 linux-2.6-driver-level-usb-autosuspend.diff, 1.1, 1.2

Matthew Garrett mjg59 at fedoraproject.org
Thu Dec 17 16:49:39 UTC 2009


Author: mjg59

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9424

Modified Files:
	kernel.spec linux-2.6-driver-level-usb-autosuspend.diff 
Added Files:
	linux-2.6-autoload-wmi.patch 
	linux-2.6-enable-btusb-autosuspend.patch 
	linux-2.6-fix-btusb-autosuspend.patch 
Log Message:
* Thu Dec 17 2009 Matthew Garrett <mjg at redhat.com> 2.6.32.1-12
- linux-2.6-driver-level-usb-autosuspend.diff: fix so it works properly...
- linux-2.6-fix-btusb-autosuspend.patch: avoid bluetooth connection drops
- linux-2.6-enable-btusb-autosuspend.patch: and default it to on
- linux-2.6-autoload-wmi.patch: autoload WMI drivers


linux-2.6-autoload-wmi.patch:
 wmi.c |  177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 173 insertions(+), 4 deletions(-)

--- NEW FILE linux-2.6-autoload-wmi.patch ---
WMI provides interface-specific GUIDs that are exported from modules as
modalises, but the core currently generates no events to trigger module
loading. This patch adds support for registering devices for each WMI GUID
and generating the appropriate uevent.

Based heavily on a patch by Carlos Corbacho (<carlos at strangeworlds.co.uk>).

Signed-off-by: Matthew Garrett <mjg at redhat.com>
---
 drivers/platform/x86/wmi.c |  175 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 173 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 177f8d7..e425a86 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -30,6 +30,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/types.h>
+#include <linux/device.h>
 #include <linux/list.h>
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
@@ -65,6 +66,7 @@ struct wmi_block {
 	acpi_handle handle;
 	wmi_notify_handler handler;
 	void *handler_data;
+	struct device *dev;
 };
 
 static struct wmi_block wmi_blocks;
@@ -195,6 +197,34 @@ static bool wmi_parse_guid(const u8 *src, u8 *dest)
 	return true;
 }
 
+/*
+ * Convert a raw GUID to the ACII string representation
+ */
+static int wmi_gtoa(const char *in, char *out)
+{
+	int i;
+
+	for (i = 3; i >= 0; i--)
+		out += sprintf(out, "%02X", in[i] & 0xFF);
+
+	out += sprintf(out, "-");
+	out += sprintf(out, "%02X", in[5] & 0xFF);
+	out += sprintf(out, "%02X", in[4] & 0xFF);
+	out += sprintf(out, "-");
+	out += sprintf(out, "%02X", in[7] & 0xFF);
+	out += sprintf(out, "%02X", in[6] & 0xFF);
+	out += sprintf(out, "-");
+	out += sprintf(out, "%02X", in[8] & 0xFF);
+	out += sprintf(out, "%02X", in[9] & 0xFF);
+	out += sprintf(out, "-");
+
+	for (i = 10; i <= 15; i++)
+		out += sprintf(out, "%02X", in[i] & 0xFF);
+
+	out = '\0';
+	return 0;
+}
+
 static bool find_guid(const char *guid_string, struct wmi_block **out)
 {
 	char tmp[16], guid_input[16];
@@ -555,6 +585,138 @@ bool wmi_has_guid(const char *guid_string)
 EXPORT_SYMBOL_GPL(wmi_has_guid);
 
 /*
+ * sysfs interface
+ */
+static ssize_t show_modalias(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	char guid_string[37];
+	struct wmi_block *wblock;
+
+	wblock = dev_get_drvdata(dev);
+	if (!wblock)
+		return -ENOMEM;
+
+	wmi_gtoa(wblock->gblock.guid, guid_string);
+
+	return sprintf(buf, "wmi:%s\n", guid_string);
+}
+static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
+
+static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	char guid_string[37];
+
+	struct wmi_block *wblock;
+
+	if (add_uevent_var(env, "MODALIAS="))
+		return -ENOMEM;
+
+	wblock = dev_get_drvdata(dev);
+	if (!wblock)
+		return -ENOMEM;
+
+	wmi_gtoa(wblock->gblock.guid, guid_string);
+
+	strcpy(&env->buf[env->buflen - 1], "wmi:");
+	memcpy(&env->buf[env->buflen - 1 + 4], guid_string, 36);
+	env->buflen += 40;
+
+	return 0;
+}
+
+static void wmi_dev_free(struct device *dev)
+{
+	kfree(dev);
+}
+
+static struct class wmi_class = {
+	.name = "wmi",
+	.dev_release = wmi_dev_free,
+	.dev_uevent = wmi_dev_uevent,
+};
+
+static int wmi_create_devs(void)
+{
+	int result;
+	char guid_string[37];
+	struct guid_block *gblock;
+	struct wmi_block *wblock;
+	struct list_head *p;
+	struct device *guid_dev;
+
+	/* Create devices for all the GUIDs */
+	list_for_each(p, &wmi_blocks.list) {
+		wblock = list_entry(p, struct wmi_block, list);
+
+		guid_dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+		if (!guid_dev)
+			return -ENOMEM;
+
+		wblock->dev = guid_dev;
+
+		guid_dev->class = &wmi_class;
+		dev_set_drvdata(guid_dev, wblock);
+
+		gblock = &wblock->gblock;
+
+		wmi_gtoa(gblock->guid, guid_string);
+		dev_set_name(guid_dev, guid_string);
+
+		result = device_register(guid_dev);
+		if (result)
+			return result;
+
+		result = device_create_file(guid_dev, &dev_attr_modalias);
+		if (result)
+			return result;
+	}
+
+	return 0;
+}
+
+static void wmi_remove_devs(void)
+{
+	struct guid_block *gblock;
+	struct wmi_block *wblock;
+	struct list_head *p;
+	struct device *guid_dev;
+
+	/* Delete devices for all the GUIDs */
+	list_for_each(p, &wmi_blocks.list) {
+		wblock = list_entry(p, struct wmi_block, list);
+
+		guid_dev = wblock->dev;
+		gblock = &wblock->gblock;
+
+		device_remove_file(guid_dev, &dev_attr_modalias);
+
+		device_unregister(guid_dev);
+	}
+}
+
+static void wmi_class_exit(void)
+{
+	wmi_remove_devs();
+	class_unregister(&wmi_class);
+}
+
+static int wmi_class_init(void)
+{
+	int ret;
+
+	ret = class_register(&wmi_class);
+	if (ret)
+		return ret;
+
+	ret = wmi_create_devs();
+	if (ret)
+		wmi_class_exit();
+
+	return ret;
+}
+
+/*
  * Parse the _WDG method for the GUID data blocks
  */
 static __init acpi_status parse_wdg(acpi_handle handle)
@@ -709,10 +871,17 @@ static int __init acpi_wmi_init(void)
 
 	if (result < 0) {
 		printk(KERN_INFO PREFIX "Error loading mapper\n");
-	} else {
-		printk(KERN_INFO PREFIX "Mapper loaded\n");
+		return -ENODEV;
+	}
+
+	result = wmi_class_init();
+	if (result) {
+		acpi_bus_unregister_driver(&acpi_wmi_driver);
+		return result;
 	}
 
+	printk(KERN_INFO PREFIX "Mapper loaded\n");
+
 	return result;
 }
 
@@ -721,6 +890,8 @@ static void __exit acpi_wmi_exit(void)
 	struct list_head *p, *tmp;
 	struct wmi_block *wblock;
 
+	wmi_class_exit();
+
 	acpi_bus_unregister_driver(&acpi_wmi_driver);
 
 	list_for_each_safe(p, tmp, &wmi_blocks.list) {
-- 
1.6.5.2

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


linux-2.6-enable-btusb-autosuspend.patch:
 btusb.c |    1 +
 1 file changed, 1 insertion(+)

--- NEW FILE linux-2.6-enable-btusb-autosuspend.patch ---
commit 8e962bd41a2cbf7f0e55191a757b87f793a725a8
Author: Matthew Garrett <mjg at redhat.com>
Date:   Tue Jun 9 20:47:51 2009 +0100

    btusb: Enable autosuspend by default

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 44bc8bb..4c33417 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1020,6 +1020,7 @@ static int btusb_probe(struct usb_interface *intf,
 	}
 
 	usb_set_intfdata(intf, data);
+	usb_device_autosuspend_enable(data->udev);
 
 	return 0;
 }

linux-2.6-fix-btusb-autosuspend.patch:
 btusb.c |    1 +
 1 file changed, 1 insertion(+)

--- NEW FILE linux-2.6-fix-btusb-autosuspend.patch ---
commit ae69717118e1f14ed8737459f8c4baca1cb9c404
Author: Matthew Garrett <mjg at redhat.com>
Date:   Wed Dec 16 14:31:30 2009 -0500

    Fix btusb autosuspend

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 4c33417..ec54dd6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -307,6 +307,7 @@ static void btusb_bulk_complete(struct urb *urb)
 		return;
 
 	usb_anchor_urb(urb, &data->bulk_anchor);
+	usb_mark_last_busy(data->udev);
 
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err < 0) {


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1874
retrieving revision 1.1875
diff -u -p -r1.1874 -r1.1875
--- kernel.spec	17 Dec 2009 16:29:32 -0000	1.1874
+++ kernel.spec	17 Dec 2009 16:49:39 -0000	1.1875
@@ -636,9 +636,12 @@ Patch260: linux-2.6-debug-nmi-timeout.pa
 Patch270: linux-2.6-debug-taint-vm.patch
 Patch280: linux-2.6-debug-spinlock-taint.patch
 Patch300: linux-2.6-driver-level-usb-autosuspend.diff
-Patch301: linux-2.6-fix-usb-serial-autosuspend.diff
-Patch302: linux-2.6-qcserial-autosuspend.diff
+Patch303: linux-2.6-enable-btusb-autosuspend.patch
 Patch304: linux-2.6-usb-uvc-autosuspend.diff
+Patch305: linux-2.6-fix-btusb-autosuspend.patch
+
+Patch310: linux-2.6-autoload-wmi.patch
+
 Patch340: linux-2.6-debug-vm-would-have-oomkilled.patch
 Patch360: linux-2.6-debug-always-inline-kzalloc.patch
 Patch380: linux-2.6-defaults-pci_no_msi.patch
@@ -1205,9 +1208,12 @@ ApplyPatch linux-2.6-nfs4-callback-hidde
 
 # USB
 ApplyPatch linux-2.6-driver-level-usb-autosuspend.diff
-#ApplyPatch linux-2.6-fix-usb-serial-autosuspend.diff
-ApplyPatch linux-2.6-qcserial-autosuspend.diff
+ApplyPatch linux-2.6-enable-btusb-autosuspend.patch
 ApplyPatch linux-2.6-usb-uvc-autosuspend.diff
+ApplyPatch linux-2.6-fix-btusb-autosuspend.patch
+
+# WMI
+ApplyPatch linux-2.6-autoload-wmi.patch
 
 # ACPI
 ApplyPatch linux-2.6-defaults-acpi-video.patch
@@ -2003,6 +2009,12 @@ fi
 # and build.
 
 %changelog
+* Thu Dec 17 2009 Matthew Garrett <mjg at redhat.com> 2.6.32.1-12
+- linux-2.6-driver-level-usb-autosuspend.diff: fix so it works properly...
+- linux-2.6-fix-btusb-autosuspend.patch: avoid bluetooth connection drops
+- linux-2.6-enable-btusb-autosuspend.patch: and default it to on
+- linux-2.6-autoload-wmi.patch: autoload WMI drivers
+
 * Thu Dec 17 2009 Jarod Wilson <jarod at redhat.com> 2.6.32.1-11
 - Split off onboard decode imon devices into pure input driver,
   leaving lirc_imon for the ancient imon devices only

linux-2.6-driver-level-usb-autosuspend.diff:
 drivers/usb/core/driver.c |   16 ++++++++++++++++
 include/linux/usb.h       |    4 ++++
 2 files changed, 20 insertions(+)

Index: linux-2.6-driver-level-usb-autosuspend.diff
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-driver-level-usb-autosuspend.diff,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- linux-2.6-driver-level-usb-autosuspend.diff	18 Jul 2009 22:50:13 -0000	1.1
+++ linux-2.6-driver-level-usb-autosuspend.diff	17 Dec 2009 16:49:39 -0000	1.2
@@ -1,6 +1,6 @@
-commit 0f592e33934bf6108e33e34f00b425f98ee833ef
+commit 7d0d20a25c6f477fb198b85510c78156d7d7c5af
 Author: Matthew Garrett <mjg at redhat.com>
-Date:   Wed Jul 8 19:04:23 2009 +0100
+Date:   Tue Jun 9 20:11:47 2009 +0100
 
     usb: Allow drivers to enable USB autosuspend on a per-device basis
     
@@ -12,10 +12,10 @@ Date:   Wed Jul 8 19:04:23 2009 +0100
     Signed-off-by: Matthew Garrett <mjg at redhat.com>
 
 diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
-index 69e5773..6e81caa 100644
+index 4f86447..f7caf00 100644
 --- a/drivers/usb/core/driver.c
 +++ b/drivers/usb/core/driver.c
-@@ -1560,6 +1560,21 @@ void usb_autopm_put_interface_async(struct usb_interface *intf)
+@@ -1575,6 +1575,22 @@ void usb_autopm_put_interface_async(struct usb_interface *intf)
  EXPORT_SYMBOL_GPL(usb_autopm_put_interface_async);
  
  /**
@@ -30,6 +30,7 @@ index 69e5773..6e81caa 100644
 +{
 +	udev->autosuspend_disabled = 0;
 +	udev->autoresume_disabled = 0;
++	usb_external_suspend_device(udev, PMSG_USER_SUSPEND);
 +}
 +EXPORT_SYMBOL_GPL(usb_device_autosuspend_enable);
 +
@@ -38,7 +39,7 @@ index 69e5773..6e81caa 100644
   * @intf: the usb_interface whose counter should be incremented
   *
 diff --git a/include/linux/usb.h b/include/linux/usb.h
-index b1e3c2f..61bddbe 100644
+index a34fa89..0c22c64 100644
 --- a/include/linux/usb.h
 +++ b/include/linux/usb.h
 @@ -543,6 +543,7 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);




More information about the fedora-extras-commits mailing list