diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 10:43:03 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 10:43:03 -0800 |
| commit | 8fc479a8258f7be5aa4bb7036c8752bfd8743874 (patch) | |
| tree | 8f016cda03a726ce4619dff39e98200accc4f75c | |
| parent | f66cb622b9a7c33b7326ae775a3d5f57ebdf7686 (diff) | |
| download | patches-8fc479a8258f7be5aa4bb7036c8752bfd8743874.tar.gz | |
2.6.24-git10 resync and coding style issues for usb added
19 files changed, 4877 insertions, 53 deletions
diff --git a/driver/sysfs-crash-debugging.patch b/driver/sysfs-crash-debugging.patch index ae74a878b41526..a1050f1dfc5b79 100644 --- a/driver/sysfs-crash-debugging.patch +++ b/driver/sysfs-crash-debugging.patch @@ -27,24 +27,24 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c -@@ -400,6 +400,7 @@ void die(const char * str, struct pt_reg +@@ -394,6 +394,7 @@ int __kprobes __die(const char * str, st #endif - printk("\n"); + printk("\n"); -+ sysfs_printk_last_file(); - if (notify_die(DIE_OOPS, str, regs, err, - current->thread.trap_no, SIGSEGV) != - NOTIFY_STOP) { ++ sysfs_printk_last_file(); + if (notify_die(DIE_OOPS, str, regs, err, + current->thread.trap_no, SIGSEGV) != + NOTIFY_STOP) { --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c -@@ -524,6 +524,7 @@ void __kprobes __die(const char * str, s +@@ -573,6 +573,7 @@ int __kprobes __die(const char * str, st printk("DEBUG_PAGEALLOC"); #endif printk("\n"); + sysfs_printk_last_file(); - notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); + if (notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) + return 1; show_registers(regs); - add_taint(TAINT_DIE); --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -16,10 +16,18 @@ diff --git a/driver/warn-when-statically-allocated-kobjects-are-used.patch b/driver/warn-when-statically-allocated-kobjects-are-used.patch index 14f39cfc317d51..a40262d4c9e4e0 100644 --- a/driver/warn-when-statically-allocated-kobjects-are-used.patch +++ b/driver/warn-when-statically-allocated-kobjects-are-used.patch @@ -47,7 +47,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> void setup_arch(char **); --- a/init/main.c +++ b/init/main.c -@@ -762,12 +762,21 @@ static void run_init_process(char *init_ +@@ -767,12 +767,21 @@ static void run_init_process(char *init_ kernel_execve(init_filename, argv_init, envp_init); } diff --git a/gregkh/sysfs-test.patch b/gregkh/sysfs-test.patch index f152c52d760816..a894861c0b832a 100644 --- a/gregkh/sysfs-test.patch +++ b/gregkh/sysfs-test.patch @@ -16,7 +16,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/drivers/Makefile +++ b/drivers/Makefile -@@ -91,3 +91,5 @@ obj-$(CONFIG_PPC_PS3) += ps3/ +@@ -90,3 +90,5 @@ obj-$(CONFIG_PPC_PS3) += ps3/ obj-$(CONFIG_OF) += of/ obj-$(CONFIG_SSB) += ssb/ obj-$(CONFIG_VIRTIO) += virtio/ diff --git a/pci/pci-kconfig-help-don-t-refer-to-the-pci-howto.patch b/pci/pci-kconfig-help-don-t-refer-to-the-pci-howto.patch index d16132fb557cb6..30f9065c0f5e78 100644 --- a/pci/pci-kconfig-help-don-t-refer-to-the-pci-howto.patch +++ b/pci/pci-kconfig-help-don-t-refer-to-the-pci-howto.patch @@ -44,7 +44,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> default y --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -572,11 +572,6 @@ config PCI +@@ -577,11 +577,6 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. @@ -72,7 +72,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> depends on PCI && !MMU --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig -@@ -354,11 +354,6 @@ config PCI +@@ -359,11 +359,6 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. @@ -100,7 +100,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> depends on !MMU_SUN3 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1956,11 +1956,6 @@ config PCI +@@ -1961,11 +1961,6 @@ config PCI your box. Other bus systems are ISA, EISA, or VESA. If you have PCI, say Y, otherwise N. @@ -128,7 +128,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> depends on PCI --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig -@@ -343,11 +343,6 @@ config PCI +@@ -351,11 +351,6 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. @@ -142,7 +142,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig -@@ -1379,11 +1379,6 @@ config PCI +@@ -1366,11 +1366,6 @@ config PCI your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or VESA. If you have PCI, say Y, otherwise N. diff --git a/pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch b/pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch index dc2f9dd4aba970..2bb9045461af52 100644 --- a/pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch +++ b/pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch @@ -51,13 +51,13 @@ Signed-off-by: Gary Hade <garyhade@us.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- - arch/x86/pci/common.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) + arch/x86/pci/common.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c -@@ -109,6 +109,19 @@ static void __devinit pcibios_fixup_ghos - } +@@ -122,6 +122,19 @@ static void __devinit pcibios_fixup_devi + rom_r->start = rom_r->end = rom_r->flags = 0; } +static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) @@ -76,16 +76,3 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* * Called after each bus is probed, but before its children * are examined. -@@ -116,8 +129,12 @@ static void __devinit pcibios_fixup_ghos - - void __devinit pcibios_fixup_bus(struct pci_bus *b) - { -+ struct pci_dev *dev; -+ - pcibios_fixup_ghosts(b); - pci_read_bridge_bases(b); -+ list_for_each_entry(dev, &b->devices, bus_list) -+ pcibios_fixup_device_resources(dev); - } - - /* diff --git a/pci/pci-remove-users-of-pci_enable_device_bars.patch b/pci/pci-remove-users-of-pci_enable_device_bars.patch index a020b90fdb4744..a18d26d8a13096 100644 --- a/pci/pci-remove-users-of-pci_enable_device_bars.patch +++ b/pci/pci-remove-users-of-pci_enable_device_bars.patch @@ -118,7 +118,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #define MIN_IOBASE_LEN 0x100 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -1566,7 +1566,7 @@ qla2x00_probe_one(struct pci_dev *pdev, +@@ -1564,7 +1564,7 @@ qla2x00_probe_one(struct pci_dev *pdev, char pci_info[30]; char fw_str[30]; struct scsi_host_template *sht; @@ -127,7 +127,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO); sht = &qla2x00_driver_template; -@@ -1577,10 +1577,16 @@ qla2x00_probe_one(struct pci_dev *pdev, +@@ -1575,10 +1575,16 @@ qla2x00_probe_one(struct pci_dev *pdev, pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532) { bars = pci_select_bars(pdev, IORESOURCE_MEM); sht = &qla24xx_driver_template; @@ -146,7 +146,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> if (pci_find_aer_capability(pdev)) if (pci_enable_pcie_error_reporting(pdev)) -@@ -1603,6 +1609,7 @@ qla2x00_probe_one(struct pci_dev *pdev, +@@ -1601,6 +1607,7 @@ qla2x00_probe_one(struct pci_dev *pdev, sprintf(ha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, ha->host_no); ha->parent = NULL; ha->bars = bars; @@ -154,7 +154,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> /* Set ISP-type information. */ qla2x00_set_isp_flags(ha); -@@ -2877,8 +2884,14 @@ qla2xxx_pci_slot_reset(struct pci_dev *p +@@ -2875,8 +2882,14 @@ qla2xxx_pci_slot_reset(struct pci_dev *p { pci_ers_result_t ret = PCI_ERS_RESULT_DISCONNECT; scsi_qla_host_t *ha = pci_get_drvdata(pdev); diff --git a/pci/pci-use-dev_printk-in-x86-quirk-messages.patch b/pci/pci-use-dev_printk-in-x86-quirk-messages.patch index 83bffca02dd65b..53aa44cdbf6430 100644 --- a/pci/pci-use-dev_printk-in-x86-quirk-messages.patch +++ b/pci/pci-use-dev_printk-in-x86-quirk-messages.patch @@ -83,7 +83,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } } -@@ -206,8 +209,8 @@ static void old_ich_force_enable_hpet(st +@@ -208,8 +211,8 @@ static void old_ich_force_enable_hpet(st if (val & 0x4) { val &= 0x3; force_hpet_address = 0xFED00000 | (val << 12); @@ -94,7 +94,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return; } -@@ -227,14 +230,14 @@ static void old_ich_force_enable_hpet(st +@@ -229,14 +232,14 @@ static void old_ich_force_enable_hpet(st /* HPET is enabled in HPTC. Just not reported by BIOS */ val &= 0x3; force_hpet_address = 0xFED00000 | (val << 12); @@ -112,7 +112,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } /* -@@ -292,8 +295,8 @@ static void vt8237_force_enable_hpet(str +@@ -294,8 +297,8 @@ static void vt8237_force_enable_hpet(str */ if (val & 0x80) { force_hpet_address = (val & ~0x3ff); @@ -123,7 +123,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return; } -@@ -307,14 +310,14 @@ static void vt8237_force_enable_hpet(str +@@ -309,14 +312,14 @@ static void vt8237_force_enable_hpet(str pci_read_config_dword(dev, 0x68, &val); if (val & 0x80) { force_hpet_address = (val & ~0x3ff); @@ -141,7 +141,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, -@@ -342,7 +345,7 @@ static void nvidia_force_enable_hpet(str +@@ -344,7 +347,7 @@ static void nvidia_force_enable_hpet(str pci_read_config_dword(dev, 0x44, &val); force_hpet_address = val & 0xfffffffe; force_hpet_resume_type = NVIDIA_FORCE_HPET_RESUME; @@ -159,7 +159,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - printk(KERN_WARNING "PCI: Searching for i450NX host bridges on %s\n", pci_name(d)); + dev_warn(&d->dev, "Searching for i450NX host bridges\n"); reg = 0xd0; - for(pxb=0; pxb<2; pxb++) { + for(pxb = 0; pxb < 2; pxb++) { pci_read_config_byte(d, reg++, &busno); @@ -41,7 +41,7 @@ static void __devinit pci_fixup_i450gx(s */ @@ -176,7 +176,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - printk(KERN_WARNING "PCI: Fixing base address flags for device %s\n", pci_name(d)); + dev_warn(&d->dev, "Fixing base address flags\n"); - for(i=0; i<4; i++) + for(i = 0; i < 4; i++) d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO; } @@ -68,7 +68,7 @@ static void __devinit pci_fixup_ncr53c8 diff --git a/pending/f1.patch b/pending/f1.patch new file mode 100644 index 00000000000000..00c882dcf223fa --- /dev/null +++ b/pending/f1.patch @@ -0,0 +1,66 @@ +--- + drivers/net/ehea/ehea_main.c | 37 ------------------------------------- + 1 file changed, 37 deletions(-) + +--- a/drivers/net/ehea/ehea_main.c ++++ b/drivers/net/ehea/ehea_main.c +@@ -2804,34 +2804,6 @@ static void __devinit logical_port_relea + of_node_put(port->ofdev.node); + } + +-static int ehea_driver_sysfs_add(struct device *dev, +- struct device_driver *driver) +-{ +- int ret; +- +- ret = sysfs_create_link(&driver->kobj, &dev->kobj, +- kobject_name(&dev->kobj)); +- if (ret == 0) { +- ret = sysfs_create_link(&dev->kobj, &driver->kobj, +- "driver"); +- if (ret) +- sysfs_remove_link(&driver->kobj, +- kobject_name(&dev->kobj)); +- } +- return ret; +-} +- +-static void ehea_driver_sysfs_remove(struct device *dev, +- struct device_driver *driver) +-{ +- struct device_driver *drv = driver; +- +- if (drv) { +- sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); +- sysfs_remove_link(&dev->kobj, "driver"); +- } +-} +- + static struct device *ehea_register_port(struct ehea_port *port, + struct device_node *dn) + { +@@ -2856,16 +2828,8 @@ static struct device *ehea_register_port + goto out_unreg_of_dev; + } + +- ret = ehea_driver_sysfs_add(&port->ofdev.dev, &ehea_driver.driver); +- if (ret) { +- ehea_error("failed to register sysfs driver link"); +- goto out_rem_dev_file; +- } +- + return &port->ofdev.dev; + +-out_rem_dev_file: +- device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); + out_unreg_of_dev: + of_device_unregister(&port->ofdev); + out: +@@ -2874,7 +2838,6 @@ out: + + static void ehea_unregister_port(struct ehea_port *port) + { +- ehea_driver_sysfs_remove(&port->ofdev.dev, &ehea_driver.driver); + device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); + of_device_unregister(&port->ofdev); + } @@ -7,11 +7,7 @@ gregkh/detect-atomic-counter-underflows.patch gregkh/gcc43-workaround.diff # driver patches queued for 2.6.24 -driver/driver-core-fix-up-build-when-config_block-n.patch -driver/x86-fix-runtime-error-in-arch-x86-kernel-cpu-mcheck-mce_amd_64.c.patch -driver/driver-core-add-bus_find_device_by_name-function.patch driver/net-convert-the-phy_device-file-to-use-bus_find_device_by_name.patch -driver/ppc-fix-powerpc-vio_find_name-to-not-use-devices_subsys.patch driver/nozomi-driver-update.patch driver/pm-export-device_pm_schedule_removal.patch @@ -64,7 +60,7 @@ pci/pci-hotplug-pciehp-use-generic-function-to-find-ext-capability.patch pci/pci-hotplug-pciehp-fix-some-whitespace-damage.patch pci/pci-fix-bus-resource-assignment-on-32-bits-with-64b-resources.patch pci/pci-fix-warning-in-setup-res.c-on-32-bit-platforms-with-64-bit-resources.patch -pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch +#pci/pci-remove-default-pci-expansion-rom-memory-allocation.patch pci/pci-quirk-enable-msi-mapping-on-ht1000.patch pci/pci-drivers-pci-msi.c-move-arch-hooks-to-the-top.patch pci/pci-kconfig-help-don-t-refer-to-the-pci-howto.patch @@ -222,6 +218,14 @@ usb/usb-fix-usb_serial_driver-structure-for-kobil-cardreader-driver.patch usb/usbfs_opts.patch usb/usb-use-a-real-vendor-and-product-id-for-root-hubs.patch usb/usb-mark-usb-drivers-as-being-gpl-only.patch +usb/usb-fix-codingstyle-issues-in-include-linux-usb.h.patch +usb/usb-fix-codingstyle-issues-in-include-linux-usb.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.h.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devices.c.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devio.c.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-hcd-pci.c.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-message.c.patch +usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.c.patch # my ols tutorial driver, never in mainline usb/usb-gotemp.patch @@ -234,3 +238,4 @@ usb/usb-gotemp.patch #pending/block-make-genhd-use-the-new-class-iterator-functions.patch #pending/class-move-driver-core-specific-parts-to-a-private-structure.patch + diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.c.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.c.patch new file mode 100644 index 00000000000000..410cd985ff3ece --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.c.patch @@ -0,0 +1,472 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/*.c + +Fixes a number of coding style issues in the remaining .c files in +drivers/usb/core/ + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/buffer.c | 11 +++++---- + drivers/usb/core/config.c | 14 +++++++----- + drivers/usb/core/driver.c | 30 ++++++++++++++------------- + drivers/usb/core/sysfs.c | 20 +++++++++--------- + drivers/usb/core/urb.c | 22 ++++++++++--------- + drivers/usb/core/usb.c | 51 +++++++++++++++++++--------------------------- + 6 files changed, 74 insertions(+), 74 deletions(-) + +--- a/drivers/usb/core/buffer.c ++++ b/drivers/usb/core/buffer.c +@@ -57,8 +57,9 @@ int hcd_buffer_create(struct usb_hcd *hc + !(hcd->driver->flags & HCD_LOCAL_MEM)) + return 0; + +- for (i = 0; i < HCD_BUFFER_POOLS; i++) { +- if (!(size = pool_max [i])) ++ for (i = 0; i < HCD_BUFFER_POOLS; i++) { ++ size = pool_max[i]; ++ if (!size) + continue; + snprintf(name, sizeof name, "buffer-%d", size); + hcd->pool[i] = dma_pool_create(name, hcd->self.controller, +@@ -81,10 +82,10 @@ int hcd_buffer_create(struct usb_hcd *hc + */ + void hcd_buffer_destroy(struct usb_hcd *hcd) + { +- int i; ++ int i; + +- for (i = 0; i < HCD_BUFFER_POOLS; i++) { +- struct dma_pool *pool = hcd->pool[i]; ++ for (i = 0; i < HCD_BUFFER_POOLS; i++) { ++ struct dma_pool *pool = hcd->pool[i]; + if (pool) { + dma_pool_destroy(pool); + hcd->pool[i] = NULL; +--- a/drivers/usb/core/config.c ++++ b/drivers/usb/core/config.c +@@ -238,7 +238,7 @@ static int usb_parse_interface(struct de + + /* Allocate space for the right(?) number of endpoints */ + num_ep = num_ep_orig = alt->desc.bNumEndpoints; +- alt->desc.bNumEndpoints = 0; // Use as a counter ++ alt->desc.bNumEndpoints = 0; /* Use as a counter */ + if (num_ep > USB_MAXENDPOINTS) { + dev_warn(ddev, "too many endpoints for config %d interface %d " + "altsetting %d: %d, using maximum allowed: %d\n", +@@ -246,7 +246,8 @@ static int usb_parse_interface(struct de + num_ep = USB_MAXENDPOINTS; + } + +- if (num_ep > 0) { /* Can't allocate 0 bytes */ ++ if (num_ep > 0) { ++ /* Can't allocate 0 bytes */ + len = sizeof(struct usb_host_endpoint) * num_ep; + alt->endpoint = kzalloc(len, GFP_KERNEL); + if (!alt->endpoint) +@@ -475,8 +476,9 @@ static int usb_parse_configuration(struc + return 0; + } + +-// hub-only!! ... and only exported for reset/reinit path. +-// otherwise used internally on disconnect/destroy path ++/* hub-only!! ... and only exported for reset/reinit path. ++ * otherwise used internally on disconnect/destroy path ++ */ + void usb_destroy_configuration(struct usb_device *dev) + { + int c, i; +@@ -498,7 +500,7 @@ void usb_destroy_configuration(struct us + kfree(cf->string); + for (i = 0; i < cf->desc.bNumInterfaces; i++) { + if (cf->intf_cache[i]) +- kref_put(&cf->intf_cache[i]->ref, ++ kref_put(&cf->intf_cache[i]->ref, + usb_release_interface_cache); + } + } +@@ -525,7 +527,7 @@ int usb_get_configuration(struct usb_dev + unsigned int cfgno, length; + unsigned char *buffer; + unsigned char *bigbuffer; +- struct usb_config_descriptor *desc; ++ struct usb_config_descriptor *desc; + + cfgno = 0; + if (dev->authorized == 0) /* Not really an error */ +--- a/drivers/usb/core/driver.c ++++ b/drivers/usb/core/driver.c +@@ -202,10 +202,10 @@ static int usb_probe_interface(struct de + intf = to_usb_interface(dev); + udev = interface_to_usbdev(intf); + +- if (udev->authorized == 0) { +- dev_err(&intf->dev, "Device is not authorized for usage\n"); +- return -ENODEV; +- } ++ if (udev->authorized == 0) { ++ dev_err(&intf->dev, "Device is not authorized for usage\n"); ++ return -ENODEV; ++ } + + id = usb_match_id(intf, driver->id_table); + if (!id) +@@ -299,7 +299,7 @@ static int usb_unbind_interface(struct d + * lock. + */ + int usb_driver_claim_interface(struct usb_driver *driver, +- struct usb_interface *iface, void* priv) ++ struct usb_interface *iface, void *priv) + { + struct device *dev = &iface->dev; + struct usb_device *udev = interface_to_usbdev(iface); +@@ -398,7 +398,7 @@ int usb_match_device(struct usb_device * + return 0; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && +- (id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass)) ++ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) + return 0; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && +@@ -586,7 +586,7 @@ static int usb_uevent(struct device *dev + struct usb_device *usb_dev; + + /* driver is often null here; dev_dbg() would oops */ +- pr_debug ("usb %s: uevent\n", dev->bus_id); ++ pr_debug("usb %s: uevent\n", dev->bus_id); + + if (is_usb_device(dev)) + usb_dev = to_usb_device(dev); +@@ -596,11 +596,11 @@ static int usb_uevent(struct device *dev + } + + if (usb_dev->devnum < 0) { +- pr_debug ("usb %s: already deleted?\n", dev->bus_id); ++ pr_debug("usb %s: already deleted?\n", dev->bus_id); + return -ENODEV; + } + if (!usb_dev->bus) { +- pr_debug ("usb %s: bus removed?\n", dev->bus_id); ++ pr_debug("usb %s: bus removed?\n", dev->bus_id); + return -ENODEV; + } + +@@ -854,8 +854,10 @@ static int usb_suspend_interface(struct + dev_err(&intf->dev, "%s error %d\n", + "suspend", status); + } else { +- // FIXME else if there's no suspend method, disconnect... +- // Not possible if auto_pm is set... ++ /* ++ * FIXME else if there's no suspend method, disconnect... ++ * Not possible if auto_pm is set... ++ */ + dev_warn(&intf->dev, "no suspend for driver %s?\n", + driver->name); + mark_quiesced(intf); +@@ -894,7 +896,7 @@ static int usb_resume_interface(struct u + dev_err(&intf->dev, "%s error %d\n", + "reset_resume", status); + } else { +- // status = -EOPNOTSUPP; ++ /* status = -EOPNOTSUPP; */ + dev_warn(&intf->dev, "no %s for driver %s?\n", + "reset_resume", driver->name); + } +@@ -905,7 +907,7 @@ static int usb_resume_interface(struct u + dev_err(&intf->dev, "%s error %d\n", + "resume", status); + } else { +- // status = -EOPNOTSUPP; ++ /* status = -EOPNOTSUPP; */ + dev_warn(&intf->dev, "no %s for driver %s?\n", + "resume", driver->name); + } +@@ -1175,7 +1177,7 @@ static int usb_resume_both(struct usb_de + * so if a root hub's controller is suspended + * then we're stuck. */ + status = usb_resume_device(udev); +- } ++ } + } else { + + /* Needed for setting udev->dev.power.power_state.event, +--- a/drivers/usb/core/sysfs.c ++++ b/drivers/usb/core/sysfs.c +@@ -72,7 +72,7 @@ set_bConfigurationValue(struct device *d + return (value < 0) ? value : count; + } + +-static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, ++static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, + show_bConfigurationValue, set_bConfigurationValue); + + /* String fields */ +@@ -650,21 +650,21 @@ void usb_remove_sysfs_dev_files(struct u + /* Interface Accociation Descriptor fields */ + #define usb_intf_assoc_attr(field, format_string) \ + static ssize_t \ +-show_iad_##field (struct device *dev, struct device_attribute *attr, \ ++show_iad_##field(struct device *dev, struct device_attribute *attr, \ + char *buf) \ + { \ +- struct usb_interface *intf = to_usb_interface (dev); \ ++ struct usb_interface *intf = to_usb_interface(dev); \ + \ +- return sprintf (buf, format_string, \ +- intf->intf_assoc->field); \ ++ return sprintf(buf, format_string, \ ++ intf->intf_assoc->field); \ + } \ + static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL); + +-usb_intf_assoc_attr (bFirstInterface, "%02x\n") +-usb_intf_assoc_attr (bInterfaceCount, "%02d\n") +-usb_intf_assoc_attr (bFunctionClass, "%02x\n") +-usb_intf_assoc_attr (bFunctionSubClass, "%02x\n") +-usb_intf_assoc_attr (bFunctionProtocol, "%02x\n") ++usb_intf_assoc_attr(bFirstInterface, "%02x\n") ++usb_intf_assoc_attr(bInterfaceCount, "%02d\n") ++usb_intf_assoc_attr(bFunctionClass, "%02x\n") ++usb_intf_assoc_attr(bFunctionSubClass, "%02x\n") ++usb_intf_assoc_attr(bFunctionProtocol, "%02x\n") + + /* Interface fields */ + #define usb_intf_attr(field, format_string) \ +--- a/drivers/usb/core/urb.c ++++ b/drivers/usb/core/urb.c +@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(usb_free_urb); + * + * A pointer to the urb with the incremented reference counter is returned. + */ +-struct urb * usb_get_urb(struct urb *urb) ++struct urb *usb_get_urb(struct urb *urb) + { + if (urb) + kref_get(&urb->kref); +@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); + * describing that request to the USB subsystem. Request completion will + * be indicated later, asynchronously, by calling the completion handler. + * The three types of completion are success, error, and unlink +- * (a software-induced fault, also called "request cancellation"). ++ * (a software-induced fault, also called "request cancellation"). + * + * URBs may be submitted in interrupt context. + * +@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); + * semaphores), or + * (c) current->state != TASK_RUNNING, this is the case only after + * you've changed it. +- * ++ * + * GFP_NOIO is used in the block io path and error handling of storage + * devices. + * +@@ -288,7 +288,8 @@ int usb_submit_urb(struct urb *urb, gfp_ + + if (!urb || urb->hcpriv || !urb->complete) + return -EINVAL; +- if (!(dev = urb->dev) || dev->state < USB_STATE_DEFAULT) ++ dev = urb->dev; ++ if ((!dev) || (dev->state < USB_STATE_DEFAULT)) + return -ENODEV; + + /* For now, get the endpoint from the pipe. Eventually drivers +@@ -351,11 +352,11 @@ int usb_submit_urb(struct urb *urb, gfp_ + max *= mult; + } + +- if (urb->number_of_packets <= 0) ++ if (urb->number_of_packets <= 0) + return -EINVAL; + for (n = 0; n < urb->number_of_packets; n++) { + len = urb->iso_frame_desc[n].length; +- if (len < 0 || len > max) ++ if (len < 0 || len > max) + return -EMSGSIZE; + urb->iso_frame_desc[n].status = -EXDEV; + urb->iso_frame_desc[n].actual_length = 0; +@@ -420,7 +421,7 @@ int usb_submit_urb(struct urb *urb, gfp_ + /* too big? */ + switch (dev->speed) { + case USB_SPEED_HIGH: /* units are microframes */ +- // NOTE usb handles 2^15 ++ /* NOTE usb handles 2^15 */ + if (urb->interval > (1024 * 8)) + urb->interval = 1024 * 8; + max = 1024 * 8; +@@ -430,12 +431,12 @@ int usb_submit_urb(struct urb *urb, gfp_ + if (xfertype == USB_ENDPOINT_XFER_INT) { + if (urb->interval > 255) + return -EINVAL; +- // NOTE ohci only handles up to 32 ++ /* NOTE ohci only handles up to 32 */ + max = 128; + } else { + if (urb->interval > 1024) + urb->interval = 1024; +- // NOTE usb and ohci handle up to 2^15 ++ /* NOTE usb and ohci handle up to 2^15 */ + max = 1024; + } + break; +@@ -574,7 +575,8 @@ void usb_kill_anchored_urbs(struct usb_a + + spin_lock_irq(&anchor->lock); + while (!list_empty(&anchor->urb_list)) { +- victim = list_entry(anchor->urb_list.prev, struct urb, anchor_list); ++ victim = list_entry(anchor->urb_list.prev, struct urb, ++ anchor_list); + /* we must make sure the URB isn't freed before we kill it*/ + usb_get_urb(victim); + spin_unlock_irq(&anchor->lock); +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -116,8 +116,9 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if); + * Don't call this function unless you are bound to the intf interface + * or you have locked the device! + */ +-struct usb_host_interface *usb_altnum_to_altsetting(const struct usb_interface *intf, +- unsigned int altnum) ++struct usb_host_interface *usb_altnum_to_altsetting( ++ const struct usb_interface *intf, ++ unsigned int altnum) + { + int i; + +@@ -134,7 +135,7 @@ struct find_interface_arg { + struct usb_interface *interface; + }; + +-static int __find_interface(struct device * dev, void * data) ++static int __find_interface(struct device *dev, void *data) + { + struct find_interface_arg *arg = data; + struct usb_interface *intf; +@@ -156,7 +157,7 @@ static int __find_interface(struct devic + * @drv: the driver whose current configuration is considered + * @minor: the minor number of the desired device + * +- * This walks the driver device list and returns a pointer to the interface ++ * This walks the driver device list and returns a pointer to the interface + * with the matching minor. Note, this only works for devices that share the + * USB major number. + */ +@@ -272,8 +273,8 @@ static unsigned usb_bus_is_wusb(struct u + * + * This call may not be used in a non-sleeping context. + */ +-struct usb_device * +-usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1) ++struct usb_device *usb_alloc_dev(struct usb_device *parent, ++ struct usb_bus *bus, unsigned port1) + { + struct usb_device *dev; + struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self); +@@ -469,11 +470,11 @@ int usb_lock_device_for_reset(struct usb + return -EHOSTUNREACH; + if (iface) { + switch (iface->condition) { +- case USB_INTERFACE_BINDING: ++ case USB_INTERFACE_BINDING: + return 0; +- case USB_INTERFACE_BOUND: ++ case USB_INTERFACE_BOUND: + break; +- default: ++ default: + return -EINTR; + } + } +@@ -548,10 +549,10 @@ struct usb_device *usb_find_device(u16 v + struct list_head *buslist; + struct usb_bus *bus; + struct usb_device *dev = NULL; +- ++ + mutex_lock(&usb_bus_list_lock); + for (buslist = usb_bus_list.next; +- buslist != &usb_bus_list; ++ buslist != &usb_bus_list; + buslist = buslist->next) { + bus = container_of(buslist, struct usb_bus, bus_list); + if (!bus->root_hub) +@@ -593,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_ + */ + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr) ++ unsigned char type, void **ptr) + { + struct usb_descriptor_header *header; + +@@ -604,7 +605,7 @@ int __usb_get_extra_descriptor(char *buf + printk(KERN_ERR + "%s: bogus descriptor, type %d length %d\n", + usbcore_name, +- header->bDescriptorType, ++ header->bDescriptorType, + header->bLength); + return -1; + } +@@ -643,12 +644,8 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descri + * + * When the buffer is no longer used, free it with usb_buffer_free(). + */ +-void *usb_buffer_alloc( +- struct usb_device *dev, +- size_t size, +- gfp_t mem_flags, +- dma_addr_t *dma +-) ++void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, ++ dma_addr_t *dma) + { + if (!dev || !dev->bus) + return NULL; +@@ -667,12 +664,8 @@ EXPORT_SYMBOL_GPL(usb_buffer_alloc); + * been allocated using usb_buffer_alloc(), and the parameters must match + * those provided in that allocation request. + */ +-void usb_buffer_free( +- struct usb_device *dev, +- size_t size, +- void *addr, +- dma_addr_t dma +-) ++void usb_buffer_free(struct usb_device *dev, size_t size, void *addr, ++ dma_addr_t dma) + { + if (!dev || !dev->bus) + return; +@@ -720,8 +713,8 @@ struct urb *usb_buffer_map(struct urb *u + urb->setup_packet, + sizeof(struct usb_ctrlrequest), + DMA_TO_DEVICE); +- // FIXME generic api broken like pci, can't report errors +- // if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; ++ /* FIXME generic api broken like pci, can't report errors */ ++ /* if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; */ + } else + urb->transfer_dma = ~0; + urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP +@@ -843,7 +836,7 @@ int usb_buffer_map_sg(const struct usb_d + || !controller->dma_mask) + return -1; + +- // FIXME generic api broken like pci, can't report errors ++ /* FIXME generic api broken like pci, can't report errors */ + return dma_map_sg(controller, sg, nents, + is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE); + } +@@ -937,7 +930,7 @@ static int __init usb_init(void) + if (retval) + goto out; + retval = bus_register(&usb_bus_type); +- if (retval) ++ if (retval) + goto bus_register_failed; + retval = usb_host_init(); + if (retval) diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.h.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.h.patch new file mode 100644 index 00000000000000..f29be20ab1d0f4 --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-.h.patch @@ -0,0 +1,381 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/*.h + +Fixes a number of coding style issues in the USB internal header files. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/hcd.h | 90 +++++++++++++++++++-------------------- + drivers/usb/core/hub.h | 18 +++---- + drivers/usb/core/otg_whitelist.h | 6 +- + drivers/usb/core/usb.h | 21 ++++----- + 4 files changed, 68 insertions(+), 67 deletions(-) + +--- a/drivers/usb/core/hcd.h ++++ b/drivers/usb/core/hcd.h +@@ -125,7 +125,7 @@ struct usb_hcd { + + /* more shared queuing code would be good; it should support + * smarter scheduling, handle transaction translators, etc; +- * input size of periodic table to an interrupt scheduler. ++ * input size of periodic table to an interrupt scheduler. + * (ohci 32, uhci 1024, ehci 256/512/1024). + */ + +@@ -133,16 +133,16 @@ struct usb_hcd { + * this structure. + */ + unsigned long hcd_priv[0] +- __attribute__ ((aligned (sizeof(unsigned long)))); ++ __attribute__ ((aligned(sizeof(unsigned long)))); + }; + + /* 2.4 does this a bit differently ... */ +-static inline struct usb_bus *hcd_to_bus (struct usb_hcd *hcd) ++static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd) + { + return &hcd->self; + } + +-static inline struct usb_hcd *bus_to_hcd (struct usb_bus *bus) ++static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus) + { + return container_of(bus, struct usb_hcd, self); + } +@@ -202,18 +202,18 @@ struct hc_driver { + struct usb_host_endpoint *ep); + + /* root hub support */ +- int (*hub_status_data) (struct usb_hcd *hcd, char *buf); +- int (*hub_control) (struct usb_hcd *hcd, ++ int (*hub_status_data) (struct usb_hcd *hcd, char *buf); ++ int (*hub_control) (struct usb_hcd *hcd, + u16 typeReq, u16 wValue, u16 wIndex, + char *buf, u16 wLength); +- int (*bus_suspend)(struct usb_hcd *); +- int (*bus_resume)(struct usb_hcd *); +- int (*start_port_reset)(struct usb_hcd *, unsigned port_num); +- void (*hub_irq_enable)(struct usb_hcd *); ++ int (*bus_suspend)(struct usb_hcd *); ++ int (*bus_resume)(struct usb_hcd *); ++ int (*start_port_reset)(struct usb_hcd *, unsigned port_num); ++ void (*hub_irq_enable)(struct usb_hcd *); + /* Needed only if port-change IRQs are level-triggered */ + + /* force handover of high-speed port to full-speed companion */ +- void (*relinquish_port)(struct usb_hcd *, int); ++ void (*relinquish_port)(struct usb_hcd *, int); + }; + + extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); +@@ -221,56 +221,56 @@ extern int usb_hcd_check_unlink_urb(stru + int status); + extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb); + +-extern int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags); +-extern int usb_hcd_unlink_urb (struct urb *urb, int status); ++extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); ++extern int usb_hcd_unlink_urb(struct urb *urb, int status); + extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, + int status); + extern void usb_hcd_flush_endpoint(struct usb_device *udev, + struct usb_host_endpoint *ep); + extern void usb_hcd_disable_endpoint(struct usb_device *udev, + struct usb_host_endpoint *ep); +-extern int usb_hcd_get_frame_number (struct usb_device *udev); ++extern int usb_hcd_get_frame_number(struct usb_device *udev); + +-extern struct usb_hcd *usb_create_hcd (const struct hc_driver *driver, ++extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, + struct device *dev, char *bus_name); +-extern struct usb_hcd *usb_get_hcd (struct usb_hcd *hcd); +-extern void usb_put_hcd (struct usb_hcd *hcd); ++extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); ++extern void usb_put_hcd(struct usb_hcd *hcd); + extern int usb_add_hcd(struct usb_hcd *hcd, + unsigned int irqnum, unsigned long irqflags); + extern void usb_remove_hcd(struct usb_hcd *hcd); + + struct platform_device; +-extern void usb_hcd_platform_shutdown(struct platform_device* dev); ++extern void usb_hcd_platform_shutdown(struct platform_device *dev); + + #ifdef CONFIG_PCI + struct pci_dev; + struct pci_device_id; +-extern int usb_hcd_pci_probe (struct pci_dev *dev, ++extern int usb_hcd_pci_probe(struct pci_dev *dev, + const struct pci_device_id *id); +-extern void usb_hcd_pci_remove (struct pci_dev *dev); ++extern void usb_hcd_pci_remove(struct pci_dev *dev); + + #ifdef CONFIG_PM +-extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state); +-extern int usb_hcd_pci_resume (struct pci_dev *dev); ++extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t state); ++extern int usb_hcd_pci_resume(struct pci_dev *dev); + #endif /* CONFIG_PM */ + +-extern void usb_hcd_pci_shutdown (struct pci_dev *dev); ++extern void usb_hcd_pci_shutdown(struct pci_dev *dev); + + #endif /* CONFIG_PCI */ + + /* pci-ish (pdev null is ok) buffer alloc/mapping support */ +-int hcd_buffer_create (struct usb_hcd *hcd); +-void hcd_buffer_destroy (struct usb_hcd *hcd); ++int hcd_buffer_create(struct usb_hcd *hcd); ++void hcd_buffer_destroy(struct usb_hcd *hcd); + +-void *hcd_buffer_alloc (struct usb_bus *bus, size_t size, ++void *hcd_buffer_alloc(struct usb_bus *bus, size_t size, + gfp_t mem_flags, dma_addr_t *dma); +-void hcd_buffer_free (struct usb_bus *bus, size_t size, ++void hcd_buffer_free(struct usb_bus *bus, size_t size, + void *addr, dma_addr_t dma); + + /* generic bus glue, needed for host controllers that don't use PCI */ +-extern irqreturn_t usb_hcd_irq (int irq, void *__hcd); ++extern irqreturn_t usb_hcd_irq(int irq, void *__hcd); + +-extern void usb_hc_died (struct usb_hcd *hcd); ++extern void usb_hc_died(struct usb_hcd *hcd); + extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); + + /* -------------------------------------------------------------------------- */ +@@ -323,9 +323,9 @@ extern void usb_destroy_configuration(st + * Generic bandwidth allocation constants/support + */ + #define FRAME_TIME_USECS 1000L +-#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */ ++#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */ + /* Trying not to use worst-case bit-stuffing +- of (7/6 * 8 * bytecount) = 9.33 * bytecount */ ++ * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ + /* bytecount = data payload byte count */ + + #define NS_TO_US(ns) ((ns + 500L) / 1000L) +@@ -337,9 +337,9 @@ extern void usb_destroy_configuration(st + */ + #define BW_HOST_DELAY 1000L /* nanoseconds */ + #define BW_HUB_LS_SETUP 333L /* nanoseconds */ +- /* 4 full-speed bit times (est.) */ ++ /* 4 full-speed bit times (est.) */ + +-#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */ ++#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */ + #define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L) + #define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L) + +@@ -349,16 +349,16 @@ extern void usb_destroy_configuration(st + * to preallocate bandwidth) + */ + #define USB2_HOST_DELAY 5 /* nsec, guess */ +-#define HS_NSECS(bytes) ( ((55 * 8 * 2083) \ ++#define HS_NSECS(bytes) (((55 * 8 * 2083) \ + + (2083UL * (3 + BitTime(bytes))))/1000 \ + + USB2_HOST_DELAY) +-#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083) \ ++#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \ + + (2083UL * (3 + BitTime(bytes))))/1000 \ + + USB2_HOST_DELAY) + #define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes)) + #define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes)) + +-extern long usb_calc_bus_time (int speed, int is_input, ++extern long usb_calc_bus_time(int speed, int is_input, + int isoc, int bytecount); + + /*-------------------------------------------------------------------------*/ +@@ -374,16 +374,16 @@ extern struct list_head usb_bus_list; + extern struct mutex usb_bus_list_lock; + extern wait_queue_head_t usb_kill_urb_queue; + +-extern void usb_enable_root_hub_irq (struct usb_bus *bus); ++extern void usb_enable_root_hub_irq(struct usb_bus *bus); + +-extern int usb_find_interface_driver (struct usb_device *dev, ++extern int usb_find_interface_driver(struct usb_device *dev, + struct usb_interface *interface); + + #define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) + + #ifdef CONFIG_PM +-extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd); +-extern void usb_root_hub_lost_power (struct usb_device *rhdev); ++extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); ++extern void usb_root_hub_lost_power(struct usb_device *rhdev); + extern int hcd_bus_suspend(struct usb_device *rhdev); + extern int hcd_bus_resume(struct usb_device *rhdev); + #else +@@ -403,13 +403,13 @@ static inline void usb_hcd_resume_root_h + * these are expected to be called from the USB core/hub thread + * with the kernel lock held + */ +-extern void usbfs_update_special (void); ++extern void usbfs_update_special(void); + extern int usbfs_init(void); + extern void usbfs_cleanup(void); + + #else /* CONFIG_USB_DEVICEFS */ + +-static inline void usbfs_update_special (void) {} ++static inline void usbfs_update_special(void) {} + static inline int usbfs_init(void) { return 0; } + static inline void usbfs_cleanup(void) { } + +@@ -464,7 +464,7 @@ static inline void usbmon_urb_complete(s + /*-------------------------------------------------------------------------*/ + + /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ +-// bleech -- resurfaced in 2.4.11 or 2.4.12 ++/* bleech -- resurfaced in 2.4.11 or 2.4.12 */ + #define bitmap DeviceRemovable + + +@@ -472,8 +472,8 @@ static inline void usbmon_urb_complete(s + + /* random stuff */ + +-#define RUN_CONTEXT (in_irq () ? "in_irq" \ +- : (in_interrupt () ? "in_interrupt" : "can sleep")) ++#define RUN_CONTEXT (in_irq() ? "in_irq" \ ++ : (in_interrupt() ? "in_interrupt" : "can sleep")) + + + /* This rwsem is for use only by the hub driver and ehci-hcd. +--- a/drivers/usb/core/hub.h ++++ b/drivers/usb/core/hub.h +@@ -55,16 +55,16 @@ + #define USB_PORT_FEAT_TEST 21 + #define USB_PORT_FEAT_INDICATOR 22 + +-/* ++/* + * Hub Status and Hub Change results + * See USB 2.0 spec Table 11-19 and Table 11-20 + */ + struct usb_port_status { + __le16 wPortStatus; +- __le16 wPortChange; ++ __le16 wPortChange; + } __attribute__ ((packed)); + +-/* ++/* + * wPortStatus bit field + * See USB 2.0 spec Table 11-21 + */ +@@ -81,7 +81,7 @@ struct usb_port_status { + #define USB_PORT_STAT_INDICATOR 0x1000 + /* bits 13 to 15 are reserved */ + +-/* ++/* + * wPortChange bit field + * See USB 2.0 spec Table 11-22 + * Bits 0 to 4 shown, bits 5 to 15 are reserved +@@ -93,7 +93,7 @@ struct usb_port_status { + #define USB_PORT_STAT_C_RESET 0x0010 + + /* +- * wHubCharacteristics (masks) ++ * wHubCharacteristics (masks) + * See USB 2.0 spec Table 11-13, offset 3 + */ + #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ +@@ -119,8 +119,8 @@ struct usb_hub_status { + #define HUB_CHANGE_OVERCURRENT 0x0002 + + +-/* +- * Hub descriptor ++/* ++ * Hub descriptor + * See USB 2.0 spec Table 11-13 + */ + +@@ -134,7 +134,7 @@ struct usb_hub_descriptor { + __le16 wHubCharacteristics; + __u8 bPwrOn2PwrGood; + __u8 bHubContrCurrent; +- /* add 1 bit for hub status change; round to bytes */ ++ /* add 1 bit for hub status change; round to bytes */ + __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; + __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; + } __attribute__ ((packed)); +@@ -190,6 +190,6 @@ struct usb_tt_clear { + u16 devinfo; + }; + +-extern void usb_hub_tt_clear_buffer (struct usb_device *dev, int pipe); ++extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); + + #endif /* __LINUX_HUB_H */ +--- a/drivers/usb/core/otg_whitelist.h ++++ b/drivers/usb/core/otg_whitelist.h +@@ -14,7 +14,7 @@ + * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries.. + * + * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING! +- */ ++ */ + + static struct usb_device_id whitelist_table [] = { + +@@ -55,7 +55,7 @@ static int is_targeted(struct usb_device + return 1; + + /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */ +- if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a && ++ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a && + le16_to_cpu(dev->descriptor.idProduct) == 0xbadd)) + return 0; + +@@ -86,7 +86,7 @@ static int is_targeted(struct usb_device + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && +- (id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass)) ++ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) + continue; + + if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && +--- a/drivers/usb/core/usb.h ++++ b/drivers/usb/core/usb.h +@@ -1,22 +1,23 @@ + /* Functions local to drivers/usb/core/ */ + +-extern int usb_create_sysfs_dev_files (struct usb_device *dev); +-extern void usb_remove_sysfs_dev_files (struct usb_device *dev); +-extern int usb_create_sysfs_intf_files (struct usb_interface *intf); +-extern void usb_remove_sysfs_intf_files (struct usb_interface *intf); +-extern int usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint, ++extern int usb_create_sysfs_dev_files(struct usb_device *dev); ++extern void usb_remove_sysfs_dev_files(struct usb_device *dev); ++extern int usb_create_sysfs_intf_files(struct usb_interface *intf); ++extern void usb_remove_sysfs_intf_files(struct usb_interface *intf); ++extern int usb_create_ep_files(struct device *parent, ++ struct usb_host_endpoint *endpoint, + struct usb_device *udev); + extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint); + + extern void usb_enable_endpoint(struct usb_device *dev, + struct usb_host_endpoint *ep); +-extern void usb_disable_endpoint (struct usb_device *dev, unsigned int epaddr); +-extern void usb_disable_interface (struct usb_device *dev, ++extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr); ++extern void usb_disable_interface(struct usb_device *dev, + struct usb_interface *intf); + extern void usb_release_interface_cache(struct kref *ref); +-extern void usb_disable_device (struct usb_device *dev, int skip_ep0); +-extern int usb_deauthorize_device (struct usb_device *); +-extern int usb_authorize_device (struct usb_device *); ++extern void usb_disable_device(struct usb_device *dev, int skip_ep0); ++extern int usb_deauthorize_device(struct usb_device *); ++extern int usb_authorize_device(struct usb_device *); + extern void usb_detect_quirks(struct usb_device *udev); + + extern int usb_get_device_descriptor(struct usb_device *dev, diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devices.c.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devices.c.patch new file mode 100644 index 00000000000000..85c8b719f94ffd --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devices.c.patch @@ -0,0 +1,407 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/devices.c + +Fixes a number of coding style issues in the devices.c file. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/devices.c | 154 +++++++++++++++++++++++---------------------- + 1 file changed, 82 insertions(+), 72 deletions(-) + +--- a/drivers/usb/core/devices.c ++++ b/drivers/usb/core/devices.c +@@ -89,7 +89,7 @@ static const char *format_string_serialn + static const char *format_bandwidth = + /* B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd */ + "B: Alloc=%3d/%3d us (%2d%%), #Int=%3d, #Iso=%3d\n"; +- ++ + static const char *format_device1 = + /* D: Ver=xx.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd */ + "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n"; +@@ -101,7 +101,7 @@ static const char *format_device2 = + static const char *format_config = + /* C: #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA */ + "C:%c #Ifs=%2d Cfg#=%2d Atr=%02x MxPwr=%3dmA\n"; +- ++ + static const char *format_iad = + /* A: FirstIf#=dd IfCount=dd Cls=xx(sssss) Sub=xx Prot=xx */ + "A: FirstIf#=%2d IfCount=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x\n"; +@@ -122,7 +122,7 @@ static const char *format_endpt = + */ + + static DECLARE_WAIT_QUEUE_HEAD(deviceconndiscwq); +-static unsigned int conndiscevcnt = 0; ++static unsigned int conndiscevcnt; + + /* this struct stores the poll state for <mountpoint>/devices pollers */ + struct usb_device_status { +@@ -172,12 +172,8 @@ static const char *class_decode(const in + return clas_info[ix].class_name; + } + +-static char *usb_dump_endpoint_descriptor( +- int speed, +- char *start, +- char *end, +- const struct usb_endpoint_descriptor *desc +-) ++static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, ++ const struct usb_endpoint_descriptor *desc) + { + char dir, unit, *type; + unsigned interval, bandwidth = 1; +@@ -235,22 +231,24 @@ static char *usb_dump_endpoint_descripto + + start += sprintf(start, format_endpt, desc->bEndpointAddress, dir, + desc->bmAttributes, type, +- (le16_to_cpu(desc->wMaxPacketSize) & 0x07ff) * bandwidth, ++ (le16_to_cpu(desc->wMaxPacketSize) & 0x07ff) * ++ bandwidth, + interval, unit); + return start; + } + + static char *usb_dump_interface_descriptor(char *start, char *end, +- const struct usb_interface_cache *intfc, +- const struct usb_interface *iface, +- int setno) ++ const struct usb_interface_cache *intfc, ++ const struct usb_interface *iface, ++ int setno) + { +- const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; ++ const struct usb_interface_descriptor *desc; + const char *driver_name = ""; + int active = 0; + + if (start > end) + return start; ++ desc = &intfc->altsetting[setno].desc; + if (iface) { + driver_name = (iface->dev.driver + ? iface->dev.driver->name +@@ -270,14 +268,10 @@ static char *usb_dump_interface_descript + return start; + } + +-static char *usb_dump_interface( +- int speed, +- char *start, +- char *end, +- const struct usb_interface_cache *intfc, +- const struct usb_interface *iface, +- int setno +-) { ++static char *usb_dump_interface(int speed, char *start, char *end, ++ const struct usb_interface_cache *intfc, ++ const struct usb_interface *iface, int setno) ++{ + const struct usb_host_interface *desc = &intfc->altsetting[setno]; + int i; + +@@ -292,7 +286,7 @@ static char *usb_dump_interface( + } + + static char *usb_dump_iad_descriptor(char *start, char *end, +- const struct usb_interface_assoc_descriptor *iad) ++ const struct usb_interface_assoc_descriptor *iad) + { + if (start > end) + return start; +@@ -311,13 +305,15 @@ static char *usb_dump_iad_descriptor(cha + * 1. marking active interface altsettings (code lists all, but should mark + * which ones are active, if any) + */ +- +-static char *usb_dump_config_descriptor(char *start, char *end, const struct usb_config_descriptor *desc, int active) ++static char *usb_dump_config_descriptor(char *start, char *end, ++ const struct usb_config_descriptor *desc, ++ int active) + { + if (start > end) + return start; + start += sprintf(start, format_config, +- active ? '*' : ' ', /* mark active/actual/current cfg. */ ++ /* mark active/actual/current cfg. */ ++ active ? '*' : ' ', + desc->bNumInterfaces, + desc->bConfigurationValue, + desc->bmAttributes, +@@ -325,13 +321,8 @@ static char *usb_dump_config_descriptor( + return start; + } + +-static char *usb_dump_config ( +- int speed, +- char *start, +- char *end, +- const struct usb_host_config *config, +- int active +-) ++static char *usb_dump_config(int speed, char *start, char *end, ++ const struct usb_host_config *config, int active) + { + int i, j; + struct usb_interface_cache *intfc; +@@ -339,7 +330,8 @@ static char *usb_dump_config ( + + if (start > end) + return start; +- if (!config) /* getting these some in 2.3.7; none in 2.3.6 */ ++ if (!config) ++ /* getting these some in 2.3.7; none in 2.3.6 */ + return start + sprintf(start, "(null Cfg. desc.)\n"); + start = usb_dump_config_descriptor(start, end, &config->desc, active); + for (i = 0; i < USB_MAXIADS; i++) { +@@ -364,7 +356,8 @@ static char *usb_dump_config ( + /* + * Dump the different USB descriptors. + */ +-static char *usb_dump_device_descriptor(char *start, char *end, const struct usb_device_descriptor *desc) ++static char *usb_dump_device_descriptor(char *start, char *end, ++ const struct usb_device_descriptor *desc) + { + u16 bcdUSB = le16_to_cpu(desc->bcdUSB); + u16 bcdDevice = le16_to_cpu(desc->bcdDevice); +@@ -374,7 +367,7 @@ static char *usb_dump_device_descriptor( + start += sprintf(start, format_device1, + bcdUSB >> 8, bcdUSB & 0xff, + desc->bDeviceClass, +- class_decode (desc->bDeviceClass), ++ class_decode(desc->bDeviceClass), + desc->bDeviceSubClass, + desc->bDeviceProtocol, + desc->bMaxPacketSize0, +@@ -391,12 +384,14 @@ static char *usb_dump_device_descriptor( + /* + * Dump the different strings that this device holds. + */ +-static char *usb_dump_device_strings(char *start, char *end, struct usb_device *dev) ++static char *usb_dump_device_strings(char *start, char *end, ++ struct usb_device *dev) + { + if (start > end) + return start; + if (dev->manufacturer) +- start += sprintf(start, format_string_manufacturer, dev->manufacturer); ++ start += sprintf(start, format_string_manufacturer, ++ dev->manufacturer); + if (start > end) + goto out; + if (dev->product) +@@ -405,7 +400,8 @@ static char *usb_dump_device_strings(cha + goto out; + #ifdef ALLOW_SERIAL_NUMBER + if (dev->serial) +- start += sprintf(start, format_string_serialnumber, dev->serial); ++ start += sprintf(start, format_string_serialnumber, ++ dev->serial); + #endif + out: + return start; +@@ -417,12 +413,12 @@ static char *usb_dump_desc(char *start, + + if (start > end) + return start; +- ++ + start = usb_dump_device_descriptor(start, end, &dev->descriptor); + + if (start > end) + return start; +- ++ + start = usb_dump_device_strings(start, end, dev); + + for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { +@@ -439,7 +435,8 @@ static char *usb_dump_desc(char *start, + + #ifdef PROC_EXTRA /* TBD: may want to add this code later */ + +-static char *usb_dump_hub_descriptor(char *start, char *end, const struct usb_hub_descriptor * desc) ++static char *usb_dump_hub_descriptor(char *start, char *end, ++ const struct usb_hub_descriptor *desc) + { + int leng = USB_DT_HUB_NONVAR_SIZE; + unsigned char *ptr = (unsigned char *)desc; +@@ -455,13 +452,16 @@ static char *usb_dump_hub_descriptor(cha + return start; + } + +-static char *usb_dump_string(char *start, char *end, const struct usb_device *dev, char *id, int index) ++static char *usb_dump_string(char *start, char *end, ++ const struct usb_device *dev, char *id, int index) + { + if (start > end) + return start; + start += sprintf(start, "Interface:"); +- if (index <= dev->maxstring && dev->stringindex && dev->stringindex[index]) +- start += sprintf(start, "%s: %.100s ", id, dev->stringindex[index]); ++ if (index <= dev->maxstring && dev->stringindex && ++ dev->stringindex[index]) ++ start += sprintf(start, "%s: %.100s ", id, ++ dev->stringindex[index]); + return start; + } + +@@ -476,8 +476,10 @@ static char *usb_dump_string(char *start + * file_offset - the offset into the devices file on completion + * The caller must own the device lock. + */ +-static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, loff_t *skip_bytes, loff_t *file_offset, +- struct usb_device *usbdev, struct usb_bus *bus, int level, int index, int count) ++static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, ++ loff_t *skip_bytes, loff_t *file_offset, ++ struct usb_device *usbdev, struct usb_bus *bus, ++ int level, int index, int count) + { + int chix; + int ret, cnt = 0; +@@ -485,17 +487,19 @@ static ssize_t usb_device_dump(char __us + char *pages_start, *data_end, *speed; + unsigned int length; + ssize_t total_written = 0; +- ++ + /* don't bother with anything else if we're not writing any data */ + if (*nbytes <= 0) + return 0; +- ++ + if (level > MAX_TOPO_LEVEL) + return 0; +- /* allocate 2^1 pages = 8K (on i386); should be more than enough for one device */ +- if (!(pages_start = (char*) __get_free_pages(GFP_KERNEL,1))) +- return -ENOMEM; +- ++ /* allocate 2^1 pages = 8K (on i386); ++ * should be more than enough for one device */ ++ pages_start = (char *)__get_free_pages(GFP_KERNEL, 1); ++ if (!pages_start) ++ return -ENOMEM; ++ + if (usbdev->parent && usbdev->parent->devnum != -1) + parent_devnum = usbdev->parent->devnum; + /* +@@ -541,15 +545,16 @@ static ssize_t usb_device_dump(char __us + bus->bandwidth_allocated, max, + (100 * bus->bandwidth_allocated + max / 2) + / max, +- bus->bandwidth_int_reqs, +- bus->bandwidth_isoc_reqs); +- ++ bus->bandwidth_int_reqs, ++ bus->bandwidth_isoc_reqs); ++ + } +- data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, usbdev); +- ++ data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, ++ usbdev); ++ + if (data_end > (pages_start + (2 * PAGE_SIZE) - 256)) + data_end += sprintf(data_end, "(truncated)\n"); +- ++ + length = data_end - pages_start; + /* if we can start copying some data to the user */ + if (length > *skip_bytes) { +@@ -567,17 +572,18 @@ static ssize_t usb_device_dump(char __us + *skip_bytes = 0; + } else + *skip_bytes -= length; +- ++ + free_pages((unsigned long)pages_start, 1); +- ++ + /* Now look at all of this device's children. */ + for (chix = 0; chix < usbdev->maxchild; chix++) { + struct usb_device *childdev = usbdev->children[chix]; + + if (childdev) { + usb_lock_device(childdev); +- ret = usb_device_dump(buffer, nbytes, skip_bytes, file_offset, childdev, +- bus, level + 1, chix, ++cnt); ++ ret = usb_device_dump(buffer, nbytes, skip_bytes, ++ file_offset, childdev, bus, ++ level + 1, chix, ++cnt); + usb_unlock_device(childdev); + if (ret == -EFAULT) + return total_written; +@@ -587,7 +593,8 @@ static ssize_t usb_device_dump(char __us + return total_written; + } + +-static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) ++static ssize_t usb_device_read(struct file *file, char __user *buf, ++ size_t nbytes, loff_t *ppos) + { + struct usb_bus *bus; + ssize_t ret, total_written = 0; +@@ -607,7 +614,8 @@ static ssize_t usb_device_read(struct fi + if (!bus->root_hub) + continue; + usb_lock_device(bus->root_hub); +- ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, bus->root_hub, bus, 0, 0, 0); ++ ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, ++ bus->root_hub, bus, 0, 0, 0); + usb_unlock_device(bus->root_hub); + if (ret < 0) { + mutex_unlock(&usb_bus_list_lock); +@@ -620,7 +628,8 @@ static ssize_t usb_device_read(struct fi + } + + /* Kernel lock for "lastev" protection */ +-static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait) ++static unsigned int usb_device_poll(struct file *file, ++ struct poll_table_struct *wait) + { + struct usb_device_status *st = file->private_data; + unsigned int mask = 0; +@@ -629,7 +638,8 @@ static unsigned int usb_device_poll(stru + if (!st) { + st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL); + +- /* we may have dropped BKL - need to check for having lost the race */ ++ /* we may have dropped BKL - ++ * need to check for having lost the race */ + if (file->private_data) { + kfree(st); + st = file->private_data; +@@ -652,7 +662,7 @@ static unsigned int usb_device_poll(stru + } + lost_race: + if (file->f_mode & FMODE_READ) +- poll_wait(file, &deviceconndiscwq, wait); ++ poll_wait(file, &deviceconndiscwq, wait); + if (st->lastev != conndiscevcnt) + mask |= POLLIN; + st->lastev = conndiscevcnt; +@@ -662,18 +672,18 @@ lost_race: + + static int usb_device_open(struct inode *inode, struct file *file) + { +- file->private_data = NULL; +- return 0; ++ file->private_data = NULL; ++ return 0; + } + + static int usb_device_release(struct inode *inode, struct file *file) + { + kfree(file->private_data); + file->private_data = NULL; +- return 0; ++ return 0; + } + +-static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig) ++static loff_t usb_device_lseek(struct file *file, loff_t offset, int orig) + { + loff_t ret; + diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devio.c.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devio.c.patch new file mode 100644 index 00000000000000..7776dfe7b8e5c5 --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-devio.c.patch @@ -0,0 +1,808 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/devio.c + +Fixes a number of coding style issues in the devio.c file. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/devio.c | 331 ++++++++++++++++++++++++++--------------------- + 1 file changed, 187 insertions(+), 144 deletions(-) + +--- a/drivers/usb/core/devio.c ++++ b/drivers/usb/core/devio.c +@@ -75,14 +75,14 @@ struct async { + u32 secid; + }; + +-static int usbfs_snoop = 0; +-module_param (usbfs_snoop, bool, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC (usbfs_snoop, "true to log all usbfs traffic"); ++static int usbfs_snoop; ++module_param(usbfs_snoop, bool, S_IRUGO | S_IWUSR); ++MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs traffic"); + + #define snoop(dev, format, arg...) \ + do { \ + if (usbfs_snoop) \ +- dev_info( dev , format , ## arg); \ ++ dev_info(dev , format , ## arg); \ + } while (0) + + #define USB_DEVICE_DEV MKDEV(USB_DEVICE_MAJOR, 0) +@@ -90,7 +90,7 @@ MODULE_PARM_DESC (usbfs_snoop, "true to + + #define MAX_USBFS_BUFFER_SIZE 16384 + +-static inline int connected (struct dev_state *ps) ++static inline int connected(struct dev_state *ps) + { + return (!list_empty(&ps->list) && + ps->dev->state != USB_STATE_NOTATTACHED); +@@ -120,7 +120,8 @@ static loff_t usbdev_lseek(struct file * + return ret; + } + +-static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) ++static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, ++ loff_t *ppos) + { + struct dev_state *ps = file->private_data; + struct usb_device *dev = ps->dev; +@@ -140,7 +141,8 @@ static ssize_t usbdev_read(struct file * + } + + if (pos < sizeof(struct usb_device_descriptor)) { +- struct usb_device_descriptor temp_desc ; /* 18 bytes - fits on the stack */ ++ /* 18 bytes - fits on the stack */ ++ struct usb_device_descriptor temp_desc; + + memcpy(&temp_desc, &dev->descriptor, sizeof(dev->descriptor)); + le16_to_cpus(&temp_desc.bcdUSB); +@@ -213,14 +215,14 @@ static struct async *alloc_async(unsigne + struct async *as; + + as = kzalloc(sizeof(struct async), GFP_KERNEL); +- if (!as) +- return NULL; ++ if (!as) ++ return NULL; + as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL); + if (!as->urb) { + kfree(as); + return NULL; + } +- return as; ++ return as; + } + + static void free_async(struct async *as) +@@ -234,52 +236,54 @@ static void free_async(struct async *as) + + static inline void async_newpending(struct async *as) + { +- struct dev_state *ps = as->ps; +- unsigned long flags; +- +- spin_lock_irqsave(&ps->lock, flags); +- list_add_tail(&as->asynclist, &ps->async_pending); +- spin_unlock_irqrestore(&ps->lock, flags); ++ struct dev_state *ps = as->ps; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ps->lock, flags); ++ list_add_tail(&as->asynclist, &ps->async_pending); ++ spin_unlock_irqrestore(&ps->lock, flags); + } + + static inline void async_removepending(struct async *as) + { +- struct dev_state *ps = as->ps; +- unsigned long flags; +- +- spin_lock_irqsave(&ps->lock, flags); +- list_del_init(&as->asynclist); +- spin_unlock_irqrestore(&ps->lock, flags); ++ struct dev_state *ps = as->ps; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&ps->lock, flags); ++ list_del_init(&as->asynclist); ++ spin_unlock_irqrestore(&ps->lock, flags); + } + + static inline struct async *async_getcompleted(struct dev_state *ps) + { +- unsigned long flags; +- struct async *as = NULL; ++ unsigned long flags; ++ struct async *as = NULL; + +- spin_lock_irqsave(&ps->lock, flags); +- if (!list_empty(&ps->async_completed)) { +- as = list_entry(ps->async_completed.next, struct async, asynclist); +- list_del_init(&as->asynclist); +- } +- spin_unlock_irqrestore(&ps->lock, flags); +- return as; ++ spin_lock_irqsave(&ps->lock, flags); ++ if (!list_empty(&ps->async_completed)) { ++ as = list_entry(ps->async_completed.next, struct async, ++ asynclist); ++ list_del_init(&as->asynclist); ++ } ++ spin_unlock_irqrestore(&ps->lock, flags); ++ return as; + } + +-static inline struct async *async_getpending(struct dev_state *ps, void __user *userurb) ++static inline struct async *async_getpending(struct dev_state *ps, ++ void __user *userurb) + { +- unsigned long flags; +- struct async *as; ++ unsigned long flags; ++ struct async *as; + +- spin_lock_irqsave(&ps->lock, flags); ++ spin_lock_irqsave(&ps->lock, flags); + list_for_each_entry(as, &ps->async_pending, asynclist) + if (as->userurb == userurb) { + list_del_init(&as->asynclist); + spin_unlock_irqrestore(&ps->lock, flags); + return as; + } +- spin_unlock_irqrestore(&ps->lock, flags); +- return NULL; ++ spin_unlock_irqrestore(&ps->lock, flags); ++ return NULL; + } + + static void snoop_urb(struct urb *urb, void __user *userurb) +@@ -298,19 +302,19 @@ static void snoop_urb(struct urb *urb, v + dev_info(&urb->dev->dev, "actual_length=%d\n", urb->actual_length); + dev_info(&urb->dev->dev, "data: "); + for (j = 0; j < urb->transfer_buffer_length; ++j) +- printk ("%02x ", data[j]); ++ printk("%02x ", data[j]); + printk("\n"); + } + + static void async_completed(struct urb *urb) + { +- struct async *as = urb->context; +- struct dev_state *ps = as->ps; ++ struct async *as = urb->context; ++ struct dev_state *ps = as->ps; + struct siginfo sinfo; + +- spin_lock(&ps->lock); +- list_move_tail(&as->asynclist, &ps->async_completed); +- spin_unlock(&ps->lock); ++ spin_lock(&ps->lock); ++ list_move_tail(&as->asynclist, &ps->async_completed); ++ spin_unlock(&ps->lock); + as->status = urb->status; + if (as->signr) { + sinfo.si_signo = as->signr; +@@ -325,7 +329,7 @@ static void async_completed(struct urb * + wake_up(&ps->wait); + } + +-static void destroy_async (struct dev_state *ps, struct list_head *list) ++static void destroy_async(struct dev_state *ps, struct list_head *list) + { + struct async *as; + unsigned long flags; +@@ -348,7 +352,8 @@ static void destroy_async (struct dev_st + } + } + +-static void destroy_async_on_interface (struct dev_state *ps, unsigned int ifnum) ++static void destroy_async_on_interface(struct dev_state *ps, ++ unsigned int ifnum) + { + struct list_head *p, *q, hitlist; + unsigned long flags; +@@ -364,7 +369,7 @@ static void destroy_async_on_interface ( + + static inline void destroy_all_async(struct dev_state *ps) + { +- destroy_async(ps, &ps->async_pending); ++ destroy_async(ps, &ps->async_pending); + } + + /* +@@ -373,15 +378,15 @@ static inline void destroy_all_async(str + * they're also undone when devices disconnect. + */ + +-static int driver_probe (struct usb_interface *intf, +- const struct usb_device_id *id) ++static int driver_probe(struct usb_interface *intf, ++ const struct usb_device_id *id) + { + return -ENODEV; + } + + static void driver_disconnect(struct usb_interface *intf) + { +- struct dev_state *ps = usb_get_intfdata (intf); ++ struct dev_state *ps = usb_get_intfdata(intf); + unsigned int ifnum = intf->altsetting->desc.bInterfaceNumber; + + if (!ps) +@@ -396,7 +401,7 @@ static void driver_disconnect(struct usb + else + warn("interface number %u out of range", ifnum); + +- usb_set_intfdata (intf, NULL); ++ usb_set_intfdata(intf, NULL); + + /* force async requests to complete */ + destroy_async_on_interface(ps, ifnum); +@@ -474,15 +479,16 @@ static int checkintf(struct dev_state *p + if (test_bit(ifnum, &ps->ifclaimed)) + return 0; + /* if not yet claimed, claim it for the driver */ +- dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n", +- task_pid_nr(current), current->comm, ifnum); ++ dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim " ++ "interface %u before use\n", task_pid_nr(current), ++ current->comm, ifnum); + return claimintf(ps, ifnum); + } + + static int findintfep(struct usb_device *dev, unsigned int ep) + { + unsigned int i, j, e; +- struct usb_interface *intf; ++ struct usb_interface *intf; + struct usb_host_interface *alts; + struct usb_endpoint_descriptor *endpt; + +@@ -493,7 +499,7 @@ static int findintfep(struct usb_device + for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { + intf = dev->actconfig->interface[i]; + for (j = 0; j < intf->num_altsetting; j++) { +- alts = &intf->altsetting[j]; ++ alts = &intf->altsetting[j]; + for (e = 0; e < alts->desc.bNumEndpoints; e++) { + endpt = &alts->endpoint[e].desc; + if (endpt->bEndpointAddress == ep) +@@ -501,10 +507,11 @@ static int findintfep(struct usb_device + } + } + } +- return -ENOENT; ++ return -ENOENT; + } + +-static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsigned int index) ++static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, ++ unsigned int index) + { + int ret = 0; + +@@ -517,7 +524,8 @@ static int check_ctrlrecip(struct dev_st + index &= 0xff; + switch (requesttype & USB_RECIP_MASK) { + case USB_RECIP_ENDPOINT: +- if ((ret = findintfep(ps->dev, index)) >= 0) ++ ret = findintfep(ps->dev, index); ++ if (ret >= 0) + ret = checkintf(ps, ret); + break; + +@@ -561,7 +569,8 @@ static int usbdev_open(struct inode *ino + mutex_lock(&usbfs_mutex); + + ret = -ENOMEM; +- if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL))) ++ ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL); ++ if (!ps) + goto out; + + ret = -ENOENT; +@@ -642,15 +651,18 @@ static int proc_control(struct dev_state + + if (copy_from_user(&ctrl, arg, sizeof(ctrl))) + return -EFAULT; +- if ((ret = check_ctrlrecip(ps, ctrl.bRequestType, ctrl.wIndex))) ++ ret = check_ctrlrecip(ps, ctrl.bRequestType, ctrl.wIndex); ++ if (ret) + return ret; + if (ctrl.wLength > PAGE_SIZE) + return -EINVAL; +- if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL))) ++ tbuf = (unsigned char *)__get_free_page(GFP_KERNEL); ++ if (!tbuf) + return -ENOMEM; + tmo = ctrl.timeout; + if (ctrl.bRequestType & 0x80) { +- if (ctrl.wLength && !access_ok(VERIFY_WRITE, ctrl.data, ctrl.wLength)) { ++ if (ctrl.wLength && !access_ok(VERIFY_WRITE, ctrl.data, ++ ctrl.wLength)) { + free_page((unsigned long)tbuf); + return -EINVAL; + } +@@ -661,14 +673,15 @@ static int proc_control(struct dev_state + ctrl.wIndex, ctrl.wLength); + + usb_unlock_device(dev); +- i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, +- ctrl.wValue, ctrl.wIndex, tbuf, ctrl.wLength, tmo); ++ i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ++ ctrl.bRequestType, ctrl.wValue, ctrl.wIndex, ++ tbuf, ctrl.wLength, tmo); + usb_lock_device(dev); + if ((i > 0) && ctrl.wLength) { + if (usbfs_snoop) { + dev_info(&dev->dev, "control read: data "); + for (j = 0; j < i; ++j) +- printk("%02x ", (unsigned char)(tbuf)[j]); ++ printk("%02x ", (u8)(tbuf)[j]); + printk("\n"); + } + if (copy_to_user(ctrl.data, tbuf, i)) { +@@ -695,12 +708,13 @@ static int proc_control(struct dev_state + printk("\n"); + } + usb_unlock_device(dev); +- i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, +- ctrl.wValue, ctrl.wIndex, tbuf, ctrl.wLength, tmo); ++ i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ++ ctrl.bRequestType, ctrl.wValue, ctrl.wIndex, ++ tbuf, ctrl.wLength, tmo); + usb_lock_device(dev); + } + free_page((unsigned long)tbuf); +- if (i<0 && i != -EPIPE) { ++ if (i < 0 && i != -EPIPE) { + dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL " + "failed cmd %s rqt %u rq %u len %u ret %d\n", + current->comm, ctrl.bRequestType, ctrl.bRequest, +@@ -720,9 +734,11 @@ static int proc_bulk(struct dev_state *p + + if (copy_from_user(&bulk, arg, sizeof(bulk))) + return -EFAULT; +- if ((ret = findintfep(ps->dev, bulk.ep)) < 0) ++ ret = findintfep(ps->dev, bulk.ep); ++ if (ret < 0) + return ret; +- if ((ret = checkintf(ps, ret))) ++ ret = checkintf(ps, ret); ++ if (ret) + return ret; + if (bulk.ep & USB_DIR_IN) + pipe = usb_rcvbulkpipe(dev, bulk.ep & 0x7f); +@@ -750,7 +766,7 @@ static int proc_bulk(struct dev_state *p + if (usbfs_snoop) { + dev_info(&dev->dev, "bulk read: data "); + for (j = 0; j < len2; ++j) +- printk("%02x ", (unsigned char)(tbuf)[j]); ++ printk("%02x ", (u8)(tbuf)[j]); + printk("\n"); + } + if (copy_to_user(bulk.data, tbuf, len2)) { +@@ -790,9 +806,11 @@ static int proc_resetep(struct dev_state + + if (get_user(ep, (unsigned int __user *)arg)) + return -EFAULT; +- if ((ret = findintfep(ps->dev, ep)) < 0) ++ ret = findintfep(ps->dev, ep); ++ if (ret < 0) + return ret; +- if ((ret = checkintf(ps, ret))) ++ ret = checkintf(ps, ret); ++ if (ret) + return ret; + usb_settoggle(ps->dev, ep & 0xf, !(ep & USB_DIR_IN), 0); + return 0; +@@ -806,18 +824,19 @@ static int proc_clearhalt(struct dev_sta + + if (get_user(ep, (unsigned int __user *)arg)) + return -EFAULT; +- if ((ret = findintfep(ps->dev, ep)) < 0) ++ ret = findintfep(ps->dev, ep); ++ if (ret < 0) + return ret; +- if ((ret = checkintf(ps, ret))) ++ ret = checkintf(ps, ret); ++ if (ret) + return ret; + if (ep & USB_DIR_IN) +- pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f); +- else +- pipe = usb_sndbulkpipe(ps->dev, ep & 0x7f); ++ pipe = usb_rcvbulkpipe(ps->dev, ep & 0x7f); ++ else ++ pipe = usb_sndbulkpipe(ps->dev, ep & 0x7f); + + return usb_clear_halt(ps->dev, pipe); + } +- + + static int proc_getdriver(struct dev_state *ps, void __user *arg) + { +@@ -871,23 +890,23 @@ static int proc_setconfig(struct dev_sta + { + int u; + int status = 0; +- struct usb_host_config *actconfig; ++ struct usb_host_config *actconfig; + + if (get_user(u, (int __user *)arg)) + return -EFAULT; + +- actconfig = ps->dev->actconfig; +- +- /* Don't touch the device if any interfaces are claimed. +- * It could interfere with other drivers' operations, and if ++ actconfig = ps->dev->actconfig; ++ ++ /* Don't touch the device if any interfaces are claimed. ++ * It could interfere with other drivers' operations, and if + * an interface is claimed by usbfs it could easily deadlock. + */ +- if (actconfig) { +- int i; +- +- for (i = 0; i < actconfig->desc.bNumInterfaces; ++i) { +- if (usb_interface_claimed(actconfig->interface[i])) { +- dev_warn (&ps->dev->dev, ++ if (actconfig) { ++ int i; ++ ++ for (i = 0; i < actconfig->desc.bNumInterfaces; ++i) { ++ if (usb_interface_claimed(actconfig->interface[i])) { ++ dev_warn(&ps->dev->dev, + "usbfs: interface %d claimed by %s " + "while '%s' sets config #%d\n", + actconfig->interface[i] +@@ -896,11 +915,11 @@ static int proc_setconfig(struct dev_sta + actconfig->interface[i] + ->dev.driver->name, + current->comm, u); +- status = -EBUSY; ++ status = -EBUSY; + break; + } +- } +- } ++ } ++ } + + /* SET_CONFIGURATION is often abused as a "cheap" driver reset, + * so avoid usb_set_configuration()'s kick to sysfs +@@ -916,8 +935,8 @@ static int proc_setconfig(struct dev_sta + } + + static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, +- struct usbdevfs_iso_packet_desc __user *iso_frame_desc, +- void __user *arg) ++ struct usbdevfs_iso_packet_desc __user *iso_frame_desc, ++ void __user *arg) + { + struct usbdevfs_iso_packet_desc *isopkt = NULL; + struct usb_host_endpoint *ep; +@@ -932,12 +951,16 @@ static int proc_do_submiturb(struct dev_ + return -EINVAL; + if (!uurb->buffer) + return -EINVAL; +- if (uurb->signr != 0 && (uurb->signr < SIGRTMIN || uurb->signr > SIGRTMAX)) ++ if (uurb->signr != 0 && (uurb->signr < SIGRTMIN || ++ uurb->signr > SIGRTMAX)) + return -EINVAL; +- if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { +- if ((ifnum = findintfep(ps->dev, uurb->endpoint)) < 0) ++ if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && ++ (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { ++ ifnum = findintfep(ps->dev, uurb->endpoint); ++ if (ifnum < 0) + return ifnum; +- if ((ret = checkintf(ps, ifnum))) ++ ret = checkintf(ps, ifnum); ++ if (ret) + return ret; + } + if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) { +@@ -953,10 +976,13 @@ static int proc_do_submiturb(struct dev_ + case USBDEVFS_URB_TYPE_CONTROL: + if (!usb_endpoint_xfer_control(&ep->desc)) + return -EINVAL; +- /* min 8 byte setup packet, max 8 byte setup plus an arbitrary data stage */ +- if (uurb->buffer_length < 8 || uurb->buffer_length > (8 + MAX_USBFS_BUFFER_SIZE)) ++ /* min 8 byte setup packet, ++ * max 8 byte setup plus an arbitrary data stage */ ++ if (uurb->buffer_length < 8 || ++ uurb->buffer_length > (8 + MAX_USBFS_BUFFER_SIZE)) + return -EINVAL; +- if (!(dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL))) ++ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); ++ if (!dr) + return -ENOMEM; + if (copy_from_user(dr, uurb->buffer, 8)) { + kfree(dr); +@@ -966,7 +992,9 @@ static int proc_do_submiturb(struct dev_ + kfree(dr); + return -EINVAL; + } +- if ((ret = check_ctrlrecip(ps, dr->bRequestType, le16_to_cpup(&dr->wIndex)))) { ++ ret = check_ctrlrecip(ps, dr->bRequestType, ++ le16_to_cpup(&dr->wIndex)); ++ if (ret) { + kfree(dr); + return ret; + } +@@ -1012,11 +1040,13 @@ static int proc_do_submiturb(struct dev_ + + case USBDEVFS_URB_TYPE_ISO: + /* arbitrary limit */ +- if (uurb->number_of_packets < 1 || uurb->number_of_packets > 128) ++ if (uurb->number_of_packets < 1 || ++ uurb->number_of_packets > 128) + return -EINVAL; + if (!usb_endpoint_xfer_isoc(&ep->desc)) + return -EINVAL; +- isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets; ++ isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * ++ uurb->number_of_packets; + if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) + return -ENOMEM; + if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) { +@@ -1024,7 +1054,8 @@ static int proc_do_submiturb(struct dev_ + return -EFAULT; + } + for (totlen = u = 0; u < uurb->number_of_packets; u++) { +- /* arbitrary limit, sufficient for USB 2.0 high-bandwidth iso */ ++ /* arbitrary limit, ++ * sufficient for USB 2.0 high-bandwidth iso */ + if (isopkt[u].length > 8192) { + kfree(isopkt); + return -EINVAL; +@@ -1054,25 +1085,27 @@ static int proc_do_submiturb(struct dev_ + default: + return -EINVAL; + } +- if (!(as = alloc_async(uurb->number_of_packets))) { ++ as = alloc_async(uurb->number_of_packets); ++ if (!as) { + kfree(isopkt); + kfree(dr); + return -ENOMEM; + } +- if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) { ++ as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL); ++ if (!as->urb->transfer_buffer) { + kfree(isopkt); + kfree(dr); + free_async(as); + return -ENOMEM; + } +- as->urb->dev = ps->dev; +- as->urb->pipe = (uurb->type << 30) | ++ as->urb->dev = ps->dev; ++ as->urb->pipe = (uurb->type << 30) | + __create_pipe(ps->dev, uurb->endpoint & 0xf) | + (uurb->endpoint & USB_DIR_IN); +- as->urb->transfer_flags = uurb->flags | ++ as->urb->transfer_flags = uurb->flags | + (is_in ? URB_DIR_IN : URB_DIR_OUT); + as->urb->transfer_buffer_length = uurb->buffer_length; +- as->urb->setup_packet = (unsigned char*)dr; ++ as->urb->setup_packet = (unsigned char *)dr; + as->urb->start_frame = uurb->start_frame; + as->urb->number_of_packets = uurb->number_of_packets; + if (uurb->type == USBDEVFS_URB_TYPE_ISO || +@@ -1080,8 +1113,8 @@ static int proc_do_submiturb(struct dev_ + as->urb->interval = 1 << min(15, ep->desc.bInterval - 1); + else + as->urb->interval = ep->desc.bInterval; +- as->urb->context = as; +- as->urb->complete = async_completed; ++ as->urb->context = as; ++ as->urb->complete = async_completed; + for (totlen = u = 0; u < uurb->number_of_packets; u++) { + as->urb->iso_frame_desc[u].offset = totlen; + as->urb->iso_frame_desc[u].length = isopkt[u].length; +@@ -1089,7 +1122,7 @@ static int proc_do_submiturb(struct dev_ + } + kfree(isopkt); + as->ps = ps; +- as->userurb = arg; ++ as->userurb = arg; + if (uurb->endpoint & USB_DIR_IN) + as->userbuffer = uurb->buffer; + else +@@ -1108,14 +1141,15 @@ static int proc_do_submiturb(struct dev_ + } + } + snoop_urb(as->urb, as->userurb); +- async_newpending(as); +- if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) { +- dev_printk(KERN_DEBUG, &ps->dev->dev, "usbfs: usb_submit_urb returned %d\n", ret); +- async_removepending(as); +- free_async(as); +- return ret; +- } +- return 0; ++ async_newpending(as); ++ if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) { ++ dev_printk(KERN_DEBUG, &ps->dev->dev, ++ "usbfs: usb_submit_urb returned %d\n", ret); ++ async_removepending(as); ++ free_async(as); ++ return ret; ++ } ++ return 0; + } + + static int proc_submiturb(struct dev_state *ps, void __user *arg) +@@ -1125,7 +1159,9 @@ static int proc_submiturb(struct dev_sta + if (copy_from_user(&uurb, arg, sizeof(uurb))) + return -EFAULT; + +- return proc_do_submiturb(ps, &uurb, (((struct usbdevfs_urb __user *)arg)->iso_frame_desc), arg); ++ return proc_do_submiturb(ps, &uurb, ++ (((struct usbdevfs_urb __user *)arg)->iso_frame_desc), ++ arg); + } + + static int proc_unlinkurb(struct dev_state *ps, void __user *arg) +@@ -1147,7 +1183,8 @@ static int processcompl(struct async *as + unsigned int i; + + if (as->userbuffer) +- if (copy_to_user(as->userbuffer, urb->transfer_buffer, urb->transfer_buffer_length)) ++ if (copy_to_user(as->userbuffer, urb->transfer_buffer, ++ urb->transfer_buffer_length)) + return -EFAULT; + if (put_user(as->status, &userurb->status)) + return -EFAULT; +@@ -1174,16 +1211,17 @@ static int processcompl(struct async *as + return 0; + } + +-static struct async* reap_as(struct dev_state *ps) ++static struct async *reap_as(struct dev_state *ps) + { +- DECLARE_WAITQUEUE(wait, current); ++ DECLARE_WAITQUEUE(wait, current); + struct async *as = NULL; + struct usb_device *dev = ps->dev; + + add_wait_queue(&ps->wait, &wait); + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); +- if ((as = async_getcompleted(ps))) ++ as = async_getcompleted(ps); ++ if (as) + break; + if (signal_pending(current)) + break; +@@ -1247,10 +1285,12 @@ static int proc_submiturb_compat(struct + { + struct usbdevfs_urb uurb; + +- if (get_urb32(&uurb,(struct usbdevfs_urb32 __user *)arg)) ++ if (get_urb32(&uurb, (struct usbdevfs_urb32 __user *)arg)) + return -EFAULT; + +- return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg); ++ return proc_do_submiturb(ps, &uurb, ++ ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, ++ arg); + } + + static int processcompl_compat(struct async *as, void __user * __user *arg) +@@ -1261,7 +1301,8 @@ static int processcompl_compat(struct as + unsigned int i; + + if (as->userbuffer) +- if (copy_to_user(as->userbuffer, urb->transfer_buffer, urb->transfer_buffer_length)) ++ if (copy_to_user(as->userbuffer, urb->transfer_buffer, ++ urb->transfer_buffer_length)) + return -EFAULT; + if (put_user(as->status, &userurb->status)) + return -EFAULT; +@@ -1352,16 +1393,16 @@ static int proc_ioctl(struct dev_state * + struct usb_driver *driver = NULL; + + /* alloc buffer */ +- if ((size = _IOC_SIZE (ctl->ioctl_code)) > 0) { +- if ((buf = kmalloc (size, GFP_KERNEL)) == NULL) ++ if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) { ++ if ((buf = kmalloc(size, GFP_KERNEL)) == NULL) + return -ENOMEM; + if ((_IOC_DIR(ctl->ioctl_code) & _IOC_WRITE)) { +- if (copy_from_user (buf, ctl->data, size)) { ++ if (copy_from_user(buf, ctl->data, size)) { + kfree(buf); + return -EFAULT; + } + } else { +- memset (buf, 0, size); ++ memset(buf, 0, size); + } + } + +@@ -1372,15 +1413,15 @@ static int proc_ioctl(struct dev_state * + + if (ps->dev->state != USB_STATE_CONFIGURED) + retval = -EHOSTUNREACH; +- else if (!(intf = usb_ifnum_to_if (ps->dev, ctl->ifno))) +- retval = -EINVAL; ++ else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno))) ++ retval = -EINVAL; + else switch (ctl->ioctl_code) { + + /* disconnect kernel driver from interface */ + case USBDEVFS_DISCONNECT: + if (intf->dev.driver) { + driver = to_usb_driver(intf->dev.driver); +- dev_dbg (&intf->dev, "disconnect by usbfs\n"); ++ dev_dbg(&intf->dev, "disconnect by usbfs\n"); + usb_driver_release_interface(driver, intf); + } else + retval = -ENODATA; +@@ -1401,7 +1442,7 @@ static int proc_ioctl(struct dev_state * + if (driver == NULL || driver->ioctl == NULL) { + retval = -ENOTTY; + } else { +- retval = driver->ioctl (intf, ctl->ioctl_code, buf); ++ retval = driver->ioctl(intf, ctl->ioctl_code, buf); + if (retval == -ENOIOCTLCMD) + retval = -ENOTTY; + } +@@ -1409,9 +1450,9 @@ static int proc_ioctl(struct dev_state * + + /* cleanup and return */ + if (retval >= 0 +- && (_IOC_DIR (ctl->ioctl_code) & _IOC_READ) != 0 ++ && (_IOC_DIR(ctl->ioctl_code) & _IOC_READ) != 0 + && size > 0 +- && copy_to_user (ctl->data, buf, size) != 0) ++ && copy_to_user(ctl->data, buf, size) != 0) + retval = -EFAULT; + + kfree(buf); +@@ -1422,7 +1463,7 @@ static int proc_ioctl_default(struct dev + { + struct usbdevfs_ioctl ctrl; + +- if (copy_from_user(&ctrl, arg, sizeof (ctrl))) ++ if (copy_from_user(&ctrl, arg, sizeof(ctrl))) + return -EFAULT; + return proc_ioctl(ps, &ctrl); + } +@@ -1450,7 +1491,8 @@ static int proc_ioctl_compat(struct dev_ + * are assuming that somehow the configuration has been prevented from + * changing. But there's no mechanism to ensure that... + */ +-static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) ++static int usbdev_ioctl(struct inode *inode, struct file *file, ++ unsigned int cmd, unsigned long arg) + { + struct dev_state *ps = file->private_data; + struct usb_device *dev = ps->dev; +@@ -1593,7 +1635,8 @@ static int usbdev_ioctl(struct inode *in + } + + /* No kernel lock - fine */ +-static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wait) ++static unsigned int usbdev_poll(struct file *file, ++ struct poll_table_struct *wait) + { + struct dev_state *ps = file->private_data; + unsigned int mask = 0; +@@ -1664,7 +1707,7 @@ int __init usb_devio_init(void) + int retval; + + retval = register_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX, +- "usb_device"); ++ "usb_device"); + if (retval) { + err("unable to register minors for usb_device"); + goto out; diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-hcd-pci.c.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-hcd-pci.c.patch new file mode 100644 index 00000000000000..88b2c8793e7f3c --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-hcd-pci.c.patch @@ -0,0 +1,336 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/hcd-pci.c + +Fixes a number of coding style issues in the hcd-pci.c file. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/hcd-pci.c | 129 +++++++++++++++++++++++---------------------- + 1 file changed, 67 insertions(+), 62 deletions(-) + +--- a/drivers/usb/core/hcd-pci.c ++++ b/drivers/usb/core/hcd-pci.c +@@ -1,6 +1,6 @@ + /* + * (C) Copyright David Brownell 2000-2002 +- * ++ * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your +@@ -55,7 +55,7 @@ + * + * Store this function in the HCD's struct pci_driver as probe(). + */ +-int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) ++int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) + { + struct hc_driver *driver; + struct usb_hcd *hcd; +@@ -64,66 +64,71 @@ int usb_hcd_pci_probe (struct pci_dev *d + if (usb_disabled()) + return -ENODEV; + +- if (!id || !(driver = (struct hc_driver *) id->driver_data)) ++ if (!id) ++ return -EINVAL; ++ driver = (struct hc_driver *)id->driver_data; ++ if (!driver) + return -EINVAL; + +- if (pci_enable_device (dev) < 0) ++ if (pci_enable_device(dev) < 0) + return -ENODEV; + dev->current_state = PCI_D0; + dev->dev.power.power_state = PMSG_ON; +- +- if (!dev->irq) { +- dev_err (&dev->dev, ++ ++ if (!dev->irq) { ++ dev_err(&dev->dev, + "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", + pci_name(dev)); +- retval = -ENODEV; ++ retval = -ENODEV; + goto err1; +- } ++ } + +- hcd = usb_create_hcd (driver, &dev->dev, pci_name(dev)); ++ hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); + if (!hcd) { + retval = -ENOMEM; + goto err1; + } + +- if (driver->flags & HCD_MEMORY) { // EHCI, OHCI +- hcd->rsrc_start = pci_resource_start (dev, 0); +- hcd->rsrc_len = pci_resource_len (dev, 0); +- if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len, ++ if (driver->flags & HCD_MEMORY) { ++ /* EHCI, OHCI */ ++ hcd->rsrc_start = pci_resource_start(dev, 0); ++ hcd->rsrc_len = pci_resource_len(dev, 0); ++ if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, + driver->description)) { +- dev_dbg (&dev->dev, "controller already in use\n"); ++ dev_dbg(&dev->dev, "controller already in use\n"); + retval = -EBUSY; + goto err2; + } +- hcd->regs = ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len); ++ hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); + if (hcd->regs == NULL) { +- dev_dbg (&dev->dev, "error mapping memory\n"); ++ dev_dbg(&dev->dev, "error mapping memory\n"); + retval = -EFAULT; + goto err3; + } + +- } else { // UHCI ++ } else { ++ /* UHCI */ + int region; + + for (region = 0; region < PCI_ROM_RESOURCE; region++) { +- if (!(pci_resource_flags (dev, region) & ++ if (!(pci_resource_flags(dev, region) & + IORESOURCE_IO)) + continue; + +- hcd->rsrc_start = pci_resource_start (dev, region); +- hcd->rsrc_len = pci_resource_len (dev, region); +- if (request_region (hcd->rsrc_start, hcd->rsrc_len, ++ hcd->rsrc_start = pci_resource_start(dev, region); ++ hcd->rsrc_len = pci_resource_len(dev, region); ++ if (request_region(hcd->rsrc_start, hcd->rsrc_len, + driver->description)) + break; + } + if (region == PCI_ROM_RESOURCE) { +- dev_dbg (&dev->dev, "no i/o regions available\n"); ++ dev_dbg(&dev->dev, "no i/o regions available\n"); + retval = -EBUSY; + goto err1; + } + } + +- pci_set_master (dev); ++ pci_set_master(dev); + + retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); + if (retval != 0) +@@ -132,18 +137,18 @@ int usb_hcd_pci_probe (struct pci_dev *d + + err4: + if (driver->flags & HCD_MEMORY) { +- iounmap (hcd->regs); ++ iounmap(hcd->regs); + err3: +- release_mem_region (hcd->rsrc_start, hcd->rsrc_len); ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + } else +- release_region (hcd->rsrc_start, hcd->rsrc_len); ++ release_region(hcd->rsrc_start, hcd->rsrc_len); + err2: +- usb_put_hcd (hcd); ++ usb_put_hcd(hcd); + err1: +- pci_disable_device (dev); +- dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); ++ pci_disable_device(dev); ++ dev_err(&dev->dev, "init %s fail, %d\n", pci_name(dev), retval); + return retval; +-} ++} + EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); + + +@@ -161,7 +166,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); + * + * Store this function in the HCD's struct pci_driver as remove(). + */ +-void usb_hcd_pci_remove (struct pci_dev *dev) ++void usb_hcd_pci_remove(struct pci_dev *dev) + { + struct usb_hcd *hcd; + +@@ -169,14 +174,14 @@ void usb_hcd_pci_remove (struct pci_dev + if (!hcd) + return; + +- usb_remove_hcd (hcd); ++ usb_remove_hcd(hcd); + if (hcd->driver->flags & HCD_MEMORY) { +- iounmap (hcd->regs); +- release_mem_region (hcd->rsrc_start, hcd->rsrc_len); ++ iounmap(hcd->regs); ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len); + } else { +- release_region (hcd->rsrc_start, hcd->rsrc_len); ++ release_region(hcd->rsrc_start, hcd->rsrc_len); + } +- usb_put_hcd (hcd); ++ usb_put_hcd(hcd); + pci_disable_device(dev); + } + EXPORT_SYMBOL_GPL(usb_hcd_pci_remove); +@@ -191,7 +196,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_remove); + * + * Store this function in the HCD's struct pci_driver as suspend(). + */ +-int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) ++int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) + { + struct usb_hcd *hcd; + int retval = 0; +@@ -246,8 +251,8 @@ int usb_hcd_pci_suspend (struct pci_dev + + /* no DMA or IRQs except when HC is active */ + if (dev->current_state == PCI_D0) { +- pci_save_state (dev); +- pci_disable_device (dev); ++ pci_save_state(dev); ++ pci_disable_device(dev); + } + + if (message.event == PM_EVENT_FREEZE || +@@ -257,7 +262,7 @@ int usb_hcd_pci_suspend (struct pci_dev + } + + if (!has_pci_pm) { +- dev_dbg (hcd->self.controller, "--> PCI D0/legacy\n"); ++ dev_dbg(hcd->self.controller, "--> PCI D0/legacy\n"); + goto done; + } + +@@ -266,30 +271,30 @@ int usb_hcd_pci_suspend (struct pci_dev + * PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset + * some device state (e.g. as part of clock reinit). + */ +- retval = pci_set_power_state (dev, PCI_D3hot); ++ retval = pci_set_power_state(dev, PCI_D3hot); + suspend_report_result(pci_set_power_state, retval); + if (retval == 0) { + int wake = device_can_wakeup(&hcd->self.root_hub->dev); + + wake = wake && device_may_wakeup(hcd->self.controller); + +- dev_dbg (hcd->self.controller, "--> PCI D3%s\n", ++ dev_dbg(hcd->self.controller, "--> PCI D3%s\n", + wake ? "/wakeup" : ""); + + /* Ignore these return values. We rely on pci code to + * reject requests the hardware can't implement, rather + * than coding the same thing. + */ +- (void) pci_enable_wake (dev, PCI_D3hot, wake); +- (void) pci_enable_wake (dev, PCI_D3cold, wake); ++ (void) pci_enable_wake(dev, PCI_D3hot, wake); ++ (void) pci_enable_wake(dev, PCI_D3cold, wake); + } else { +- dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n", ++ dev_dbg(&dev->dev, "PCI D3 suspend fail, %d\n", + retval); +- (void) usb_hcd_pci_resume (dev); ++ (void) usb_hcd_pci_resume(dev); + } + + } else if (hcd->state != HC_STATE_HALT) { +- dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", ++ dev_dbg(hcd->self.controller, "hcd state %d; not suspended\n", + hcd->state); + WARN_ON(1); + retval = -EINVAL; +@@ -304,7 +309,7 @@ done: + if (machine_is(powermac)) { + struct device_node *of_node; + +- of_node = pci_device_to_OF_node (dev); ++ of_node = pci_device_to_OF_node(dev); + if (of_node) + pmac_call_feature(PMAC_FTR_USB_ENABLE, + of_node, 0, 0); +@@ -322,14 +327,14 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); + * + * Store this function in the HCD's struct pci_driver as resume(). + */ +-int usb_hcd_pci_resume (struct pci_dev *dev) ++int usb_hcd_pci_resume(struct pci_dev *dev) + { + struct usb_hcd *hcd; + int retval; + + hcd = pci_get_drvdata(dev); + if (hcd->state != HC_STATE_SUSPENDED) { +- dev_dbg (hcd->self.controller, ++ dev_dbg(hcd->self.controller, + "can't resume, not suspended!\n"); + return 0; + } +@@ -339,9 +344,9 @@ int usb_hcd_pci_resume (struct pci_dev * + if (machine_is(powermac)) { + struct device_node *of_node; + +- of_node = pci_device_to_OF_node (dev); ++ of_node = pci_device_to_OF_node(dev); + if (of_node) +- pmac_call_feature (PMAC_FTR_USB_ENABLE, ++ pmac_call_feature(PMAC_FTR_USB_ENABLE, + of_node, 0, 1); + } + #endif +@@ -380,8 +385,8 @@ int usb_hcd_pci_resume (struct pci_dev * + } + #endif + /* yes, ignore these results too... */ +- (void) pci_enable_wake (dev, dev->current_state, 0); +- (void) pci_enable_wake (dev, PCI_D3cold, 0); ++ (void) pci_enable_wake(dev, dev->current_state, 0); ++ (void) pci_enable_wake(dev, PCI_D3cold, 0); + } else { + /* Same basic cases: clean (powered/not), dirty */ + dev_dbg(hcd->self.controller, "PCI legacy resume\n"); +@@ -392,14 +397,14 @@ int usb_hcd_pci_resume (struct pci_dev * + * but that won't re-enable bus mastering. Yet pci_disable_device() + * explicitly disables bus mastering... + */ +- retval = pci_enable_device (dev); ++ retval = pci_enable_device(dev); + if (retval < 0) { +- dev_err (hcd->self.controller, ++ dev_err(hcd->self.controller, + "can't re-enable after resume, %d!\n", retval); + return retval; + } +- pci_set_master (dev); +- pci_restore_state (dev); ++ pci_set_master(dev); ++ pci_restore_state(dev); + + dev->dev.power.power_state = PMSG_ON; + +@@ -408,9 +413,9 @@ int usb_hcd_pci_resume (struct pci_dev * + if (hcd->driver->resume) { + retval = hcd->driver->resume(hcd); + if (retval) { +- dev_err (hcd->self.controller, ++ dev_err(hcd->self.controller, + "PCI post-resume error %d!\n", retval); +- usb_hc_died (hcd); ++ usb_hc_died(hcd); + } + } + +@@ -424,7 +429,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_resume); + * usb_hcd_pci_shutdown - shutdown host controller + * @dev: USB Host Controller being shutdown + */ +-void usb_hcd_pci_shutdown (struct pci_dev *dev) ++void usb_hcd_pci_shutdown(struct pci_dev *dev) + { + struct usb_hcd *hcd; + diff --git a/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-message.c.patch b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-message.c.patch new file mode 100644 index 00000000000000..e5fdf2e3971885 --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-drivers-usb-core-message.c.patch @@ -0,0 +1,841 @@ +From foo@baz.org Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in drivers/usb/core/message.c + +Fixes a number of coding style issues in the message.c file. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/core/message.c | 402 +++++++++++++++++++++++---------------------- + 1 file changed, 206 insertions(+), 196 deletions(-) + +--- a/drivers/usb/core/message.c ++++ b/drivers/usb/core/message.c +@@ -39,7 +39,7 @@ static void usb_api_blocking_completion( + * own interruptible routines. + */ + static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length) +-{ ++{ + struct api_context ctx; + unsigned long expire; + int retval; +@@ -74,9 +74,9 @@ out: + } + + /*-------------------------------------------------------------------*/ +-// returns status (negative) or length (positive) ++/* returns status (negative) or length (positive) */ + static int usb_internal_control_msg(struct usb_device *usb_dev, +- unsigned int pipe, ++ unsigned int pipe, + struct usb_ctrlrequest *cmd, + void *data, int len, int timeout) + { +@@ -87,7 +87,7 @@ static int usb_internal_control_msg(stru + urb = usb_alloc_urb(0, GFP_NOIO); + if (!urb) + return -ENOMEM; +- ++ + usb_fill_control_urb(urb, usb_dev, pipe, (unsigned char *)cmd, data, + len, usb_api_blocking_completion, NULL); + +@@ -99,47 +99,51 @@ static int usb_internal_control_msg(stru + } + + /** +- * usb_control_msg - Builds a control urb, sends it off and waits for completion +- * @dev: pointer to the usb device to send the message to +- * @pipe: endpoint "pipe" to send the message to +- * @request: USB message request value +- * @requesttype: USB message request type value +- * @value: USB message value +- * @index: USB message index value +- * @data: pointer to the data to send +- * @size: length in bytes of the data to send +- * @timeout: time in msecs to wait for the message to complete before +- * timing out (if 0 the wait is forever) +- * Context: !in_interrupt () +- * +- * This function sends a simple control message to a specified endpoint +- * and waits for the message to complete, or timeout. +- * +- * If successful, it returns the number of bytes transferred, otherwise a negative error number. +- * +- * Don't use this function from within an interrupt context, like a +- * bottom half handler. If you need an asynchronous message, or need to send +- * a message from within interrupt context, use usb_submit_urb() +- * If a thread in your driver uses this call, make sure your disconnect() +- * method can wait for it to complete. Since you don't have a handle on +- * the URB used, you can't cancel the request. +- */ +-int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, +- __u16 value, __u16 index, void *data, __u16 size, int timeout) ++ * usb_control_msg - Builds a control urb, sends it off and waits for completion ++ * @dev: pointer to the usb device to send the message to ++ * @pipe: endpoint "pipe" to send the message to ++ * @request: USB message request value ++ * @requesttype: USB message request type value ++ * @value: USB message value ++ * @index: USB message index value ++ * @data: pointer to the data to send ++ * @size: length in bytes of the data to send ++ * @timeout: time in msecs to wait for the message to complete before timing ++ * out (if 0 the wait is forever) ++ * ++ * Context: !in_interrupt () ++ * ++ * This function sends a simple control message to a specified endpoint and ++ * waits for the message to complete, or timeout. ++ * ++ * If successful, it returns the number of bytes transferred, otherwise a ++ * negative error number. ++ * ++ * Don't use this function from within an interrupt context, like a bottom half ++ * handler. If you need an asynchronous message, or need to send a message ++ * from within interrupt context, use usb_submit_urb(). ++ * If a thread in your driver uses this call, make sure your disconnect() ++ * method can wait for it to complete. Since you don't have a handle on the ++ * URB used, you can't cancel the request. ++ */ ++int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, ++ __u8 requesttype, __u16 value, __u16 index, void *data, ++ __u16 size, int timeout) + { +- struct usb_ctrlrequest *dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); ++ struct usb_ctrlrequest *dr; + int ret; +- ++ ++ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); + if (!dr) + return -ENOMEM; + +- dr->bRequestType= requesttype; ++ dr->bRequestType = requesttype; + dr->bRequest = request; + dr->wValue = cpu_to_le16p(&value); + dr->wIndex = cpu_to_le16p(&index); + dr->wLength = cpu_to_le16p(&size); + +- //dbg("usb_control_msg"); ++ /* dbg("usb_control_msg"); */ + + ret = usb_internal_control_msg(dev, pipe, dr, data, size, timeout); + +@@ -155,9 +159,11 @@ EXPORT_SYMBOL_GPL(usb_control_msg); + * @pipe: endpoint "pipe" to send the message to + * @data: pointer to the data to send + * @len: length in bytes of the data to send +- * @actual_length: pointer to a location to put the actual length transferred in bytes ++ * @actual_length: pointer to a location to put the actual length transferred ++ * in bytes + * @timeout: time in msecs to wait for the message to complete before + * timing out (if 0 the wait is forever) ++ * + * Context: !in_interrupt () + * + * This function sends a simple interrupt message to a specified endpoint and +@@ -181,38 +187,38 @@ int usb_interrupt_msg(struct usb_device + EXPORT_SYMBOL_GPL(usb_interrupt_msg); + + /** +- * usb_bulk_msg - Builds a bulk urb, sends it off and waits for completion +- * @usb_dev: pointer to the usb device to send the message to +- * @pipe: endpoint "pipe" to send the message to +- * @data: pointer to the data to send +- * @len: length in bytes of the data to send +- * @actual_length: pointer to a location to put the actual length transferred in bytes +- * @timeout: time in msecs to wait for the message to complete before +- * timing out (if 0 the wait is forever) +- * Context: !in_interrupt () +- * +- * This function sends a simple bulk message to a specified endpoint +- * and waits for the message to complete, or timeout. +- * +- * If successful, it returns 0, otherwise a negative error number. +- * The number of actual bytes transferred will be stored in the +- * actual_length paramater. +- * +- * Don't use this function from within an interrupt context, like a +- * bottom half handler. If you need an asynchronous message, or need to +- * send a message from within interrupt context, use usb_submit_urb() +- * If a thread in your driver uses this call, make sure your disconnect() +- * method can wait for it to complete. Since you don't have a handle on +- * the URB used, you can't cancel the request. +- * +- * Because there is no usb_interrupt_msg() and no USBDEVFS_INTERRUPT +- * ioctl, users are forced to abuse this routine by using it to submit +- * URBs for interrupt endpoints. We will take the liberty of creating +- * an interrupt URB (with the default interval) if the target is an +- * interrupt endpoint. ++ * usb_bulk_msg - Builds a bulk urb, sends it off and waits for completion ++ * @usb_dev: pointer to the usb device to send the message to ++ * @pipe: endpoint "pipe" to send the message to ++ * @data: pointer to the data to send ++ * @len: length in bytes of the data to send ++ * @actual_length: pointer to a location to put the actual length transferred ++ * in bytes ++ * @timeout: time in msecs to wait for the message to complete before ++ * timing out (if 0 the wait is forever) ++ * ++ * Context: !in_interrupt () ++ * ++ * This function sends a simple bulk message to a specified endpoint ++ * and waits for the message to complete, or timeout. ++ * ++ * If successful, it returns 0, otherwise a negative error number. The number ++ * of actual bytes transferred will be stored in the actual_length paramater. ++ * ++ * Don't use this function from within an interrupt context, like a bottom half ++ * handler. If you need an asynchronous message, or need to send a message ++ * from within interrupt context, use usb_submit_urb() If a thread in your ++ * driver uses this call, make sure your disconnect() method can wait for it to ++ * complete. Since you don't have a handle on the URB used, you can't cancel ++ * the request. ++ * ++ * Because there is no usb_interrupt_msg() and no USBDEVFS_INTERRUPT ioctl, ++ * users are forced to abuse this routine by using it to submit URBs for ++ * interrupt endpoints. We will take the liberty of creating an interrupt URB ++ * (with the default interval) if the target is an interrupt endpoint. + */ +-int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, +- void *data, int len, int *actual_length, int timeout) ++int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, ++ void *data, int len, int *actual_length, int timeout) + { + struct urb *urb; + struct usb_host_endpoint *ep; +@@ -242,26 +248,26 @@ EXPORT_SYMBOL_GPL(usb_bulk_msg); + + /*-------------------------------------------------------------------*/ + +-static void sg_clean (struct usb_sg_request *io) ++static void sg_clean(struct usb_sg_request *io) + { + if (io->urbs) { + while (io->entries--) +- usb_free_urb (io->urbs [io->entries]); +- kfree (io->urbs); ++ usb_free_urb(io->urbs [io->entries]); ++ kfree(io->urbs); + io->urbs = NULL; + } + if (io->dev->dev.dma_mask != NULL) +- usb_buffer_unmap_sg (io->dev, usb_pipein(io->pipe), +- io->sg, io->nents); ++ usb_buffer_unmap_sg(io->dev, usb_pipein(io->pipe), ++ io->sg, io->nents); + io->dev = NULL; + } + +-static void sg_complete (struct urb *urb) ++static void sg_complete(struct urb *urb) + { +- struct usb_sg_request *io = urb->context; ++ struct usb_sg_request *io = urb->context; + int status = urb->status; + +- spin_lock (&io->lock); ++ spin_lock(&io->lock); + + /* In 2.5 we require hcds' endpoint queues not to progress after fault + * reports, until the completion callback (this!) returns. That lets +@@ -277,13 +283,13 @@ static void sg_complete (struct urb *urb + && (io->status != -ECONNRESET + || status != -ECONNRESET) + && urb->actual_length) { +- dev_err (io->dev->bus->controller, ++ dev_err(io->dev->bus->controller, + "dev %s ep%d%s scatterlist error %d/%d\n", + io->dev->devpath, + usb_endpoint_num(&urb->ep->desc), + usb_urb_dir_in(urb) ? "in" : "out", + status, io->status); +- // BUG (); ++ /* BUG (); */ + } + + if (io->status == 0 && status && status != -ECONNRESET) { +@@ -295,22 +301,22 @@ static void sg_complete (struct urb *urb + * unlink pending urbs so they won't rx/tx bad data. + * careful: unlink can sometimes be synchronous... + */ +- spin_unlock (&io->lock); ++ spin_unlock(&io->lock); + for (i = 0, found = 0; i < io->entries; i++) { + if (!io->urbs [i] || !io->urbs [i]->dev) + continue; + if (found) { +- retval = usb_unlink_urb (io->urbs [i]); ++ retval = usb_unlink_urb(io->urbs [i]); + if (retval != -EINPROGRESS && + retval != -ENODEV && + retval != -EBUSY) +- dev_err (&io->dev->dev, ++ dev_err(&io->dev->dev, + "%s, unlink --> %d\n", + __FUNCTION__, retval); + } else if (urb == io->urbs [i]) + found = 1; + } +- spin_lock (&io->lock); ++ spin_lock(&io->lock); + } + urb->dev = NULL; + +@@ -318,9 +324,9 @@ static void sg_complete (struct urb *urb + io->bytes += urb->actual_length; + io->count--; + if (!io->count) +- complete (&io->complete); ++ complete(&io->complete); + +- spin_unlock (&io->lock); ++ spin_unlock(&io->lock); + } + + +@@ -349,28 +355,21 @@ static void sg_complete (struct urb *urb + * The request may be canceled with usb_sg_cancel(), either before or after + * usb_sg_wait() is called. + */ +-int usb_sg_init ( +- struct usb_sg_request *io, +- struct usb_device *dev, +- unsigned pipe, +- unsigned period, +- struct scatterlist *sg, +- int nents, +- size_t length, +- gfp_t mem_flags +-) +-{ +- int i; +- int urb_flags; +- int dma; ++int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, ++ unsigned pipe, unsigned period, struct scatterlist *sg, ++ int nents, size_t length, gfp_t mem_flags) ++{ ++ int i; ++ int urb_flags; ++ int dma; + + if (!io || !dev || !sg +- || usb_pipecontrol (pipe) +- || usb_pipeisoc (pipe) ++ || usb_pipecontrol(pipe) ++ || usb_pipeisoc(pipe) + || nents <= 0) + return -EINVAL; + +- spin_lock_init (&io->lock); ++ spin_lock_init(&io->lock); + io->dev = dev; + io->pipe = pipe; + io->sg = sg; +@@ -382,7 +381,7 @@ int usb_sg_init ( + dma = (dev->dev.dma_mask != NULL); + if (dma) + io->entries = usb_buffer_map_sg(dev, usb_pipein(pipe), +- sg, nents); ++ sg, nents); + else + io->entries = nents; + +@@ -391,30 +390,30 @@ int usb_sg_init ( + return io->entries; + + io->count = io->entries; +- io->urbs = kmalloc (io->entries * sizeof *io->urbs, mem_flags); ++ io->urbs = kmalloc(io->entries * sizeof *io->urbs, mem_flags); + if (!io->urbs) + goto nomem; + + urb_flags = URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT; +- if (usb_pipein (pipe)) ++ if (usb_pipein(pipe)) + urb_flags |= URB_SHORT_NOT_OK; + + for (i = 0; i < io->entries; i++) { +- unsigned len; ++ unsigned len; + +- io->urbs [i] = usb_alloc_urb (0, mem_flags); +- if (!io->urbs [i]) { ++ io->urbs[i] = usb_alloc_urb(0, mem_flags); ++ if (!io->urbs[i]) { + io->entries = i; + goto nomem; + } + +- io->urbs [i]->dev = NULL; +- io->urbs [i]->pipe = pipe; +- io->urbs [i]->interval = period; +- io->urbs [i]->transfer_flags = urb_flags; ++ io->urbs[i]->dev = NULL; ++ io->urbs[i]->pipe = pipe; ++ io->urbs[i]->interval = period; ++ io->urbs[i]->transfer_flags = urb_flags; + +- io->urbs [i]->complete = sg_complete; +- io->urbs [i]->context = io; ++ io->urbs[i]->complete = sg_complete; ++ io->urbs[i]->context = io; + + /* + * Some systems need to revert to PIO when DMA is temporarily +@@ -433,8 +432,8 @@ int usb_sg_init ( + * to prevent stale pointers and to help spot bugs. + */ + if (dma) { +- io->urbs [i]->transfer_dma = sg_dma_address (sg + i); +- len = sg_dma_len (sg + i); ++ io->urbs[i]->transfer_dma = sg_dma_address(sg + i); ++ len = sg_dma_len(sg + i); + #if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU) + io->urbs[i]->transfer_buffer = NULL; + #else +@@ -442,28 +441,28 @@ int usb_sg_init ( + #endif + } else { + /* hc may use _only_ transfer_buffer */ +- io->urbs [i]->transfer_buffer = sg_virt(&sg[i]); +- len = sg [i].length; ++ io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); ++ len = sg[i].length; + } + + if (length) { +- len = min_t (unsigned, len, length); ++ len = min_t(unsigned, len, length); + length -= len; + if (length == 0) + io->entries = i + 1; + } +- io->urbs [i]->transfer_buffer_length = len; ++ io->urbs[i]->transfer_buffer_length = len; + } +- io->urbs [--i]->transfer_flags &= ~URB_NO_INTERRUPT; ++ io->urbs[--i]->transfer_flags &= ~URB_NO_INTERRUPT; + + /* transaction state */ + io->status = 0; + io->bytes = 0; +- init_completion (&io->complete); ++ init_completion(&io->complete); + return 0; + + nomem: +- sg_clean (io); ++ sg_clean(io); + return -ENOMEM; + } + EXPORT_SYMBOL_GPL(usb_sg_init); +@@ -507,31 +506,32 @@ EXPORT_SYMBOL_GPL(usb_sg_init); + * speed interrupt endpoints, which allow at most one packet per millisecond, + * of at most 8 or 64 bytes (respectively). + */ +-void usb_sg_wait (struct usb_sg_request *io) ++void usb_sg_wait(struct usb_sg_request *io) + { +- int i, entries = io->entries; ++ int i; ++ int entries = io->entries; + + /* queue the urbs. */ +- spin_lock_irq (&io->lock); ++ spin_lock_irq(&io->lock); + i = 0; + while (i < entries && !io->status) { +- int retval; ++ int retval; + +- io->urbs [i]->dev = io->dev; +- retval = usb_submit_urb (io->urbs [i], GFP_ATOMIC); ++ io->urbs[i]->dev = io->dev; ++ retval = usb_submit_urb(io->urbs [i], GFP_ATOMIC); + + /* after we submit, let completions or cancelations fire; + * we handshake using io->status. + */ +- spin_unlock_irq (&io->lock); ++ spin_unlock_irq(&io->lock); + switch (retval) { + /* maybe we retrying will recover */ +- case -ENXIO: // hc didn't queue this one ++ case -ENXIO: /* hc didn't queue this one */ + case -EAGAIN: + case -ENOMEM: + io->urbs[i]->dev = NULL; + retval = 0; +- yield (); ++ yield(); + break; + + /* no error? continue immediately. +@@ -542,33 +542,33 @@ void usb_sg_wait (struct usb_sg_request + */ + case 0: + ++i; +- cpu_relax (); ++ cpu_relax(); + break; + + /* fail any uncompleted urbs */ + default: +- io->urbs [i]->dev = NULL; +- io->urbs [i]->status = retval; +- dev_dbg (&io->dev->dev, "%s, submit --> %d\n", ++ io->urbs[i]->dev = NULL; ++ io->urbs[i]->status = retval; ++ dev_dbg(&io->dev->dev, "%s, submit --> %d\n", + __FUNCTION__, retval); +- usb_sg_cancel (io); ++ usb_sg_cancel(io); + } +- spin_lock_irq (&io->lock); ++ spin_lock_irq(&io->lock); + if (retval && (io->status == 0 || io->status == -ECONNRESET)) + io->status = retval; + } + io->count -= entries - i; + if (io->count == 0) +- complete (&io->complete); +- spin_unlock_irq (&io->lock); ++ complete(&io->complete); ++ spin_unlock_irq(&io->lock); + + /* OK, yes, this could be packaged as non-blocking. + * So could the submit loop above ... but it's easier to + * solve neither problem than to solve both! + */ +- wait_for_completion (&io->complete); ++ wait_for_completion(&io->complete); + +- sg_clean (io); ++ sg_clean(io); + } + EXPORT_SYMBOL_GPL(usb_sg_wait); + +@@ -580,31 +580,31 @@ EXPORT_SYMBOL_GPL(usb_sg_wait); + * It can also prevents one initialized by usb_sg_init() from starting, + * so that call just frees resources allocated to the request. + */ +-void usb_sg_cancel (struct usb_sg_request *io) ++void usb_sg_cancel(struct usb_sg_request *io) + { +- unsigned long flags; ++ unsigned long flags; + +- spin_lock_irqsave (&io->lock, flags); ++ spin_lock_irqsave(&io->lock, flags); + + /* shut everything down, if it didn't already */ + if (!io->status) { +- int i; ++ int i; + + io->status = -ECONNRESET; +- spin_unlock (&io->lock); ++ spin_unlock(&io->lock); + for (i = 0; i < io->entries; i++) { +- int retval; ++ int retval; + + if (!io->urbs [i]->dev) + continue; +- retval = usb_unlink_urb (io->urbs [i]); ++ retval = usb_unlink_urb(io->urbs [i]); + if (retval != -EINPROGRESS && retval != -EBUSY) +- dev_warn (&io->dev->dev, "%s, unlink --> %d\n", ++ dev_warn(&io->dev->dev, "%s, unlink --> %d\n", + __FUNCTION__, retval); + } +- spin_lock (&io->lock); ++ spin_lock(&io->lock); + } +- spin_unlock_irqrestore (&io->lock, flags); ++ spin_unlock_irqrestore(&io->lock, flags); + } + EXPORT_SYMBOL_GPL(usb_sg_cancel); + +@@ -632,12 +632,13 @@ EXPORT_SYMBOL_GPL(usb_sg_cancel); + * Returns the number of bytes received on success, or else the status code + * returned by the underlying usb_control_msg() call. + */ +-int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char index, void *buf, int size) ++int usb_get_descriptor(struct usb_device *dev, unsigned char type, ++ unsigned char index, void *buf, int size) + { + int i; + int result; +- +- memset(buf,0,size); // Make sure we parse really received data ++ ++ memset(buf, 0, size); /* Make sure we parse really received data */ + + for (i = 0; i < 3; ++i) { + /* retry on length 0 or error; some devices are flakey */ +@@ -712,7 +713,7 @@ static void usb_try_string_workarounds(u + } + + static int usb_string_sub(struct usb_device *dev, unsigned int langid, +- unsigned int index, unsigned char *buf) ++ unsigned int index, unsigned char *buf) + { + int rc; + +@@ -755,7 +756,7 @@ static int usb_string_sub(struct usb_dev + * @buf: where to put the string + * @size: how big is "buf"? + * Context: !in_interrupt () +- * ++ * + * This converts the UTF-16LE encoded strings returned by devices, from + * usb_get_string_descriptor(), to null-terminated ISO-8859-1 encoded ones + * that are more usable in most kernel contexts. Note that all characters +@@ -791,23 +792,23 @@ int usb_string(struct usb_device *dev, i + if (!dev->have_langid) { + err = usb_string_sub(dev, 0, 0, tbuf); + if (err < 0) { +- dev_err (&dev->dev, ++ dev_err(&dev->dev, + "string descriptor 0 read error: %d\n", + err); + goto errout; + } else if (err < 4) { +- dev_err (&dev->dev, "string descriptor 0 too short\n"); ++ dev_err(&dev->dev, "string descriptor 0 too short\n"); + err = -EINVAL; + goto errout; + } else { + dev->have_langid = 1; +- dev->string_langid = tbuf[2] | (tbuf[3]<< 8); +- /* always use the first langid listed */ +- dev_dbg (&dev->dev, "default language 0x%04x\n", ++ dev->string_langid = tbuf[2] | (tbuf[3] << 8); ++ /* always use the first langid listed */ ++ dev_dbg(&dev->dev, "default language 0x%04x\n", + dev->string_langid); + } + } +- ++ + err = usb_string_sub(dev, dev->string_langid, index, tbuf); + if (err < 0) + goto errout; +@@ -825,7 +826,9 @@ int usb_string(struct usb_device *dev, i + err = idx; + + if (tbuf[1] != USB_DT_STRING) +- dev_dbg(&dev->dev, "wrong descriptor type %02x for string %d (\"%s\")\n", tbuf[1], index, buf); ++ dev_dbg(&dev->dev, ++ "wrong descriptor type %02x for string %d (\"%s\")\n", ++ tbuf[1], index, buf); + + errout: + kfree(tbuf); +@@ -847,9 +850,15 @@ char *usb_cache_string(struct usb_device + char *smallbuf = NULL; + int len; + +- if (index > 0 && (buf = kmalloc(256, GFP_KERNEL)) != NULL) { +- if ((len = usb_string(udev, index, buf, 256)) > 0) { +- if ((smallbuf = kmalloc(++len, GFP_KERNEL)) == NULL) ++ if (index <= 0) ++ return NULL; ++ ++ buf = kmalloc(256, GFP_KERNEL); ++ if (buf) { ++ len = usb_string(udev, index, buf, 256); ++ if (len > 0) { ++ smallbuf = kmalloc(++len, GFP_KERNEL); ++ if (!smallbuf) + return buf; + memcpy(smallbuf, buf, len); + } +@@ -888,7 +897,7 @@ int usb_get_device_descriptor(struct usb + return -ENOMEM; + + ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, size); +- if (ret >= 0) ++ if (ret >= 0) + memcpy(&dev->descriptor, desc, size); + kfree(desc); + return ret; +@@ -961,8 +970,8 @@ int usb_clear_halt(struct usb_device *de + { + int result; + int endp = usb_pipeendpoint(pipe); +- +- if (usb_pipein (pipe)) ++ ++ if (usb_pipein(pipe)) + endp |= USB_DIR_IN; + + /* we don't care if it wasn't halted first. in fact some devices +@@ -1045,7 +1054,7 @@ void usb_disable_interface(struct usb_de + } + } + +-/* ++/** + * usb_disable_device - Disable all the endpoints for a USB device + * @dev: the device whose endpoints are being disabled + * @skip_ep0: 0 to disable endpoint 0, 1 to skip it. +@@ -1060,7 +1069,7 @@ void usb_disable_device(struct usb_devic + int i; + + dev_dbg(&dev->dev, "%s nuking %s URBs\n", __FUNCTION__, +- skip_ep0 ? "non-ep0" : "all"); ++ skip_ep0 ? "non-ep0" : "all"); + for (i = skip_ep0; i < 16; ++i) { + usb_disable_endpoint(dev, i); + usb_disable_endpoint(dev, i + USB_DIR_IN); +@@ -1078,17 +1087,17 @@ void usb_disable_device(struct usb_devic + interface = dev->actconfig->interface[i]; + if (!device_is_registered(&interface->dev)) + continue; +- dev_dbg (&dev->dev, "unregistering interface %s\n", ++ dev_dbg(&dev->dev, "unregistering interface %s\n", + interface->dev.bus_id); + usb_remove_sysfs_intf_files(interface); +- device_del (&interface->dev); ++ device_del(&interface->dev); + } + + /* Now that the interfaces are unbound, nobody should + * try to access them. + */ + for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { +- put_device (&dev->actconfig->interface[i]->dev); ++ put_device(&dev->actconfig->interface[i]->dev); + dev->actconfig->interface[i] = NULL; + } + dev->actconfig = NULL; +@@ -1097,8 +1106,7 @@ void usb_disable_device(struct usb_devic + } + } + +- +-/* ++/** + * usb_enable_endpoint - Enable an endpoint for USB communications + * @dev: the device whose interface is being enabled + * @ep: the endpoint +@@ -1123,7 +1131,7 @@ void usb_enable_endpoint(struct usb_devi + ep->enabled = 1; + } + +-/* ++/** + * usb_enable_interface - Enable all the endpoints for an interface + * @dev: the device whose interface is being enabled + * @intf: pointer to the interface descriptor +@@ -1179,6 +1187,8 @@ int usb_set_interface(struct usb_device + struct usb_host_interface *alt; + int ret; + int manual = 0; ++ unsigned int epaddr; ++ unsigned int pipe; + + if (dev->state == USB_STATE_SUSPENDED) + return -EHOSTUNREACH; +@@ -1233,11 +1243,11 @@ int usb_set_interface(struct usb_device + int i; + + for (i = 0; i < alt->desc.bNumEndpoints; i++) { +- unsigned int epaddr = +- alt->endpoint[i].desc.bEndpointAddress; +- unsigned int pipe = +- __create_pipe(dev, USB_ENDPOINT_NUMBER_MASK & epaddr) +- | (usb_endpoint_out(epaddr) ? USB_DIR_OUT : USB_DIR_IN); ++ epaddr = alt->endpoint[i].desc.bEndpointAddress; ++ pipe = __create_pipe(dev, ++ USB_ENDPOINT_NUMBER_MASK & epaddr) | ++ (usb_endpoint_out(epaddr) ? ++ USB_DIR_OUT : USB_DIR_IN); + + usb_clear_halt(dev, pipe); + } +@@ -1366,7 +1376,8 @@ static int usb_if_uevent(struct device * + return -ENOMEM; + + if (add_uevent_var(env, +- "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", ++ "MODALIAS=usb:" ++ "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", + le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct), + le16_to_cpu(usb_dev->descriptor.bcdDevice), +@@ -1396,8 +1407,8 @@ struct device_type usb_if_device_type = + }; + + static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev, +- struct usb_host_config *config, +- u8 inum) ++ struct usb_host_config *config, ++ u8 inum) + { + struct usb_interface_assoc_descriptor *retval = NULL; + struct usb_interface_assoc_descriptor *intf_assoc; +@@ -1424,7 +1435,6 @@ static struct usb_interface_assoc_descri + return retval; + } + +- + /* + * usb_set_configuration - Makes a particular device setting be current + * @dev: the device whose configuration is being updated +@@ -1542,12 +1552,12 @@ free_interfaces: + * getting rid of old interfaces means unbinding their drivers. + */ + if (dev->state != USB_STATE_ADDRESS) +- usb_disable_device (dev, 1); // Skip ep0 +- +- if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- USB_REQ_SET_CONFIGURATION, 0, configuration, 0, +- NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0) { ++ usb_disable_device(dev, 1); /* Skip ep0 */ + ++ ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ++ USB_REQ_SET_CONFIGURATION, 0, configuration, 0, ++ NULL, 0, USB_CTRL_SET_TIMEOUT); ++ if (ret < 0) { + /* All the old state is gone, so what else can we do? + * The device is probably useless now anyway. + */ +@@ -1594,11 +1604,11 @@ free_interfaces: + intf->dev.bus = &usb_bus_type; + intf->dev.type = &usb_if_device_type; + intf->dev.dma_mask = dev->dev.dma_mask; +- device_initialize (&intf->dev); ++ device_initialize(&intf->dev); + mark_quiesced(intf); +- sprintf (&intf->dev.bus_id[0], "%d-%s:%d.%d", +- dev->bus->busnum, dev->devpath, +- configuration, alt->desc.bInterfaceNumber); ++ sprintf(&intf->dev.bus_id[0], "%d-%s:%d.%d", ++ dev->bus->busnum, dev->devpath, ++ configuration, alt->desc.bInterfaceNumber); + } + kfree(new_interfaces); + +@@ -1614,11 +1624,11 @@ free_interfaces: + for (i = 0; i < nintf; ++i) { + struct usb_interface *intf = cp->interface[i]; + +- dev_dbg (&dev->dev, ++ dev_dbg(&dev->dev, + "adding %s (config #%d, interface %d)\n", + intf->dev.bus_id, configuration, + intf->cur_altsetting->desc.bInterfaceNumber); +- ret = device_add (&intf->dev); ++ ret = device_add(&intf->dev); + if (ret != 0) { + dev_err(&dev->dev, "device_add(%s) --> %d\n", + intf->dev.bus_id, ret); diff --git a/usb/usb-fix-codingstyle-issues-in-include-linux-usb.h.patch b/usb/usb-fix-codingstyle-issues-in-include-linux-usb.h.patch new file mode 100644 index 00000000000000..0de12f2e69fd2c --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-include-linux-usb.h.patch @@ -0,0 +1,504 @@ +From e46d6eef5d2cb06f750b0c4441850cb4c79530a1 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:20:32 -0800 +Subject: USB: fix codingstyle issues in include/linux/usb.h + +No logical code changes were made, but checkpatch.pl is much happier now. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + include/linux/usb.h | 204 ++++++++++++++++++++++++++++------------------------ + 1 file changed, 113 insertions(+), 91 deletions(-) + +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -162,19 +162,19 @@ struct usb_interface { + unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ + + struct device dev; /* interface specific device info */ +- struct device *usb_dev; /* pointer to the usb class's device, if any */ ++ struct device *usb_dev; + int pm_usage_cnt; /* usage counter for autosuspend */ + }; + #define to_usb_interface(d) container_of(d, struct usb_interface, dev) + #define interface_to_usbdev(intf) \ + container_of(intf->dev.parent, struct usb_device, dev) + +-static inline void *usb_get_intfdata (struct usb_interface *intf) ++static inline void *usb_get_intfdata(struct usb_interface *intf) + { +- return dev_get_drvdata (&intf->dev); ++ return dev_get_drvdata(&intf->dev); + } + +-static inline void usb_set_intfdata (struct usb_interface *intf, void *data) ++static inline void usb_set_intfdata(struct usb_interface *intf, void *data) + { + dev_set_drvdata(&intf->dev, data); + } +@@ -275,9 +275,10 @@ struct usb_host_config { + + int __usb_get_extra_descriptor(char *buffer, unsigned size, + unsigned char type, void **ptr); +-#define usb_get_extra_descriptor(ifpoint,type,ptr)\ +- __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ +- type,(void**)ptr) ++#define usb_get_extra_descriptor(ifpoint, type, ptr) \ ++ __usb_get_extra_descriptor((ifpoint)->extra, \ ++ (ifpoint)->extralen, \ ++ type, (void **)ptr) + + /* ----------------------------------------------------------------------- */ + +@@ -388,7 +389,7 @@ struct usb_device { + unsigned can_submit:1; /* URBs may be submitted */ + unsigned discon_suspended:1; /* Disconnected while suspended */ + unsigned have_langid:1; /* whether string_langid is valid */ +- unsigned authorized:1; /* Policy has determined we can use it */ ++ unsigned authorized:1; /* Policy has said we can use it */ + unsigned wusb:1; /* Device is Wireless USB */ + int string_langid; /* language ID for strings */ + +@@ -417,7 +418,8 @@ struct usb_device { + + int pm_usage_cnt; /* usage counter for autosuspend */ + u32 quirks; /* quirks of the whole device */ +- atomic_t urbnum; /* number of URBs submitted for the whole device */ ++ atomic_t urbnum; /* number of URBs submitted for ++ the whole device */ + + unsigned long active_duration; /* total time device is not suspended */ + +@@ -501,11 +503,11 @@ static inline void usb_mark_last_busy(st + /*-------------------------------------------------------------------------*/ + + /* for drivers using iso endpoints */ +-extern int usb_get_current_frame_number (struct usb_device *usb_dev); ++extern int usb_get_current_frame_number(struct usb_device *usb_dev); + + /* used these for multi-interface device registration */ + extern int usb_driver_claim_interface(struct usb_driver *driver, +- struct usb_interface *iface, void* priv); ++ struct usb_interface *iface, void *priv); + + /** + * usb_interface_claimed - returns true iff an interface is claimed +@@ -517,7 +519,8 @@ extern int usb_driver_claim_interface(st + * may need to explicitly claim that lock. + * + */ +-static inline int usb_interface_claimed(struct usb_interface *iface) { ++static inline int usb_interface_claimed(struct usb_interface *iface) ++{ + return (iface->dev.driver != NULL); + } + +@@ -560,12 +563,11 @@ extern struct usb_host_interface *usb_al + * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are + * high speed, and a different one if they are full or low speed. + */ +-static inline int usb_make_path (struct usb_device *dev, char *buf, +- size_t size) ++static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) + { + int actual; +- actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, +- dev->devpath); ++ actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, ++ dev->devpath); + return (actual >= (int)size) ? -1 : actual; + } + +@@ -611,7 +613,8 @@ static inline int usb_endpoint_dir_in(co + * + * Returns true if the endpoint is of type OUT, otherwise it returns false. + */ +-static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_dir_out( ++ const struct usb_endpoint_descriptor *epd) + { + return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); + } +@@ -622,7 +625,8 @@ static inline int usb_endpoint_dir_out(c + * + * Returns true if the endpoint is of type bulk, otherwise it returns false. + */ +-static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_xfer_bulk( ++ const struct usb_endpoint_descriptor *epd) + { + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_BULK); +@@ -634,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk + * + * Returns true if the endpoint is of type control, otherwise it returns false. + */ +-static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_xfer_control( ++ const struct usb_endpoint_descriptor *epd) + { + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_CONTROL); +@@ -647,7 +652,8 @@ static inline int usb_endpoint_xfer_cont + * Returns true if the endpoint is of type interrupt, otherwise it returns + * false. + */ +-static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_xfer_int( ++ const struct usb_endpoint_descriptor *epd) + { + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_INT); +@@ -660,7 +666,8 @@ static inline int usb_endpoint_xfer_int( + * Returns true if the endpoint is of type isochronous, otherwise it returns + * false. + */ +-static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_xfer_isoc( ++ const struct usb_endpoint_descriptor *epd) + { + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == + USB_ENDPOINT_XFER_ISOC); +@@ -673,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc + * Returns true if the endpoint has bulk transfer type and IN direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_bulk_in( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); + } +@@ -685,7 +693,8 @@ static inline int usb_endpoint_is_bulk_i + * Returns true if the endpoint has bulk transfer type and OUT direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_bulk_out( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); + } +@@ -697,7 +706,8 @@ static inline int usb_endpoint_is_bulk_o + * Returns true if the endpoint has interrupt transfer type and IN direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_int_in( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); + } +@@ -709,7 +719,8 @@ static inline int usb_endpoint_is_int_in + * Returns true if the endpoint has interrupt transfer type and OUT direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_int_out( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); + } +@@ -721,7 +732,8 @@ static inline int usb_endpoint_is_int_ou + * Returns true if the endpoint has isochronous transfer type and IN direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_isoc_in( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); + } +@@ -733,7 +745,8 @@ static inline int usb_endpoint_is_isoc_i + * Returns true if the endpoint has isochronous transfer type and OUT direction, + * otherwise it returns false. + */ +-static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) ++static inline int usb_endpoint_is_isoc_out( ++ const struct usb_endpoint_descriptor *epd) + { + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); + } +@@ -764,8 +777,9 @@ static inline int usb_endpoint_is_isoc_o + * specific device. + */ + #define USB_DEVICE(vend,prod) \ +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ +- .idProduct = (prod) ++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ ++ .idVendor = (vend), \ ++ .idProduct = (prod) + /** + * USB_DEVICE_VER - macro used to describe a specific usb device with a + * version range +@@ -777,10 +791,12 @@ static inline int usb_endpoint_is_isoc_o + * This macro is used to create a struct usb_device_id that matches a + * specific device, with a version range. + */ +-#define USB_DEVICE_VER(vend,prod,lo,hi) \ ++#define USB_DEVICE_VER(vend, prod, lo, hi) \ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ +- .idVendor = (vend), .idProduct = (prod), \ +- .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) ++ .idVendor = (vend), \ ++ .idProduct = (prod), \ ++ .bcdDevice_lo = (lo), \ ++ .bcdDevice_hi = (hi) + + /** + * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb +@@ -792,8 +808,9 @@ static inline int usb_endpoint_is_isoc_o + * This macro is used to create a struct usb_device_id that matches a + * specific interface protocol of devices. + */ +-#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ +- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ ++#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \ ++ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ ++ USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ + .idVendor = (vend), \ + .idProduct = (prod), \ + .bInterfaceProtocol = (pr) +@@ -807,12 +824,14 @@ static inline int usb_endpoint_is_isoc_o + * This macro is used to create a struct usb_device_id that matches a + * specific class of devices. + */ +-#define USB_DEVICE_INFO(cl,sc,pr) \ +- .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ +- .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) ++#define USB_DEVICE_INFO(cl, sc, pr) \ ++ .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \ ++ .bDeviceClass = (cl), \ ++ .bDeviceSubClass = (sc), \ ++ .bDeviceProtocol = (pr) + + /** +- * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces ++ * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces + * @cl: bInterfaceClass value + * @sc: bInterfaceSubClass value + * @pr: bInterfaceProtocol value +@@ -820,9 +839,11 @@ static inline int usb_endpoint_is_isoc_o + * This macro is used to create a struct usb_device_id that matches a + * specific class of interfaces. + */ +-#define USB_INTERFACE_INFO(cl,sc,pr) \ +- .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ +- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) ++#define USB_INTERFACE_INFO(cl, sc, pr) \ ++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \ ++ .bInterfaceClass = (cl), \ ++ .bInterfaceSubClass = (sc), \ ++ .bInterfaceProtocol = (pr) + + /** + * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device +@@ -839,12 +860,14 @@ static inline int usb_endpoint_is_isoc_o + * This is especially useful when explicitly matching devices that have + * vendor specific bDeviceClass values, but standards-compliant interfaces. + */ +-#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ ++#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ + .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ + | USB_DEVICE_ID_MATCH_DEVICE, \ +- .idVendor = (vend), .idProduct = (prod), \ ++ .idVendor = (vend), \ ++ .idProduct = (prod), \ + .bInterfaceClass = (cl), \ +- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) ++ .bInterfaceSubClass = (sc), \ ++ .bInterfaceProtocol = (pr) + + /* ----------------------------------------------------------------------- */ + +@@ -1122,7 +1145,7 @@ typedef void (*usb_complete_t)(struct ur + * transferred. It will normally be the same as requested, unless + * either an error was reported or a short read was performed. + * The URB_SHORT_NOT_OK transfer flag may be used to make such +- * short reads be reported as errors. ++ * short reads be reported as errors. + * @setup_packet: Only used for control transfers, this points to eight bytes + * of setup data. Control transfers always start by sending this data + * to the device. Then transfer_buffer is read or written, if needed. +@@ -1141,7 +1164,7 @@ typedef void (*usb_complete_t)(struct ur + * @complete: Completion handler. This URB is passed as the parameter to the + * completion function. The completion function may then do what + * it likes with the URB, including resubmitting or freeing it. +- * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to ++ * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to + * collect the transfer status for each buffer. + * + * This structure identifies USB transfer requests. URBs must be allocated by +@@ -1245,8 +1268,7 @@ typedef void (*usb_complete_t)(struct ur + * when the urb is owned by the hcd, that is, since the call to + * usb_submit_urb() till the entry into the completion routine. + */ +-struct urb +-{ ++struct urb { + /* private: usb core and host controller only fields in the urb */ + struct kref kref; /* reference count of the URB */ + void *hcpriv; /* private data for host controller */ +@@ -1257,10 +1279,10 @@ struct urb + /* public: documented fields in the urb that can be used by drivers */ + struct list_head urb_list; /* list head for use by the urb's + * current owner */ +- struct list_head anchor_list; /* the URB may be anchored by the driver */ ++ struct list_head anchor_list; /* the URB may be anchored */ + struct usb_anchor *anchor; + struct usb_device *dev; /* (in) pointer to associated device */ +- struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ ++ struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ + unsigned int pipe; /* (in) pipe information */ + int status; /* (return) non-ISO status */ + unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ +@@ -1297,14 +1319,14 @@ struct urb + * Initializes a control urb with the proper information needed to submit + * it to a device. + */ +-static inline void usb_fill_control_urb (struct urb *urb, +- struct usb_device *dev, +- unsigned int pipe, +- unsigned char *setup_packet, +- void *transfer_buffer, +- int buffer_length, +- usb_complete_t complete_fn, +- void *context) ++static inline void usb_fill_control_urb(struct urb *urb, ++ struct usb_device *dev, ++ unsigned int pipe, ++ unsigned char *setup_packet, ++ void *transfer_buffer, ++ int buffer_length, ++ usb_complete_t complete_fn, ++ void *context) + { + urb->dev = dev; + urb->pipe = pipe; +@@ -1328,13 +1350,13 @@ static inline void usb_fill_control_urb + * Initializes a bulk urb with the proper information needed to submit it + * to a device. + */ +-static inline void usb_fill_bulk_urb (struct urb *urb, +- struct usb_device *dev, +- unsigned int pipe, +- void *transfer_buffer, +- int buffer_length, +- usb_complete_t complete_fn, +- void *context) ++static inline void usb_fill_bulk_urb(struct urb *urb, ++ struct usb_device *dev, ++ unsigned int pipe, ++ void *transfer_buffer, ++ int buffer_length, ++ usb_complete_t complete_fn, ++ void *context) + { + urb->dev = dev; + urb->pipe = pipe; +@@ -1362,14 +1384,14 @@ static inline void usb_fill_bulk_urb (st + * the endpoint interval, and express polling intervals in microframes + * (eight per millisecond) rather than in frames (one per millisecond). + */ +-static inline void usb_fill_int_urb (struct urb *urb, +- struct usb_device *dev, +- unsigned int pipe, +- void *transfer_buffer, +- int buffer_length, +- usb_complete_t complete_fn, +- void *context, +- int interval) ++static inline void usb_fill_int_urb(struct urb *urb, ++ struct usb_device *dev, ++ unsigned int pipe, ++ void *transfer_buffer, ++ int buffer_length, ++ usb_complete_t complete_fn, ++ void *context, ++ int interval) + { + urb->dev = dev; + urb->pipe = pipe; +@@ -1422,15 +1444,15 @@ static inline int usb_urb_dir_out(struct + return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; + } + +-void *usb_buffer_alloc (struct usb_device *dev, size_t size, ++void *usb_buffer_alloc(struct usb_device *dev, size_t size, + gfp_t mem_flags, dma_addr_t *dma); +-void usb_buffer_free (struct usb_device *dev, size_t size, ++void usb_buffer_free(struct usb_device *dev, size_t size, + void *addr, dma_addr_t dma); + + #if 0 +-struct urb *usb_buffer_map (struct urb *urb); +-void usb_buffer_dmasync (struct urb *urb); +-void usb_buffer_unmap (struct urb *urb); ++struct urb *usb_buffer_map(struct urb *urb); ++void usb_buffer_dmasync(struct urb *urb); ++void usb_buffer_unmap(struct urb *urb); + #endif + + struct scatterlist; +@@ -1502,7 +1524,7 @@ struct usb_sg_request { + int status; + size_t bytes; + +- /* ++ /* + * members below are private: to usbcore, + * and are not provided for driver access! + */ +@@ -1520,18 +1542,18 @@ struct usb_sg_request { + struct completion complete; + }; + +-int usb_sg_init ( ++int usb_sg_init( + struct usb_sg_request *io, + struct usb_device *dev, +- unsigned pipe, ++ unsigned pipe, + unsigned period, + struct scatterlist *sg, + int nents, + size_t length, + gfp_t mem_flags + ); +-void usb_sg_cancel (struct usb_sg_request *io); +-void usb_sg_wait (struct usb_sg_request *io); ++void usb_sg_cancel(struct usb_sg_request *io); ++void usb_sg_wait(struct usb_sg_request *io); + + + /* ----------------------------------------------------------------------- */ +@@ -1588,21 +1610,21 @@ static inline unsigned int __create_pipe + + /* Create various pipes... */ + #define usb_sndctrlpipe(dev,endpoint) \ +- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) ++ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) + #define usb_rcvctrlpipe(dev,endpoint) \ +- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ++ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) + #define usb_sndisocpipe(dev,endpoint) \ +- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) ++ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) + #define usb_rcvisocpipe(dev,endpoint) \ +- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ++ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) + #define usb_sndbulkpipe(dev,endpoint) \ +- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) ++ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) + #define usb_rcvbulkpipe(dev,endpoint) \ +- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ++ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) + #define usb_sndintpipe(dev,endpoint) \ +- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) ++ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) + #define usb_rcvintpipe(dev,endpoint) \ +- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ++ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) + + /*-------------------------------------------------------------------------*/ + diff --git a/usb/usb-fix-codingstyle-issues-in-include-linux-usb.patch b/usb/usb-fix-codingstyle-issues-in-include-linux-usb.patch new file mode 100644 index 00000000000000..4dccca89d77358 --- /dev/null +++ b/usb/usb-fix-codingstyle-issues-in-include-linux-usb.patch @@ -0,0 +1,1017 @@ +From 298a051907e1de2883e2c1504a49d968ecaeb3fa Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman <gregkh@suse.de> +Date: Wed, 30 Jan 2008 15:21:33 -0800 +Subject: USB: fix codingstyle issues in include/linux/usb/ + +Fixes a number of coding style issues in the USB public header files. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + include/linux/usb/audio.h | 14 +-- + include/linux/usb/cdc.h | 16 ++-- + include/linux/usb/gadget.h | 123 ++++++++++++++------------------- + include/linux/usb/gadgetfs.h | 22 +++-- + include/linux/usb/iowarrior.h | 25 ++++-- + include/linux/usb/isp116x.h | 2 + include/linux/usb/midi.h | 26 +++---- + include/linux/usb/net2280.h | 32 ++++---- + include/linux/usb/otg.h | 2 + include/linux/usb/serial.h | 155 +++++++++++++++++++++++------------------- + include/linux/usb/sl811.h | 6 - + 11 files changed, 219 insertions(+), 204 deletions(-) + +--- a/include/linux/usb/audio.h ++++ b/include/linux/usb/audio.h +@@ -27,13 +27,13 @@ + + /* 4.3.2 Class-Specific AC Interface Descriptor */ + struct usb_ac_header_descriptor { +- __u8 bLength; // 8+n +- __u8 bDescriptorType; // USB_DT_CS_INTERFACE +- __u8 bDescriptorSubtype; // USB_MS_HEADER +- __le16 bcdADC; // 0x0100 +- __le16 wTotalLength; // includes Unit and Terminal desc. +- __u8 bInCollection; // n +- __u8 baInterfaceNr[]; // [n] ++ __u8 bLength; /* 8+n */ ++ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ ++ __u8 bDescriptorSubtype; /* USB_MS_HEADER */ ++ __le16 bcdADC; /* 0x0100 */ ++ __le16 wTotalLength; /* includes Unit and Terminal desc. */ ++ __u8 bInCollection; /* n */ ++ __u8 baInterfaceNr[]; /* [n] */ + } __attribute__ ((packed)); + + #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) +--- a/include/linux/usb/cdc.h ++++ b/include/linux/usb/cdc.h +@@ -29,16 +29,16 @@ + * Class-Specific descriptors ... there are a couple dozen of them + */ + +-#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ +-#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ +-#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ +-#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ ++#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ ++#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ ++#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ ++#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ + #define USB_CDC_COUNTRY_TYPE 0x07 +-#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ +-#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ ++#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ ++#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ + #define USB_CDC_WHCM_TYPE 0x11 +-#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ +-#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ ++#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ ++#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ + #define USB_CDC_DMM_TYPE 0x14 + #define USB_CDC_OBEX_TYPE 0x15 + +--- a/include/linux/usb/gadget.h ++++ b/include/linux/usb/gadget.h +@@ -70,9 +70,10 @@ struct usb_ep; + * + * Bulk endpoints can use any size buffers, and can also be used for interrupt + * transfers. interrupt-only endpoints can be much less functional. ++ * ++ * NOTE: this is analagous to 'struct urb' on the host side, except that ++ * it's thinner and promotes more pre-allocation. + */ +- // NOTE this is analagous to 'struct urb' on the host side, +- // except that it's thinner and promotes more pre-allocation. + + struct usb_request { + void *buf; +@@ -168,10 +169,10 @@ struct usb_ep { + * + * returns zero, or a negative error code. + */ +-static inline int +-usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) ++static inline int usb_ep_enable(struct usb_ep *ep, ++ const struct usb_endpoint_descriptor *desc) + { +- return ep->ops->enable (ep, desc); ++ return ep->ops->enable(ep, desc); + } + + /** +@@ -186,10 +187,9 @@ usb_ep_enable (struct usb_ep *ep, const + * + * returns zero, or a negative error code. + */ +-static inline int +-usb_ep_disable (struct usb_ep *ep) ++static inline int usb_ep_disable(struct usb_ep *ep) + { +- return ep->ops->disable (ep); ++ return ep->ops->disable(ep); + } + + /** +@@ -206,10 +206,10 @@ usb_ep_disable (struct usb_ep *ep) + * + * Returns the request, or null if one could not be allocated. + */ +-static inline struct usb_request * +-usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) ++static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep, ++ gfp_t gfp_flags) + { +- return ep->ops->alloc_request (ep, gfp_flags); ++ return ep->ops->alloc_request(ep, gfp_flags); + } + + /** +@@ -221,10 +221,10 @@ usb_ep_alloc_request (struct usb_ep *ep, + * Caller guarantees the request is not queued, and that it will + * no longer be requeued (or otherwise used). + */ +-static inline void +-usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) ++static inline void usb_ep_free_request(struct usb_ep *ep, ++ struct usb_request *req) + { +- ep->ops->free_request (ep, req); ++ ep->ops->free_request(ep, req); + } + + /** +@@ -281,10 +281,10 @@ usb_ep_free_request (struct usb_ep *ep, + * report errors; errors will also be + * reported when the usb peripheral is disconnected. + */ +-static inline int +-usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) ++static inline int usb_ep_queue(struct usb_ep *ep, ++ struct usb_request *req, gfp_t gfp_flags) + { +- return ep->ops->queue (ep, req, gfp_flags); ++ return ep->ops->queue(ep, req, gfp_flags); + } + + /** +@@ -301,9 +301,9 @@ usb_ep_queue (struct usb_ep *ep, struct + * restrictions prevent drivers from supporting configuration changes, + * even to configuration zero (a "chapter 9" requirement). + */ +-static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) ++static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) + { +- return ep->ops->dequeue (ep, req); ++ return ep->ops->dequeue(ep, req); + } + + /** +@@ -327,10 +327,9 @@ static inline int usb_ep_dequeue (struct + * transfer requests are still queued, or if the controller hardware + * (usually a FIFO) still holds bytes that the host hasn't collected. + */ +-static inline int +-usb_ep_set_halt (struct usb_ep *ep) ++static inline int usb_ep_set_halt(struct usb_ep *ep) + { +- return ep->ops->set_halt (ep, 1); ++ return ep->ops->set_halt(ep, 1); + } + + /** +@@ -346,10 +345,9 @@ usb_ep_set_halt (struct usb_ep *ep) + * Note that some hardware can't support this request (like pxa2xx_udc), + * and accordingly can't correctly implement interface altsettings. + */ +-static inline int +-usb_ep_clear_halt (struct usb_ep *ep) ++static inline int usb_ep_clear_halt(struct usb_ep *ep) + { +- return ep->ops->set_halt (ep, 0); ++ return ep->ops->set_halt(ep, 0); + } + + /** +@@ -367,11 +365,10 @@ usb_ep_clear_halt (struct usb_ep *ep) + * errno if the endpoint doesn't use a FIFO or doesn't support such + * precise handling. + */ +-static inline int +-usb_ep_fifo_status (struct usb_ep *ep) ++static inline int usb_ep_fifo_status(struct usb_ep *ep) + { + if (ep->ops->fifo_status) +- return ep->ops->fifo_status (ep); ++ return ep->ops->fifo_status(ep); + else + return -EOPNOTSUPP; + } +@@ -385,11 +382,10 @@ usb_ep_fifo_status (struct usb_ep *ep) + * must never be used except when endpoint is not being used for any + * protocol translation. + */ +-static inline void +-usb_ep_fifo_flush (struct usb_ep *ep) ++static inline void usb_ep_fifo_flush(struct usb_ep *ep) + { + if (ep->ops->fifo_flush) +- ep->ops->fifo_flush (ep); ++ ep->ops->fifo_flush(ep); + } + + +@@ -469,10 +465,10 @@ struct usb_gadget { + struct device dev; + }; + +-static inline void set_gadget_data (struct usb_gadget *gadget, void *data) +- { dev_set_drvdata (&gadget->dev, data); } +-static inline void *get_gadget_data (struct usb_gadget *gadget) +- { return dev_get_drvdata (&gadget->dev); } ++static inline void set_gadget_data(struct usb_gadget *gadget, void *data) ++ { dev_set_drvdata(&gadget->dev, data); } ++static inline void *get_gadget_data(struct usb_gadget *gadget) ++ { return dev_get_drvdata(&gadget->dev); } + + /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ + #define gadget_for_each_ep(tmp,gadget) \ +@@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct u + #endif + } + +- + /** + * usb_gadget_frame_number - returns the current frame number + * @gadget: controller that reports the frame number +@@ -519,9 +514,9 @@ static inline int gadget_is_otg(struct u + * Returns the usb frame number, normally eleven bits from a SOF packet, + * or negative errno if this device doesn't support this capability. + */ +-static inline int usb_gadget_frame_number (struct usb_gadget *gadget) ++static inline int usb_gadget_frame_number(struct usb_gadget *gadget) + { +- return gadget->ops->get_frame (gadget); ++ return gadget->ops->get_frame(gadget); + } + + /** +@@ -537,11 +532,11 @@ static inline int usb_gadget_frame_numbe + * even if OTG isn't otherwise in use. OTG devices may also start + * remote wakeup even when hosts don't explicitly enable it. + */ +-static inline int usb_gadget_wakeup (struct usb_gadget *gadget) ++static inline int usb_gadget_wakeup(struct usb_gadget *gadget) + { + if (!gadget->ops->wakeup) + return -EOPNOTSUPP; +- return gadget->ops->wakeup (gadget); ++ return gadget->ops->wakeup(gadget); + } + + /** +@@ -553,12 +548,11 @@ static inline int usb_gadget_wakeup (str + * + * returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_set_selfpowered (struct usb_gadget *gadget) ++static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) + { + if (!gadget->ops->set_selfpowered) + return -EOPNOTSUPP; +- return gadget->ops->set_selfpowered (gadget, 1); ++ return gadget->ops->set_selfpowered(gadget, 1); + } + + /** +@@ -571,12 +565,11 @@ usb_gadget_set_selfpowered (struct usb_g + * + * returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_clear_selfpowered (struct usb_gadget *gadget) ++static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) + { + if (!gadget->ops->set_selfpowered) + return -EOPNOTSUPP; +- return gadget->ops->set_selfpowered (gadget, 0); ++ return gadget->ops->set_selfpowered(gadget, 0); + } + + /** +@@ -591,12 +584,11 @@ usb_gadget_clear_selfpowered (struct usb + * + * Returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_vbus_connect(struct usb_gadget *gadget) ++static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) + { + if (!gadget->ops->vbus_session) + return -EOPNOTSUPP; +- return gadget->ops->vbus_session (gadget, 1); ++ return gadget->ops->vbus_session(gadget, 1); + } + + /** +@@ -611,12 +603,11 @@ usb_gadget_vbus_connect(struct usb_gadge + * + * Returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) ++static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) + { + if (!gadget->ops->vbus_draw) + return -EOPNOTSUPP; +- return gadget->ops->vbus_draw (gadget, mA); ++ return gadget->ops->vbus_draw(gadget, mA); + } + + /** +@@ -629,12 +620,11 @@ usb_gadget_vbus_draw(struct usb_gadget * + * + * Returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_vbus_disconnect(struct usb_gadget *gadget) ++static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) + { + if (!gadget->ops->vbus_session) + return -EOPNOTSUPP; +- return gadget->ops->vbus_session (gadget, 0); ++ return gadget->ops->vbus_session(gadget, 0); + } + + /** +@@ -648,12 +638,11 @@ usb_gadget_vbus_disconnect(struct usb_ga + * + * Returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_connect (struct usb_gadget *gadget) ++static inline int usb_gadget_connect(struct usb_gadget *gadget) + { + if (!gadget->ops->pullup) + return -EOPNOTSUPP; +- return gadget->ops->pullup (gadget, 1); ++ return gadget->ops->pullup(gadget, 1); + } + + /** +@@ -671,16 +660,14 @@ usb_gadget_connect (struct usb_gadget *g + * + * Returns zero on success, else negative errno. + */ +-static inline int +-usb_gadget_disconnect (struct usb_gadget *gadget) ++static inline int usb_gadget_disconnect(struct usb_gadget *gadget) + { + if (!gadget->ops->pullup) + return -EOPNOTSUPP; +- return gadget->ops->pullup (gadget, 0); ++ return gadget->ops->pullup(gadget, 0); + } + + +- + /*-------------------------------------------------------------------------*/ + + /** +@@ -764,7 +751,7 @@ struct usb_gadget_driver { + void (*suspend)(struct usb_gadget *); + void (*resume)(struct usb_gadget *); + +- // FIXME support safe rmmod ++ /* FIXME support safe rmmod */ + struct device_driver driver; + }; + +@@ -790,7 +777,7 @@ struct usb_gadget_driver { + * the bind() functions will be in init sections. + * This function must be called in a context that can sleep. + */ +-int usb_gadget_register_driver (struct usb_gadget_driver *driver); ++int usb_gadget_register_driver(struct usb_gadget_driver *driver); + + /** + * usb_gadget_unregister_driver - unregister a gadget driver +@@ -805,7 +792,7 @@ int usb_gadget_register_driver (struct u + * will in in exit sections, so may not be linked in some kernels. + * This function must be called in a context that can sleep. + */ +-int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); ++int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); + + /*-------------------------------------------------------------------------*/ + +@@ -838,7 +825,7 @@ struct usb_gadget_strings { + }; + + /* put descriptor for string with that id into buf (buflen >= 256) */ +-int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf); ++int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); + + /*-------------------------------------------------------------------------*/ + +@@ -856,10 +843,10 @@ int usb_gadget_config_buf(const struct u + + /* utility wrapping a simple endpoint selection policy */ + +-extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, ++extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, + struct usb_endpoint_descriptor *) __devinit; + +-extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit; ++extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; + + #endif /* __KERNEL__ */ + +--- a/include/linux/usb/gadgetfs.h ++++ b/include/linux/usb/gadgetfs.h +@@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type { + GADGETFS_DISCONNECT, + GADGETFS_SETUP, + GADGETFS_SUSPEND, +- // and likely more ! ++ /* and likely more ! */ + }; + + /* NOTE: this structure must stay the same size and layout on +@@ -44,15 +44,17 @@ enum usb_gadgetfs_event_type { + */ + struct usb_gadgetfs_event { + union { +- // NOP, DISCONNECT, SUSPEND: nothing +- // ... some hardware can't report disconnection ++ /* NOP, DISCONNECT, SUSPEND: nothing ++ * ... some hardware can't report disconnection ++ */ + +- // CONNECT: just the speed ++ /* CONNECT: just the speed */ + enum usb_device_speed speed; + +- // SETUP: packet; DATA phase i/o precedes next event +- // (setup.bmRequestType & USB_DIR_IN) flags direction +- // ... includes SET_CONFIGURATION, SET_INTERFACE ++ /* SETUP: packet; DATA phase i/o precedes next event ++ *(setup.bmRequestType & USB_DIR_IN) flags direction ++ * ... includes SET_CONFIGURATION, SET_INTERFACE ++ */ + struct usb_ctrlrequest setup; + } u; + enum usb_gadgetfs_event_type type; +@@ -73,14 +75,14 @@ struct usb_gadgetfs_event { + * THIS returns how many bytes are "unclaimed" in the endpoint fifo + * (needed for precise fault handling, when the hardware allows it) + */ +-#define GADGETFS_FIFO_STATUS _IO('g',1) ++#define GADGETFS_FIFO_STATUS _IO('g', 1) + + /* discards any unclaimed data in the fifo. */ +-#define GADGETFS_FIFO_FLUSH _IO('g',2) ++#define GADGETFS_FIFO_FLUSH _IO('g', 2) + + /* resets endpoint halt+toggle; used to implement set_interface. + * some hardware (like pxa2xx) can't support this. + */ +-#define GADGETFS_CLEAR_HALT _IO('g',3) ++#define GADGETFS_CLEAR_HALT _IO('g', 3) + + #endif /* __LINUX_USB_GADGETFS_H */ +--- a/include/linux/usb/iowarrior.h ++++ b/include/linux/usb/iowarrior.h +@@ -14,14 +14,23 @@ + this information. + */ + struct iowarrior_info { +- __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ +- __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */ +- __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */ +- __u32 revision; /* revision number of the chip */ +- __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ +- __u32 power; /* power consumption of the device in mA */ +- __u32 if_num; /* the number of the endpoint */ +- __u32 report_size; /* size of the data-packets on this interface */ ++ /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ ++ __u32 vendor; ++ /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */ ++ __u32 product; ++ /* the serial number of our chip (if a serial-number is not available ++ * this is empty string) */ ++ __u8 serial[9]; ++ /* revision number of the chip */ ++ __u32 revision; ++ /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ ++ __u32 speed; ++ /* power consumption of the device in mA */ ++ __u32 power; ++ /* the number of the endpoint */ ++ __u32 if_num; ++ /* size of the data-packets on this interface */ ++ __u32 report_size; + }; + + /* +--- a/include/linux/usb/isp116x.h ++++ b/include/linux/usb/isp116x.h +@@ -25,5 +25,5 @@ struct isp116x_platform_data { + 300ns delay between access to ADDR_REG and DATA_REG + OE, WE MUST NOT be changed during these intervals + */ +- void (*delay) (struct device * dev, int delay); ++ void (*delay) (struct device *dev, int delay); + }; +--- a/include/linux/usb/midi.h ++++ b/include/linux/usb/midi.h +@@ -47,9 +47,9 @@ struct usb_ms_header_descriptor { + /* 6.1.2.2 MIDI IN Jack Descriptor */ + struct usb_midi_in_jack_descriptor { + __u8 bLength; +- __u8 bDescriptorType; // USB_DT_CS_INTERFACE +- __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK +- __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL ++ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ ++ __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */ ++ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ + __u8 bJackID; + __u8 iJack; + } __attribute__ ((packed)); +@@ -64,12 +64,12 @@ struct usb_midi_source_pin { + /* 6.1.2.3 MIDI OUT Jack Descriptor */ + struct usb_midi_out_jack_descriptor { + __u8 bLength; +- __u8 bDescriptorType; // USB_DT_CS_INTERFACE +- __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK +- __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL ++ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ ++ __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */ ++ __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */ + __u8 bJackID; +- __u8 bNrInputPins; // p +- struct usb_midi_source_pin pins[]; // [p] ++ __u8 bNrInputPins; /* p */ ++ struct usb_midi_source_pin pins[]; /* [p] */ + /*__u8 iJack; -- ommitted due to variable-sized pins[] */ + } __attribute__ ((packed)); + +@@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p + + /* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ + struct usb_ms_endpoint_descriptor { +- __u8 bLength; // 4+n +- __u8 bDescriptorType; // USB_DT_CS_ENDPOINT +- __u8 bDescriptorSubtype; // USB_MS_GENERAL +- __u8 bNumEmbMIDIJack; // n +- __u8 baAssocJackID[]; // [n] ++ __u8 bLength; /* 4+n */ ++ __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ ++ __u8 bDescriptorSubtype; /* USB_MS_GENERAL */ ++ __u8 bNumEmbMIDIJack; /* n */ ++ __u8 baAssocJackID[]; /* [n] */ + } __attribute__ ((packed)); + + #define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) +--- a/include/linux/usb/net2280.h ++++ b/include/linux/usb/net2280.h +@@ -37,7 +37,7 @@ + + /* main registers, BAR0 + 0x0000 */ + struct net2280_regs { +- // offset 0x0000 ++ /* offset 0x0000 */ + u32 devinit; + #define LOCAL_CLOCK_FREQUENCY 8 + #define FORCE_PCI_RESET 7 +@@ -61,7 +61,7 @@ struct net2280_regs { + #define EEPROM_WRITE_DATA 0 + u32 eeclkfreq; + u32 _unused0; +- // offset 0x0010 ++ /* offset 0x0010 */ + + u32 pciirqenb0; /* interrupt PCI master ... */ + #define SETUP_PACKET_INTERRUPT_ENABLE 7 +@@ -131,7 +131,7 @@ struct net2280_regs { + #define RESUME_INTERRUPT_ENABLE 1 + #define SOF_INTERRUPT_ENABLE 0 + +- // offset 0x0020 ++ /* offset 0x0020 */ + u32 _unused1; + u32 usbirqenb1; + #define USB_INTERRUPT_ENABLE 31 +@@ -195,7 +195,7 @@ struct net2280_regs { + #define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 + #define RESUME_INTERRUPT 1 + #define SOF_INTERRUPT 0 +- // offset 0x0030 ++ /* offset 0x0030 */ + u32 idxaddr; + u32 idxdata; + u32 fifoctl; +@@ -204,7 +204,7 @@ struct net2280_regs { + #define PCI_BASE2_SELECT 2 + #define FIFO_CONFIGURATION_SELECT 0 + u32 _unused2; +- // offset 0x0040 ++ /* offset 0x0040 */ + u32 memaddr; + #define START 28 + #define DIRECTION 27 +@@ -213,7 +213,7 @@ struct net2280_regs { + u32 memdata0; + u32 memdata1; + u32 _unused3; +- // offset 0x0050 ++ /* offset 0x0050 */ + u32 gpioctl; + #define GPIO3_LED_SELECT 12 + #define GPIO3_INTERRUPT_ENABLE 11 +@@ -237,7 +237,7 @@ struct net2280_regs { + + /* usb control, BAR0 + 0x0080 */ + struct net2280_usb_regs { +- // offset 0x0080 ++ /* offset 0x0080 */ + u32 stdrsp; + #define STALL_UNSUPPORTED_REQUESTS 31 + #define SET_TEST_MODE 16 +@@ -275,7 +275,7 @@ struct net2280_usb_regs { + #define PME_WAKEUP_ENABLE 2 + #define DEVICE_REMOTE_WAKEUP_ENABLE 1 + #define SELF_POWERED_STATUS 0 +- // offset 0x0090 ++ /* offset 0x0090 */ + u32 usbstat; + #define HIGH_SPEED 7 + #define FULL_SPEED 6 +@@ -291,7 +291,7 @@ struct net2280_usb_regs { + #define TERMINATION_SELECT 0 + u32 setup0123; + u32 setup4567; +- // offset 0x0090 ++ /* offset 0x0090 */ + u32 _unused0; + u32 ouraddr; + #define FORCE_IMMEDIATE 7 +@@ -301,7 +301,7 @@ struct net2280_usb_regs { + + /* pci control, BAR0 + 0x0100 */ + struct net2280_pci_regs { +- // offset 0x0100 ++ /* offset 0x0100 */ + u32 pcimstctl; + #define PCI_ARBITER_PARK_SELECT 13 + #define PCI_MULTI LEVEL_ARBITER 12 +@@ -331,7 +331,7 @@ struct net2280_pci_regs { + * that can be loaded into some of these registers. + */ + struct net2280_dma_regs { /* [11.7] */ +- // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, ++ /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */ + u32 dmactl; + #define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 + #define DMA_CLEAR_COUNT_ENABLE 21 +@@ -355,7 +355,7 @@ struct net2280_dma_regs { /* [11.7] */ + #define DMA_ABORT 1 + #define DMA_START 0 + u32 _unused0 [2]; +- // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, ++ /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ + u32 dmacount; + #define VALID_BIT 31 + #define DMA_DIRECTION 30 +@@ -371,9 +371,9 @@ struct net2280_dma_regs { /* [11.7] */ + /* dedicated endpoint registers, BAR0 + 0x0200 */ + + struct net2280_dep_regs { /* [11.8] */ +- // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 ++ /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */ + u32 dep_cfg; +- // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 ++ /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ + u32 dep_rsp; + u32 _unused [2]; + } __attribute__ ((packed)); +@@ -383,7 +383,7 @@ struct net2280_dep_regs { /* [11.8] */ + * ep0 reserved for control; E and F have only 64 bytes of fifo + */ + struct net2280_ep_regs { /* [11.9] */ +- // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 ++ /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */ + u32 ep_cfg; + #define ENDPOINT_BYTE_COUNT 16 + #define ENDPOINT_ENABLE 10 +@@ -435,7 +435,7 @@ struct net2280_ep_regs { /* [11.9] */ + #define DATA_PACKET_TRANSMITTED_INTERRUPT 2 + #define DATA_OUT_PING_TOKEN_INTERRUPT 1 + #define DATA_IN_TOKEN_INTERRUPT 0 +- // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 ++ /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ + u32 ep_avail; + u32 ep_data; + u32 _unused0 [2]; +--- a/include/linux/usb/otg.h ++++ b/include/linux/usb/otg.h +@@ -1,4 +1,4 @@ +-// include/linux/usb/otg.h ++/* USB OTG (On The Go) defines */ + + /* + * These APIs may be used between USB controllers. USB device drivers +--- a/include/linux/usb/serial.h ++++ b/include/linux/usb/serial.h +@@ -20,7 +20,8 @@ + #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ + #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ + +-#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ ++/* The maximum number of ports one device can grab at once */ ++#define MAX_NUM_PORTS 8 + + /* parity check flag */ + #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) +@@ -61,29 +62,29 @@ + * ports of a device. + */ + struct usb_serial_port { +- struct usb_serial * serial; +- struct tty_struct * tty; ++ struct usb_serial *serial; ++ struct tty_struct *tty; + spinlock_t lock; + struct mutex mutex; + unsigned char number; + +- unsigned char * interrupt_in_buffer; +- struct urb * interrupt_in_urb; ++ unsigned char *interrupt_in_buffer; ++ struct urb *interrupt_in_urb; + __u8 interrupt_in_endpointAddress; + +- unsigned char * interrupt_out_buffer; ++ unsigned char *interrupt_out_buffer; + int interrupt_out_size; +- struct urb * interrupt_out_urb; ++ struct urb *interrupt_out_urb; + __u8 interrupt_out_endpointAddress; + +- unsigned char * bulk_in_buffer; ++ unsigned char *bulk_in_buffer; + int bulk_in_size; +- struct urb * read_urb; ++ struct urb *read_urb; + __u8 bulk_in_endpointAddress; + +- unsigned char * bulk_out_buffer; ++ unsigned char *bulk_out_buffer; + int bulk_out_size; +- struct urb * write_urb; ++ struct urb *write_urb; + int write_urb_busy; + __u8 bulk_out_endpointAddress; + +@@ -98,12 +99,13 @@ struct usb_serial_port { + #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) + + /* get and set the port private data pointer helper functions */ +-static inline void *usb_get_serial_port_data (struct usb_serial_port *port) ++static inline void *usb_get_serial_port_data(struct usb_serial_port *port) + { + return dev_get_drvdata(&port->dev); + } + +-static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) ++static inline void usb_set_serial_port_data(struct usb_serial_port *port, ++ void *data) + { + dev_set_drvdata(&port->dev, data); + } +@@ -126,9 +128,9 @@ static inline void usb_set_serial_port_d + * usb_set_serial_data() to access this. + */ + struct usb_serial { +- struct usb_device * dev; +- struct usb_serial_driver * type; +- struct usb_interface * interface; ++ struct usb_device *dev; ++ struct usb_serial_driver *type; ++ struct usb_interface *interface; + unsigned char disconnected; + unsigned char minor; + unsigned char num_ports; +@@ -137,30 +139,30 @@ struct usb_serial { + char num_interrupt_out; + char num_bulk_in; + char num_bulk_out; +- struct usb_serial_port * port[MAX_NUM_PORTS]; ++ struct usb_serial_port *port[MAX_NUM_PORTS]; + struct kref kref; + struct mutex disc_mutex; +- void * private; ++ void *private; + }; + #define to_usb_serial(d) container_of(d, struct usb_serial, kref) + + #define NUM_DONT_CARE 99 + + /* get and set the serial private data pointer helper functions */ +-static inline void *usb_get_serial_data (struct usb_serial *serial) ++static inline void *usb_get_serial_data(struct usb_serial *serial) + { + return serial->private; + } + +-static inline void usb_set_serial_data (struct usb_serial *serial, void *data) ++static inline void usb_set_serial_data(struct usb_serial *serial, void *data) + { + serial->private = data; + } + + /** + * usb_serial_driver - describes a usb serial driver +- * @description: pointer to a string that describes this driver. This string used +- * in the syslog messages when a device is inserted or removed. ++ * @description: pointer to a string that describes this driver. This string ++ * used in the syslog messages when a device is inserted or removed. + * @id_table: pointer to a list of usb_device_id structures that define all + * of the devices this structure can support. + * @num_interrupt_in: If a device doesn't have this many interrupt-in +@@ -221,82 +223,91 @@ struct usb_serial_driver { + struct usb_driver *usb_driver; + struct usb_dynids dynids; + +- int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); +- int (*attach) (struct usb_serial *serial); ++ int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); ++ int (*attach)(struct usb_serial *serial); + int (*calc_num_ports) (struct usb_serial *serial); + +- void (*shutdown) (struct usb_serial *serial); ++ void (*shutdown)(struct usb_serial *serial); + +- int (*port_probe) (struct usb_serial_port *port); +- int (*port_remove) (struct usb_serial_port *port); ++ int (*port_probe)(struct usb_serial_port *port); ++ int (*port_remove)(struct usb_serial_port *port); + +- int (*suspend) (struct usb_serial *serial, pm_message_t message); +- int (*resume) (struct usb_serial *serial); ++ int (*suspend)(struct usb_serial *serial, pm_message_t message); ++ int (*resume)(struct usb_serial *serial); + + /* serial function calls */ +- int (*open) (struct usb_serial_port *port, struct file * filp); +- void (*close) (struct usb_serial_port *port, struct file * filp); +- int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); +- int (*write_room) (struct usb_serial_port *port); +- int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); +- void (*set_termios) (struct usb_serial_port *port, struct ktermios * old); +- void (*break_ctl) (struct usb_serial_port *port, int break_state); +- int (*chars_in_buffer) (struct usb_serial_port *port); +- void (*throttle) (struct usb_serial_port *port); +- void (*unthrottle) (struct usb_serial_port *port); +- int (*tiocmget) (struct usb_serial_port *port, struct file *file); +- int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); ++ int (*open)(struct usb_serial_port *port, struct file *filp); ++ void (*close)(struct usb_serial_port *port, struct file *filp); ++ int (*write)(struct usb_serial_port *port, const unsigned char *buf, ++ int count); ++ int (*write_room)(struct usb_serial_port *port); ++ int (*ioctl)(struct usb_serial_port *port, struct file *file, ++ unsigned int cmd, unsigned long arg); ++ void (*set_termios)(struct usb_serial_port *port, struct ktermios *old); ++ void (*break_ctl)(struct usb_serial_port *port, int break_state); ++ int (*chars_in_buffer)(struct usb_serial_port *port); ++ void (*throttle)(struct usb_serial_port *port); ++ void (*unthrottle)(struct usb_serial_port *port); ++ int (*tiocmget)(struct usb_serial_port *port, struct file *file); ++ int (*tiocmset)(struct usb_serial_port *port, struct file *file, ++ unsigned int set, unsigned int clear); + + void (*read_int_callback)(struct urb *urb); + void (*write_int_callback)(struct urb *urb); + void (*read_bulk_callback)(struct urb *urb); + void (*write_bulk_callback)(struct urb *urb); + }; +-#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) ++#define to_usb_serial_driver(d) \ ++ container_of(d, struct usb_serial_driver, driver) + + extern int usb_serial_register(struct usb_serial_driver *driver); + extern void usb_serial_deregister(struct usb_serial_driver *driver); + extern void usb_serial_port_softint(struct usb_serial_port *port); + +-extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); ++extern int usb_serial_probe(struct usb_interface *iface, ++ const struct usb_device_id *id); + extern void usb_serial_disconnect(struct usb_interface *iface); + + extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); + extern int usb_serial_resume(struct usb_interface *intf); + +-extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); +-extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); ++extern int ezusb_writememory(struct usb_serial *serial, int address, ++ unsigned char *data, int length, __u8 bRequest); ++extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit); + + /* USB Serial console functions */ + #ifdef CONFIG_USB_SERIAL_CONSOLE +-extern void usb_serial_console_init (int debug, int minor); +-extern void usb_serial_console_exit (void); ++extern void usb_serial_console_init(int debug, int minor); ++extern void usb_serial_console_exit(void); + extern void usb_serial_console_disconnect(struct usb_serial *serial); + #else +-static inline void usb_serial_console_init (int debug, int minor) { } +-static inline void usb_serial_console_exit (void) { } ++static inline void usb_serial_console_init(int debug, int minor) { } ++static inline void usb_serial_console_exit(void) { } + static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} + #endif + + /* Functions needed by other parts of the usbserial core */ +-extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); ++extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); + extern void usb_serial_put(struct usb_serial *serial); +-extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); +-extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); +-extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); +-extern int usb_serial_generic_resume (struct usb_serial *serial); +-extern int usb_serial_generic_write_room (struct usb_serial_port *port); +-extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); +-extern void usb_serial_generic_read_bulk_callback (struct urb *urb); +-extern void usb_serial_generic_write_bulk_callback (struct urb *urb); +-extern void usb_serial_generic_throttle (struct usb_serial_port *port); +-extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); +-extern void usb_serial_generic_shutdown (struct usb_serial *serial); +-extern int usb_serial_generic_register (int debug); +-extern void usb_serial_generic_deregister (void); ++extern int usb_serial_generic_open(struct usb_serial_port *port, ++ struct file *filp); ++extern int usb_serial_generic_write(struct usb_serial_port *port, ++ const unsigned char *buf, int count); ++extern void usb_serial_generic_close(struct usb_serial_port *port, ++ struct file *filp); ++extern int usb_serial_generic_resume(struct usb_serial *serial); ++extern int usb_serial_generic_write_room(struct usb_serial_port *port); ++extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port); ++extern void usb_serial_generic_read_bulk_callback(struct urb *urb); ++extern void usb_serial_generic_write_bulk_callback(struct urb *urb); ++extern void usb_serial_generic_throttle(struct usb_serial_port *port); ++extern void usb_serial_generic_unthrottle(struct usb_serial_port *port); ++extern void usb_serial_generic_shutdown(struct usb_serial *serial); ++extern int usb_serial_generic_register(int debug); ++extern void usb_serial_generic_deregister(void); + +-extern int usb_serial_bus_register (struct usb_serial_driver *device); +-extern void usb_serial_bus_deregister (struct usb_serial_driver *device); ++extern int usb_serial_bus_register(struct usb_serial_driver *device); ++extern void usb_serial_bus_deregister(struct usb_serial_driver *device); + + extern struct usb_serial_driver usb_serial_generic_device; + extern struct bus_type usb_serial_bus_type; +@@ -310,16 +321,22 @@ static inline void usb_serial_debug_data + int i; + + if (debug) { +- dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); ++ dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", ++ function, size); + for (i = 0; i < size; ++i) +- printk ("%.2x ", data[i]); +- printk ("\n"); ++ printk("%.2x ", data[i]); ++ printk("\n"); + } + } + + /* Use our own dbg macro */ + #undef dbg +-#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) ++#define dbg(format, arg...) \ ++ do { \ ++ if (debug) \ ++ printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ ++ ## arg); \ ++ } while (0) + + + +--- a/include/linux/usb/sl811.h ++++ b/include/linux/usb/sl811.h +@@ -19,8 +19,8 @@ struct sl811_platform_data { + /* pulse sl811 nRST (probably with a GPIO) */ + void (*reset)(struct device *dev); + +- // some boards need something like these: +- // int (*check_overcurrent)(struct device *dev); +- // void (*clock_enable)(struct device *dev, int is_on); ++ /* some boards need something like these: */ ++ /* int (*check_overcurrent)(struct device *dev); */ ++ /* void (*clock_enable)(struct device *dev, int is_on); */ + }; + diff --git a/usb/usb-gadget-code-switches-to-pr_err-and-friends.patch b/usb/usb-gadget-code-switches-to-pr_err-and-friends.patch index d2330266918988..e112d6b97fb460 100644 --- a/usb/usb-gadget-code-switches-to-pr_err-and-friends.patch +++ b/usb/usb-gadget-code-switches-to-pr_err-and-friends.patch @@ -181,7 +181,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c -@@ -1159,7 +1159,7 @@ static int __devinit gmidi_bind(struct u +@@ -1158,7 +1158,7 @@ static int __devinit gmidi_bind(struct u /* support optional vendor/distro customization */ if (idVendor) { if (!idProduct) { @@ -190,7 +190,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> return -ENODEV; } device_desc.idVendor = cpu_to_le16(idVendor); -@@ -1191,7 +1191,7 @@ static int __devinit gmidi_bind(struct u +@@ -1190,7 +1190,7 @@ static int __devinit gmidi_bind(struct u in_ep = usb_ep_autoconfig(gadget, &bulk_in_desc); if (!in_ep) { autoconf_fail: @@ -199,7 +199,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> shortname, gadget->name); return -ENODEV; } -@@ -1213,7 +1213,7 @@ autoconf_fail: +@@ -1212,7 +1212,7 @@ autoconf_fail: * it SHOULD NOT have problems with bulk-capable hardware. * so warn about unrecognized controllers, don't panic. */ @@ -1 +1 @@ -2.6.24-git7 +2.6.24-git10 |
