diff options
36 files changed, 2060 insertions, 209 deletions
diff --git a/driver-core/bus_id-dma.patch b/driver-core/bus_id-dma.patch index e2fd29610e1abf..7e7837ed350d26 100644 --- a/driver-core/bus_id-dma.patch +++ b/driver-core/bus_id-dma.patch @@ -10,7 +10,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c -@@ -1012,7 +1012,7 @@ static int __init dw_probe(struct platfo +@@ -1011,7 +1011,7 @@ static int __init dw_probe(struct platfo dma_writel(dw, CFG, DW_CFG_DMA_EN); printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n", diff --git a/driver-core/bus_id-mmc2.patch b/driver-core/bus_id-mmc2.patch index f48d788b40b5db..ec1acdf8674a47 100644 --- a/driver-core/bus_id-mmc2.patch +++ b/driver-core/bus_id-mmc2.patch @@ -11,7 +11,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c -@@ -1602,7 +1602,7 @@ static int __init atmci_probe(struct pla +@@ -1603,7 +1603,7 @@ static int __init atmci_probe(struct pla tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host); diff --git a/driver-core/driver-core-check-bus-match-without-holding-device-lock.patch b/driver-core/driver-core-check-bus-match-without-holding-device-lock.patch index 96f23d21a7f2b0..b7f53a0d890e90 100644 --- a/driver-core/driver-core-check-bus-match-without-holding-device-lock.patch +++ b/driver-core/driver-core-check-bus-match-without-holding-device-lock.patch @@ -47,7 +47,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +} extern void sysdev_shutdown(void); - extern int sysdev_suspend(pm_message_t state); + --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -198,7 +198,7 @@ static ssize_t driver_bind(struct device @@ -61,7 +61,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> down(&dev->sem); --- a/drivers/base/dd.c +++ b/drivers/base/dd.c -@@ -172,14 +172,8 @@ int driver_probe_done(void) +@@ -189,14 +189,8 @@ int wait_for_device_probe(void) * @drv: driver to bind a device to * @dev: device to try to bind to the driver * @@ -78,7 +78,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> * * This function must be called with @dev->sem held. When called for a * USB interface, @dev->parent->sem must be held as well. -@@ -190,21 +184,22 @@ int driver_probe_device(struct device_dr +@@ -207,21 +201,22 @@ int driver_probe_device(struct device_dr if (!device_is_registered(dev)) return -ENODEV; @@ -104,7 +104,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return driver_probe_device(drv, dev); } -@@ -257,7 +252,7 @@ static int __driver_attach(struct device +@@ -274,7 +269,7 @@ static int __driver_attach(struct device * is an error. */ diff --git a/driver-core/driver-core-consolidate-driver_probe_done-loops-into-one-place.patch b/driver-core/driver-core-consolidate-driver_probe_done-loops-into-one-place.patch deleted file mode 100644 index 88743e6902d8ed..00000000000000 --- a/driver-core/driver-core-consolidate-driver_probe_done-loops-into-one-place.patch +++ /dev/null @@ -1,122 +0,0 @@ -From akpm@linux-foundation.org Wed Feb 18 16:04:01 2009 -From: Arjan van de Ven <arjan@linux.intel.com> -Date: Wed, 11 Feb 2009 13:20:21 -0800 -Subject: driver core: consolidate driver_probe_done() loops into one place -To: greg@kroah.com -Cc: akpm@linux-foundation.org, arjan@linux.intel.com, kay.sievers@vrfy.org, lenb@kernel.org, pavel@ucw.cz, rjw@sisk.pl -Message-ID: <200902112120.n1BLKLAE021664@imap1.linux-foundation.org> - - -From: Arjan van de Ven <arjan@linux.intel.com> - -There are a few places that currently loop over driver_probe_done(), and -I'm about to add another one. This patch abstracts it into a helper to -reduce duplication. - -[akpm@linux-foundation.org: fix build] -[akpm@linux-foundation.org: coding-style fixes] -Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> -Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> -Cc: Len Brown <lenb@kernel.org> -Cc: Kay Sievers <kay.sievers@vrfy.org> -Cc: Pavel Machek <pavel@ucw.cz> -Signed-off-by: Andrew Morton <akpm@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/dd.c | 17 +++++++++++++++++ - include/linux/device.h | 2 ++ - init/do_mounts.c | 13 +++++++++---- - init/do_mounts_md.c | 5 +++-- - 4 files changed, 31 insertions(+), 6 deletions(-) - ---- a/drivers/base/dd.c -+++ b/drivers/base/dd.c -@@ -18,9 +18,11 @@ - */ - - #include <linux/device.h> -+#include <linux/delay.h> - #include <linux/module.h> - #include <linux/kthread.h> - #include <linux/wait.h> -+#include <linux/async.h> - - #include "base.h" - #include "power/power.h" -@@ -168,6 +170,21 @@ int driver_probe_done(void) - } - - /** -+ * wait_for_device_probe -+ * Wait for device probing to be completed. -+ * -+ * Note: this function polls at 100 msec intervals. -+ */ -+int wait_for_device_probe(void) -+{ -+ /* wait for the known devices to complete their probing */ -+ while (driver_probe_done() != 0) -+ msleep(100); -+ async_synchronize_full(); -+ return 0; -+} -+ -+/** - * driver_probe_device - attempt to bind device & driver together - * @drv: driver to bind a device to - * @dev: device to try to bind to the driver ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -148,6 +148,8 @@ extern void put_driver(struct device_dri - extern struct device_driver *driver_find(const char *name, - struct bus_type *bus); - extern int driver_probe_done(void); -+extern int wait_for_device_probe(void); -+ - - /* sysfs interface for exporting driver attributes */ - ---- a/init/do_mounts.c -+++ b/init/do_mounts.c -@@ -370,10 +370,14 @@ void __init prepare_namespace(void) - ssleep(root_delay); - } - -- /* wait for the known devices to complete their probing */ -- while (driver_probe_done() != 0) -- msleep(100); -- async_synchronize_full(); -+ /* -+ * wait for the known devices to complete their probing -+ * -+ * Note: this is a potential source of long boot delays. -+ * For example, it is not atypical to wait 5 seconds here -+ * for the touchpad of a laptop to initialize. -+ */ -+ wait_for_device_probe(); - - md_run_setup(); - -@@ -399,6 +403,7 @@ void __init prepare_namespace(void) - while (driver_probe_done() != 0 || - (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) - msleep(100); -+ async_synchronize_full(); - } - - is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; ---- a/init/do_mounts_md.c -+++ b/init/do_mounts_md.c -@@ -281,8 +281,9 @@ static void __init autodetect_raid(void) - */ - printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n"); - printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n"); -- while (driver_probe_done() < 0) -- msleep(100); -+ -+ wait_for_device_probe(); -+ - fd = sys_open("/dev/md0", 0, 0); - if (fd >= 0) { - sys_ioctl(fd, RAID_AUTORUN, raid_autopart); diff --git a/driver-core/driver-core-create-a-private-portion-of-struct-device.patch b/driver-core/driver-core-create-a-private-portion-of-struct-device.patch index ec8673d647e88a..fa6eaf7ff17457 100644 --- a/driver-core/driver-core-create-a-private-portion-of-struct-device.patch +++ b/driver-core/driver-core-create-a-private-portion-of-struct-device.patch @@ -78,7 +78,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> struct device_driver; struct driver_private; struct class; -@@ -371,6 +372,8 @@ struct device { +@@ -373,6 +374,8 @@ struct device { struct klist_node knode_bus; struct device *parent; diff --git a/driver-core/driver-core-get-rid-of-struct-device-s-bus_id-string-array.patch b/driver-core/driver-core-get-rid-of-struct-device-s-bus_id-string-array.patch index e338ac97fe4db6..b88b47a4255f88 100644 --- a/driver-core/driver-core-get-rid-of-struct-device-s-bus_id-string-array.patch +++ b/driver-core/driver-core-get-rid-of-struct-device-s-bus_id-string-array.patch @@ -102,7 +102,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> if (old_class_name) { --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -372,7 +372,6 @@ struct device { +@@ -374,7 +374,6 @@ struct device { struct device *parent; struct kobject kobj; @@ -110,7 +110,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> unsigned uevent_suppress:1; const char *init_name; /* initial name of the device */ struct device_type *type; -@@ -425,8 +424,7 @@ struct device { +@@ -427,8 +426,7 @@ struct device { static inline const char *dev_name(const struct device *dev) { diff --git a/driver-core/driver-core-move-klist_children-into-private-structure.patch b/driver-core/driver-core-move-klist_children-into-private-structure.patch index ce52b2f10880aa..2b7cbf9a7ca8c7 100644 --- a/driver-core/driver-core-move-klist_children-into-private-structure.patch +++ b/driver-core/driver-core-move-klist_children-into-private-structure.patch @@ -160,7 +160,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -366,8 +366,6 @@ struct device_dma_parameters { +@@ -368,8 +368,6 @@ struct device_dma_parameters { }; struct device { diff --git a/driver-core/driver-core-move-knode_bus-into-private-structure.patch b/driver-core/driver-core-move-knode_bus-into-private-structure.patch index 40e348d9eae808..d15a5579ffd2bd 100644 --- a/driver-core/driver-core-move-knode_bus-into-private-structure.patch +++ b/driver-core/driver-core-move-knode_bus-into-private-structure.patch @@ -162,7 +162,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> list_splice(&sorted_devices, &device_klist->k_list); --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -366,7 +366,6 @@ struct device_dma_parameters { +@@ -368,7 +368,6 @@ struct device_dma_parameters { }; struct device { diff --git a/driver-core/driver-core-move-knode_driver-into-private-structure.patch b/driver-core/driver-core-move-knode_driver-into-private-structure.patch index bafe0c939e95ae..8289fae4c30a03 100644 --- a/driver-core/driver-core-move-knode_driver-into-private-structure.patch +++ b/driver-core/driver-core-move-knode_driver-into-private-structure.patch @@ -42,7 +42,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> extern int devices_init(void); --- a/drivers/base/dd.c +++ b/drivers/base/dd.c -@@ -28,7 +28,7 @@ +@@ -30,7 +30,7 @@ static void driver_bound(struct device *dev) { @@ -51,7 +51,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> printk(KERN_WARNING "%s: device %s already bound\n", __func__, kobject_name(&dev->kobj)); return; -@@ -41,7 +41,7 @@ static void driver_bound(struct device * +@@ -43,7 +43,7 @@ static void driver_bound(struct device * blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_BOUND_DRIVER, dev); @@ -60,7 +60,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } static int driver_sysfs_add(struct device *dev) -@@ -305,7 +305,7 @@ static void __device_release_driver(stru +@@ -322,7 +322,7 @@ static void __device_release_driver(stru drv->remove(dev); devres_release_all(dev); dev->driver = NULL; @@ -69,7 +69,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } } -@@ -335,6 +335,7 @@ EXPORT_SYMBOL_GPL(device_release_driver) +@@ -352,6 +352,7 @@ EXPORT_SYMBOL_GPL(device_release_driver) */ void driver_detach(struct device_driver *drv) { @@ -77,7 +77,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> struct device *dev; for (;;) { -@@ -343,8 +344,10 @@ void driver_detach(struct device_driver +@@ -360,8 +361,10 @@ void driver_detach(struct device_driver spin_unlock(&drv->p->klist_devices.k_lock); break; } @@ -128,7 +128,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> break; --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -366,7 +366,6 @@ struct device_dma_parameters { +@@ -368,7 +368,6 @@ struct device_dma_parameters { }; struct device { diff --git a/driver-core/driver-core-resume-wait-for-device-probing-to-finish.patch b/driver-core/driver-core-resume-wait-for-device-probing-to-finish.patch deleted file mode 100644 index be9d33c063766f..00000000000000 --- a/driver-core/driver-core-resume-wait-for-device-probing-to-finish.patch +++ /dev/null @@ -1,57 +0,0 @@ -From akpm@linux-foundation.org Wed Feb 18 16:04:28 2009 -From: Arjan van de Ven <arjan@linux.intel.com> -Date: Wed, 11 Feb 2009 13:20:22 -0800 -Subject: Driver core: resume: wait for device probing to finish -To: greg@kroah.com -Cc: akpm@linux-foundation.org, arjan@linux.intel.com, kay.sievers@vrfy.org, lenb@kernel.org, pavel@suse.cz, rjw@sisk.pl -Message-ID: <200902112120.n1BLKM4I021741@imap1.linux-foundation.org> - - -From: Arjan van de Ven <arjan@linux.intel.com> - -The resume code does not currently wait for device probing to finish. -Even without async function calls this is dicey and not correct, but with -async function calls during the boot sequence this is going to get hit -more... - -This patch adds the synchronization using the newly introduced helper. - -Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> -Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> -Cc: Len Brown <lenb@kernel.org> -Cc: Pavel Machek <pavel@suse.cz> -Cc: Kay Sievers <kay.sievers@vrfy.org> -Signed-off-by: Andrew Morton <akpm@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - kernel/power/disk.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - ---- a/kernel/power/disk.c -+++ b/kernel/power/disk.c -@@ -595,6 +595,12 @@ static int software_resume(void) - unsigned int flags; - - /* -+ * If the user said "noresume".. bail out early. -+ */ -+ if (noresume) -+ return 0; -+ -+ /* - * name_to_dev_t() below takes a sysfs buffer mutex when sysfs - * is configured into the kernel. Since the regular hibernate - * trigger path is via sysfs which takes a buffer mutex before -@@ -610,6 +616,11 @@ static int software_resume(void) - mutex_unlock(&pm_mutex); - return -ENOENT; - } -+ /* -+ * Some device discovery might still be in progress; we need -+ * to wait for this to finish. -+ */ -+ wait_for_device_probe(); - swsusp_resume_device = name_to_dev_t(resume_file); - pr_debug("PM: Resume from partition %s\n", resume_file); - } else { diff --git a/driver-core/platform-introduce-module-id-table-for-platform-devices.patch b/driver-core/platform-introduce-module-id-table-for-platform-devices.patch index 67a71b772df906..6f479eb65245da 100644 --- a/driver-core/platform-introduce-module-id-table-for-platform-devices.patch +++ b/driver-core/platform-introduce-module-id-table-for-platform-devices.patch @@ -130,7 +130,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> extern int platform_driver_register(struct platform_driver *); --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c -@@ -709,6 +709,14 @@ static int do_dmi_entry(const char *file +@@ -710,6 +710,14 @@ static int do_dmi_entry(const char *file strcat(alias, ":"); return 1; } @@ -145,7 +145,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* Ignore any prefix, eg. some architectures prepend _ */ static inline int sym_is(const char *symbol, const char *name) { -@@ -848,6 +856,10 @@ void handle_moddevtable(struct module *m +@@ -849,6 +857,10 @@ void handle_moddevtable(struct module *m do_table(symval, sym->st_size, sizeof(struct dmi_system_id), "dmi", do_dmi_entry, mod); diff --git a/driver-core/platform-make-better-use-of-to_platform_-device-driver-macros.patch b/driver-core/platform-make-better-use-of-to_platform_-device-driver-macros.patch index 970ef98e8ef1bb..f2c1dbd27f2d55 100644 --- a/driver-core/platform-make-better-use-of-to_platform_-device-driver-macros.patch +++ b/driver-core/platform-make-better-use-of-to_platform_-device-driver-macros.patch @@ -70,7 +70,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c -@@ -4133,10 +4133,9 @@ static int have_no_fdc = -ENODEV; +@@ -4135,10 +4135,9 @@ static int have_no_fdc = -ENODEV; static ssize_t floppy_cmos_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -19,6 +19,18 @@ usb.current/usb-fsl_usb2_udc-fix-potential-queue-head-corruption.patch usb.current/usb-ehci-slow-down-itd-reuse.patch usb.current/usb-gadget-obex-select-correct-ep-descriptors.patch usb.current/usb-option-add-benq-3g-modem-information.patch +usb.current/usb-cdc-acm-add-usb-id-for-motomagx-phones.patch +usb.current/usb-serial-add-support-for-second-revision-of-ericsson-f3507g-wwan-card.patch +usb.current/usb-musb-make-davinci-work-in-mainline.patch +usb.current/usb-musb-be-careful-with-64k-transfer-lengths.patch +usb.current/usb-musb-fix-musb_host_tx-for-shared-endpoint-fifo.patch +usb.current/usb-musb-fix-urb_dequeue-method.patch +usb.current/usb-musb-host-endpoint_disable-oops-fixes.patch +usb.current/usb-musb-fix-data-toggle-saving-with-shared-fifo.patch +usb.current/usb-musb-be-careful-with-64k-transfer-lengths-host-side.patch +usb.current/usb-musb-use-right-poll-limit-for-low-speed-devices.patch +usb.current/usb-musb-resume-suspended-root-hub-on-disconnect.patch +usb.current/usb-musb-fix-srp-sysfs-entry-deletion.patch ##################################################################### # Stuff to be merged after 2.6.29 is out @@ -82,8 +94,6 @@ driver-core/driver-core-move-klist_children-into-private-structure.patch driver-core/driver-core-move-knode_driver-into-private-structure.patch driver-core/driver-core-move-knode_bus-into-private-structure.patch -driver-core/driver-core-consolidate-driver_probe_done-loops-into-one-place.patch -driver-core/driver-core-resume-wait-for-device-probing-to-finish.patch # dynamic debug rework driver-core/dynamic-debug-combine-dprintk-and-dynamic-printk.patch @@ -156,6 +166,9 @@ usb/usb-storage-make-onetouch-a-separate-module.patch usb/usb-allow-libusb-to-talk-to-unauthenticated-wusb-devices.patch usb/usb-composite-avoid-inconsistent-lock-state.patch +# submitted to netdev +usb/usb-asix-new-device-ids.patch + # stuff I want in my tree, but not to go into -next gregkh.post/usb-gotemp.patch #usb-remove-err-macro-from-usb.h.patch @@ -512,3 +525,12 @@ staging/staging-comedi-add-new-driver-to-kernel-build.patch staging/staging-comedi-addi-data-header-file-cleanups.patch staging/staging-comedi-addi-data-apci1710_82x54-cleanups.patch +staging/staging-add-p9auth-driver.patch +staging/staging-p9auth-fix-credential-logic.patch +staging/staging-p9auth-add-to-the-kernel-build.patch +staging/staging-p9auth-remove-unneeded-header-file.patch +staging/staging-p9auth-fix-up-codingstyle-issues.patch +staging/staging-p9auth-fix-up-sparse-warnings.patch +staging/staging-p9auth-use-kzalloc.patch +staging/staging-p9auth-clean-up-includes.patch + diff --git a/staging/staging-add-p9auth-driver.patch b/staging/staging-add-p9auth-driver.patch new file mode 100644 index 00000000000000..5b27de66f1e66d --- /dev/null +++ b/staging/staging-add-p9auth-driver.patch @@ -0,0 +1,406 @@ +From 1b02b91da9f90328330d499f3bf54af2c44f7758 Mon Sep 17 00:00:00 2001 +From: Ashwin Ganti <ashwin.ganti@gmail.com> +Date: Tue, 24 Feb 2009 19:48:44 -0800 +Subject: Staging: add p9auth driver + +From: Ashwin Ganti <ashwin.ganti@gmail.com> + +This is a driver that adds Plan 9 style capability device +implementation. + +From: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 347 ++++++++++++++++++++++++++++++++++++++++ + drivers/staging/p9auth/p9auth.h | 35 ++++ + 2 files changed, 382 insertions(+) + +--- /dev/null ++++ b/drivers/staging/p9auth/p9auth.c +@@ -0,0 +1,347 @@ ++/* ++ * Plan 9 style capability device implementation for the Linux Kernel ++ * ++ * Copyright 2008, 2009 Ashwin Ganti <ashwin.ganti@gmail.com> ++ * ++ * Released under the GPLv2 ++ * ++ */ ++#include <linux/module.h> ++#include <linux/moduleparam.h> ++#include <linux/init.h> ++#include <linux/kernel.h> ++#include <linux/slab.h> ++#include <linux/fs.h> ++#include <linux/errno.h> ++#include <linux/types.h> ++#include <linux/proc_fs.h> ++#include <linux/fcntl.h> ++#include <linux/cdev.h> ++#include <linux/syscalls.h> ++#include <asm/system.h> ++#include <asm/uaccess.h> ++#include <linux/list.h> ++#include <linux/err.h> ++#include <linux/mm.h> ++#include <linux/string.h> ++#include <linux/crypto.h> ++#include <linux/highmem.h> ++#include <linux/jiffies.h> ++#include <linux/timex.h> ++#include <linux/interrupt.h> ++#include <linux/scatterlist.h> ++#include <linux/crypto.h> ++#include "p9auth.h" ++ ++int cap_major = CAP_MAJOR; ++int cap_minor = 0; ++int cap_nr_devs = CAP_NR_DEVS; ++int cap_node_size = CAP_NODE_SIZE; ++ ++module_param(cap_major, int, S_IRUGO); ++module_param(cap_minor, int, S_IRUGO); ++module_param(cap_nr_devs, int, S_IRUGO); ++ ++MODULE_AUTHOR("Ashwin Ganti"); ++MODULE_LICENSE("GPL"); ++ ++struct cap_dev *cap_devices; ++ ++void hexdump(unsigned char *buf, unsigned int len) ++{ ++ while (len--) ++ printk("%02x", *buf++); ++ printk("\n"); ++} ++ ++int cap_trim(struct cap_dev *dev) ++{ ++ struct cap_node *tmp; ++ struct list_head *pos, *q; ++ if (dev->head != NULL) { ++ list_for_each_safe(pos, q, &(dev->head->list)) { ++ tmp = list_entry(pos, struct cap_node, list); ++ list_del(pos); ++ kfree(tmp); ++ } ++ } ++ return 0; ++} ++ ++int cap_open(struct inode *inode, struct file *filp) ++{ ++ struct cap_dev *dev; ++ dev = container_of(inode->i_cdev, struct cap_dev, cdev); ++ filp->private_data = dev; ++ ++ /* trim to 0 the length of the device if open was write-only */ ++ if ((filp->f_flags & O_ACCMODE) == O_WRONLY) { ++ if (down_interruptible(&dev->sem)) ++ return -ERESTARTSYS; ++ cap_trim(dev); ++ up(&dev->sem); ++ } ++ /* initialise the head if it is NULL */ ++ if (dev->head == NULL) { ++ dev->head = ++ (struct cap_node *) kmalloc(sizeof(struct cap_node), ++ GFP_KERNEL); ++ INIT_LIST_HEAD(&(dev->head->list)); ++ } ++ return 0; ++} ++ ++int cap_release(struct inode *inode, struct file *filp) ++{ ++ return 0; ++} ++ ++ssize_t ++cap_write(struct file * filp, const char __user * buf, ++ size_t count, loff_t * f_pos) ++{ ++ struct cap_node *node_ptr, *tmp; ++ struct list_head *pos; ++ struct cap_dev *dev = filp->private_data; ++ ssize_t retval = -ENOMEM; ++ int len, target_int, source_int, flag = 0; ++ char *user_buf, *user_buf_running, *source_user, *target_user, ++ *rand_str, *hash_str, *result; ++ ++ if (down_interruptible(&dev->sem)) ++ return -ERESTARTSYS; ++ ++ node_ptr = ++ (struct cap_node *) kmalloc(sizeof(struct cap_node), ++ GFP_KERNEL); ++ user_buf = (char *) kmalloc(count, GFP_KERNEL); ++ memset(user_buf, 0, count); ++ ++ if (copy_from_user(user_buf, buf, count)) { ++ retval = -EFAULT; ++ goto out; ++ } ++ ++ /* If the minor number is 0 ( /dev/caphash ) then simply add the ++ * hashed capability supplied by the user to the list of hashes ++ */ ++ if (0 == iminor(filp->f_dentry->d_inode)) { ++ printk(KERN_INFO "Capability being written to /dev/caphash : \n"); ++ hexdump(user_buf, count); ++ memcpy(node_ptr->data, user_buf, count); ++ list_add(&(node_ptr->list), &(dev->head->list)); ++ } else { ++ /* break the supplied string into tokens with @ as the delimiter ++ If the string is "user1@user2@randomstring" we need to split it ++ and hash 'user1@user2' using 'randomstring' as the key ++ */ ++ user_buf_running = kstrdup(user_buf, GFP_KERNEL); ++ source_user = strsep(&user_buf_running, "@"); ++ target_user = strsep(&user_buf_running, "@"); ++ rand_str = strsep(&user_buf_running, "@"); ++ ++ /* hash the string user1@user2 with rand_str as the key */ ++ len = strlen(source_user) + strlen(target_user) + 1; ++ hash_str = (char *) kmalloc(len, GFP_KERNEL); ++ memset(hash_str, 0, len); ++ strcat(hash_str, source_user); ++ strcat(hash_str, "@"); ++ strcat(hash_str, target_user); ++ ++ printk(KERN_ALERT "the source user is %s \n", source_user); ++ printk(KERN_ALERT "the target user is %s \n", target_user); ++ ++ result = ++ cap_hash(hash_str, len, rand_str, strlen(rand_str)); ++ if (NULL == result) { ++ retval = -EFAULT; ++ goto out; ++ } ++ memcpy(node_ptr->data, result, CAP_NODE_SIZE); ++ /* Change the process's uid if the hash is present in the ++ * list of hashes ++ */ ++ list_for_each(pos, &(cap_devices->head->list)) { ++ /* Change the user id of the process if the hashes match */ ++ if (0 == ++ memcmp(result, ++ list_entry(pos, struct cap_node, ++ list)->data, ++ CAP_NODE_SIZE)) { ++ target_int = (unsigned int) ++ simple_strtol(target_user, NULL, 0); ++ source_int = (unsigned int) ++ simple_strtol(source_user, NULL, 0); ++ flag = 1; ++ ++ /* Check whether the process writing to capuse is actually owned by ++ * the source owner ++ */ ++ if (source_int != current->uid) { ++ printk(KERN_ALERT ++ "Process is not owned by the source user of the capability.\n"); ++ retval = -EFAULT; ++ goto out; ++ } ++ /* What all id's need to be changed here? uid, euid, fsid, savedids ?? ++ * Currently I am changing the effective user id ++ * since most of the authorisation decisions are based on it ++ */ ++ current->uid = (uid_t) target_int; ++ current->euid = (uid_t) target_int; ++ ++ /* Remove the capability from the list and break */ ++ tmp = ++ list_entry(pos, struct cap_node, list); ++ list_del(pos); ++ kfree(tmp); ++ break; ++ } ++ } ++ if (0 == flag) { ++ /* The capability is not present in the list of the hashes stored, hence return failure */ ++ printk(KERN_ALERT ++ "Invalid capabiliy written to /dev/capuse \n"); ++ retval = -EFAULT; ++ goto out; ++ } ++ } ++ *f_pos += count; ++ retval = count; ++ /* update the size */ ++ if (dev->size < *f_pos) ++ dev->size = *f_pos; ++ ++ out: ++ up(&dev->sem); ++ return retval; ++} ++ ++struct file_operations cap_fops = { ++ .owner = THIS_MODULE, ++ .write = cap_write, ++ .open = cap_open, ++ .release = cap_release, ++}; ++ ++ ++void cap_cleanup_module(void) ++{ ++ int i; ++ dev_t devno = MKDEV(cap_major, cap_minor); ++ if (cap_devices) { ++ for (i = 0; i < cap_nr_devs; i++) { ++ cap_trim(cap_devices + i); ++ cdev_del(&cap_devices[i].cdev); ++ } ++ kfree(cap_devices); ++ } ++ unregister_chrdev_region(devno, cap_nr_devs); ++ ++} ++ ++ ++static void cap_setup_cdev(struct cap_dev *dev, int index) ++{ ++ int err, devno = MKDEV(cap_major, cap_minor + index); ++ cdev_init(&dev->cdev, &cap_fops); ++ dev->cdev.owner = THIS_MODULE; ++ dev->cdev.ops = &cap_fops; ++ err = cdev_add(&dev->cdev, devno, 1); ++ if (err) ++ printk(KERN_NOTICE "Error %d adding cap%d", err, index); ++} ++ ++ ++int cap_init_module(void) ++{ ++ int result, i; ++ dev_t dev = 0; ++ ++ if (cap_major) { ++ dev = MKDEV(cap_major, cap_minor); ++ result = register_chrdev_region(dev, cap_nr_devs, "cap"); ++ } else { ++ result = alloc_chrdev_region(&dev, cap_minor, cap_nr_devs, ++ "cap"); ++ cap_major = MAJOR(dev); ++ } ++ ++ if (result < 0) { ++ printk(KERN_WARNING "cap: can't get major %d\n", ++ cap_major); ++ return result; ++ } ++ ++ cap_devices = ++ kmalloc(cap_nr_devs * sizeof(struct cap_dev), GFP_KERNEL); ++ if (!cap_devices) { ++ result = -ENOMEM; ++ goto fail; ++ } ++ memset(cap_devices, 0, cap_nr_devs * sizeof(struct cap_dev)); ++ ++ /* Initialize each device. */ ++ for (i = 0; i < cap_nr_devs; i++) { ++ cap_devices[i].node_size = cap_node_size; ++ init_MUTEX(&cap_devices[i].sem); ++ cap_setup_cdev(&cap_devices[i], i); ++ } ++ ++ return 0; ++ ++ fail: ++ cap_cleanup_module(); ++ return result; ++} ++ ++module_init(cap_init_module); ++module_exit(cap_cleanup_module); ++ ++char *cap_hash(char *plain_text, unsigned int plain_text_size, ++ char *key, unsigned int key_size) ++{ ++ struct scatterlist sg; ++ char *result = (char *) kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ int ret; ++ ++ tfm = crypto_alloc_hash("hmac(sha1)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ printk("failed to load transform for hmac(sha1): %ld\n", ++ PTR_ERR(tfm)); ++ kfree(result); ++ return NULL; ++ } ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ memset(result, 0, MAX_DIGEST_SIZE); ++ sg_set_buf(&sg, plain_text, plain_text_size); ++ ++ ret = crypto_hash_setkey(tfm, key, key_size); ++ if (ret) { ++ printk("setkey() failed ret=%d\n", ret); ++ kfree(result); ++ result = NULL; ++ goto out; ++ } ++ ++ ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); ++ if (ret) { ++ printk("digest () failed ret=%d\n", ret); ++ kfree(result); ++ result = NULL; ++ goto out; ++ } ++ ++ printk("crypto hash digest size %d\n", ++ crypto_hash_digestsize(tfm)); ++ hexdump(result, MAX_DIGEST_SIZE); ++ ++ out: ++ crypto_free_hash(tfm); ++ return result; ++} +--- /dev/null ++++ b/drivers/staging/p9auth/p9auth.h +@@ -0,0 +1,35 @@ ++#ifndef CAP_MAJOR ++#define CAP_MAJOR 0 ++#endif ++ ++#ifndef CAP_NR_DEVS ++#define CAP_NR_DEVS 2 /* caphash and capuse */ ++#endif ++ ++#ifndef CAP_NODE_SIZE ++#define CAP_NODE_SIZE 20 ++#endif ++ ++#define MAX_DIGEST_SIZE 20 ++ ++struct cap_node { ++ char data[CAP_NODE_SIZE]; ++ struct list_head list; ++}; ++ ++struct cap_dev { ++ struct cap_node *head; ++ int node_size; ++ unsigned long size; ++ struct semaphore sem; ++ struct cdev cdev; ++}; ++ ++extern int cap_major; ++extern int cap_nr_devs; ++extern int cap_node_size; ++ ++int cap_trim(struct cap_dev *); ++ssize_t cap_write(struct file *, const char __user *, size_t, loff_t *); ++char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, unsigned int key_size); ++void hex_dump(unsigned char * buf, unsigned int len); diff --git a/staging/staging-p9auth-add-to-the-kernel-build.patch b/staging/staging-p9auth-add-to-the-kernel-build.patch new file mode 100644 index 00000000000000..4315c1116cb31c --- /dev/null +++ b/staging/staging-p9auth-add-to-the-kernel-build.patch @@ -0,0 +1,51 @@ +From cb773269ddefcd589ebf816a4888998095dcd099 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:08:20 -0800 +Subject: Staging: p9auth: add to the kernel build + +From: Greg Kroah-Hartman <gregkh@suse.de> + +This adds the p9auth code to the kernel build + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/Kconfig | 2 ++ + drivers/staging/Makefile | 1 + + drivers/staging/p9auth/Kconfig | 8 ++++++++ + drivers/staging/p9auth/Makefile | 1 + + 4 files changed, 12 insertions(+) + +--- a/drivers/staging/Kconfig ++++ b/drivers/staging/Kconfig +@@ -107,5 +107,7 @@ source "drivers/staging/b3dfg/Kconfig" + + source "drivers/staging/phison/Kconfig" + ++source "drivers/staging/p9auth/Kconfig" ++ + endif # !STAGING_EXCLUDE_BUILD + endif # STAGING +--- a/drivers/staging/Makefile ++++ b/drivers/staging/Makefile +@@ -36,3 +36,4 @@ obj-$(CONFIG_STLC45XX) += stlc45xx/ + obj-$(CONFIG_USB_SERIAL_ATEN2011) += uc2322/ + obj-$(CONFIG_B3DFG) += b3dfg/ + obj-$(CONFIG_IDE_PHISON) += phison/ ++obj-$(CONFIG_PLAN9AUTH) += p9auth/ +--- /dev/null ++++ b/drivers/staging/p9auth/Kconfig +@@ -0,0 +1,8 @@ ++config PLAN9AUTH ++ tristate "Plan 9 style capability device implementation" ++ default n ++ help ++ This module implements the Plan 9 style capability device. ++ ++ To compile this driver as a module, choose ++ M here: the module will be called p9auth. +--- /dev/null ++++ b/drivers/staging/p9auth/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_PLAN9AUTH) += p9auth.o diff --git a/staging/staging-p9auth-clean-up-includes.patch b/staging/staging-p9auth-clean-up-includes.patch new file mode 100644 index 00000000000000..48f79e1d339014 --- /dev/null +++ b/staging/staging-p9auth-clean-up-includes.patch @@ -0,0 +1,51 @@ +From 0955bb5da4169781e76192ca2974ccb45790faf8 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:37:55 -0800 +Subject: Staging: p9auth: clean up #includes + +From: Greg Kroah-Hartman <gregkh@suse.de> + +Not all of these files needed to be included, clean up the list. + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -6,31 +6,21 @@ + * Released under the GPLv2 + * + */ +-#include <linux/module.h> +-#include <linux/moduleparam.h> + #include <linux/init.h> + #include <linux/kernel.h> ++#include <linux/moduleparam.h> + #include <linux/slab.h> + #include <linux/fs.h> + #include <linux/errno.h> +-#include <linux/types.h> +-#include <linux/proc_fs.h> + #include <linux/fcntl.h> + #include <linux/cdev.h> +-#include <linux/syscalls.h> + #include <linux/uaccess.h> + #include <linux/list.h> +-#include <linux/err.h> + #include <linux/mm.h> + #include <linux/string.h> + #include <linux/crypto.h> + #include <linux/highmem.h> +-#include <linux/jiffies.h> +-#include <linux/timex.h> +-#include <linux/interrupt.h> + #include <linux/scatterlist.h> +-#include <linux/crypto.h> +-#include <asm/system.h> + + #ifndef CAP_MAJOR + #define CAP_MAJOR 0 diff --git a/staging/staging-p9auth-fix-credential-logic.patch b/staging/staging-p9auth-fix-credential-logic.patch new file mode 100644 index 00000000000000..85a6f0db557c3e --- /dev/null +++ b/staging/staging-p9auth-fix-credential-logic.patch @@ -0,0 +1,58 @@ +From 98045170693c31b203a37b78a3b0168c6280d012 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:06:34 -0800 +Subject: Staging: p9auth: fix credential logic + +From: Greg Kroah-Hartman <gregkh@suse.de> + +current->uid is no longer allowed in the 2.6.29 kernel, so use +the proper credential api to be able to alter the uid and euid values. + +Note, this now builds properly, hopefully still works properly, would be +good for someone to test it out... + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -104,6 +104,7 @@ cap_write(struct file * filp, const char + struct list_head *pos; + struct cap_dev *dev = filp->private_data; + ssize_t retval = -ENOMEM; ++ struct cred *new; + int len, target_int, source_int, flag = 0; + char *user_buf, *user_buf_running, *source_user, *target_user, + *rand_str, *hash_str, *result; +@@ -177,7 +178,7 @@ cap_write(struct file * filp, const char + /* Check whether the process writing to capuse is actually owned by + * the source owner + */ +- if (source_int != current->uid) { ++ if (source_int != current_uid()) { + printk(KERN_ALERT + "Process is not owned by the source user of the capability.\n"); + retval = -EFAULT; +@@ -187,8 +188,16 @@ cap_write(struct file * filp, const char + * Currently I am changing the effective user id + * since most of the authorisation decisions are based on it + */ +- current->uid = (uid_t) target_int; +- current->euid = (uid_t) target_int; ++ new = prepare_creds(); ++ if (!new) { ++ retval = -ENOMEM; ++ goto out; ++ } ++ new->uid = (uid_t) target_int; ++ new->euid = (uid_t) target_int; ++ retval = commit_creds(new); ++ if (retval) ++ goto out; + + /* Remove the capability from the list and break */ + tmp = diff --git a/staging/staging-p9auth-fix-up-codingstyle-issues.patch b/staging/staging-p9auth-fix-up-codingstyle-issues.patch new file mode 100644 index 00000000000000..b93b04f059c4dd --- /dev/null +++ b/staging/staging-p9auth-fix-up-codingstyle-issues.patch @@ -0,0 +1,260 @@ +From a4d5ffa5b8792e03f6a34b0f7d7616f56386f18e Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:21:55 -0800 +Subject: Staging: p9auth: fix up codingstyle issues + +From: Greg Kroah-Hartman <gregkh@suse.de> + +This fixes up a number of scripts/codingstyle.pl warnings and errors + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 90 +++++++++++++++++++++------------------- + 1 file changed, 49 insertions(+), 41 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -18,8 +18,7 @@ + #include <linux/fcntl.h> + #include <linux/cdev.h> + #include <linux/syscalls.h> +-#include <asm/system.h> +-#include <asm/uaccess.h> ++#include <linux/uaccess.h> + #include <linux/list.h> + #include <linux/err.h> + #include <linux/mm.h> +@@ -31,6 +30,7 @@ + #include <linux/interrupt.h> + #include <linux/scatterlist.h> + #include <linux/crypto.h> ++#include <asm/system.h> + + #ifndef CAP_MAJOR + #define CAP_MAJOR 0 +@@ -59,13 +59,11 @@ struct cap_dev { + struct cdev cdev; + }; + +-int cap_trim(struct cap_dev *); +-ssize_t cap_write(struct file *, const char __user *, size_t, loff_t *); +-char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, unsigned int key_size); +-void hex_dump(unsigned char * buf, unsigned int len); ++char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, ++ unsigned int key_size); + + int cap_major = CAP_MAJOR; +-int cap_minor = 0; ++int cap_minor; + int cap_nr_devs = CAP_NR_DEVS; + int cap_node_size = CAP_NODE_SIZE; + +@@ -114,9 +112,7 @@ int cap_open(struct inode *inode, struct + } + /* initialise the head if it is NULL */ + if (dev->head == NULL) { +- dev->head = +- (struct cap_node *) kmalloc(sizeof(struct cap_node), +- GFP_KERNEL); ++ dev->head = kmalloc(sizeof(struct cap_node), GFP_KERNEL); + INIT_LIST_HEAD(&(dev->head->list)); + } + return 0; +@@ -127,9 +123,8 @@ int cap_release(struct inode *inode, str + return 0; + } + +-ssize_t +-cap_write(struct file * filp, const char __user * buf, +- size_t count, loff_t * f_pos) ++ssize_t cap_write(struct file *filp, const char __user *buf, size_t count, ++ loff_t *f_pos) + { + struct cap_node *node_ptr, *tmp; + struct list_head *pos; +@@ -143,10 +138,8 @@ cap_write(struct file * filp, const char + if (down_interruptible(&dev->sem)) + return -ERESTARTSYS; + +- node_ptr = +- (struct cap_node *) kmalloc(sizeof(struct cap_node), +- GFP_KERNEL); +- user_buf = (char *) kmalloc(count, GFP_KERNEL); ++ node_ptr = kmalloc(sizeof(struct cap_node), GFP_KERNEL); ++ user_buf = kmalloc(count, GFP_KERNEL); + memset(user_buf, 0, count); + + if (copy_from_user(user_buf, buf, count)) { +@@ -154,7 +147,8 @@ cap_write(struct file * filp, const char + goto out; + } + +- /* If the minor number is 0 ( /dev/caphash ) then simply add the ++ /* ++ * If the minor number is 0 ( /dev/caphash ) then simply add the + * hashed capability supplied by the user to the list of hashes + */ + if (0 == iminor(filp->f_dentry->d_inode)) { +@@ -163,9 +157,11 @@ cap_write(struct file * filp, const char + memcpy(node_ptr->data, user_buf, count); + list_add(&(node_ptr->list), &(dev->head->list)); + } else { +- /* break the supplied string into tokens with @ as the delimiter +- If the string is "user1@user2@randomstring" we need to split it +- and hash 'user1@user2' using 'randomstring' as the key ++ /* ++ * break the supplied string into tokens with @ as the ++ * delimiter If the string is "user1@user2@randomstring" we ++ * need to split it and hash 'user1@user2' using 'randomstring' ++ * as the key. + */ + user_buf_running = kstrdup(user_buf, GFP_KERNEL); + source_user = strsep(&user_buf_running, "@"); +@@ -174,7 +170,7 @@ cap_write(struct file * filp, const char + + /* hash the string user1@user2 with rand_str as the key */ + len = strlen(source_user) + strlen(target_user) + 1; +- hash_str = (char *) kmalloc(len, GFP_KERNEL); ++ hash_str = kmalloc(len, GFP_KERNEL); + memset(hash_str, 0, len); + strcat(hash_str, source_user); + strcat(hash_str, "@"); +@@ -194,7 +190,10 @@ cap_write(struct file * filp, const char + * list of hashes + */ + list_for_each(pos, &(cap_devices->head->list)) { +- /* Change the user id of the process if the hashes match */ ++ /* ++ * Change the user id of the process if the hashes ++ * match ++ */ + if (0 == + memcmp(result, + list_entry(pos, struct cap_node, +@@ -206,8 +205,9 @@ cap_write(struct file * filp, const char + simple_strtol(source_user, NULL, 0); + flag = 1; + +- /* Check whether the process writing to capuse is actually owned by +- * the source owner ++ /* ++ * Check whether the process writing to capuse ++ * is actually owned by the source owner + */ + if (source_int != current_uid()) { + printk(KERN_ALERT +@@ -215,9 +215,11 @@ cap_write(struct file * filp, const char + retval = -EFAULT; + goto out; + } +- /* What all id's need to be changed here? uid, euid, fsid, savedids ?? +- * Currently I am changing the effective user id +- * since most of the authorisation decisions are based on it ++ /* ++ * What all id's need to be changed here? uid, ++ * euid, fsid, savedids ?? Currently I am ++ * changing the effective user id since most of ++ * the authorisation decisions are based on it + */ + new = prepare_creds(); + if (!new) { +@@ -230,16 +232,21 @@ cap_write(struct file * filp, const char + if (retval) + goto out; + +- /* Remove the capability from the list and break */ +- tmp = +- list_entry(pos, struct cap_node, list); ++ /* ++ * Remove the capability from the list and ++ * break ++ */ ++ tmp = list_entry(pos, struct cap_node, list); + list_del(pos); + kfree(tmp); + break; + } + } + if (0 == flag) { +- /* The capability is not present in the list of the hashes stored, hence return failure */ ++ /* ++ * The capability is not present in the list of the ++ * hashes stored, hence return failure ++ */ + printk(KERN_ALERT + "Invalid capabiliy written to /dev/capuse \n"); + retval = -EFAULT; +@@ -252,12 +259,12 @@ cap_write(struct file * filp, const char + if (dev->size < *f_pos) + dev->size = *f_pos; + +- out: ++out: + up(&dev->sem); + return retval; + } + +-struct file_operations cap_fops = { ++const struct file_operations cap_fops = { + .owner = THIS_MODULE, + .write = cap_write, + .open = cap_open, +@@ -330,7 +337,7 @@ int cap_init_module(void) + + return 0; + +- fail: ++fail: + cap_cleanup_module(); + return result; + } +@@ -342,14 +349,15 @@ char *cap_hash(char *plain_text, unsigne + char *key, unsigned int key_size) + { + struct scatterlist sg; +- char *result = (char *) kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); ++ char *result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); + struct crypto_hash *tfm; + struct hash_desc desc; + int ret; + + tfm = crypto_alloc_hash("hmac(sha1)", 0, CRYPTO_ALG_ASYNC); + if (IS_ERR(tfm)) { +- printk("failed to load transform for hmac(sha1): %ld\n", ++ printk(KERN_ERR ++ "failed to load transform for hmac(sha1): %ld\n", + PTR_ERR(tfm)); + kfree(result); + return NULL; +@@ -363,7 +371,7 @@ char *cap_hash(char *plain_text, unsigne + + ret = crypto_hash_setkey(tfm, key, key_size); + if (ret) { +- printk("setkey() failed ret=%d\n", ret); ++ printk(KERN_ERR "setkey() failed ret=%d\n", ret); + kfree(result); + result = NULL; + goto out; +@@ -371,17 +379,17 @@ char *cap_hash(char *plain_text, unsigne + + ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); + if (ret) { +- printk("digest () failed ret=%d\n", ret); ++ printk(KERN_ERR "digest () failed ret=%d\n", ret); + kfree(result); + result = NULL; + goto out; + } + +- printk("crypto hash digest size %d\n", ++ printk(KERN_DEBUG "crypto hash digest size %d\n", + crypto_hash_digestsize(tfm)); + hexdump(result, MAX_DIGEST_SIZE); + +- out: ++out: + crypto_free_hash(tfm); + return result; + } diff --git a/staging/staging-p9auth-fix-up-sparse-warnings.patch b/staging/staging-p9auth-fix-up-sparse-warnings.patch new file mode 100644 index 00000000000000..17d4414f871167 --- /dev/null +++ b/staging/staging-p9auth-fix-up-sparse-warnings.patch @@ -0,0 +1,232 @@ +From 71cf684cae73cd5338b48b9448b248a50aec976c Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:25:02 -0800 +Subject: Staging: p9auth: fix up sparse warnings + +From: Greg Kroah-Hartman <gregkh@suse.de> + +Everything needs to be static, as sparse complains and you don't want to +polute the global kernel symbol namespace. So mark everything as such +and move one function around to prevent a forward declaration from being +needed. + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 133 +++++++++++++++++++--------------------- + 1 file changed, 64 insertions(+), 69 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -59,13 +59,10 @@ struct cap_dev { + struct cdev cdev; + }; + +-char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, +- unsigned int key_size); +- +-int cap_major = CAP_MAJOR; +-int cap_minor; +-int cap_nr_devs = CAP_NR_DEVS; +-int cap_node_size = CAP_NODE_SIZE; ++static int cap_major = CAP_MAJOR; ++static int cap_minor; ++static int cap_nr_devs = CAP_NR_DEVS; ++static int cap_node_size = CAP_NODE_SIZE; + + module_param(cap_major, int, S_IRUGO); + module_param(cap_minor, int, S_IRUGO); +@@ -74,16 +71,65 @@ module_param(cap_nr_devs, int, S_IRUGO); + MODULE_AUTHOR("Ashwin Ganti"); + MODULE_LICENSE("GPL"); + +-struct cap_dev *cap_devices; ++static struct cap_dev *cap_devices; + +-void hexdump(unsigned char *buf, unsigned int len) ++static void hexdump(unsigned char *buf, unsigned int len) + { + while (len--) + printk("%02x", *buf++); + printk("\n"); + } + +-int cap_trim(struct cap_dev *dev) ++static char *cap_hash(char *plain_text, unsigned int plain_text_size, ++ char *key, unsigned int key_size) ++{ ++ struct scatterlist sg; ++ char *result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); ++ struct crypto_hash *tfm; ++ struct hash_desc desc; ++ int ret; ++ ++ tfm = crypto_alloc_hash("hmac(sha1)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) { ++ printk(KERN_ERR ++ "failed to load transform for hmac(sha1): %ld\n", ++ PTR_ERR(tfm)); ++ kfree(result); ++ return NULL; ++ } ++ ++ desc.tfm = tfm; ++ desc.flags = 0; ++ ++ memset(result, 0, MAX_DIGEST_SIZE); ++ sg_set_buf(&sg, plain_text, plain_text_size); ++ ++ ret = crypto_hash_setkey(tfm, key, key_size); ++ if (ret) { ++ printk(KERN_ERR "setkey() failed ret=%d\n", ret); ++ kfree(result); ++ result = NULL; ++ goto out; ++ } ++ ++ ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); ++ if (ret) { ++ printk(KERN_ERR "digest () failed ret=%d\n", ret); ++ kfree(result); ++ result = NULL; ++ goto out; ++ } ++ ++ printk(KERN_DEBUG "crypto hash digest size %d\n", ++ crypto_hash_digestsize(tfm)); ++ hexdump(result, MAX_DIGEST_SIZE); ++ ++out: ++ crypto_free_hash(tfm); ++ return result; ++} ++ ++static int cap_trim(struct cap_dev *dev) + { + struct cap_node *tmp; + struct list_head *pos, *q; +@@ -97,7 +143,7 @@ int cap_trim(struct cap_dev *dev) + return 0; + } + +-int cap_open(struct inode *inode, struct file *filp) ++static int cap_open(struct inode *inode, struct file *filp) + { + struct cap_dev *dev; + dev = container_of(inode->i_cdev, struct cap_dev, cdev); +@@ -118,13 +164,13 @@ int cap_open(struct inode *inode, struct + return 0; + } + +-int cap_release(struct inode *inode, struct file *filp) ++static int cap_release(struct inode *inode, struct file *filp) + { + return 0; + } + +-ssize_t cap_write(struct file *filp, const char __user *buf, size_t count, +- loff_t *f_pos) ++static ssize_t cap_write(struct file *filp, const char __user *buf, ++ size_t count, loff_t *f_pos) + { + struct cap_node *node_ptr, *tmp; + struct list_head *pos; +@@ -179,8 +225,7 @@ ssize_t cap_write(struct file *filp, con + printk(KERN_ALERT "the source user is %s \n", source_user); + printk(KERN_ALERT "the target user is %s \n", target_user); + +- result = +- cap_hash(hash_str, len, rand_str, strlen(rand_str)); ++ result = cap_hash(hash_str, len, rand_str, strlen(rand_str)); + if (NULL == result) { + retval = -EFAULT; + goto out; +@@ -264,15 +309,14 @@ out: + return retval; + } + +-const struct file_operations cap_fops = { ++static const struct file_operations cap_fops = { + .owner = THIS_MODULE, + .write = cap_write, + .open = cap_open, + .release = cap_release, + }; + +- +-void cap_cleanup_module(void) ++static void cap_cleanup_module(void) + { + int i; + dev_t devno = MKDEV(cap_major, cap_minor); +@@ -287,7 +331,6 @@ void cap_cleanup_module(void) + + } + +- + static void cap_setup_cdev(struct cap_dev *dev, int index) + { + int err, devno = MKDEV(cap_major, cap_minor + index); +@@ -299,8 +342,7 @@ static void cap_setup_cdev(struct cap_de + printk(KERN_NOTICE "Error %d adding cap%d", err, index); + } + +- +-int cap_init_module(void) ++static int cap_init_module(void) + { + int result, i; + dev_t dev = 0; +@@ -345,51 +387,4 @@ fail: + module_init(cap_init_module); + module_exit(cap_cleanup_module); + +-char *cap_hash(char *plain_text, unsigned int plain_text_size, +- char *key, unsigned int key_size) +-{ +- struct scatterlist sg; +- char *result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); +- struct crypto_hash *tfm; +- struct hash_desc desc; +- int ret; +- +- tfm = crypto_alloc_hash("hmac(sha1)", 0, CRYPTO_ALG_ASYNC); +- if (IS_ERR(tfm)) { +- printk(KERN_ERR +- "failed to load transform for hmac(sha1): %ld\n", +- PTR_ERR(tfm)); +- kfree(result); +- return NULL; +- } +- +- desc.tfm = tfm; +- desc.flags = 0; +- +- memset(result, 0, MAX_DIGEST_SIZE); +- sg_set_buf(&sg, plain_text, plain_text_size); +- +- ret = crypto_hash_setkey(tfm, key, key_size); +- if (ret) { +- printk(KERN_ERR "setkey() failed ret=%d\n", ret); +- kfree(result); +- result = NULL; +- goto out; +- } +- +- ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); +- if (ret) { +- printk(KERN_ERR "digest () failed ret=%d\n", ret); +- kfree(result); +- result = NULL; +- goto out; +- } +- +- printk(KERN_DEBUG "crypto hash digest size %d\n", +- crypto_hash_digestsize(tfm)); +- hexdump(result, MAX_DIGEST_SIZE); + +-out: +- crypto_free_hash(tfm); +- return result; +-} diff --git a/staging/staging-p9auth-remove-unneeded-header-file.patch b/staging/staging-p9auth-remove-unneeded-header-file.patch new file mode 100644 index 00000000000000..0dfb559b70f7c0 --- /dev/null +++ b/staging/staging-p9auth-remove-unneeded-header-file.patch @@ -0,0 +1,98 @@ +From 9a25191baf379462ea2d6c508f5a5e20b4d7fc83 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:11:39 -0800 +Subject: Staging: p9auth: remove unneeded header file + +From: Greg Kroah-Hartman <gregkh@suse.de> + +The p9auth.h file is not needed, move the stuff into p9auth.c file and +delete it. + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 33 ++++++++++++++++++++++++++++++++- + drivers/staging/p9auth/p9auth.h | 35 ----------------------------------- + 2 files changed, 32 insertions(+), 36 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -31,7 +31,38 @@ + #include <linux/interrupt.h> + #include <linux/scatterlist.h> + #include <linux/crypto.h> +-#include "p9auth.h" ++ ++#ifndef CAP_MAJOR ++#define CAP_MAJOR 0 ++#endif ++ ++#ifndef CAP_NR_DEVS ++#define CAP_NR_DEVS 2 /* caphash and capuse */ ++#endif ++ ++#ifndef CAP_NODE_SIZE ++#define CAP_NODE_SIZE 20 ++#endif ++ ++#define MAX_DIGEST_SIZE 20 ++ ++struct cap_node { ++ char data[CAP_NODE_SIZE]; ++ struct list_head list; ++}; ++ ++struct cap_dev { ++ struct cap_node *head; ++ int node_size; ++ unsigned long size; ++ struct semaphore sem; ++ struct cdev cdev; ++}; ++ ++int cap_trim(struct cap_dev *); ++ssize_t cap_write(struct file *, const char __user *, size_t, loff_t *); ++char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, unsigned int key_size); ++void hex_dump(unsigned char * buf, unsigned int len); + + int cap_major = CAP_MAJOR; + int cap_minor = 0; +--- a/drivers/staging/p9auth/p9auth.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-#ifndef CAP_MAJOR +-#define CAP_MAJOR 0 +-#endif +- +-#ifndef CAP_NR_DEVS +-#define CAP_NR_DEVS 2 /* caphash and capuse */ +-#endif +- +-#ifndef CAP_NODE_SIZE +-#define CAP_NODE_SIZE 20 +-#endif +- +-#define MAX_DIGEST_SIZE 20 +- +-struct cap_node { +- char data[CAP_NODE_SIZE]; +- struct list_head list; +-}; +- +-struct cap_dev { +- struct cap_node *head; +- int node_size; +- unsigned long size; +- struct semaphore sem; +- struct cdev cdev; +-}; +- +-extern int cap_major; +-extern int cap_nr_devs; +-extern int cap_node_size; +- +-int cap_trim(struct cap_dev *); +-ssize_t cap_write(struct file *, const char __user *, size_t, loff_t *); +-char *cap_hash(char *plain_text, unsigned int plain_text_size, char *key, unsigned int key_size); +-void hex_dump(unsigned char * buf, unsigned int len); diff --git a/staging/staging-p9auth-use-kzalloc.patch b/staging/staging-p9auth-use-kzalloc.patch new file mode 100644 index 00000000000000..d721bd672e3194 --- /dev/null +++ b/staging/staging-p9auth-use-kzalloc.patch @@ -0,0 +1,87 @@ +From d74fd948e448514edbae6b44de1cb032f3971b6f Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Tue, 24 Feb 2009 20:31:39 -0800 +Subject: Staging: p9auth: use kzalloc + +From: Greg Kroah-Hartman <gregkh@suse.de> + +It's nicer than doing kmalloc/memset. + +Also check the return value of all allocations, one was previously not +being checked properly. + +Cc: Ashwin Ganti <ashwin.ganti@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/p9auth/p9auth.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +--- a/drivers/staging/p9auth/p9auth.c ++++ b/drivers/staging/p9auth/p9auth.c +@@ -84,7 +84,7 @@ static char *cap_hash(char *plain_text, + char *key, unsigned int key_size) + { + struct scatterlist sg; +- char *result = kmalloc(MAX_DIGEST_SIZE, GFP_KERNEL); ++ char *result; + struct crypto_hash *tfm; + struct hash_desc desc; + int ret; +@@ -94,14 +94,18 @@ static char *cap_hash(char *plain_text, + printk(KERN_ERR + "failed to load transform for hmac(sha1): %ld\n", + PTR_ERR(tfm)); +- kfree(result); + return NULL; + } + + desc.tfm = tfm; + desc.flags = 0; + +- memset(result, 0, MAX_DIGEST_SIZE); ++ result = kzalloc(MAX_DIGEST_SIZE, GFP_KERNEL); ++ if (!result) { ++ printk(KERN_ERR "out of memory!\n"); ++ goto out; ++ } ++ + sg_set_buf(&sg, plain_text, plain_text_size); + + ret = crypto_hash_setkey(tfm, key, key_size); +@@ -185,8 +189,7 @@ static ssize_t cap_write(struct file *fi + return -ERESTARTSYS; + + node_ptr = kmalloc(sizeof(struct cap_node), GFP_KERNEL); +- user_buf = kmalloc(count, GFP_KERNEL); +- memset(user_buf, 0, count); ++ user_buf = kzalloc(count, GFP_KERNEL); + + if (copy_from_user(user_buf, buf, count)) { + retval = -EFAULT; +@@ -216,8 +219,7 @@ static ssize_t cap_write(struct file *fi + + /* hash the string user1@user2 with rand_str as the key */ + len = strlen(source_user) + strlen(target_user) + 1; +- hash_str = kmalloc(len, GFP_KERNEL); +- memset(hash_str, 0, len); ++ hash_str = kzalloc(len, GFP_KERNEL); + strcat(hash_str, source_user); + strcat(hash_str, "@"); + strcat(hash_str, target_user); +@@ -362,13 +364,12 @@ static int cap_init_module(void) + return result; + } + +- cap_devices = +- kmalloc(cap_nr_devs * sizeof(struct cap_dev), GFP_KERNEL); ++ cap_devices = kzalloc(cap_nr_devs * sizeof(struct cap_dev), ++ GFP_KERNEL); + if (!cap_devices) { + result = -ENOMEM; + goto fail; + } +- memset(cap_devices, 0, cap_nr_devs * sizeof(struct cap_dev)); + + /* Initialize each device. */ + for (i = 0; i < cap_nr_devs; i++) { diff --git a/usb.current/usb-cdc-acm-add-usb-id-for-motomagx-phones.patch b/usb.current/usb-cdc-acm-add-usb-id-for-motomagx-phones.patch new file mode 100644 index 00000000000000..a1c2f14a569b28 --- /dev/null +++ b/usb.current/usb-cdc-acm-add-usb-id-for-motomagx-phones.patch @@ -0,0 +1,33 @@ +From dimichxp@gmail.com Tue Feb 24 21:12:08 2009 +From: Dmitriy Taychenachev <dimichxp@gmail.com> +Date: Wed, 25 Feb 2009 12:36:51 +0800 +Subject: USB: cdc-acm: add usb id for motomagx phones +To: linux-usb@vger.kernel.org +Message-ID: <2651740bf64c1d981c26.1235536611@wifi.master> + + +The Motorola MOTOMAGX phones (Z6, E8, Zn5 so far) are providing +combined ACM/BLAN USB configuration. Since it has Vendor Specific +class, the corresponding drivers (cdc-acm, zaurus) can't find it just +by interface info. This patch adds usb id so the cdc-acm driver can +properly handle this combined device. + +Signed-off-by: Dmitriy Taychenachev <dimichxp@gmail.com> +Cc: stable <stable@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/class/cdc-acm.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -1376,6 +1376,8 @@ static struct usb_device_id acm_ids[] = + { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ + }, ++ { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ ++ }, + + /* control interfaces with various AT-command sets */ + { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, diff --git a/usb.current/usb-musb-be-careful-with-64k-transfer-lengths-host-side.patch b/usb.current/usb-musb-be-careful-with-64k-transfer-lengths-host-side.patch new file mode 100644 index 00000000000000..e8dbe1f2503446 --- /dev/null +++ b/usb.current/usb-musb-be-careful-with-64k-transfer-lengths-host-side.patch @@ -0,0 +1,66 @@ +From david-b@pacbell.net Tue Feb 24 21:08:27 2009 +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:31:23 -0800 +Subject: USB: musb: be careful with 64K+ transfer lengths, host side +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Sergei Shtylyov <sshtylyov@ru.mvista.com> +Message-ID: <200902211531.23169.david-b@pacbell.net> +Content-Disposition: inline + + +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> + +Feeding 32-bit length cast down to 'u16' to min() to calculate the FIFO +count in musb_host_tx() risks sending a short packet prematurely for +transfer sizes over 64 KB. + +Similarly, although data transfer size shouldn't exceed 65535 bytes for +the control endpoint, making musb_h_ep0_continue() more robust WRT URBs +with possibly oversized buffer will not hurt either... + +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Felipe Balbi <felipe.balbi@nokia.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -937,8 +937,8 @@ static bool musb_h_ep0_continue(struct m + switch (musb->ep0_stage) { + case MUSB_EP0_IN: + fifo_dest = urb->transfer_buffer + urb->actual_length; +- fifo_count = min(len, ((u16) (urb->transfer_buffer_length +- - urb->actual_length))); ++ fifo_count = min_t(size_t, len, urb->transfer_buffer_length - ++ urb->actual_length); + if (fifo_count < len) + urb->status = -EOVERFLOW; + +@@ -971,10 +971,9 @@ static bool musb_h_ep0_continue(struct m + } + /* FALLTHROUGH */ + case MUSB_EP0_OUT: +- fifo_count = min(qh->maxpacket, ((u16) +- (urb->transfer_buffer_length +- - urb->actual_length))); +- ++ fifo_count = min_t(size_t, qh->maxpacket, ++ urb->transfer_buffer_length - ++ urb->actual_length); + if (fifo_count) { + fifo_dest = (u8 *) (urb->transfer_buffer + + urb->actual_length); +@@ -1304,7 +1303,8 @@ void musb_host_tx(struct musb *musb, u8 + * packets before updating TXCSR ... other docs disagree ... + */ + /* PIO: start next packet in this URB */ +- wLength = min(qh->maxpacket, (u16) wLength); ++ if (wLength > qh->maxpacket) ++ wLength = qh->maxpacket; + musb_write_fifo(hw_ep, wLength, buf); + qh->segsize = wLength; + diff --git a/usb.current/usb-musb-be-careful-with-64k-transfer-lengths.patch b/usb.current/usb-musb-be-careful-with-64k-transfer-lengths.patch new file mode 100644 index 00000000000000..d1fab57b512f6d --- /dev/null +++ b/usb.current/usb-musb-be-careful-with-64k-transfer-lengths.patch @@ -0,0 +1,46 @@ +From david-b@pacbell.net Tue Feb 24 21:06:10 2009 +From: Felipe Balbi <felipe.balbi@nokia.com> +Date: Sat, 21 Feb 2009 15:29:42 -0800 +Subject: USB: musb: be careful with 64K+ transfer lengths (gadget side) +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Felipe Balbi <felipe.balbi@nokia.com> +Message-ID: <200902211529.42439.david-b@pacbell.net> +Content-Disposition: inline + + +From: Felipe Balbi <felipe.balbi@nokia.com> + +request->actual is an unsigned and we should use the same +variable type for fifo_count otherwise we might lose some +data if request->length >= 64kbytes. + +[ dbrownell@users.sourceforge.net: fix compiler warning ] + +Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_gadget.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/musb/musb_gadget.c ++++ b/drivers/usb/musb/musb_gadget.c +@@ -575,7 +575,7 @@ static void rxstate(struct musb *musb, s + struct usb_request *request = &req->request; + struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; + void __iomem *epio = musb->endpoints[epnum].regs; +- u16 fifo_count = 0; ++ unsigned fifo_count = 0; + u16 len = musb_ep->packet_sz; + + csr = musb_readw(epio, MUSB_RXCSR); +@@ -687,7 +687,7 @@ static void rxstate(struct musb *musb, s + len, fifo_count, + musb_ep->packet_sz); + +- fifo_count = min(len, fifo_count); ++ fifo_count = min_t(unsigned, len, fifo_count); + + #ifdef CONFIG_USB_TUSB_OMAP_DMA + if (tusb_dma_omap() && musb_ep->dma) { diff --git a/usb.current/usb-musb-fix-data-toggle-saving-with-shared-fifo.patch b/usb.current/usb-musb-fix-data-toggle-saving-with-shared-fifo.patch new file mode 100644 index 00000000000000..bb75c3306baa5f --- /dev/null +++ b/usb.current/usb-musb-fix-data-toggle-saving-with-shared-fifo.patch @@ -0,0 +1,46 @@ +From david-b@pacbell.net Tue Feb 24 21:07:45 2009 +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:31:13 -0800 +Subject: USB: musb: fix data toggle saving with shared FIFO +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Sergei Shtylyov <sshtylyov@ru.mvista.com> +Message-ID: <200902211531.13134.david-b@pacbell.net> +Content-Disposition: inline + + +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> + +For some strange reason the host side musb_giveback() decides +that it's always got an IN transfer when the hardware endpoint +is using a shared FIFO. This causes musb_save_toggle() to read +the toggle state from the RXCSR register instead of TXCSR, and +may also cause unneeded reloading of RX endpoint registers. + +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -335,16 +335,11 @@ musb_save_toggle(struct musb_hw_ep *ep, + static struct musb_qh * + musb_giveback(struct musb_qh *qh, struct urb *urb, int status) + { +- int is_in; + struct musb_hw_ep *ep = qh->hw_ep; + struct musb *musb = ep->musb; ++ int is_in = usb_pipein(urb->pipe); + int ready = qh->is_ready; + +- if (ep->is_shared_fifo) +- is_in = 1; +- else +- is_in = usb_pipein(urb->pipe); +- + /* save toggle eagerly, for paranoia */ + switch (qh->type) { + case USB_ENDPOINT_XFER_BULK: diff --git a/usb.current/usb-musb-fix-musb_host_tx-for-shared-endpoint-fifo.patch b/usb.current/usb-musb-fix-musb_host_tx-for-shared-endpoint-fifo.patch new file mode 100644 index 00000000000000..1c876093b06582 --- /dev/null +++ b/usb.current/usb-musb-fix-musb_host_tx-for-shared-endpoint-fifo.patch @@ -0,0 +1,43 @@ +From david-b@pacbell.net Tue Feb 24 21:06:30 2009 +From: Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:30:15 -0800 +Subject: USB: musb: fix musb_host_tx() for shared endpoint FIFO +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com> +Message-ID: <200902211530.15372.david-b@pacbell.net> +Content-Disposition: inline + + +From: Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com> + +The input queue should be used for TX on endpoints which +share FIFO hardware. The host TX path wasn't doing that. + +Shared FIFOs are most often configured for periodic endpoints, +which are mostly used for RX/IN transfers ... that's probably +how this bug managed to linger for a long time. + +[ dbrownell@users.sourceforge.net: update patch description ] + +Signed-off-by: Dmitry Krivoschekov <dkrivoschekov@ru.mvista.com> +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Acked-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Felipe Balbi <felipe.balbi@nokia.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -1161,7 +1161,8 @@ void musb_host_tx(struct musb *musb, u8 + struct urb *urb; + struct musb_hw_ep *hw_ep = musb->endpoints + epnum; + void __iomem *epio = hw_ep->regs; +- struct musb_qh *qh = hw_ep->out_qh; ++ struct musb_qh *qh = hw_ep->is_shared_fifo ? hw_ep->in_qh ++ : hw_ep->out_qh; + u32 status = 0; + void __iomem *mbase = musb->mregs; + struct dma_channel *dma; diff --git a/usb.current/usb-musb-fix-srp-sysfs-entry-deletion.patch b/usb.current/usb-musb-fix-srp-sysfs-entry-deletion.patch new file mode 100644 index 00000000000000..05f7d06439f410 --- /dev/null +++ b/usb.current/usb-musb-fix-srp-sysfs-entry-deletion.patch @@ -0,0 +1,44 @@ +From david-b@pacbell.net Tue Feb 24 21:09:27 2009 +From: Vikram Pandita <vikram.pandita@ti.com> +Date: Sat, 21 Feb 2009 15:31:44 -0800 +Subject: USB: musb: fix srp sysfs entry deletion +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, "Pandita, Vikram" <vikram.pandita@ti.com> +Message-ID: <200902211531.44907.david-b@pacbell.net> + + +From: Vikram Pandita <vikram.pandita@ti.com> + +The SRP sysfs attribute is dependent on gadget mode; any +gadget may support SRP. But "rmmod musb_hdrc" didn't +remove that attribute; fix. + +Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> +Acked-by: Felipe Balbi <me@felipebalbi.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -1816,7 +1816,7 @@ static void musb_free(struct musb *musb) + #ifdef CONFIG_SYSFS + device_remove_file(musb->controller, &dev_attr_mode); + device_remove_file(musb->controller, &dev_attr_vbus); +-#ifdef CONFIG_USB_MUSB_OTG ++#ifdef CONFIG_USB_GADGET_MUSB_HDRC + device_remove_file(musb->controller, &dev_attr_srp); + #endif + #endif +@@ -2064,7 +2064,7 @@ fail2: + #ifdef CONFIG_SYSFS + device_remove_file(musb->controller, &dev_attr_mode); + device_remove_file(musb->controller, &dev_attr_vbus); +-#ifdef CONFIG_USB_MUSB_OTG ++#ifdef CONFIG_USB_GADGET_MUSB_HDRC + device_remove_file(musb->controller, &dev_attr_srp); + #endif + #endif diff --git a/usb.current/usb-musb-fix-urb_dequeue-method.patch b/usb.current/usb-musb-fix-urb_dequeue-method.patch new file mode 100644 index 00000000000000..ddd7419e3be7ad --- /dev/null +++ b/usb.current/usb-musb-fix-urb_dequeue-method.patch @@ -0,0 +1,75 @@ +From david-b@pacbell.net Tue Feb 24 21:06:55 2009 +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:30:45 -0800 +Subject: USB: musb: fix urb_dequeue() method +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Sergei Shtylyov <sshtylyov@ru.mvista.com> +Message-ID: <200902211530.45704.david-b@pacbell.net> +Content-Disposition: inline + + +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> + +The urb_dequeue() method forgets to unlink 'struct musb_qh' from the +control or bulk schedules when the URB being cancelled is the only +one queued to its endpoint. That will cause musb_advance_schedule() +to block once it reaches 'struct musb_qh' with now empty URB list, so +URBs queued for other endpoints after the one being dequeued will not +be served. + +Fix by unlinking the QH from the list except when it's already being +handled (typically by musb_giveback). Since a QH with an empty URB +list is now supposed to be freed, do that. And remove a now-useless +check from musb_advance_schedule(). + +[ dbrownell@users.sourceforge.net: update patch description, + and fold in a dequeue() comment patch ] + +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Felipe Balbi <felipe.balbi@nokia.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -432,7 +432,7 @@ musb_advance_schedule(struct musb *musb, + else + qh = musb_giveback(qh, urb, urb->status); + +- if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) { ++ if (qh != NULL && qh->is_ready) { + DBG(4, "... next ep%d %cX urb %p\n", + hw_ep->epnum, is_in ? 'R' : 'T', + next_urb(qh)); +@@ -2038,9 +2038,9 @@ static int musb_urb_dequeue(struct usb_h + goto done; + + /* Any URB not actively programmed into endpoint hardware can be +- * immediately given back. Such an URB must be at the head of its ++ * immediately given back; that's any URB not at the head of an + * endpoint queue, unless someday we get real DMA queues. And even +- * then, it might not be known to the hardware... ++ * if it's at the head, it might not be known to the hardware... + * + * Otherwise abort current transfer, pending dma, etc.; urb->status + * has already been updated. This is a synchronous abort; it'd be +@@ -2079,6 +2079,15 @@ static int musb_urb_dequeue(struct usb_h + qh->is_ready = 0; + __musb_giveback(musb, urb, 0); + qh->is_ready = ready; ++ ++ /* If nothing else (usually musb_giveback) is using it ++ * and its URB list has emptied, recycle this qh. ++ */ ++ if (ready && list_empty(&qh->hep->urb_list)) { ++ qh->hep->hcpriv = NULL; ++ list_del(&qh->ring); ++ kfree(qh); ++ } + } else + ret = musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); + done: diff --git a/usb.current/usb-musb-host-endpoint_disable-oops-fixes.patch b/usb.current/usb-musb-host-endpoint_disable-oops-fixes.patch new file mode 100644 index 00000000000000..0eb20519bb362e --- /dev/null +++ b/usb.current/usb-musb-host-endpoint_disable-oops-fixes.patch @@ -0,0 +1,93 @@ +From david-b@pacbell.net Tue Feb 24 21:07:26 2009 +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:31:01 -0800 +Subject: USB: musb: host endpoint_disable() oops fixes +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Sergei Shtylyov <sshtylyov@ru.mvista.com> +Message-ID: <200902211531.01389.david-b@pacbell.net> +Content-Disposition: inline + + +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> + +The musb_h_disable() routine can oops in some cases: + + - It's not safe to read hep->hcpriv outside musb->lock, + since it gets changed on completion IRQ paths. + + - The list iterators aren't safe to use in that way; + just remove the first element while !list_empty(), + so deletions on other code paths can't make trouble. + +We need two "scrub the list" loops because only one branch +should touch hardware and advance the schedule. + +[ dbrownell@users.sourceforge.net: massively simplify + patch description; add key points as code comments ] + +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 36 ++++++++++++++++++++++++++---------- + 1 file changed, 26 insertions(+), 10 deletions(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -2103,15 +2103,16 @@ musb_h_disable(struct usb_hcd *hcd, stru + unsigned long flags; + struct musb *musb = hcd_to_musb(hcd); + u8 is_in = epnum & USB_DIR_IN; +- struct musb_qh *qh = hep->hcpriv; +- struct urb *urb, *tmp; ++ struct musb_qh *qh; ++ struct urb *urb; + struct list_head *sched; + +- if (!qh) +- return; +- + spin_lock_irqsave(&musb->lock, flags); + ++ qh = hep->hcpriv; ++ if (qh == NULL) ++ goto exit; ++ + switch (qh->type) { + case USB_ENDPOINT_XFER_CONTROL: + sched = &musb->control; +@@ -2145,13 +2146,28 @@ musb_h_disable(struct usb_hcd *hcd, stru + + /* cleanup */ + musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); +- } else +- urb = NULL; + +- /* then just nuke all the others */ +- list_for_each_entry_safe_from(urb, tmp, &hep->urb_list, urb_list) +- musb_giveback(qh, urb, -ESHUTDOWN); ++ /* Then nuke all the others ... and advance the ++ * queue on hw_ep (e.g. bulk ring) when we're done. ++ */ ++ while (!list_empty(&hep->urb_list)) { ++ urb = next_urb(qh); ++ urb->status = -ESHUTDOWN; ++ musb_advance_schedule(musb, urb, qh->hw_ep, is_in); ++ } ++ } else { ++ /* Just empty the queue; the hardware is busy with ++ * other transfers, and since !qh->is_ready nothing ++ * will activate any of these as it advances. ++ */ ++ while (!list_empty(&hep->urb_list)) ++ __musb_giveback(musb, next_urb(qh), -ESHUTDOWN); + ++ hep->hcpriv = NULL; ++ list_del(&qh->ring); ++ kfree(qh); ++ } ++exit: + spin_unlock_irqrestore(&musb->lock, flags); + } + diff --git a/usb.current/usb-musb-make-davinci-work-in-mainline.patch b/usb.current/usb-musb-make-davinci-work-in-mainline.patch new file mode 100644 index 00000000000000..f5025e57bdf2ed --- /dev/null +++ b/usb.current/usb-musb-make-davinci-work-in-mainline.patch @@ -0,0 +1,144 @@ +From david-b@pacbell.net Tue Feb 24 21:03:58 2009 +From: David Brownell <david-b@pacbell.net> +Date: Fri, 20 Feb 2009 13:45:17 -0800 +Subject: usb: musb: make Davinci *work* in mainline +To: Greg KH <greg@kroah.com>, linux-usb@vger.kernel.org +Cc: DaVinci <davinci-linux-open-source@linux.davincidsp.com> +Message-ID: <200902201345.17183.david-b@pacbell.net> +Content-Disposition: inline + + +From: David Brownell <dbrownell@users.sourceforge.net> + +Now that the musb build fixes for DaVinci got merged (RC3?), kick in +the other bits needed to get it finally *working* in mainline: + + - Use clk_enable()/clk_disable() ... the "always enable USB clocks" + code this originally relied on has since been removed. + + - Initialize the USB device only after the relevant I2C GPIOs are + available, so the host side can properly enable VBUS. + + - Tweak init sequencing to cope with mainline's relatively late init + of the I2C system bus for power switches, transceivers, and so on. + +Sanity tested on DM6664 EVM for host and peripheral modes; that system +won't boot with CONFIG_PM enabled, so OTG can't yet be tested. Also +verified on OMAP3. + +(Unrelated: correct the MODULE_PARM_DESC spelling of musb_debug.) + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Felipe Balbi <me@felipebalbi.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + arch/arm/mach-davinci/board-evm.c | 6 +++--- + arch/arm/mach-davinci/clock.c | 5 +++++ + arch/arm/mach-davinci/usb.c | 1 + + drivers/usb/musb/davinci.c | 15 ++++----------- + drivers/usb/musb/musb_core.c | 8 ++++---- + 5 files changed, 17 insertions(+), 18 deletions(-) + +--- a/arch/arm/mach-davinci/board-evm.c ++++ b/arch/arm/mach-davinci/board-evm.c +@@ -311,6 +311,9 @@ evm_u35_setup(struct i2c_client *client, + gpio_request(gpio + 7, "nCF_SEL"); + gpio_direction_output(gpio + 7, 1); + ++ /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ ++ setup_usb(500, 8); ++ + return 0; + } + +@@ -417,9 +420,6 @@ static __init void davinci_evm_init(void + platform_add_devices(davinci_evm_devices, + ARRAY_SIZE(davinci_evm_devices)); + evm_init_i2c(); +- +- /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ +- setup_usb(500, 8); + } + + static __init void davinci_evm_irq_init(void) +--- a/arch/arm/mach-davinci/clock.c ++++ b/arch/arm/mach-davinci/clock.c +@@ -231,6 +231,11 @@ static struct clk davinci_clks[] = { + .lpsc = DAVINCI_LPSC_GPIO, + }, + { ++ .name = "usb", ++ .rate = &commonrate, ++ .lpsc = DAVINCI_LPSC_USB, ++ }, ++ { + .name = "AEMIFCLK", + .rate = &commonrate, + .lpsc = DAVINCI_LPSC_AEMIF, +--- a/arch/arm/mach-davinci/usb.c ++++ b/arch/arm/mach-davinci/usb.c +@@ -47,6 +47,7 @@ static struct musb_hdrc_platform_data us + #elif defined(CONFIG_USB_MUSB_HOST) + .mode = MUSB_HOST, + #endif ++ .clock = "usb", + .config = &musb_config, + }; + +--- a/drivers/usb/musb/davinci.c ++++ b/drivers/usb/musb/davinci.c +@@ -377,18 +377,8 @@ int __init musb_platform_init(struct mus + u32 revision; + + musb->mregs += DAVINCI_BASE_OFFSET; +-#if 0 +- /* REVISIT there's something odd about clocking, this +- * didn't appear do the job ... +- */ +- musb->clock = clk_get(pDevice, "usb"); +- if (IS_ERR(musb->clock)) +- return PTR_ERR(musb->clock); + +- status = clk_enable(musb->clock); +- if (status < 0) +- return -ENODEV; +-#endif ++ clk_enable(musb->clock); + + /* returns zero if e.g. not clocked */ + revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG); +@@ -453,5 +443,8 @@ int musb_platform_exit(struct musb *musb + } + + phy_off(); ++ ++ clk_disable(musb->clock); ++ + return 0; + } +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -115,7 +115,7 @@ + + + unsigned musb_debug; +-module_param(musb_debug, uint, S_IRUGO | S_IWUSR); ++module_param_named(debug, musb_debug, uint, S_IRUGO | S_IWUSR); + MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); + + #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" +@@ -2243,10 +2243,10 @@ static int __init musb_init(void) + return platform_driver_probe(&musb_driver, musb_probe); + } + +-/* make us init after usbcore and before usb +- * gadget and host-side drivers start to register ++/* make us init after usbcore and i2c (transceivers, regulators, etc) ++ * and before usb gadget and host-side drivers start to register + */ +-subsys_initcall(musb_init); ++fs_initcall(musb_init); + + static void __exit musb_cleanup(void) + { diff --git a/usb.current/usb-musb-resume-suspended-root-hub-on-disconnect.patch b/usb.current/usb-musb-resume-suspended-root-hub-on-disconnect.patch new file mode 100644 index 00000000000000..47a734aa362e40 --- /dev/null +++ b/usb.current/usb-musb-resume-suspended-root-hub-on-disconnect.patch @@ -0,0 +1,38 @@ +From david-b@pacbell.net Tue Feb 24 21:09:07 2009 +From: Anand Gadiyar <gadiyar@ti.com> +Date: Sat, 21 Feb 2009 15:31:40 -0800 +Subject: USB: musb: resume suspended root hub on disconnect +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Anand Gadiyar <gadiyar@ti.com> +Message-ID: <200902211531.40766.david-b@pacbell.net> +Content-Disposition: inline + + +From: Anand Gadiyar <gadiyar@ti.com> + +If this is not done, khubd will not be informed of the disconnect +and will assume the device is still there. + +Easily seen when a hub is connected with no device attached to it; +it will autosuspend. When the hub is disconnected, it still shows +up in /proc/bus/usb/devices + +Signed-off-by: Anand Gadiyar <gadiyar@ti.com> +Acked-by: Felipe Balbi <felipe.balbi@nokia.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -767,6 +767,7 @@ static irqreturn_t musb_stage2_irq(struc + #ifdef CONFIG_USB_MUSB_HDRC_HCD + case OTG_STATE_A_HOST: + case OTG_STATE_A_SUSPEND: ++ usb_hcd_resume_root_hub(musb_to_hcd(musb)); + musb_root_disconnect(musb); + if (musb->a_wait_bcon != 0) + musb_platform_try_idle(musb, jiffies diff --git a/usb.current/usb-musb-use-right-poll-limit-for-low-speed-devices.patch b/usb.current/usb-musb-use-right-poll-limit-for-low-speed-devices.patch new file mode 100644 index 00000000000000..c12bd48a5c55fa --- /dev/null +++ b/usb.current/usb-musb-use-right-poll-limit-for-low-speed-devices.patch @@ -0,0 +1,56 @@ +From david-b@pacbell.net Tue Feb 24 21:08:49 2009 +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Date: Sat, 21 Feb 2009 15:31:35 -0800 +Subject: USB: musb: use right poll limit for low speed devices +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Sergei Shtylyov <sshtylyov@ru.mvista.com> +Message-ID: <200902211531.35324.david-b@pacbell.net> +Content-Disposition: inline + + +From: Sergei Shtylyov <sshtylyov@ru.mvista.com> + +Remove wrongly applied upper limit on the interrupt transfer +interval for low speed devices (not much of an error per se, +according to USB specs). + +Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/musb/musb_host.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +--- a/drivers/usb/musb/musb_host.c ++++ b/drivers/usb/musb/musb_host.c +@@ -1863,19 +1863,21 @@ static int musb_urb_enqueue( + } + qh->type_reg = type_reg; + +- /* precompute rxinterval/txinterval register */ +- interval = min((u8)16, epd->bInterval); /* log encoding */ ++ /* Precompute RXINTERVAL/TXINTERVAL register */ + switch (qh->type) { + case USB_ENDPOINT_XFER_INT: +- /* fullspeed uses linear encoding */ +- if (USB_SPEED_FULL == urb->dev->speed) { +- interval = epd->bInterval; +- if (!interval) +- interval = 1; ++ /* ++ * Full/low speeds use the linear encoding, ++ * high speed uses the logarithmic encoding. ++ */ ++ if (urb->dev->speed <= USB_SPEED_FULL) { ++ interval = max_t(u8, epd->bInterval, 1); ++ break; + } + /* FALLTHROUGH */ + case USB_ENDPOINT_XFER_ISOC: +- /* iso always uses log encoding */ ++ /* ISO always uses logarithmic encoding */ ++ interval = min_t(u8, epd->bInterval, 16); + break; + default: + /* REVISIT we actually want to use NAK limits, hinting to the diff --git a/usb.current/usb-serial-add-support-for-second-revision-of-ericsson-f3507g-wwan-card.patch b/usb.current/usb-serial-add-support-for-second-revision-of-ericsson-f3507g-wwan-card.patch new file mode 100644 index 00000000000000..1acacebeb015ca --- /dev/null +++ b/usb.current/usb-serial-add-support-for-second-revision-of-ericsson-f3507g-wwan-card.patch @@ -0,0 +1,42 @@ +From akpm@linux-foundation.org Tue Feb 24 21:13:38 2009 +From: Patrik Kullman <patrik@yes.nu> +Date: Tue, 24 Feb 2009 13:38:53 -0800 +Subject: USB: serial: add support for second revision of Ericsson F3507G WWAN card +To: mm-commits@vger.kernel.org +Cc: patrik@yes.nu, greg@kroah.com +Message-ID: <200902242138.n1OLcr0l013079@imap1.linux-foundation.org> + +From: Patrik Kullman <patrik@yes.nu> + +I noticed that my revision of the F3507G WWAN card isn't listed in +drivers/usb/serial/option.c + +Signed-off-by: Andrew Morton <akpm@linux-foundation.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/option.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -294,7 +294,8 @@ static int option_send_setup(struct tty + + /* Ericsson products */ + #define ERICSSON_VENDOR_ID 0x0bdb +-#define ERICSSON_PRODUCT_F3507G 0x1900 ++#define ERICSSON_PRODUCT_F3507G_1 0x1900 ++#define ERICSSON_PRODUCT_F3507G_2 0x1902 + + #define BENQ_VENDOR_ID 0x04a5 + #define BENQ_PRODUCT_H10 0x4068 +@@ -512,7 +513,8 @@ static struct usb_device_id option_ids[] + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, + { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, +- { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) }, ++ { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_1) }, ++ { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_2) }, + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, + { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ + { } /* Terminating entry */ diff --git a/usb/usb-asix-new-device-ids.patch b/usb/usb-asix-new-device-ids.patch new file mode 100644 index 00000000000000..c8d35de1d5e67e --- /dev/null +++ b/usb/usb-asix-new-device-ids.patch @@ -0,0 +1,39 @@ +From foo@baz Mon Feb 23 15:51:16 PST 2009 +Date: Mon, 23 Feb 2009 15:51:16 -0800 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: asix: new device ids + +From: Greg Kroah-Hartman <gregkh@suse.de> + +This patch adds two new device ids to the asix driver. + +One comes directly from the asix driver on their web site, the other was +reported by Armani Liao as needed for the MSI X320 to get the driver to +work properly for it. + +Reported-by: Armani Liao <aliao@novell.com> +Cc: stable <stable@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/net/usb/asix.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/drivers/net/usb/asix.c ++++ b/drivers/net/usb/asix.c +@@ -1451,6 +1451,14 @@ static const struct usb_device_id produc + // Cables-to-Go USB Ethernet Adapter + USB_DEVICE(0x0b95, 0x772a), + .driver_info = (unsigned long) &ax88772_info, ++}, { ++ // ABOCOM for pci ++ USB_DEVICE(0x14ea, 0xab11), ++ .driver_info = (unsigned long) &ax88178_info, ++}, { ++ // ASIX 88772a ++ USB_DEVICE(0x0db0, 0xa877), ++ .driver_info = (unsigned long) &ax88772_info, + }, + { }, // END + }; diff --git a/usb/usb-suspend-resume-support-for-option-driver.patch b/usb/usb-suspend-resume-support-for-option-driver.patch index 11a2074bcb07f9..a262d03fd73c5e 100644 --- a/usb/usb-suspend-resume-support-for-option-driver.patch +++ b/usb/usb-suspend-resume-support-for-option-driver.patch @@ -33,7 +33,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* Vendor and product IDs */ #define OPTION_VENDOR_ID 0x0AF0 -@@ -523,6 +525,8 @@ static struct usb_driver option_driver = +@@ -525,6 +527,8 @@ static struct usb_driver option_driver = .name = "option", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, @@ -42,7 +42,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> .id_table = option_ids, .no_dynamic_id = 1, }; -@@ -551,6 +555,8 @@ static struct usb_serial_driver option_1 +@@ -553,6 +557,8 @@ static struct usb_serial_driver option_1 .attach = option_startup, .shutdown = option_shutdown, .read_int_callback = option_instat_callback, @@ -51,7 +51,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> }; static int debug; -@@ -821,10 +827,10 @@ static void option_instat_callback(struc +@@ -823,10 +829,10 @@ static void option_instat_callback(struc req_pkt->bRequestType, req_pkt->bRequest); } } else @@ -64,7 +64,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> urb->dev = serial->dev; err = usb_submit_urb(urb, GFP_ATOMIC); if (err) -@@ -843,7 +849,6 @@ static int option_write_room(struct tty_ +@@ -845,7 +851,6 @@ static int option_write_room(struct tty_ portdata = usb_get_serial_port_data(port); @@ -72,7 +72,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> for (i = 0; i < N_OUT_URB; i++) { this_urb = portdata->out_urbs[i]; if (this_urb && !test_bit(i, &portdata->out_busy)) -@@ -1105,14 +1110,12 @@ bail_out_error: +@@ -1107,14 +1112,12 @@ bail_out_error: return 1; } @@ -88,7 +88,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* Stop reading/writing urbs */ for (i = 0; i < serial->num_ports; ++i) { port = serial->port[i]; -@@ -1122,6 +1125,17 @@ static void option_shutdown(struct usb_s +@@ -1124,6 +1127,17 @@ static void option_shutdown(struct usb_s for (j = 0; j < N_OUT_URB; j++) usb_kill_urb(portdata->out_urbs[j]); } @@ -106,7 +106,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* Now free them */ for (i = 0; i < serial->num_ports; ++i) { -@@ -1152,6 +1166,66 @@ static void option_shutdown(struct usb_s +@@ -1154,6 +1168,66 @@ static void option_shutdown(struct usb_s } } @@ -1 +1 @@ -2.6.29-rc5 +2.6.29-rc6 |