aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/scan.c38
-rw-r--r--drivers/ata/libata-sff.c43
-rw-r--r--drivers/ata/pata_via.c1
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/core.c6
-rw-r--r--drivers/base/cpu.c16
-rw-r--r--drivers/base/firmware_class.c2
-rw-r--r--drivers/base/node.c7
-rw-r--r--drivers/base/platform.c33
-rw-r--r--drivers/base/power/main.c31
-rw-r--r--drivers/char/agp/intel-agp.c34
-rw-r--r--drivers/char/hvc_console.c31
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c10
-rw-r--r--drivers/char/tty_buffer.c4
-rw-r--r--drivers/char/tty_port.c2
-rw-r--r--drivers/char/virtio_console.c15
-rw-r--r--drivers/char/vt_ioctl.c39
-rw-r--r--drivers/edac/edac_mce_amd.c7
-rw-r--r--drivers/firewire/core-device.c103
-rw-r--r--drivers/firewire/core-iso.c5
-rw-r--r--drivers/firewire/ohci.c4
-rw-r--r--drivers/gpio/max730x.c4
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c46
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h4
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c31
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c7
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h14
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c5
-rw-r--r--drivers/gpu/drm/i915/intel_display.c16
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c52
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c13
-rw-r--r--drivers/i2c/busses/i2c-scmi.c32
-rw-r--r--drivers/infiniband/core/sysfs.c1
-rw-r--r--drivers/isdn/hisax/avma1_cs.c12
-rw-r--r--drivers/isdn/hisax/elsa_cs.c12
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c12
-rw-r--r--drivers/isdn/hisax/teles_cs.c12
-rw-r--r--drivers/misc/c2port/core.c4
-rw-r--r--drivers/mmc/core/mmc.c3
-rw-r--r--drivers/mtd/maps/omap_nor.c0
-rw-r--r--drivers/net/arm/ks8695net.c24
-rw-r--r--drivers/net/bnx2.c14
-rw-r--r--drivers/net/can/bfin_can.c97
-rw-r--r--drivers/net/igb/e1000_82575.c1
-rw-r--r--drivers/net/igb/e1000_hw.h1
-rw-r--r--drivers/net/igb/igb.h1
-rw-r--r--drivers/net/igb/igb_main.c23
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c78
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c6
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c22
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h1
-rw-r--r--drivers/net/ixgbevf/ethtool.c42
-rw-r--r--drivers/net/ixgbevf/ixgbevf_main.c74
-rw-r--r--drivers/net/ixgbevf/vf.h6
-rw-r--r--drivers/net/jme.c35
-rw-r--r--drivers/net/jme.h2
-rw-r--r--drivers/net/ks8851.c1
-rw-r--r--drivers/net/ksz884x.c2
-rw-r--r--drivers/net/mlx4/main.c1
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/usb/smsc95xx.c18
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_debugfs.c3
-rw-r--r--drivers/pci/pci-sysfs.c2
-rw-r--r--drivers/pcmcia/at91_cf.c2
-rw-r--r--drivers/pcmcia/au1000_generic.c13
-rw-r--r--drivers/pcmcia/bfin_cf_pcmcia.c12
-rw-r--r--drivers/pcmcia/cs.c124
-rw-r--r--drivers/pcmcia/db1xxx_ss.c27
-rw-r--r--drivers/pcmcia/ds.c8
-rw-r--r--drivers/pcmcia/i82092.c16
-rw-r--r--drivers/pcmcia/i82365.c11
-rw-r--r--drivers/pcmcia/m32r_cfc.c11
-rw-r--r--drivers/pcmcia/m32r_pcc.c12
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c17
-rw-r--r--drivers/pcmcia/omap_cf.c12
-rw-r--r--drivers/pcmcia/pd6729.c80
-rw-r--r--drivers/pcmcia/pxa2xx_base.c8
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c7
-rw-r--r--drivers/pcmcia/sa1100_generic.c13
-rw-r--r--drivers/pcmcia/sa1111_generic.c12
-rw-r--r--drivers/pcmcia/tcic.c12
-rw-r--r--drivers/pcmcia/vrc4171_card.c13
-rw-r--r--drivers/pcmcia/yenta_socket.c17
-rw-r--r--drivers/regulator/core.c1
-rw-r--r--drivers/regulator/lp3971.c10
-rw-r--r--drivers/regulator/max1586.c2
-rw-r--r--drivers/regulator/max8649.c3
-rw-r--r--drivers/regulator/max8660.c2
-rw-r--r--drivers/regulator/max8925-regulator.c6
-rw-r--r--drivers/rtc/rtc-mc13783.c23
-rw-r--r--drivers/s390/block/dasd_3990_erp.c7
-rw-r--r--drivers/s390/block/dasd_eckd.c4
-rw-r--r--drivers/s390/char/sclp_async.c1
-rw-r--r--drivers/s390/char/sclp_cmd.c14
-rw-r--r--drivers/s390/char/zcore.c31
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c4
-rw-r--r--drivers/serial/sh-sci.c5
-rw-r--r--drivers/serial/sh-sci.h35
-rw-r--r--drivers/sh/intc.c31
-rw-r--r--drivers/usb/class/cdc-acm.c2
-rw-r--r--drivers/usb/class/cdc-wdm.c134
-rw-r--r--drivers/usb/core/devio.c17
-rw-r--r--drivers/usb/core/urb.c1
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/epautoconf.c2
-rw-r--r--drivers/usb/gadget/f_mass_storage.c3
-rw-r--r--drivers/usb/gadget/gadget_chips.h8
-rw-r--r--drivers/usb/gadget/goku_udc.c2
-rw-r--r--drivers/usb/gadget/multi.c2
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c1
-rw-r--r--drivers/usb/host/Makefile4
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-sched.c28
-rw-r--r--drivers/usb/host/ehci.h5
-rw-r--r--drivers/usb/host/r8a66597-hcd.c16
-rw-r--r--drivers/usb/host/xhci-mem.c9
-rw-r--r--drivers/usb/host/xhci.c (renamed from drivers/usb/host/xhci-hcd.c)1
-rw-r--r--drivers/usb/musb/musb_core.c13
-rw-r--r--drivers/usb/musb/musb_core.h4
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/musb_regs.h28
-rw-r--r--drivers/usb/serial/Kconfig4
-rw-r--r--drivers/usb/serial/console.c1
-rw-r--r--drivers/usb/serial/cp210x.c5
-rw-r--r--drivers/usb/serial/ftdi_sio.c7
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h7
-rw-r--r--drivers/usb/serial/generic.c49
-rw-r--r--drivers/usb/serial/option.c53
-rw-r--r--drivers/usb/serial/qcserial.c29
-rw-r--r--drivers/usb/storage/unusual_devs.h23
-rw-r--r--drivers/uwb/hwa-rc.c2
-rw-r--r--drivers/uwb/i1480/dfu/usb.c12
-rw-r--r--drivers/uwb/wlp/messages.c106
-rw-r--r--drivers/vhost/net.c10
-rw-r--r--drivers/vhost/vhost.c18
-rw-r--r--drivers/video/geode/lxfb.h2
-rw-r--r--drivers/video/geode/lxfb_ops.c10
-rw-r--r--drivers/video/omap2/displays/panel-generic.c22
-rw-r--r--drivers/video/omap2/dss/dss.c3
-rw-r--r--drivers/video/omap2/vram.c11
-rw-r--r--drivers/video/pxa168fb.c2
145 files changed, 1366 insertions, 1102 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index fb7fc24fe727..189cbc2585fa 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -8,6 +8,7 @@
8#include <linux/acpi.h> 8#include <linux/acpi.h>
9#include <linux/signal.h> 9#include <linux/signal.h>
10#include <linux/kthread.h> 10#include <linux/kthread.h>
11#include <linux/dmi.h>
11 12
12#include <acpi/acpi_drivers.h> 13#include <acpi/acpi_drivers.h>
13 14
@@ -1032,6 +1033,41 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id)
1032 list_add_tail(&id->list, &device->pnp.ids); 1033 list_add_tail(&id->list, &device->pnp.ids);
1033} 1034}
1034 1035
1036/*
1037 * Old IBM workstations have a DSDT bug wherein the SMBus object
1038 * lacks the SMBUS01 HID and the methods do not have the necessary "_"
1039 * prefix. Work around this.
1040 */
1041static int acpi_ibm_smbus_match(struct acpi_device *device)
1042{
1043 acpi_handle h_dummy;
1044 struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL};
1045 int result;
1046
1047 if (!dmi_name_in_vendors("IBM"))
1048 return -ENODEV;
1049
1050 /* Look for SMBS object */
1051 result = acpi_get_name(device->handle, ACPI_SINGLE_NAME, &path);
1052 if (result)
1053 return result;
1054
1055 if (strcmp("SMBS", path.pointer)) {
1056 result = -ENODEV;
1057 goto out;
1058 }
1059
1060 /* Does it have the necessary (but misnamed) methods? */
1061 result = -ENODEV;
1062 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "SBI", &h_dummy)) &&
1063 ACPI_SUCCESS(acpi_get_handle(device->handle, "SBR", &h_dummy)) &&
1064 ACPI_SUCCESS(acpi_get_handle(device->handle, "SBW", &h_dummy)))
1065 result = 0;
1066out:
1067 kfree(path.pointer);
1068 return result;
1069}
1070
1035static void acpi_device_set_id(struct acpi_device *device) 1071static void acpi_device_set_id(struct acpi_device *device)
1036{ 1072{
1037 acpi_status status; 1073 acpi_status status;
@@ -1082,6 +1118,8 @@ static void acpi_device_set_id(struct acpi_device *device)
1082 acpi_add_id(device, ACPI_BAY_HID); 1118 acpi_add_id(device, ACPI_BAY_HID);
1083 else if (ACPI_SUCCESS(acpi_dock_match(device))) 1119 else if (ACPI_SUCCESS(acpi_dock_match(device)))
1084 acpi_add_id(device, ACPI_DOCK_HID); 1120 acpi_add_id(device, ACPI_DOCK_HID);
1121 else if (!acpi_ibm_smbus_match(device))
1122 acpi_add_id(device, ACPI_SMBUS_IBM_HID);
1085 1123
1086 break; 1124 break;
1087 case ACPI_BUS_TYPE_POWER: 1125 case ACPI_BUS_TYPE_POWER:
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 561dec2481cb..277477251a86 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1667,6 +1667,7 @@ unsigned int ata_sff_host_intr(struct ata_port *ap,
1667{ 1667{
1668 struct ata_eh_info *ehi = &ap->link.eh_info; 1668 struct ata_eh_info *ehi = &ap->link.eh_info;
1669 u8 status, host_stat = 0; 1669 u8 status, host_stat = 0;
1670 bool bmdma_stopped = false;
1670 1671
1671 VPRINTK("ata%u: protocol %d task_state %d\n", 1672 VPRINTK("ata%u: protocol %d task_state %d\n",
1672 ap->print_id, qc->tf.protocol, ap->hsm_task_state); 1673 ap->print_id, qc->tf.protocol, ap->hsm_task_state);
@@ -1699,6 +1700,7 @@ unsigned int ata_sff_host_intr(struct ata_port *ap,
1699 1700
1700 /* before we do anything else, clear DMA-Start bit */ 1701 /* before we do anything else, clear DMA-Start bit */
1701 ap->ops->bmdma_stop(qc); 1702 ap->ops->bmdma_stop(qc);
1703 bmdma_stopped = true;
1702 1704
1703 if (unlikely(host_stat & ATA_DMA_ERR)) { 1705 if (unlikely(host_stat & ATA_DMA_ERR)) {
1704 /* error when transfering data to/from memory */ 1706 /* error when transfering data to/from memory */
@@ -1716,8 +1718,14 @@ unsigned int ata_sff_host_intr(struct ata_port *ap,
1716 1718
1717 /* check main status, clearing INTRQ if needed */ 1719 /* check main status, clearing INTRQ if needed */
1718 status = ata_sff_irq_status(ap); 1720 status = ata_sff_irq_status(ap);
1719 if (status & ATA_BUSY) 1721 if (status & ATA_BUSY) {
1720 goto idle_irq; 1722 if (bmdma_stopped) {
1723 /* BMDMA engine is already stopped, we're screwed */
1724 qc->err_mask |= AC_ERR_HSM;
1725 ap->hsm_task_state = HSM_ST_ERR;
1726 } else
1727 goto idle_irq;
1728 }
1721 1729
1722 /* ack bmdma irq events */ 1730 /* ack bmdma irq events */
1723 ap->ops->sff_irq_clear(ap); 1731 ap->ops->sff_irq_clear(ap);
@@ -1762,13 +1770,16 @@ EXPORT_SYMBOL_GPL(ata_sff_host_intr);
1762irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) 1770irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
1763{ 1771{
1764 struct ata_host *host = dev_instance; 1772 struct ata_host *host = dev_instance;
1773 bool retried = false;
1765 unsigned int i; 1774 unsigned int i;
1766 unsigned int handled = 0, polling = 0; 1775 unsigned int handled, idle, polling;
1767 unsigned long flags; 1776 unsigned long flags;
1768 1777
1769 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ 1778 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
1770 spin_lock_irqsave(&host->lock, flags); 1779 spin_lock_irqsave(&host->lock, flags);
1771 1780
1781retry:
1782 handled = idle = polling = 0;
1772 for (i = 0; i < host->n_ports; i++) { 1783 for (i = 0; i < host->n_ports; i++) {
1773 struct ata_port *ap = host->ports[i]; 1784 struct ata_port *ap = host->ports[i];
1774 struct ata_queued_cmd *qc; 1785 struct ata_queued_cmd *qc;
@@ -1782,7 +1793,8 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
1782 handled |= ata_sff_host_intr(ap, qc); 1793 handled |= ata_sff_host_intr(ap, qc);
1783 else 1794 else
1784 polling |= 1 << i; 1795 polling |= 1 << i;
1785 } 1796 } else
1797 idle |= 1 << i;
1786 } 1798 }
1787 1799
1788 /* 1800 /*
@@ -1790,7 +1802,9 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
1790 * asserting IRQ line, nobody cared will ensue. Check IRQ 1802 * asserting IRQ line, nobody cared will ensue. Check IRQ
1791 * pending status if available and clear spurious IRQ. 1803 * pending status if available and clear spurious IRQ.
1792 */ 1804 */
1793 if (!handled) { 1805 if (!handled && !retried) {
1806 bool retry = false;
1807
1794 for (i = 0; i < host->n_ports; i++) { 1808 for (i = 0; i < host->n_ports; i++) {
1795 struct ata_port *ap = host->ports[i]; 1809 struct ata_port *ap = host->ports[i];
1796 1810
@@ -1805,8 +1819,23 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
1805 ata_port_printk(ap, KERN_INFO, 1819 ata_port_printk(ap, KERN_INFO,
1806 "clearing spurious IRQ\n"); 1820 "clearing spurious IRQ\n");
1807 1821
1808 ap->ops->sff_check_status(ap); 1822 if (idle & (1 << i)) {
1809 ap->ops->sff_irq_clear(ap); 1823 ap->ops->sff_check_status(ap);
1824 ap->ops->sff_irq_clear(ap);
1825 } else {
1826 /* clear INTRQ and check if BUSY cleared */
1827 if (!(ap->ops->sff_check_status(ap) & ATA_BUSY))
1828 retry |= true;
1829 /*
1830 * With command in flight, we can't do
1831 * sff_irq_clear() w/o racing with completion.
1832 */
1833 }
1834 }
1835
1836 if (retry) {
1837 retried = true;
1838 goto retry;
1810 } 1839 }
1811 } 1840 }
1812 1841
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 3059ec017de3..95d39c36acea 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -677,6 +677,7 @@ static const struct pci_device_id via[] = {
677 { PCI_VDEVICE(VIA, 0x3164), }, 677 { PCI_VDEVICE(VIA, 0x3164), },
678 { PCI_VDEVICE(VIA, 0x5324), }, 678 { PCI_VDEVICE(VIA, 0x5324), },
679 { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE }, 679 { PCI_VDEVICE(VIA, 0xC409), VIA_IDFLAG_SINGLE },
680 { PCI_VDEVICE(VIA, 0x9001), VIA_IDFLAG_SINGLE },
680 681
681 { }, 682 { },
682}; 683};
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 0147f476b8a9..9c6a0d6408e7 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -219,6 +219,8 @@ static void class_create_release(struct class *cls)
219 * This is used to create a struct class pointer that can then be used 219 * This is used to create a struct class pointer that can then be used
220 * in calls to device_create(). 220 * in calls to device_create().
221 * 221 *
222 * Returns &struct class pointer on success, or ERR_PTR() on error.
223 *
222 * Note, the pointer created here is to be destroyed when finished by 224 * Note, the pointer created here is to be destroyed when finished by
223 * making a call to class_destroy(). 225 * making a call to class_destroy().
224 */ 226 */
diff --git a/drivers/base/core.c b/drivers/base/core.c
index ef55df34ddd0..b56a0ba31d4a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1345,6 +1345,8 @@ static void root_device_release(struct device *dev)
1345 * 'module' symlink which points to the @owner directory 1345 * 'module' symlink which points to the @owner directory
1346 * in sysfs. 1346 * in sysfs.
1347 * 1347 *
1348 * Returns &struct device pointer on success, or ERR_PTR() on error.
1349 *
1348 * Note: You probably want to use root_device_register(). 1350 * Note: You probably want to use root_device_register().
1349 */ 1351 */
1350struct device *__root_device_register(const char *name, struct module *owner) 1352struct device *__root_device_register(const char *name, struct module *owner)
@@ -1432,6 +1434,8 @@ static void device_create_release(struct device *dev)
1432 * Any further sysfs files that might be required can be created using this 1434 * Any further sysfs files that might be required can be created using this
1433 * pointer. 1435 * pointer.
1434 * 1436 *
1437 * Returns &struct device pointer on success, or ERR_PTR() on error.
1438 *
1435 * Note: the struct class passed to this function must have previously 1439 * Note: the struct class passed to this function must have previously
1436 * been created with a call to class_create(). 1440 * been created with a call to class_create().
1437 */ 1441 */
@@ -1492,6 +1496,8 @@ EXPORT_SYMBOL_GPL(device_create_vargs);
1492 * Any further sysfs files that might be required can be created using this 1496 * Any further sysfs files that might be required can be created using this
1493 * pointer. 1497 * pointer.
1494 * 1498 *
1499 * Returns &struct device pointer on success, or ERR_PTR() on error.
1500 *
1495 * Note: the struct class passed to this function must have previously 1501 * Note: the struct class passed to this function must have previously
1496 * been created with a call to class_create(). 1502 * been created with a call to class_create().
1497 */ 1503 */
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 7036e8e96ab8..b5242e1e8bc4 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -79,24 +79,24 @@ void unregister_cpu(struct cpu *cpu)
79} 79}
80 80
81#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 81#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
82static ssize_t cpu_probe_store(struct sys_device *dev, 82static ssize_t cpu_probe_store(struct sysdev_class *class,
83 struct sysdev_attribute *attr, 83 struct sysdev_class_attribute *attr,
84 const char *buf, 84 const char *buf,
85 size_t count) 85 size_t count)
86{ 86{
87 return arch_cpu_probe(buf, count); 87 return arch_cpu_probe(buf, count);
88} 88}
89 89
90static ssize_t cpu_release_store(struct sys_device *dev, 90static ssize_t cpu_release_store(struct sysdev_class *class,
91 struct sysdev_attribute *attr, 91 struct sysdev_class_attribute *attr,
92 const char *buf, 92 const char *buf,
93 size_t count) 93 size_t count)
94{ 94{
95 return arch_cpu_release(buf, count); 95 return arch_cpu_release(buf, count);
96} 96}
97 97
98static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 98static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
99static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store); 99static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store);
100#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ 100#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
101 101
102#else /* ... !CONFIG_HOTPLUG_CPU */ 102#else /* ... !CONFIG_HOTPLUG_CPU */
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d0dc26ad5387..18518ba13c81 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -78,6 +78,7 @@ firmware_timeout_show(struct class *class,
78/** 78/**
79 * firmware_timeout_store - set number of seconds to wait for firmware 79 * firmware_timeout_store - set number of seconds to wait for firmware
80 * @class: device class pointer 80 * @class: device class pointer
81 * @attr: device attribute pointer
81 * @buf: buffer to scan for timeout value 82 * @buf: buffer to scan for timeout value
82 * @count: number of bytes in @buf 83 * @count: number of bytes in @buf
83 * 84 *
@@ -442,6 +443,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
442 fw_priv = dev_get_drvdata(f_dev); 443 fw_priv = dev_get_drvdata(f_dev);
443 444
444 fw_priv->fw = fw; 445 fw_priv->fw = fw;
446 sysfs_bin_attr_init(&fw_priv->attr_data);
445 retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); 447 retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
446 if (retval) { 448 if (retval) {
447 dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); 449 dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
diff --git a/drivers/base/node.c b/drivers/base/node.c
index ad43185ec15a..93b3ac65c2d4 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -165,8 +165,11 @@ static ssize_t node_read_distance(struct sys_device * dev,
165 int len = 0; 165 int len = 0;
166 int i; 166 int i;
167 167
168 /* buf currently PAGE_SIZE, need ~4 chars per node */ 168 /*
169 BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2); 169 * buf is currently PAGE_SIZE in length and each node needs 4 chars
170 * at the most (distance + space or newline).
171 */
172 BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE);
170 173
171 for_each_online_node(i) 174 for_each_online_node(i)
172 len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); 175 len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1ba9d617d241..4b4b565c835f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -362,6 +362,8 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
362 * enumeration tasks, they don't fully conform to the Linux driver model. 362 * enumeration tasks, they don't fully conform to the Linux driver model.
363 * In particular, when such drivers are built as modules, they can't be 363 * In particular, when such drivers are built as modules, they can't be
364 * "hotplugged". 364 * "hotplugged".
365 *
366 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
365 */ 367 */
366struct platform_device *platform_device_register_simple(const char *name, 368struct platform_device *platform_device_register_simple(const char *name,
367 int id, 369 int id,
@@ -408,6 +410,8 @@ EXPORT_SYMBOL_GPL(platform_device_register_simple);
408 * allocated for the device allows drivers using such devices to be 410 * allocated for the device allows drivers using such devices to be
409 * unloaded without waiting for the last reference to the device to be 411 * unloaded without waiting for the last reference to the device to be
410 * dropped. 412 * dropped.
413 *
414 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
411 */ 415 */
412struct platform_device *platform_device_register_data( 416struct platform_device *platform_device_register_data(
413 struct device *parent, 417 struct device *parent,
@@ -559,6 +563,8 @@ EXPORT_SYMBOL_GPL(platform_driver_probe);
559 * 563 *
560 * Use this in legacy-style modules that probe hardware directly and 564 * Use this in legacy-style modules that probe hardware directly and
561 * register a single platform device and corresponding platform driver. 565 * register a single platform device and corresponding platform driver.
566 *
567 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
562 */ 568 */
563struct platform_device * __init_or_module platform_create_bundle( 569struct platform_device * __init_or_module platform_create_bundle(
564 struct platform_driver *driver, 570 struct platform_driver *driver,
@@ -1052,9 +1058,11 @@ static __initdata LIST_HEAD(early_platform_driver_list);
1052static __initdata LIST_HEAD(early_platform_device_list); 1058static __initdata LIST_HEAD(early_platform_device_list);
1053 1059
1054/** 1060/**
1055 * early_platform_driver_register 1061 * early_platform_driver_register - register early platform driver
1056 * @epdrv: early_platform driver structure 1062 * @epdrv: early_platform driver structure
1057 * @buf: string passed from early_param() 1063 * @buf: string passed from early_param()
1064 *
1065 * Helper function for early_platform_init() / early_platform_init_buffer()
1058 */ 1066 */
1059int __init early_platform_driver_register(struct early_platform_driver *epdrv, 1067int __init early_platform_driver_register(struct early_platform_driver *epdrv,
1060 char *buf) 1068 char *buf)
@@ -1106,9 +1114,12 @@ int __init early_platform_driver_register(struct early_platform_driver *epdrv,
1106} 1114}
1107 1115
1108/** 1116/**
1109 * early_platform_add_devices - add a numbers of early platform devices 1117 * early_platform_add_devices - adds a number of early platform devices
1110 * @devs: array of early platform devices to add 1118 * @devs: array of early platform devices to add
1111 * @num: number of early platform devices in array 1119 * @num: number of early platform devices in array
1120 *
1121 * Used by early architecture code to register early platform devices and
1122 * their platform data.
1112 */ 1123 */
1113void __init early_platform_add_devices(struct platform_device **devs, int num) 1124void __init early_platform_add_devices(struct platform_device **devs, int num)
1114{ 1125{
@@ -1128,8 +1139,12 @@ void __init early_platform_add_devices(struct platform_device **devs, int num)
1128} 1139}
1129 1140
1130/** 1141/**
1131 * early_platform_driver_register_all 1142 * early_platform_driver_register_all - register early platform drivers
1132 * @class_str: string to identify early platform driver class 1143 * @class_str: string to identify early platform driver class
1144 *
1145 * Used by architecture code to register all early platform drivers
1146 * for a certain class. If omitted then only early platform drivers
1147 * with matching kernel command line class parameters will be registered.
1133 */ 1148 */
1134void __init early_platform_driver_register_all(char *class_str) 1149void __init early_platform_driver_register_all(char *class_str)
1135{ 1150{
@@ -1151,7 +1166,7 @@ void __init early_platform_driver_register_all(char *class_str)
1151} 1166}
1152 1167
1153/** 1168/**
1154 * early_platform_match 1169 * early_platform_match - find early platform device matching driver
1155 * @epdrv: early platform driver structure 1170 * @epdrv: early platform driver structure
1156 * @id: id to match against 1171 * @id: id to match against
1157 */ 1172 */
@@ -1169,7 +1184,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id)
1169} 1184}
1170 1185
1171/** 1186/**
1172 * early_platform_left 1187 * early_platform_left - check if early platform driver has matching devices
1173 * @epdrv: early platform driver structure 1188 * @epdrv: early platform driver structure
1174 * @id: return true if id or above exists 1189 * @id: return true if id or above exists
1175 */ 1190 */
@@ -1187,7 +1202,7 @@ static __init int early_platform_left(struct early_platform_driver *epdrv,
1187} 1202}
1188 1203
1189/** 1204/**
1190 * early_platform_driver_probe_id 1205 * early_platform_driver_probe_id - probe drivers matching class_str and id
1191 * @class_str: string to identify early platform driver class 1206 * @class_str: string to identify early platform driver class
1192 * @id: id to match against 1207 * @id: id to match against
1193 * @nr_probe: number of platform devices to successfully probe before exiting 1208 * @nr_probe: number of platform devices to successfully probe before exiting
@@ -1257,10 +1272,14 @@ static int __init early_platform_driver_probe_id(char *class_str,
1257} 1272}
1258 1273
1259/** 1274/**
1260 * early_platform_driver_probe 1275 * early_platform_driver_probe - probe a class of registered drivers
1261 * @class_str: string to identify early platform driver class 1276 * @class_str: string to identify early platform driver class
1262 * @nr_probe: number of platform devices to successfully probe before exiting 1277 * @nr_probe: number of platform devices to successfully probe before exiting
1263 * @user_only: only probe user specified early platform devices 1278 * @user_only: only probe user specified early platform devices
1279 *
1280 * Used by architecture code to probe registered early platform drivers
1281 * within a certain class. For probe to happen a registered early platform
1282 * device matching a registered early platform driver is needed.
1264 */ 1283 */
1265int __init early_platform_driver_probe(char *class_str, 1284int __init early_platform_driver_probe(char *class_str,
1266 int nr_probe, 1285 int nr_probe,
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index d477f4dc5e51..941fcb87e52a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -439,8 +439,23 @@ static int device_resume_noirq(struct device *dev, pm_message_t state)
439 if (dev->bus && dev->bus->pm) { 439 if (dev->bus && dev->bus->pm) {
440 pm_dev_dbg(dev, state, "EARLY "); 440 pm_dev_dbg(dev, state, "EARLY ");
441 error = pm_noirq_op(dev, dev->bus->pm, state); 441 error = pm_noirq_op(dev, dev->bus->pm, state);
442 if (error)
443 goto End;
442 } 444 }
443 445
446 if (dev->type && dev->type->pm) {
447 pm_dev_dbg(dev, state, "EARLY type ");
448 error = pm_noirq_op(dev, dev->type->pm, state);
449 if (error)
450 goto End;
451 }
452
453 if (dev->class && dev->class->pm) {
454 pm_dev_dbg(dev, state, "EARLY class ");
455 error = pm_noirq_op(dev, dev->class->pm, state);
456 }
457
458End:
444 TRACE_RESUME(error); 459 TRACE_RESUME(error);
445 return error; 460 return error;
446} 461}
@@ -735,10 +750,26 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state)
735{ 750{
736 int error = 0; 751 int error = 0;
737 752
753 if (dev->class && dev->class->pm) {
754 pm_dev_dbg(dev, state, "LATE class ");
755 error = pm_noirq_op(dev, dev->class->pm, state);
756 if (error)
757 goto End;
758 }
759
760 if (dev->type && dev->type->pm) {
761 pm_dev_dbg(dev, state, "LATE type ");
762 error = pm_noirq_op(dev, dev->type->pm, state);
763 if (error)
764 goto End;
765 }
766
738 if (dev->bus && dev->bus->pm) { 767 if (dev->bus && dev->bus->pm) {
739 pm_dev_dbg(dev, state, "LATE "); 768 pm_dev_dbg(dev, state, "LATE ");
740 error = pm_noirq_op(dev, dev->bus->pm, state); 769 error = pm_noirq_op(dev, dev->bus->pm, state);
741 } 770 }
771
772End:
742 return error; 773 return error;
743} 774}
744 775
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index a3e10dc7cc25..b78d5c381efe 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL(intel_agp_enabled);
97#define IS_PINEVIEW (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \ 97#define IS_PINEVIEW (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB || \
98 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB) 98 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_PINEVIEW_HB)
99 99
100#define IS_SNB (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \
101 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB)
102
100#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \ 103#define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_EAGLELAKE_HB || \
101 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \ 104 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
102 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \ 105 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
@@ -107,8 +110,7 @@ EXPORT_SYMBOL(intel_agp_enabled);
107 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || \ 110 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || \
108 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \ 111 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB || \
109 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB || \ 112 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB || \
110 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB || \ 113 IS_SNB)
111 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB)
112 114
113extern int agp_memory_reserved; 115extern int agp_memory_reserved;
114 116
@@ -175,6 +177,10 @@ extern int agp_memory_reserved;
175#define SNB_GMCH_GMS_STOLEN_448M (0xe << 3) 177#define SNB_GMCH_GMS_STOLEN_448M (0xe << 3)
176#define SNB_GMCH_GMS_STOLEN_480M (0xf << 3) 178#define SNB_GMCH_GMS_STOLEN_480M (0xf << 3)
177#define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3) 179#define SNB_GMCH_GMS_STOLEN_512M (0x10 << 3)
180#define SNB_GTT_SIZE_0M (0 << 8)
181#define SNB_GTT_SIZE_1M (1 << 8)
182#define SNB_GTT_SIZE_2M (2 << 8)
183#define SNB_GTT_SIZE_MASK (3 << 8)
178 184
179static const struct aper_size_info_fixed intel_i810_sizes[] = 185static const struct aper_size_info_fixed intel_i810_sizes[] =
180{ 186{
@@ -1200,6 +1206,9 @@ static void intel_i9xx_setup_flush(void)
1200 if (intel_private.ifp_resource.start) 1206 if (intel_private.ifp_resource.start)
1201 return; 1207 return;
1202 1208
1209 if (IS_SNB)
1210 return;
1211
1203 /* setup a resource for this object */ 1212 /* setup a resource for this object */
1204 intel_private.ifp_resource.name = "Intel Flush Page"; 1213 intel_private.ifp_resource.name = "Intel Flush Page";
1205 intel_private.ifp_resource.flags = IORESOURCE_MEM; 1214 intel_private.ifp_resource.flags = IORESOURCE_MEM;
@@ -1438,6 +1447,8 @@ static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge,
1438 1447
1439static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size) 1448static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1440{ 1449{
1450 u16 snb_gmch_ctl;
1451
1441 switch (agp_bridge->dev->device) { 1452 switch (agp_bridge->dev->device) {
1442 case PCI_DEVICE_ID_INTEL_GM45_HB: 1453 case PCI_DEVICE_ID_INTEL_GM45_HB:
1443 case PCI_DEVICE_ID_INTEL_EAGLELAKE_HB: 1454 case PCI_DEVICE_ID_INTEL_EAGLELAKE_HB:
@@ -1449,9 +1460,26 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
1449 case PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB: 1460 case PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB:
1450 case PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB: 1461 case PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB:
1451 case PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB: 1462 case PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB:
1463 *gtt_offset = *gtt_size = MB(2);
1464 break;
1452 case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB: 1465 case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_HB:
1453 case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB: 1466 case PCI_DEVICE_ID_INTEL_SANDYBRIDGE_M_HB:
1454 *gtt_offset = *gtt_size = MB(2); 1467 *gtt_offset = MB(2);
1468
1469 pci_read_config_word(intel_private.pcidev, SNB_GMCH_CTRL, &snb_gmch_ctl);
1470 switch (snb_gmch_ctl & SNB_GTT_SIZE_MASK) {
1471 default:
1472 case SNB_GTT_SIZE_0M:
1473 printk(KERN_ERR "Bad GTT size mask: 0x%04x.\n", snb_gmch_ctl);
1474 *gtt_size = MB(0);
1475 break;
1476 case SNB_GTT_SIZE_1M:
1477 *gtt_size = MB(1);
1478 break;
1479 case SNB_GTT_SIZE_2M:
1480 *gtt_size = MB(2);
1481 break;
1482 }
1455 break; 1483 break;
1456 default: 1484 default:
1457 *gtt_offset = *gtt_size = KB(512); 1485 *gtt_offset = *gtt_size = KB(512);
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 465185fc0f52..ba55bba151b9 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -312,6 +312,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
312 spin_lock_irqsave(&hp->lock, flags); 312 spin_lock_irqsave(&hp->lock, flags);
313 /* Check and then increment for fast path open. */ 313 /* Check and then increment for fast path open. */
314 if (hp->count++ > 0) { 314 if (hp->count++ > 0) {
315 tty_kref_get(tty);
315 spin_unlock_irqrestore(&hp->lock, flags); 316 spin_unlock_irqrestore(&hp->lock, flags);
316 hvc_kick(); 317 hvc_kick();
317 return 0; 318 return 0;
@@ -319,7 +320,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
319 320
320 tty->driver_data = hp; 321 tty->driver_data = hp;
321 322
322 hp->tty = tty; 323 hp->tty = tty_kref_get(tty);
323 324
324 spin_unlock_irqrestore(&hp->lock, flags); 325 spin_unlock_irqrestore(&hp->lock, flags);
325 326
@@ -336,6 +337,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
336 spin_lock_irqsave(&hp->lock, flags); 337 spin_lock_irqsave(&hp->lock, flags);
337 hp->tty = NULL; 338 hp->tty = NULL;
338 spin_unlock_irqrestore(&hp->lock, flags); 339 spin_unlock_irqrestore(&hp->lock, flags);
340 tty_kref_put(tty);
339 tty->driver_data = NULL; 341 tty->driver_data = NULL;
340 kref_put(&hp->kref, destroy_hvc_struct); 342 kref_put(&hp->kref, destroy_hvc_struct);
341 printk(KERN_ERR "hvc_open: request_irq failed with rc %d.\n", rc); 343 printk(KERN_ERR "hvc_open: request_irq failed with rc %d.\n", rc);
@@ -363,13 +365,18 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
363 return; 365 return;
364 366
365 hp = tty->driver_data; 367 hp = tty->driver_data;
368
366 spin_lock_irqsave(&hp->lock, flags); 369 spin_lock_irqsave(&hp->lock, flags);
370 tty_kref_get(tty);
367 371
368 if (--hp->count == 0) { 372 if (--hp->count == 0) {
369 /* We are done with the tty pointer now. */ 373 /* We are done with the tty pointer now. */
370 hp->tty = NULL; 374 hp->tty = NULL;
371 spin_unlock_irqrestore(&hp->lock, flags); 375 spin_unlock_irqrestore(&hp->lock, flags);
372 376
377 /* Put the ref obtained in hvc_open() */
378 tty_kref_put(tty);
379
373 if (hp->ops->notifier_del) 380 if (hp->ops->notifier_del)
374 hp->ops->notifier_del(hp, hp->data); 381 hp->ops->notifier_del(hp, hp->data);
375 382
@@ -389,6 +396,7 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)
389 spin_unlock_irqrestore(&hp->lock, flags); 396 spin_unlock_irqrestore(&hp->lock, flags);
390 } 397 }
391 398
399 tty_kref_put(tty);
392 kref_put(&hp->kref, destroy_hvc_struct); 400 kref_put(&hp->kref, destroy_hvc_struct);
393} 401}
394 402
@@ -424,10 +432,11 @@ static void hvc_hangup(struct tty_struct *tty)
424 spin_unlock_irqrestore(&hp->lock, flags); 432 spin_unlock_irqrestore(&hp->lock, flags);
425 433
426 if (hp->ops->notifier_hangup) 434 if (hp->ops->notifier_hangup)
427 hp->ops->notifier_hangup(hp, hp->data); 435 hp->ops->notifier_hangup(hp, hp->data);
428 436
429 while(temp_open_count) { 437 while(temp_open_count) {
430 --temp_open_count; 438 --temp_open_count;
439 tty_kref_put(tty);
431 kref_put(&hp->kref, destroy_hvc_struct); 440 kref_put(&hp->kref, destroy_hvc_struct);
432 } 441 }
433} 442}
@@ -592,7 +601,7 @@ int hvc_poll(struct hvc_struct *hp)
592 } 601 }
593 602
594 /* No tty attached, just skip */ 603 /* No tty attached, just skip */
595 tty = hp->tty; 604 tty = tty_kref_get(hp->tty);
596 if (tty == NULL) 605 if (tty == NULL)
597 goto bail; 606 goto bail;
598 607
@@ -672,6 +681,8 @@ int hvc_poll(struct hvc_struct *hp)
672 681
673 tty_flip_buffer_push(tty); 682 tty_flip_buffer_push(tty);
674 } 683 }
684 if (tty)
685 tty_kref_put(tty);
675 686
676 return poll_mask; 687 return poll_mask;
677} 688}
@@ -807,7 +818,7 @@ int hvc_remove(struct hvc_struct *hp)
807 struct tty_struct *tty; 818 struct tty_struct *tty;
808 819
809 spin_lock_irqsave(&hp->lock, flags); 820 spin_lock_irqsave(&hp->lock, flags);
810 tty = hp->tty; 821 tty = tty_kref_get(hp->tty);
811 822
812 if (hp->index < MAX_NR_HVC_CONSOLES) 823 if (hp->index < MAX_NR_HVC_CONSOLES)
813 vtermnos[hp->index] = -1; 824 vtermnos[hp->index] = -1;
@@ -819,18 +830,18 @@ int hvc_remove(struct hvc_struct *hp)
819 /* 830 /*
820 * We 'put' the instance that was grabbed when the kref instance 831 * We 'put' the instance that was grabbed when the kref instance
821 * was initialized using kref_init(). Let the last holder of this 832 * was initialized using kref_init(). Let the last holder of this
822 * kref cause it to be removed, which will probably be the tty_hangup 833 * kref cause it to be removed, which will probably be the tty_vhangup
823 * below. 834 * below.
824 */ 835 */
825 kref_put(&hp->kref, destroy_hvc_struct); 836 kref_put(&hp->kref, destroy_hvc_struct);
826 837
827 /* 838 /*
828 * This function call will auto chain call hvc_hangup. The tty should 839 * This function call will auto chain call hvc_hangup.
829 * always be valid at this time unless a simultaneous tty close already
830 * cleaned up the hvc_struct.
831 */ 840 */
832 if (tty) 841 if (tty) {
833 tty_hangup(tty); 842 tty_vhangup(tty);
843 tty_kref_put(tty);
844 }
834 return 0; 845 return 0;
835} 846}
836EXPORT_SYMBOL_GPL(hvc_remove); 847EXPORT_SYMBOL_GPL(hvc_remove);
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index ec5e3f8df648..c6ad4234378d 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2272,42 +2272,52 @@ static int create_files(struct bmc_device *bmc)
2272 bmc->device_id_attr.attr.name = "device_id"; 2272 bmc->device_id_attr.attr.name = "device_id";
2273 bmc->device_id_attr.attr.mode = S_IRUGO; 2273 bmc->device_id_attr.attr.mode = S_IRUGO;
2274 bmc->device_id_attr.show = device_id_show; 2274 bmc->device_id_attr.show = device_id_show;
2275 sysfs_attr_init(&bmc->device_id_attr.attr);
2275 2276
2276 bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; 2277 bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs";
2277 bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; 2278 bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO;
2278 bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; 2279 bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show;
2280 sysfs_attr_init(&bmc->provides_dev_sdrs_attr.attr);
2279 2281
2280 bmc->revision_attr.attr.name = "revision"; 2282 bmc->revision_attr.attr.name = "revision";
2281 bmc->revision_attr.attr.mode = S_IRUGO; 2283 bmc->revision_attr.attr.mode = S_IRUGO;
2282 bmc->revision_attr.show = revision_show; 2284 bmc->revision_attr.show = revision_show;
2285 sysfs_attr_init(&bmc->revision_attr.attr);
2283 2286
2284 bmc->firmware_rev_attr.attr.name = "firmware_revision"; 2287 bmc->firmware_rev_attr.attr.name = "firmware_revision";
2285 bmc->firmware_rev_attr.attr.mode = S_IRUGO; 2288 bmc->firmware_rev_attr.attr.mode = S_IRUGO;
2286 bmc->firmware_rev_attr.show = firmware_rev_show; 2289 bmc->firmware_rev_attr.show = firmware_rev_show;
2290 sysfs_attr_init(&bmc->firmware_rev_attr.attr);
2287 2291
2288 bmc->version_attr.attr.name = "ipmi_version"; 2292 bmc->version_attr.attr.name = "ipmi_version";
2289 bmc->version_attr.attr.mode = S_IRUGO; 2293 bmc->version_attr.attr.mode = S_IRUGO;
2290 bmc->version_attr.show = ipmi_version_show; 2294 bmc->version_attr.show = ipmi_version_show;
2295 sysfs_attr_init(&bmc->version_attr.attr);
2291 2296
2292 bmc->add_dev_support_attr.attr.name = "additional_device_support"; 2297 bmc->add_dev_support_attr.attr.name = "additional_device_support";
2293 bmc->add_dev_support_attr.attr.mode = S_IRUGO; 2298 bmc->add_dev_support_attr.attr.mode = S_IRUGO;
2294 bmc->add_dev_support_attr.show = add_dev_support_show; 2299 bmc->add_dev_support_attr.show = add_dev_support_show;
2300 sysfs_attr_init(&bmc->add_dev_support_attr.attr);
2295 2301
2296 bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; 2302 bmc->manufacturer_id_attr.attr.name = "manufacturer_id";
2297 bmc->manufacturer_id_attr.attr.mode = S_IRUGO; 2303 bmc->manufacturer_id_attr.attr.mode = S_IRUGO;
2298 bmc->manufacturer_id_attr.show = manufacturer_id_show; 2304 bmc->manufacturer_id_attr.show = manufacturer_id_show;
2305 sysfs_attr_init(&bmc->manufacturer_id_attr.attr);
2299 2306
2300 bmc->product_id_attr.attr.name = "product_id"; 2307 bmc->product_id_attr.attr.name = "product_id";
2301 bmc->product_id_attr.attr.mode = S_IRUGO; 2308 bmc->product_id_attr.attr.mode = S_IRUGO;
2302 bmc->product_id_attr.show = product_id_show; 2309 bmc->product_id_attr.show = product_id_show;
2310 sysfs_attr_init(&bmc->product_id_attr.attr);
2303 2311
2304 bmc->guid_attr.attr.name = "guid"; 2312 bmc->guid_attr.attr.name = "guid";
2305 bmc->guid_attr.attr.mode = S_IRUGO; 2313 bmc->guid_attr.attr.mode = S_IRUGO;
2306 bmc->guid_attr.show = guid_show; 2314 bmc->guid_attr.show = guid_show;
2315 sysfs_attr_init(&bmc->guid_attr.attr);
2307 2316
2308 bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; 2317 bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision";
2309 bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; 2318 bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO;
2310 bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; 2319 bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show;
2320 sysfs_attr_init(&bmc->aux_firmware_rev_attr.attr);
2311 2321
2312 err = device_create_file(&bmc->dev->dev, 2322 err = device_create_file(&bmc->dev->dev,
2313 &bmc->device_id_attr); 2323 &bmc->device_id_attr);
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
index af8d97715728..7ee52164d474 100644
--- a/drivers/char/tty_buffer.c
+++ b/drivers/char/tty_buffer.c
@@ -248,7 +248,7 @@ int tty_insert_flip_string_fixed_flag(struct tty_struct *tty,
248{ 248{
249 int copied = 0; 249 int copied = 0;
250 do { 250 do {
251 int goal = min(size - copied, TTY_BUFFER_PAGE); 251 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
252 int space = tty_buffer_request_room(tty, goal); 252 int space = tty_buffer_request_room(tty, goal);
253 struct tty_buffer *tb = tty->buf.tail; 253 struct tty_buffer *tb = tty->buf.tail;
254 /* If there is no space then tb may be NULL */ 254 /* If there is no space then tb may be NULL */
@@ -285,7 +285,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
285{ 285{
286 int copied = 0; 286 int copied = 0;
287 do { 287 do {
288 int goal = min(size - copied, TTY_BUFFER_PAGE); 288 int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE);
289 int space = tty_buffer_request_room(tty, goal); 289 int space = tty_buffer_request_room(tty, goal);
290 struct tty_buffer *tb = tty->buf.tail; 290 struct tty_buffer *tb = tty->buf.tail;
291 /* If there is no space then tb may be NULL */ 291 /* If there is no space then tb may be NULL */
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index be492dd66437..a3bd1d0b66cf 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -119,7 +119,7 @@ EXPORT_SYMBOL(tty_port_tty_set);
119static void tty_port_shutdown(struct tty_port *port) 119static void tty_port_shutdown(struct tty_port *port)
120{ 120{
121 mutex_lock(&port->mutex); 121 mutex_lock(&port->mutex);
122 if (port->ops->shutdown && 122 if (port->ops->shutdown && !port->console &&
123 test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) 123 test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags))
124 port->ops->shutdown(port); 124 port->ops->shutdown(port);
125 mutex_unlock(&port->mutex); 125 mutex_unlock(&port->mutex);
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index f404ccfc9c20..44288ce0cb45 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -681,6 +681,10 @@ static void resize_console(struct port *port)
681 struct virtio_device *vdev; 681 struct virtio_device *vdev;
682 struct winsize ws; 682 struct winsize ws;
683 683
684 /* The port could have been hot-unplugged */
685 if (!port)
686 return;
687
684 vdev = port->portdev->vdev; 688 vdev = port->portdev->vdev;
685 if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) { 689 if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
686 vdev->config->get(vdev, 690 vdev->config->get(vdev,
@@ -947,11 +951,18 @@ static void handle_control_message(struct ports_device *portdev,
947 */ 951 */
948 err = sysfs_create_group(&port->dev->kobj, 952 err = sysfs_create_group(&port->dev->kobj,
949 &port_attribute_group); 953 &port_attribute_group);
950 if (err) 954 if (err) {
951 dev_err(port->dev, 955 dev_err(port->dev,
952 "Error %d creating sysfs device attributes\n", 956 "Error %d creating sysfs device attributes\n",
953 err); 957 err);
954 958 } else {
959 /*
960 * Generate a udev event so that appropriate
961 * symlinks can be created based on udev
962 * rules.
963 */
964 kobject_uevent(&port->dev->kobj, KOBJ_CHANGE);
965 }
955 break; 966 break;
956 case VIRTIO_CONSOLE_PORT_REMOVE: 967 case VIRTIO_CONSOLE_PORT_REMOVE:
957 /* 968 /*
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 87778dcf8727..6aa10284104a 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -888,7 +888,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
888 ret = -EFAULT; 888 ret = -EFAULT;
889 goto out; 889 goto out;
890 } 890 }
891 if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS && tmp.mode != VT_PROCESS_AUTO) { 891 if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {
892 ret = -EINVAL; 892 ret = -EINVAL;
893 goto out; 893 goto out;
894 } 894 }
@@ -1622,7 +1622,7 @@ static void complete_change_console(struct vc_data *vc)
1622 * telling it that it has acquired. Also check if it has died and 1622 * telling it that it has acquired. Also check if it has died and
1623 * clean up (similar to logic employed in change_console()) 1623 * clean up (similar to logic employed in change_console())
1624 */ 1624 */
1625 if (vc->vt_mode.mode == VT_PROCESS || vc->vt_mode.mode == VT_PROCESS_AUTO) { 1625 if (vc->vt_mode.mode == VT_PROCESS) {
1626 /* 1626 /*
1627 * Send the signal as privileged - kill_pid() will 1627 * Send the signal as privileged - kill_pid() will
1628 * tell us if the process has gone or something else 1628 * tell us if the process has gone or something else
@@ -1682,7 +1682,7 @@ void change_console(struct vc_data *new_vc)
1682 * vt to auto control. 1682 * vt to auto control.
1683 */ 1683 */
1684 vc = vc_cons[fg_console].d; 1684 vc = vc_cons[fg_console].d;
1685 if (vc->vt_mode.mode == VT_PROCESS || vc->vt_mode.mode == VT_PROCESS_AUTO) { 1685 if (vc->vt_mode.mode == VT_PROCESS) {
1686 /* 1686 /*
1687 * Send the signal as privileged - kill_pid() will 1687 * Send the signal as privileged - kill_pid() will
1688 * tell us if the process has gone or something else 1688 * tell us if the process has gone or something else
@@ -1693,28 +1693,27 @@ void change_console(struct vc_data *new_vc)
1693 */ 1693 */
1694 vc->vt_newvt = new_vc->vc_num; 1694 vc->vt_newvt = new_vc->vc_num;
1695 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) { 1695 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
1696 if(vc->vt_mode.mode == VT_PROCESS)
1697 /*
1698 * It worked. Mark the vt to switch to and
1699 * return. The process needs to send us a
1700 * VT_RELDISP ioctl to complete the switch.
1701 */
1702 return;
1703 } else {
1704 /* 1696 /*
1705 * The controlling process has died, so we revert back to 1697 * It worked. Mark the vt to switch to and
1706 * normal operation. In this case, we'll also change back 1698 * return. The process needs to send us a
1707 * to KD_TEXT mode. I'm not sure if this is strictly correct 1699 * VT_RELDISP ioctl to complete the switch.
1708 * but it saves the agony when the X server dies and the screen
1709 * remains blanked due to KD_GRAPHICS! It would be nice to do
1710 * this outside of VT_PROCESS but there is no single process
1711 * to account for and tracking tty count may be undesirable.
1712 */ 1700 */
1713 reset_vc(vc); 1701 return;
1714 } 1702 }
1715 1703
1716 /* 1704 /*
1717 * Fall through to normal (VT_AUTO and VT_PROCESS_AUTO) handling of the switch... 1705 * The controlling process has died, so we revert back to
1706 * normal operation. In this case, we'll also change back
1707 * to KD_TEXT mode. I'm not sure if this is strictly correct
1708 * but it saves the agony when the X server dies and the screen
1709 * remains blanked due to KD_GRAPHICS! It would be nice to do
1710 * this outside of VT_PROCESS but there is no single process
1711 * to account for and tracking tty count may be undesirable.
1712 */
1713 reset_vc(vc);
1714
1715 /*
1716 * Fall through to normal (VT_AUTO) handling of the switch...
1718 */ 1717 */
1719 } 1718 }
1720 1719
diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c
index 8fc91a019620..f5b6d9fe4def 100644
--- a/drivers/edac/edac_mce_amd.c
+++ b/drivers/edac/edac_mce_amd.c
@@ -316,7 +316,12 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
316 if (regs->nbsh & K8_NBSH_ERR_CPU_VAL) 316 if (regs->nbsh & K8_NBSH_ERR_CPU_VAL)
317 pr_cont(", core: %u\n", (u8)(regs->nbsh & 0xf)); 317 pr_cont(", core: %u\n", (u8)(regs->nbsh & 0xf));
318 } else { 318 } else {
319 pr_cont(", core: %d\n", fls((regs->nbsh & 0xf) - 1)); 319 u8 assoc_cpus = regs->nbsh & 0xf;
320
321 if (assoc_cpus > 0)
322 pr_cont(", core: %d", fls(assoc_cpus) - 1);
323
324 pr_cont("\n");
320 } 325 }
321 326
322 pr_emerg("%s.\n", EXT_ERR_MSG(xec)); 327 pr_emerg("%s.\n", EXT_ERR_MSG(xec));
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 5db0518c66da..882472d1e144 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -126,97 +126,74 @@ int fw_csr_string(const u32 *directory, int key, char *buf, size_t size)
126} 126}
127EXPORT_SYMBOL(fw_csr_string); 127EXPORT_SYMBOL(fw_csr_string);
128 128
129static bool is_fw_unit(struct device *dev); 129static void get_ids(const u32 *directory, int *id)
130
131static int match_unit_directory(const u32 *directory, u32 match_flags,
132 const struct ieee1394_device_id *id)
133{ 130{
134 struct fw_csr_iterator ci; 131 struct fw_csr_iterator ci;
135 int key, value, match; 132 int key, value;
136 133
137 match = 0;
138 fw_csr_iterator_init(&ci, directory); 134 fw_csr_iterator_init(&ci, directory);
139 while (fw_csr_iterator_next(&ci, &key, &value)) { 135 while (fw_csr_iterator_next(&ci, &key, &value)) {
140 if (key == CSR_VENDOR && value == id->vendor_id) 136 switch (key) {
141 match |= IEEE1394_MATCH_VENDOR_ID; 137 case CSR_VENDOR: id[0] = value; break;
142 if (key == CSR_MODEL && value == id->model_id) 138 case CSR_MODEL: id[1] = value; break;
143 match |= IEEE1394_MATCH_MODEL_ID; 139 case CSR_SPECIFIER_ID: id[2] = value; break;
144 if (key == CSR_SPECIFIER_ID && value == id->specifier_id) 140 case CSR_VERSION: id[3] = value; break;
145 match |= IEEE1394_MATCH_SPECIFIER_ID; 141 }
146 if (key == CSR_VERSION && value == id->version)
147 match |= IEEE1394_MATCH_VERSION;
148 } 142 }
143}
144
145static void get_modalias_ids(struct fw_unit *unit, int *id)
146{
147 get_ids(&fw_parent_device(unit)->config_rom[5], id);
148 get_ids(unit->directory, id);
149}
150
151static bool match_ids(const struct ieee1394_device_id *id_table, int *id)
152{
153 int match = 0;
154
155 if (id[0] == id_table->vendor_id)
156 match |= IEEE1394_MATCH_VENDOR_ID;
157 if (id[1] == id_table->model_id)
158 match |= IEEE1394_MATCH_MODEL_ID;
159 if (id[2] == id_table->specifier_id)
160 match |= IEEE1394_MATCH_SPECIFIER_ID;
161 if (id[3] == id_table->version)
162 match |= IEEE1394_MATCH_VERSION;
149 163
150 return (match & match_flags) == match_flags; 164 return (match & id_table->match_flags) == id_table->match_flags;
151} 165}
152 166
167static bool is_fw_unit(struct device *dev);
168
153static int fw_unit_match(struct device *dev, struct device_driver *drv) 169static int fw_unit_match(struct device *dev, struct device_driver *drv)
154{ 170{
155 struct fw_unit *unit = fw_unit(dev); 171 const struct ieee1394_device_id *id_table =
156 struct fw_device *device; 172 container_of(drv, struct fw_driver, driver)->id_table;
157 const struct ieee1394_device_id *id; 173 int id[] = {0, 0, 0, 0};
158 174
159 /* We only allow binding to fw_units. */ 175 /* We only allow binding to fw_units. */
160 if (!is_fw_unit(dev)) 176 if (!is_fw_unit(dev))
161 return 0; 177 return 0;
162 178
163 device = fw_parent_device(unit); 179 get_modalias_ids(fw_unit(dev), id);
164 id = container_of(drv, struct fw_driver, driver)->id_table;
165 180
166 for (; id->match_flags != 0; id++) { 181 for (; id_table->match_flags != 0; id_table++)
167 if (match_unit_directory(unit->directory, id->match_flags, id)) 182 if (match_ids(id_table, id))
168 return 1; 183 return 1;
169 184
170 /* Also check vendor ID in the root directory. */
171 if ((id->match_flags & IEEE1394_MATCH_VENDOR_ID) &&
172 match_unit_directory(&device->config_rom[5],
173 IEEE1394_MATCH_VENDOR_ID, id) &&
174 match_unit_directory(unit->directory, id->match_flags
175 & ~IEEE1394_MATCH_VENDOR_ID, id))
176 return 1;
177 }
178
179 return 0; 185 return 0;
180} 186}
181 187
182static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) 188static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size)
183{ 189{
184 struct fw_device *device = fw_parent_device(unit); 190 int id[] = {0, 0, 0, 0};
185 struct fw_csr_iterator ci;
186 191
187 int key, value; 192 get_modalias_ids(unit, id);
188 int vendor = 0;
189 int model = 0;
190 int specifier_id = 0;
191 int version = 0;
192
193 fw_csr_iterator_init(&ci, &device->config_rom[5]);
194 while (fw_csr_iterator_next(&ci, &key, &value)) {
195 switch (key) {
196 case CSR_VENDOR:
197 vendor = value;
198 break;
199 case CSR_MODEL:
200 model = value;
201 break;
202 }
203 }
204
205 fw_csr_iterator_init(&ci, unit->directory);
206 while (fw_csr_iterator_next(&ci, &key, &value)) {
207 switch (key) {
208 case CSR_SPECIFIER_ID:
209 specifier_id = value;
210 break;
211 case CSR_VERSION:
212 version = value;
213 break;
214 }
215 }
216 193
217 return snprintf(buffer, buffer_size, 194 return snprintf(buffer, buffer_size,
218 "ieee1394:ven%08Xmo%08Xsp%08Xver%08X", 195 "ieee1394:ven%08Xmo%08Xsp%08Xver%08X",
219 vendor, model, specifier_id, version); 196 id[0], id[1], id[2], id[3]);
220} 197}
221 198
222static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env) 199static int fw_unit_uevent(struct device *dev, struct kobj_uevent_env *env)
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 1c0b504a42f3..99c20f1b613a 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -331,8 +331,9 @@ void fw_iso_resource_manage(struct fw_card *card, int generation,
331 if (ret < 0) 331 if (ret < 0)
332 *bandwidth = 0; 332 *bandwidth = 0;
333 333
334 if (allocate && ret < 0 && c >= 0) { 334 if (allocate && ret < 0) {
335 deallocate_channel(card, irm_id, generation, c, buffer); 335 if (c >= 0)
336 deallocate_channel(card, irm_id, generation, c, buffer);
336 *channel = ret; 337 *channel = ret;
337 } 338 }
338} 339}
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 75dc6988cffd..e33917bf97d2 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -231,6 +231,8 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
231 231
232static char ohci_driver_name[] = KBUILD_MODNAME; 232static char ohci_driver_name[] = KBUILD_MODNAME;
233 233
234#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009
235
234#define QUIRK_CYCLE_TIMER 1 236#define QUIRK_CYCLE_TIMER 1
235#define QUIRK_RESET_PACKET 2 237#define QUIRK_RESET_PACKET 2
236#define QUIRK_BE_HEADERS 4 238#define QUIRK_BE_HEADERS 4
@@ -239,6 +241,8 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
239static const struct { 241static const struct {
240 unsigned short vendor, device, flags; 242 unsigned short vendor, device, flags;
241} ohci_quirks[] = { 243} ohci_quirks[] = {
244 {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER |
245 QUIRK_RESET_PACKET},
242 {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET}, 246 {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET},
243 {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 247 {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
244 {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, 248 {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER},
diff --git a/drivers/gpio/max730x.c b/drivers/gpio/max730x.c
index c9bced55f82b..4a7d662ff9b7 100644
--- a/drivers/gpio/max730x.c
+++ b/drivers/gpio/max730x.c
@@ -242,3 +242,7 @@ int __devexit __max730x_remove(struct device *dev)
242 return ret; 242 return ret;
243} 243}
244EXPORT_SYMBOL_GPL(__max730x_remove); 244EXPORT_SYMBOL_GPL(__max730x_remove);
245
246MODULE_AUTHOR("Juergen Beisert, Wolfram Sang");
247MODULE_LICENSE("GPL v2");
248MODULE_DESCRIPTION("MAX730x GPIO-Expanders, generic parts");
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8bfc0bbf13e6..a9f8589490cf 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1881,29 +1881,29 @@ struct drm_ioctl_desc i915_ioctls[] = {
1881 DRM_IOCTL_DEF(DRM_I915_GET_VBLANK_PIPE, i915_vblank_pipe_get, DRM_AUTH ), 1881 DRM_IOCTL_DEF(DRM_I915_GET_VBLANK_PIPE, i915_vblank_pipe_get, DRM_AUTH ),
1882 DRM_IOCTL_DEF(DRM_I915_VBLANK_SWAP, i915_vblank_swap, DRM_AUTH), 1882 DRM_IOCTL_DEF(DRM_I915_VBLANK_SWAP, i915_vblank_swap, DRM_AUTH),
1883 DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1883 DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
1884 DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1884 DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED),
1885 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), 1885 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH|DRM_UNLOCKED),
1886 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER2, i915_gem_execbuffer2, DRM_AUTH), 1886 DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER2, i915_gem_execbuffer2, DRM_AUTH|DRM_UNLOCKED),
1887 DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), 1887 DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY|DRM_UNLOCKED),
1888 DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), 1888 DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY|DRM_UNLOCKED),
1889 DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), 1889 DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_UNLOCKED),
1890 DRM_IOCTL_DEF(DRM_I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH), 1890 DRM_IOCTL_DEF(DRM_I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_UNLOCKED),
1891 DRM_IOCTL_DEF(DRM_I915_GEM_ENTERVT, i915_gem_entervt_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1891 DRM_IOCTL_DEF(DRM_I915_GEM_ENTERVT, i915_gem_entervt_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED),
1892 DRM_IOCTL_DEF(DRM_I915_GEM_LEAVEVT, i915_gem_leavevt_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), 1892 DRM_IOCTL_DEF(DRM_I915_GEM_LEAVEVT, i915_gem_leavevt_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED),
1893 DRM_IOCTL_DEF(DRM_I915_GEM_CREATE, i915_gem_create_ioctl, 0), 1893 DRM_IOCTL_DEF(DRM_I915_GEM_CREATE, i915_gem_create_ioctl, DRM_UNLOCKED),
1894 DRM_IOCTL_DEF(DRM_I915_GEM_PREAD, i915_gem_pread_ioctl, 0), 1894 DRM_IOCTL_DEF(DRM_I915_GEM_PREAD, i915_gem_pread_ioctl, DRM_UNLOCKED),
1895 DRM_IOCTL_DEF(DRM_I915_GEM_PWRITE, i915_gem_pwrite_ioctl, 0), 1895 DRM_IOCTL_DEF(DRM_I915_GEM_PWRITE, i915_gem_pwrite_ioctl, DRM_UNLOCKED),
1896 DRM_IOCTL_DEF(DRM_I915_GEM_MMAP, i915_gem_mmap_ioctl, 0), 1896 DRM_IOCTL_DEF(DRM_I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_UNLOCKED),
1897 DRM_IOCTL_DEF(DRM_I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, 0), 1897 DRM_IOCTL_DEF(DRM_I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, DRM_UNLOCKED),
1898 DRM_IOCTL_DEF(DRM_I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, 0), 1898 DRM_IOCTL_DEF(DRM_I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, DRM_UNLOCKED),
1899 DRM_IOCTL_DEF(DRM_I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, 0), 1899 DRM_IOCTL_DEF(DRM_I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, DRM_UNLOCKED),
1900 DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, 0), 1900 DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, DRM_UNLOCKED),
1901 DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, 0), 1901 DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, DRM_UNLOCKED),
1902 DRM_IOCTL_DEF(DRM_I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, 0), 1902 DRM_IOCTL_DEF(DRM_I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, DRM_UNLOCKED),
1903 DRM_IOCTL_DEF(DRM_I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, 0), 1903 DRM_IOCTL_DEF(DRM_I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, DRM_UNLOCKED),
1904 DRM_IOCTL_DEF(DRM_I915_GEM_MADVISE, i915_gem_madvise_ioctl, 0), 1904 DRM_IOCTL_DEF(DRM_I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_UNLOCKED),
1905 DRM_IOCTL_DEF(DRM_I915_OVERLAY_PUT_IMAGE, intel_overlay_put_image, DRM_MASTER|DRM_CONTROL_ALLOW), 1905 DRM_IOCTL_DEF(DRM_I915_OVERLAY_PUT_IMAGE, intel_overlay_put_image, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
1906 DRM_IOCTL_DEF(DRM_I915_OVERLAY_ATTRS, intel_overlay_attrs, DRM_MASTER|DRM_CONTROL_ALLOW), 1906 DRM_IOCTL_DEF(DRM_I915_OVERLAY_ATTRS, intel_overlay_attrs, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
1907}; 1907};
1908 1908
1909int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); 1909int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 1b2e95455c05..4b26919abdb2 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -139,12 +139,12 @@ const static struct intel_device_info intel_ironlake_m_info = {
139 139
140const static struct intel_device_info intel_sandybridge_d_info = { 140const static struct intel_device_info intel_sandybridge_d_info = {
141 .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1, 141 .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
142 .has_hotplug = 1, 142 .has_hotplug = 1, .is_gen6 = 1,
143}; 143};
144 144
145const static struct intel_device_info intel_sandybridge_m_info = { 145const static struct intel_device_info intel_sandybridge_m_info = {
146 .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, .need_gfx_hws = 1, 146 .is_i965g = 1, .is_mobile = 1, .is_i9xx = 1, .need_gfx_hws = 1,
147 .has_hotplug = 1, 147 .has_hotplug = 1, .is_gen6 = 1,
148}; 148};
149 149
150const static struct pci_device_id pciidlist[] = { 150const static struct pci_device_id pciidlist[] = {
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 979439cfb827..aba8260fbc5e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -205,6 +205,7 @@ struct intel_device_info {
205 u8 is_g4x : 1; 205 u8 is_g4x : 1;
206 u8 is_pineview : 1; 206 u8 is_pineview : 1;
207 u8 is_ironlake : 1; 207 u8 is_ironlake : 1;
208 u8 is_gen6 : 1;
208 u8 has_fbc : 1; 209 u8 has_fbc : 1;
209 u8 has_rc6 : 1; 210 u8 has_rc6 : 1;
210 u8 has_pipe_cxsr : 1; 211 u8 has_pipe_cxsr : 1;
@@ -1084,6 +1085,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1084#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) 1085#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
1085#define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake) 1086#define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake)
1086#define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx) 1087#define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx)
1088#define IS_GEN6(dev) (INTEL_INFO(dev)->is_gen6)
1087#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) 1089#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1088 1090
1089#define IS_GEN3(dev) (IS_I915G(dev) || \ 1091#define IS_GEN3(dev) (IS_I915G(dev) || \
@@ -1107,8 +1109,6 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1107 1109
1108#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) 1110#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1109 1111
1110#define IS_GEN6(dev) ((dev)->pci_device == 0x0102)
1111
1112/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1112/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1113 * rows, which changed the alignment requirements and fence programming. 1113 * rows, which changed the alignment requirements and fence programming.
1114 */ 1114 */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fba37e9f775d..933e865a8929 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1466,9 +1466,6 @@ i915_gem_object_put_pages(struct drm_gem_object *obj)
1466 obj_priv->dirty = 0; 1466 obj_priv->dirty = 0;
1467 1467
1468 for (i = 0; i < page_count; i++) { 1468 for (i = 0; i < page_count; i++) {
1469 if (obj_priv->pages[i] == NULL)
1470 break;
1471
1472 if (obj_priv->dirty) 1469 if (obj_priv->dirty)
1473 set_page_dirty(obj_priv->pages[i]); 1470 set_page_dirty(obj_priv->pages[i]);
1474 1471
@@ -2227,11 +2224,6 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
2227 seqno = i915_add_request(dev, NULL, obj->write_domain); 2224 seqno = i915_add_request(dev, NULL, obj->write_domain);
2228 if (seqno == 0) 2225 if (seqno == 0)
2229 return -ENOMEM; 2226 return -ENOMEM;
2230
2231 ret = i915_wait_request(dev, seqno);
2232 if (ret)
2233 return ret;
2234
2235 continue; 2227 continue;
2236 } 2228 }
2237 } 2229 }
@@ -2256,7 +2248,6 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
2256 struct address_space *mapping; 2248 struct address_space *mapping;
2257 struct inode *inode; 2249 struct inode *inode;
2258 struct page *page; 2250 struct page *page;
2259 int ret;
2260 2251
2261 if (obj_priv->pages_refcount++ != 0) 2252 if (obj_priv->pages_refcount++ != 0)
2262 return 0; 2253 return 0;
@@ -2279,11 +2270,9 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
2279 mapping_gfp_mask (mapping) | 2270 mapping_gfp_mask (mapping) |
2280 __GFP_COLD | 2271 __GFP_COLD |
2281 gfpmask); 2272 gfpmask);
2282 if (IS_ERR(page)) { 2273 if (IS_ERR(page))
2283 ret = PTR_ERR(page); 2274 goto err_pages;
2284 i915_gem_object_put_pages(obj); 2275
2285 return ret;
2286 }
2287 obj_priv->pages[i] = page; 2276 obj_priv->pages[i] = page;
2288 } 2277 }
2289 2278
@@ -2291,6 +2280,15 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
2291 i915_gem_object_do_bit_17_swizzle(obj); 2280 i915_gem_object_do_bit_17_swizzle(obj);
2292 2281
2293 return 0; 2282 return 0;
2283
2284err_pages:
2285 while (i--)
2286 page_cache_release(obj_priv->pages[i]);
2287
2288 drm_free_large(obj_priv->pages);
2289 obj_priv->pages = NULL;
2290 obj_priv->pages_refcount--;
2291 return PTR_ERR(page);
2294} 2292}
2295 2293
2296static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg) 2294static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg)
@@ -4730,6 +4728,11 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
4730 ring->space += ring->Size; 4728 ring->space += ring->Size;
4731 } 4729 }
4732 4730
4731 if (IS_I9XX(dev) && !IS_GEN3(dev)) {
4732 I915_WRITE(MI_MODE,
4733 (VS_TIMER_DISPATCH) << 16 | VS_TIMER_DISPATCH);
4734 }
4735
4733 return 0; 4736 return 0;
4734} 4737}
4735 4738
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index b5c55d88ff76..c01c878e51ba 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -325,9 +325,12 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
325 * need to ensure that any fence register is cleared. 325 * need to ensure that any fence register is cleared.
326 */ 326 */
327 if (!i915_gem_object_fence_offset_ok(obj, args->tiling_mode)) 327 if (!i915_gem_object_fence_offset_ok(obj, args->tiling_mode))
328 ret = i915_gem_object_unbind(obj); 328 ret = i915_gem_object_unbind(obj);
329 else if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
330 ret = i915_gem_object_put_fence_reg(obj);
329 else 331 else
330 ret = i915_gem_object_put_fence_reg(obj); 332 i915_gem_release_mmap(obj);
333
331 if (ret != 0) { 334 if (ret != 0) {
332 WARN(ret != -ERESTARTSYS, 335 WARN(ret != -ERESTARTSYS,
333 "failed to reset object for tiling switch"); 336 "failed to reset object for tiling switch");
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3d59862c7ccd..cbbf59f56dfa 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -298,6 +298,10 @@
298#define INSTDONE 0x02090 298#define INSTDONE 0x02090
299#define NOPID 0x02094 299#define NOPID 0x02094
300#define HWSTAM 0x02098 300#define HWSTAM 0x02098
301
302#define MI_MODE 0x0209c
303# define VS_TIMER_DISPATCH (1 << 6)
304
301#define SCPD0 0x0209c /* 915+ only */ 305#define SCPD0 0x0209c /* 915+ only */
302#define IER 0x020a0 306#define IER 0x020a0
303#define IIR 0x020a4 307#define IIR 0x020a4
@@ -366,7 +370,7 @@
366#define FBC_CTL_PERIODIC (1<<30) 370#define FBC_CTL_PERIODIC (1<<30)
367#define FBC_CTL_INTERVAL_SHIFT (16) 371#define FBC_CTL_INTERVAL_SHIFT (16)
368#define FBC_CTL_UNCOMPRESSIBLE (1<<14) 372#define FBC_CTL_UNCOMPRESSIBLE (1<<14)
369#define FBC_C3_IDLE (1<<13) 373#define FBC_CTL_C3_IDLE (1<<13)
370#define FBC_CTL_STRIDE_SHIFT (5) 374#define FBC_CTL_STRIDE_SHIFT (5)
371#define FBC_CTL_FENCENO (1<<0) 375#define FBC_CTL_FENCENO (1<<0)
372#define FBC_COMMAND 0x0320c 376#define FBC_COMMAND 0x0320c
@@ -2172,6 +2176,14 @@
2172#define DISPLAY_PORT_PLL_BIOS_1 0x46010 2176#define DISPLAY_PORT_PLL_BIOS_1 0x46010
2173#define DISPLAY_PORT_PLL_BIOS_2 0x46014 2177#define DISPLAY_PORT_PLL_BIOS_2 0x46014
2174 2178
2179#define PCH_DSPCLK_GATE_D 0x42020
2180# define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7)
2181# define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5)
2182
2183#define PCH_3DCGDIS0 0x46020
2184# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
2185# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
2186
2175#define FDI_PLL_FREQ_CTL 0x46030 2187#define FDI_PLL_FREQ_CTL 0x46030
2176#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) 2188#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
2177#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 2189#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 70c9d4ba7042..f9ba452f0cbf 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -417,8 +417,9 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
417 edp = find_section(bdb, BDB_EDP); 417 edp = find_section(bdb, BDB_EDP);
418 if (!edp) { 418 if (!edp) {
419 if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp_support) { 419 if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp_support) {
420 DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported,\ 420 DRM_DEBUG_KMS("No eDP BDB found but eDP panel "
421 assume 18bpp panel color depth.\n"); 421 "supported, assume 18bpp panel color "
422 "depth.\n");
422 dev_priv->edp_bpp = 18; 423 dev_priv->edp_bpp = 18;
423 } 424 }
424 return; 425 return;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9cd6de5f9906..58fc7fa0eb1d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1032,7 +1032,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1032 /* enable it... */ 1032 /* enable it... */
1033 fbc_ctl = FBC_CTL_EN | FBC_CTL_PERIODIC; 1033 fbc_ctl = FBC_CTL_EN | FBC_CTL_PERIODIC;
1034 if (IS_I945GM(dev)) 1034 if (IS_I945GM(dev))
1035 fbc_ctl |= FBC_C3_IDLE; /* 945 needs special SR handling */ 1035 fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */
1036 fbc_ctl |= (dev_priv->cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT; 1036 fbc_ctl |= (dev_priv->cfb_pitch & 0xff) << FBC_CTL_STRIDE_SHIFT;
1037 fbc_ctl |= (interval & 0x2fff) << FBC_CTL_INTERVAL_SHIFT; 1037 fbc_ctl |= (interval & 0x2fff) << FBC_CTL_INTERVAL_SHIFT;
1038 if (obj_priv->tiling_mode != I915_TILING_NONE) 1038 if (obj_priv->tiling_mode != I915_TILING_NONE)
@@ -4717,6 +4717,20 @@ void intel_init_clock_gating(struct drm_device *dev)
4717 * specs, but enable as much else as we can. 4717 * specs, but enable as much else as we can.
4718 */ 4718 */
4719 if (HAS_PCH_SPLIT(dev)) { 4719 if (HAS_PCH_SPLIT(dev)) {
4720 uint32_t dspclk_gate = VRHUNIT_CLOCK_GATE_DISABLE;
4721
4722 if (IS_IRONLAKE(dev)) {
4723 /* Required for FBC */
4724 dspclk_gate |= DPFDUNIT_CLOCK_GATE_DISABLE;
4725 /* Required for CxSR */
4726 dspclk_gate |= DPARBUNIT_CLOCK_GATE_DISABLE;
4727
4728 I915_WRITE(PCH_3DCGDIS0,
4729 MARIUNIT_CLOCK_GATE_DISABLE |
4730 SVSMUNIT_CLOCK_GATE_DISABLE);
4731 }
4732
4733 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate);
4720 return; 4734 return;
4721 } else if (IS_G4X(dev)) { 4735 } else if (IS_G4X(dev)) {
4722 uint32_t dspclk_gate; 4736 uint32_t dspclk_gate;
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 14e516fdc2dd..2b3fa7a3c028 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -607,53 +607,6 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
607 I915_WRITE(PFIT_CONTROL, lvds_priv->pfit_control); 607 I915_WRITE(PFIT_CONTROL, lvds_priv->pfit_control);
608} 608}
609 609
610/* Some lid devices report incorrect lid status, assume they're connected */
611static const struct dmi_system_id bad_lid_status[] = {
612 {
613 .ident = "Compaq nx9020",
614 .matches = {
615 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
616 DMI_MATCH(DMI_BOARD_NAME, "3084"),
617 },
618 },
619 {
620 .ident = "Samsung SX20S",
621 .matches = {
622 DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
623 DMI_MATCH(DMI_BOARD_NAME, "SX20S"),
624 },
625 },
626 {
627 .ident = "Aspire One",
628 .matches = {
629 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
630 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"),
631 },
632 },
633 {
634 .ident = "Aspire 1810T",
635 .matches = {
636 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
637 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1810T"),
638 },
639 },
640 {
641 .ident = "PC-81005",
642 .matches = {
643 DMI_MATCH(DMI_SYS_VENDOR, "MALATA"),
644 DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"),
645 },
646 },
647 {
648 .ident = "Clevo M5x0N",
649 .matches = {
650 DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
651 DMI_MATCH(DMI_BOARD_NAME, "M5x0N"),
652 },
653 },
654 { }
655};
656
657/** 610/**
658 * Detect the LVDS connection. 611 * Detect the LVDS connection.
659 * 612 *
@@ -669,12 +622,9 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
669 /* ACPI lid methods were generally unreliable in this generation, so 622 /* ACPI lid methods were generally unreliable in this generation, so
670 * don't even bother. 623 * don't even bother.
671 */ 624 */
672 if (IS_GEN2(dev)) 625 if (IS_GEN2(dev) || IS_GEN3(dev))
673 return connector_status_connected; 626 return connector_status_connected;
674 627
675 if (!dmi_check_system(bad_lid_status) && !acpi_lid_open())
676 status = connector_status_disconnected;
677
678 return status; 628 return status;
679} 629}
680 630
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index d355d1d527e7..60595fc26fdd 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1068,14 +1068,18 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
1068 1068
1069 drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id, 1069 drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id,
1070 DRM_MODE_OBJECT_CRTC); 1070 DRM_MODE_OBJECT_CRTC);
1071 if (!drmmode_obj) 1071 if (!drmmode_obj) {
1072 return -ENOENT; 1072 ret = -ENOENT;
1073 goto out_free;
1074 }
1073 crtc = to_intel_crtc(obj_to_crtc(drmmode_obj)); 1075 crtc = to_intel_crtc(obj_to_crtc(drmmode_obj));
1074 1076
1075 new_bo = drm_gem_object_lookup(dev, file_priv, 1077 new_bo = drm_gem_object_lookup(dev, file_priv,
1076 put_image_rec->bo_handle); 1078 put_image_rec->bo_handle);
1077 if (!new_bo) 1079 if (!new_bo) {
1078 return -ENOENT; 1080 ret = -ENOENT;
1081 goto out_free;
1082 }
1079 1083
1080 mutex_lock(&dev->mode_config.mutex); 1084 mutex_lock(&dev->mode_config.mutex);
1081 mutex_lock(&dev->struct_mutex); 1085 mutex_lock(&dev->struct_mutex);
@@ -1165,6 +1169,7 @@ out_unlock:
1165 mutex_unlock(&dev->struct_mutex); 1169 mutex_unlock(&dev->struct_mutex);
1166 mutex_unlock(&dev->mode_config.mutex); 1170 mutex_unlock(&dev->mode_config.mutex);
1167 drm_gem_object_unreference_unlocked(new_bo); 1171 drm_gem_object_unreference_unlocked(new_bo);
1172out_free:
1168 kfree(params); 1173 kfree(params);
1169 1174
1170 return ret; 1175 return ret;
diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index 365e0becaf12..388cbdc96db7 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -33,6 +33,7 @@ struct acpi_smbus_cmi {
33 u8 cap_info:1; 33 u8 cap_info:1;
34 u8 cap_read:1; 34 u8 cap_read:1;
35 u8 cap_write:1; 35 u8 cap_write:1;
36 struct smbus_methods_t *methods;
36}; 37};
37 38
38static const struct smbus_methods_t smbus_methods = { 39static const struct smbus_methods_t smbus_methods = {
@@ -41,10 +42,19 @@ static const struct smbus_methods_t smbus_methods = {
41 .mt_sbw = "_SBW", 42 .mt_sbw = "_SBW",
42}; 43};
43 44
45/* Some IBM BIOSes omit the leading underscore */
46static const struct smbus_methods_t ibm_smbus_methods = {
47 .mt_info = "SBI_",
48 .mt_sbr = "SBR_",
49 .mt_sbw = "SBW_",
50};
51
44static const struct acpi_device_id acpi_smbus_cmi_ids[] = { 52static const struct acpi_device_id acpi_smbus_cmi_ids[] = {
45 {"SMBUS01", 0}, 53 {"SMBUS01", (kernel_ulong_t)&smbus_methods},
54 {ACPI_SMBUS_IBM_HID, (kernel_ulong_t)&ibm_smbus_methods},
46 {"", 0} 55 {"", 0}
47}; 56};
57MODULE_DEVICE_TABLE(acpi, acpi_smbus_cmi_ids);
48 58
49#define ACPI_SMBUS_STATUS_OK 0x00 59#define ACPI_SMBUS_STATUS_OK 0x00
50#define ACPI_SMBUS_STATUS_FAIL 0x07 60#define ACPI_SMBUS_STATUS_FAIL 0x07
@@ -150,11 +160,11 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
150 160
151 if (read_write == I2C_SMBUS_READ) { 161 if (read_write == I2C_SMBUS_READ) {
152 protocol |= ACPI_SMBUS_PRTCL_READ; 162 protocol |= ACPI_SMBUS_PRTCL_READ;
153 method = smbus_methods.mt_sbr; 163 method = smbus_cmi->methods->mt_sbr;
154 input.count = 3; 164 input.count = 3;
155 } else { 165 } else {
156 protocol |= ACPI_SMBUS_PRTCL_WRITE; 166 protocol |= ACPI_SMBUS_PRTCL_WRITE;
157 method = smbus_methods.mt_sbw; 167 method = smbus_cmi->methods->mt_sbw;
158 input.count = 5; 168 input.count = 5;
159 } 169 }
160 170
@@ -290,13 +300,13 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
290 union acpi_object *obj; 300 union acpi_object *obj;
291 acpi_status status; 301 acpi_status status;
292 302
293 if (!strcmp(name, smbus_methods.mt_info)) { 303 if (!strcmp(name, smbus_cmi->methods->mt_info)) {
294 status = acpi_evaluate_object(smbus_cmi->handle, 304 status = acpi_evaluate_object(smbus_cmi->handle,
295 smbus_methods.mt_info, 305 smbus_cmi->methods->mt_info,
296 NULL, &buffer); 306 NULL, &buffer);
297 if (ACPI_FAILURE(status)) { 307 if (ACPI_FAILURE(status)) {
298 ACPI_ERROR((AE_INFO, "Evaluating %s: %i", 308 ACPI_ERROR((AE_INFO, "Evaluating %s: %i",
299 smbus_methods.mt_info, status)); 309 smbus_cmi->methods->mt_info, status));
300 return -EIO; 310 return -EIO;
301 } 311 }
302 312
@@ -319,9 +329,9 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
319 329
320 kfree(buffer.pointer); 330 kfree(buffer.pointer);
321 smbus_cmi->cap_info = 1; 331 smbus_cmi->cap_info = 1;
322 } else if (!strcmp(name, smbus_methods.mt_sbr)) 332 } else if (!strcmp(name, smbus_cmi->methods->mt_sbr))
323 smbus_cmi->cap_read = 1; 333 smbus_cmi->cap_read = 1;
324 else if (!strcmp(name, smbus_methods.mt_sbw)) 334 else if (!strcmp(name, smbus_cmi->methods->mt_sbw))
325 smbus_cmi->cap_write = 1; 335 smbus_cmi->cap_write = 1;
326 else 336 else
327 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported CMI method: %s\n", 337 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported CMI method: %s\n",
@@ -349,6 +359,7 @@ static acpi_status acpi_smbus_cmi_query_methods(acpi_handle handle, u32 level,
349static int acpi_smbus_cmi_add(struct acpi_device *device) 359static int acpi_smbus_cmi_add(struct acpi_device *device)
350{ 360{
351 struct acpi_smbus_cmi *smbus_cmi; 361 struct acpi_smbus_cmi *smbus_cmi;
362 const struct acpi_device_id *id;
352 363
353 smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL); 364 smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
354 if (!smbus_cmi) 365 if (!smbus_cmi)
@@ -362,6 +373,11 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
362 smbus_cmi->cap_read = 0; 373 smbus_cmi->cap_read = 0;
363 smbus_cmi->cap_write = 0; 374 smbus_cmi->cap_write = 0;
364 375
376 for (id = acpi_smbus_cmi_ids; id->id[0]; id++)
377 if (!strcmp(id->id, acpi_device_hid(device)))
378 smbus_cmi->methods =
379 (struct smbus_methods_t *) id->driver_data;
380
365 acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1, 381 acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
366 acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL); 382 acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
367 383
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 1558bb7fc74d..f901957abc8b 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -461,6 +461,7 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *,
461 element->attr.attr.mode = S_IRUGO; 461 element->attr.attr.mode = S_IRUGO;
462 element->attr.show = show; 462 element->attr.show = show;
463 element->index = i; 463 element->index = i;
464 sysfs_attr_init(&element->attr.attr);
464 465
465 tab_attr[i] = &element->attr.attr; 466 tab_attr[i] = &element->attr.attr;
466 } 467 }
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index e5deb15cf40c..8d1d63a02b34 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -50,7 +50,7 @@ module_param(isdnprot, int, 0);
50 handler. 50 handler.
51*/ 51*/
52 52
53static int avma1cs_config(struct pcmcia_device *link); 53static int avma1cs_config(struct pcmcia_device *link) __devinit ;
54static void avma1cs_release(struct pcmcia_device *link); 54static void avma1cs_release(struct pcmcia_device *link);
55 55
56/* 56/*
@@ -59,7 +59,7 @@ static void avma1cs_release(struct pcmcia_device *link);
59 needed to manage one actual PCMCIA card. 59 needed to manage one actual PCMCIA card.
60*/ 60*/
61 61
62static void avma1cs_detach(struct pcmcia_device *p_dev); 62static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
63 63
64 64
65/* 65/*
@@ -99,7 +99,7 @@ typedef struct local_info_t {
99 99
100======================================================================*/ 100======================================================================*/
101 101
102static int avma1cs_probe(struct pcmcia_device *p_dev) 102static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
103{ 103{
104 local_info_t *local; 104 local_info_t *local;
105 105
@@ -140,7 +140,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
140 140
141======================================================================*/ 141======================================================================*/
142 142
143static void avma1cs_detach(struct pcmcia_device *link) 143static void __devexit avma1cs_detach(struct pcmcia_device *link)
144{ 144{
145 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); 145 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link);
146 avma1cs_release(link); 146 avma1cs_release(link);
@@ -174,7 +174,7 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
174} 174}
175 175
176 176
177static int avma1cs_config(struct pcmcia_device *link) 177static int __devinit avma1cs_config(struct pcmcia_device *link)
178{ 178{
179 local_info_t *dev; 179 local_info_t *dev;
180 int i; 180 int i;
@@ -282,7 +282,7 @@ static struct pcmcia_driver avma1cs_driver = {
282 .name = "avma1_cs", 282 .name = "avma1_cs",
283 }, 283 },
284 .probe = avma1cs_probe, 284 .probe = avma1cs_probe,
285 .remove = avma1cs_detach, 285 .remove = __devexit_p(avma1cs_detach),
286 .id_table = avma1cs_ids, 286 .id_table = avma1cs_ids,
287}; 287};
288 288
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index c9a30b1c9237..c9f2279e21f5 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -76,7 +76,7 @@ module_param(protocol, int, 0);
76 handler. 76 handler.
77*/ 77*/
78 78
79static int elsa_cs_config(struct pcmcia_device *link); 79static int elsa_cs_config(struct pcmcia_device *link) __devinit ;
80static void elsa_cs_release(struct pcmcia_device *link); 80static void elsa_cs_release(struct pcmcia_device *link);
81 81
82/* 82/*
@@ -85,7 +85,7 @@ static void elsa_cs_release(struct pcmcia_device *link);
85 needed to manage one actual PCMCIA card. 85 needed to manage one actual PCMCIA card.
86*/ 86*/
87 87
88static void elsa_cs_detach(struct pcmcia_device *p_dev); 88static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit;
89 89
90/* 90/*
91 A driver needs to provide a dev_node_t structure for each device 91 A driver needs to provide a dev_node_t structure for each device
@@ -121,7 +121,7 @@ typedef struct local_info_t {
121 121
122======================================================================*/ 122======================================================================*/
123 123
124static int elsa_cs_probe(struct pcmcia_device *link) 124static int __devinit elsa_cs_probe(struct pcmcia_device *link)
125{ 125{
126 local_info_t *local; 126 local_info_t *local;
127 127
@@ -166,7 +166,7 @@ static int elsa_cs_probe(struct pcmcia_device *link)
166 166
167======================================================================*/ 167======================================================================*/
168 168
169static void elsa_cs_detach(struct pcmcia_device *link) 169static void __devexit elsa_cs_detach(struct pcmcia_device *link)
170{ 170{
171 local_info_t *info = link->priv; 171 local_info_t *info = link->priv;
172 172
@@ -210,7 +210,7 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
210 return -ENODEV; 210 return -ENODEV;
211} 211}
212 212
213static int elsa_cs_config(struct pcmcia_device *link) 213static int __devinit elsa_cs_config(struct pcmcia_device *link)
214{ 214{
215 local_info_t *dev; 215 local_info_t *dev;
216 int i; 216 int i;
@@ -327,7 +327,7 @@ static struct pcmcia_driver elsa_cs_driver = {
327 .name = "elsa_cs", 327 .name = "elsa_cs",
328 }, 328 },
329 .probe = elsa_cs_probe, 329 .probe = elsa_cs_probe,
330 .remove = elsa_cs_detach, 330 .remove = __devexit_p(elsa_cs_detach),
331 .id_table = elsa_ids, 331 .id_table = elsa_ids,
332 .suspend = elsa_suspend, 332 .suspend = elsa_suspend,
333 .resume = elsa_resume, 333 .resume = elsa_resume,
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 7836ec3c7f86..71b3ddef03bb 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -76,7 +76,7 @@ module_param(protocol, int, 0);
76 event handler. 76 event handler.
77*/ 77*/
78 78
79static int sedlbauer_config(struct pcmcia_device *link); 79static int sedlbauer_config(struct pcmcia_device *link) __devinit ;
80static void sedlbauer_release(struct pcmcia_device *link); 80static void sedlbauer_release(struct pcmcia_device *link);
81 81
82/* 82/*
@@ -85,7 +85,7 @@ static void sedlbauer_release(struct pcmcia_device *link);
85 needed to manage one actual PCMCIA card. 85 needed to manage one actual PCMCIA card.
86*/ 86*/
87 87
88static void sedlbauer_detach(struct pcmcia_device *p_dev); 88static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit;
89 89
90/* 90/*
91 You'll also need to prototype all the functions that will actually 91 You'll also need to prototype all the functions that will actually
@@ -129,7 +129,7 @@ typedef struct local_info_t {
129 129
130======================================================================*/ 130======================================================================*/
131 131
132static int sedlbauer_probe(struct pcmcia_device *link) 132static int __devinit sedlbauer_probe(struct pcmcia_device *link)
133{ 133{
134 local_info_t *local; 134 local_info_t *local;
135 135
@@ -177,7 +177,7 @@ static int sedlbauer_probe(struct pcmcia_device *link)
177 177
178======================================================================*/ 178======================================================================*/
179 179
180static void sedlbauer_detach(struct pcmcia_device *link) 180static void __devexit sedlbauer_detach(struct pcmcia_device *link)
181{ 181{
182 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); 182 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
183 183
@@ -283,7 +283,7 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
283 283
284 284
285 285
286static int sedlbauer_config(struct pcmcia_device *link) 286static int __devinit sedlbauer_config(struct pcmcia_device *link)
287{ 287{
288 local_info_t *dev = link->priv; 288 local_info_t *dev = link->priv;
289 win_req_t *req; 289 win_req_t *req;
@@ -441,7 +441,7 @@ static struct pcmcia_driver sedlbauer_driver = {
441 .name = "sedlbauer_cs", 441 .name = "sedlbauer_cs",
442 }, 442 },
443 .probe = sedlbauer_probe, 443 .probe = sedlbauer_probe,
444 .remove = sedlbauer_detach, 444 .remove = __devexit_p(sedlbauer_detach),
445 .id_table = sedlbauer_ids, 445 .id_table = sedlbauer_ids,
446 .suspend = sedlbauer_suspend, 446 .suspend = sedlbauer_suspend,
447 .resume = sedlbauer_resume, 447 .resume = sedlbauer_resume,
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index b0c5976cbdb3..d010a0da8e19 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -57,7 +57,7 @@ module_param(protocol, int, 0);
57 handler. 57 handler.
58*/ 58*/
59 59
60static int teles_cs_config(struct pcmcia_device *link); 60static int teles_cs_config(struct pcmcia_device *link) __devinit ;
61static void teles_cs_release(struct pcmcia_device *link); 61static void teles_cs_release(struct pcmcia_device *link);
62 62
63/* 63/*
@@ -66,7 +66,7 @@ static void teles_cs_release(struct pcmcia_device *link);
66 needed to manage one actual PCMCIA card. 66 needed to manage one actual PCMCIA card.
67*/ 67*/
68 68
69static void teles_detach(struct pcmcia_device *p_dev); 69static void teles_detach(struct pcmcia_device *p_dev) __devexit ;
70 70
71/* 71/*
72 A linked list of "instances" of the teles_cs device. Each actual 72 A linked list of "instances" of the teles_cs device. Each actual
@@ -112,7 +112,7 @@ typedef struct local_info_t {
112 112
113======================================================================*/ 113======================================================================*/
114 114
115static int teles_probe(struct pcmcia_device *link) 115static int __devinit teles_probe(struct pcmcia_device *link)
116{ 116{
117 local_info_t *local; 117 local_info_t *local;
118 118
@@ -156,7 +156,7 @@ static int teles_probe(struct pcmcia_device *link)
156 156
157======================================================================*/ 157======================================================================*/
158 158
159static void teles_detach(struct pcmcia_device *link) 159static void __devexit teles_detach(struct pcmcia_device *link)
160{ 160{
161 local_info_t *info = link->priv; 161 local_info_t *info = link->priv;
162 162
@@ -200,7 +200,7 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev,
200 return -ENODEV; 200 return -ENODEV;
201} 201}
202 202
203static int teles_cs_config(struct pcmcia_device *link) 203static int __devinit teles_cs_config(struct pcmcia_device *link)
204{ 204{
205 local_info_t *dev; 205 local_info_t *dev;
206 int i; 206 int i;
@@ -319,7 +319,7 @@ static struct pcmcia_driver teles_cs_driver = {
319 .name = "teles_cs", 319 .name = "teles_cs",
320 }, 320 },
321 .probe = teles_probe, 321 .probe = teles_probe,
322 .remove = teles_detach, 322 .remove = __devexit_p(teles_detach),
323 .id_table = teles_ids, 323 .id_table = teles_ids,
324 .suspend = teles_suspend, 324 .suspend = teles_suspend,
325 .resume = teles_resume, 325 .resume = teles_resume,
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index b5346b4db91a..b7a85f46a6c2 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -912,8 +912,8 @@ struct c2port_device *c2port_device_register(char *name,
912 912
913 c2dev->dev = device_create(c2port_class, NULL, 0, c2dev, 913 c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
914 "c2port%d", id); 914 "c2port%d", id);
915 if (unlikely(!c2dev->dev)) { 915 if (unlikely(IS_ERR(c2dev->dev))) {
916 ret = -ENOMEM; 916 ret = PTR_ERR(c2dev->dev);
917 goto error_device_create; 917 goto error_device_create;
918 } 918 }
919 dev_set_drvdata(c2dev->dev, c2dev); 919 dev_set_drvdata(c2dev->dev, c2dev);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 0eac6c814904..e041c003db22 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -225,7 +225,7 @@ static int mmc_read_ext_csd(struct mmc_card *card)
225 mmc_card_set_blockaddr(card); 225 mmc_card_set_blockaddr(card);
226 } 226 }
227 227
228 switch (ext_csd[EXT_CSD_CARD_TYPE]) { 228 switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
229 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: 229 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26:
230 card->ext_csd.hs_max_dtr = 52000000; 230 card->ext_csd.hs_max_dtr = 52000000;
231 break; 231 break;
@@ -237,7 +237,6 @@ static int mmc_read_ext_csd(struct mmc_card *card)
237 printk(KERN_WARNING "%s: card is mmc v4 but doesn't " 237 printk(KERN_WARNING "%s: card is mmc v4 but doesn't "
238 "support any high-speed modes.\n", 238 "support any high-speed modes.\n",
239 mmc_hostname(card->host)); 239 mmc_hostname(card->host));
240 goto out;
241 } 240 }
242 241
243 if (card->ext_csd.rev >= 3) { 242 if (card->ext_csd.rev >= 3) {
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/drivers/mtd/maps/omap_nor.c
+++ /dev/null
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index a1d4188c430b..e7810b74f396 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -449,11 +449,10 @@ ks8695_rx_irq(int irq, void *dev_id)
449} 449}
450 450
451/** 451/**
452 * ks8695_rx - Receive packets called by NAPI poll method 452 * ks8695_rx - Receive packets called by NAPI poll method
453 * @ksp: Private data for the KS8695 Ethernet 453 * @ksp: Private data for the KS8695 Ethernet
454 * @budget: The max packets would be receive 454 * @budget: Number of packets allowed to process
455 */ 455 */
456
457static int ks8695_rx(struct ks8695_priv *ksp, int budget) 456static int ks8695_rx(struct ks8695_priv *ksp, int budget)
458{ 457{
459 struct net_device *ndev = ksp->ndev; 458 struct net_device *ndev = ksp->ndev;
@@ -461,7 +460,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
461 int buff_n; 460 int buff_n;
462 u32 flags; 461 u32 flags;
463 int pktlen; 462 int pktlen;
464 int last_rx_processed = -1;
465 int received = 0; 463 int received = 0;
466 464
467 buff_n = ksp->next_rx_desc_read; 465 buff_n = ksp->next_rx_desc_read;
@@ -471,6 +469,7 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
471 cpu_to_le32(RDES_OWN)))) { 469 cpu_to_le32(RDES_OWN)))) {
472 rmb(); 470 rmb();
473 flags = le32_to_cpu(ksp->rx_ring[buff_n].status); 471 flags = le32_to_cpu(ksp->rx_ring[buff_n].status);
472
474 /* Found an SKB which we own, this means we 473 /* Found an SKB which we own, this means we
475 * received a packet 474 * received a packet
476 */ 475 */
@@ -533,23 +532,18 @@ rx_failure:
533 ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN); 532 ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN);
534rx_finished: 533rx_finished:
535 received++; 534 received++;
536 /* And note this as processed so we can start
537 * from here next time
538 */
539 last_rx_processed = buff_n;
540 buff_n = (buff_n + 1) & MAX_RX_DESC_MASK; 535 buff_n = (buff_n + 1) & MAX_RX_DESC_MASK;
541 /*And note which RX descriptor we last did */
542 if (likely(last_rx_processed != -1))
543 ksp->next_rx_desc_read =
544 (last_rx_processed + 1) &
545 MAX_RX_DESC_MASK;
546 } 536 }
537
538 /* And note which RX descriptor we last did */
539 ksp->next_rx_desc_read = buff_n;
540
547 /* And refill the buffers */ 541 /* And refill the buffers */
548 ks8695_refill_rxbuffers(ksp); 542 ks8695_refill_rxbuffers(ksp);
549 543
550 /* Kick the RX DMA engine, in case it became 544 /* Kick the RX DMA engine, in case it became suspended */
551 * suspended */
552 ks8695_writereg(ksp, KS8695_DRSC, 0); 545 ks8695_writereg(ksp, KS8695_DRSC, 0);
546
553 return received; 547 return received;
554} 548}
555 549
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 381887ba677c..a257babd1bb4 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -246,6 +246,8 @@ static const struct flash_spec flash_5709 = {
246 246
247MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl); 247MODULE_DEVICE_TABLE(pci, bnx2_pci_tbl);
248 248
249static void bnx2_init_napi(struct bnx2 *bp);
250
249static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr) 251static inline u32 bnx2_tx_avail(struct bnx2 *bp, struct bnx2_tx_ring_info *txr)
250{ 252{
251 u32 diff; 253 u32 diff;
@@ -6197,6 +6199,7 @@ bnx2_open(struct net_device *dev)
6197 bnx2_disable_int(bp); 6199 bnx2_disable_int(bp);
6198 6200
6199 bnx2_setup_int_mode(bp, disable_msi); 6201 bnx2_setup_int_mode(bp, disable_msi);
6202 bnx2_init_napi(bp);
6200 bnx2_napi_enable(bp); 6203 bnx2_napi_enable(bp);
6201 rc = bnx2_alloc_mem(bp); 6204 rc = bnx2_alloc_mem(bp);
6202 if (rc) 6205 if (rc)
@@ -7643,9 +7646,11 @@ poll_bnx2(struct net_device *dev)
7643 int i; 7646 int i;
7644 7647
7645 for (i = 0; i < bp->irq_nvecs; i++) { 7648 for (i = 0; i < bp->irq_nvecs; i++) {
7646 disable_irq(bp->irq_tbl[i].vector); 7649 struct bnx2_irq *irq = &bp->irq_tbl[i];
7647 bnx2_interrupt(bp->irq_tbl[i].vector, &bp->bnx2_napi[i]); 7650
7648 enable_irq(bp->irq_tbl[i].vector); 7651 disable_irq(irq->vector);
7652 irq->handler(irq->vector, &bp->bnx2_napi[i]);
7653 enable_irq(irq->vector);
7649 } 7654 }
7650} 7655}
7651#endif 7656#endif
@@ -8207,7 +8212,7 @@ bnx2_init_napi(struct bnx2 *bp)
8207{ 8212{
8208 int i; 8213 int i;
8209 8214
8210 for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) { 8215 for (i = 0; i < bp->irq_nvecs; i++) {
8211 struct bnx2_napi *bnapi = &bp->bnx2_napi[i]; 8216 struct bnx2_napi *bnapi = &bp->bnx2_napi[i];
8212 int (*poll)(struct napi_struct *, int); 8217 int (*poll)(struct napi_struct *, int);
8213 8218
@@ -8276,7 +8281,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8276 dev->ethtool_ops = &bnx2_ethtool_ops; 8281 dev->ethtool_ops = &bnx2_ethtool_ops;
8277 8282
8278 bp = netdev_priv(dev); 8283 bp = netdev_priv(dev);
8279 bnx2_init_napi(bp);
8280 8284
8281 pci_set_drvdata(pdev, dev); 8285 pci_set_drvdata(pdev, dev);
8282 8286
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index 866905fa4119..03489864376d 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -22,6 +22,7 @@
22#include <linux/can/dev.h> 22#include <linux/can/dev.h>
23#include <linux/can/error.h> 23#include <linux/can/error.h>
24 24
25#include <asm/bfin_can.h>
25#include <asm/portmux.h> 26#include <asm/portmux.h>
26 27
27#define DRV_NAME "bfin_can" 28#define DRV_NAME "bfin_can"
@@ -29,90 +30,6 @@
29#define TX_ECHO_SKB_MAX 1 30#define TX_ECHO_SKB_MAX 1
30 31
31/* 32/*
32 * transmit and receive channels
33 */
34#define TRANSMIT_CHL 24
35#define RECEIVE_STD_CHL 0
36#define RECEIVE_EXT_CHL 4
37#define RECEIVE_RTR_CHL 8
38#define RECEIVE_EXT_RTR_CHL 12
39#define MAX_CHL_NUMBER 32
40
41/*
42 * bfin can registers layout
43 */
44struct bfin_can_mask_regs {
45 u16 aml;
46 u16 dummy1;
47 u16 amh;
48 u16 dummy2;
49};
50
51struct bfin_can_channel_regs {
52 u16 data[8];
53 u16 dlc;
54 u16 dummy1;
55 u16 tsv;
56 u16 dummy2;
57 u16 id0;
58 u16 dummy3;
59 u16 id1;
60 u16 dummy4;
61};
62
63struct bfin_can_regs {
64 /*
65 * global control and status registers
66 */
67 u16 mc1; /* offset 0 */
68 u16 dummy1;
69 u16 md1; /* offset 4 */
70 u16 rsv1[13];
71 u16 mbtif1; /* offset 0x20 */
72 u16 dummy2;
73 u16 mbrif1; /* offset 0x24 */
74 u16 dummy3;
75 u16 mbim1; /* offset 0x28 */
76 u16 rsv2[11];
77 u16 mc2; /* offset 0x40 */
78 u16 dummy4;
79 u16 md2; /* offset 0x44 */
80 u16 dummy5;
81 u16 trs2; /* offset 0x48 */
82 u16 rsv3[11];
83 u16 mbtif2; /* offset 0x60 */
84 u16 dummy6;
85 u16 mbrif2; /* offset 0x64 */
86 u16 dummy7;
87 u16 mbim2; /* offset 0x68 */
88 u16 rsv4[11];
89 u16 clk; /* offset 0x80 */
90 u16 dummy8;
91 u16 timing; /* offset 0x84 */
92 u16 rsv5[3];
93 u16 status; /* offset 0x8c */
94 u16 dummy9;
95 u16 cec; /* offset 0x90 */
96 u16 dummy10;
97 u16 gis; /* offset 0x94 */
98 u16 dummy11;
99 u16 gim; /* offset 0x98 */
100 u16 rsv6[3];
101 u16 ctrl; /* offset 0xa0 */
102 u16 dummy12;
103 u16 intr; /* offset 0xa4 */
104 u16 rsv7[7];
105 u16 esr; /* offset 0xb4 */
106 u16 rsv8[37];
107
108 /*
109 * channel(mailbox) mask and message registers
110 */
111 struct bfin_can_mask_regs msk[MAX_CHL_NUMBER]; /* offset 0x100 */
112 struct bfin_can_channel_regs chl[MAX_CHL_NUMBER]; /* offset 0x200 */
113};
114
115/*
116 * bfin can private data 33 * bfin can private data
117 */ 34 */
118struct bfin_can_priv { 35struct bfin_can_priv {
@@ -163,7 +80,7 @@ static int bfin_can_set_bittiming(struct net_device *dev)
163 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) 80 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
164 timing |= SAM; 81 timing |= SAM;
165 82
166 bfin_write16(&reg->clk, clk); 83 bfin_write16(&reg->clock, clk);
167 bfin_write16(&reg->timing, timing); 84 bfin_write16(&reg->timing, timing);
168 85
169 dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n", 86 dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n",
@@ -185,11 +102,11 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
185 bfin_write16(&reg->gim, 0); 102 bfin_write16(&reg->gim, 0);
186 103
187 /* reset can and enter configuration mode */ 104 /* reset can and enter configuration mode */
188 bfin_write16(&reg->ctrl, SRS | CCR); 105 bfin_write16(&reg->control, SRS | CCR);
189 SSYNC(); 106 SSYNC();
190 bfin_write16(&reg->ctrl, CCR); 107 bfin_write16(&reg->control, CCR);
191 SSYNC(); 108 SSYNC();
192 while (!(bfin_read16(&reg->ctrl) & CCA)) { 109 while (!(bfin_read16(&reg->control) & CCA)) {
193 udelay(10); 110 udelay(10);
194 if (--timeout == 0) { 111 if (--timeout == 0) {
195 dev_err(dev->dev.parent, 112 dev_err(dev->dev.parent,
@@ -244,7 +161,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
244 /* 161 /*
245 * leave configuration mode 162 * leave configuration mode
246 */ 163 */
247 bfin_write16(&reg->ctrl, bfin_read16(&reg->ctrl) & ~CCR); 164 bfin_write16(&reg->control, bfin_read16(&reg->control) & ~CCR);
248 165
249 while (bfin_read16(&reg->status) & CCA) { 166 while (bfin_read16(&reg->status) & CCA) {
250 udelay(10); 167 udelay(10);
@@ -726,7 +643,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
726 643
727 if (netif_running(dev)) { 644 if (netif_running(dev)) {
728 /* enter sleep mode */ 645 /* enter sleep mode */
729 bfin_write16(&reg->ctrl, bfin_read16(&reg->ctrl) | SMR); 646 bfin_write16(&reg->control, bfin_read16(&reg->control) | SMR);
730 SSYNC(); 647 SSYNC();
731 while (!(bfin_read16(&reg->intr) & SMACK)) { 648 while (!(bfin_read16(&reg->intr) & SMACK)) {
732 udelay(10); 649 udelay(10);
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index 9d7fa2fb85ea..0bc990ec4a8e 100644
--- a/drivers/net/igb/e1000_82575.c
+++ b/drivers/net/igb/e1000_82575.c
@@ -94,6 +94,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
94 case E1000_DEV_ID_82576_FIBER: 94 case E1000_DEV_ID_82576_FIBER:
95 case E1000_DEV_ID_82576_SERDES: 95 case E1000_DEV_ID_82576_SERDES:
96 case E1000_DEV_ID_82576_QUAD_COPPER: 96 case E1000_DEV_ID_82576_QUAD_COPPER:
97 case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
97 case E1000_DEV_ID_82576_SERDES_QUAD: 98 case E1000_DEV_ID_82576_SERDES_QUAD:
98 mac->type = e1000_82576; 99 mac->type = e1000_82576;
99 break; 100 break;
diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
index 448005276b26..82a533f5192a 100644
--- a/drivers/net/igb/e1000_hw.h
+++ b/drivers/net/igb/e1000_hw.h
@@ -41,6 +41,7 @@ struct e1000_hw;
41#define E1000_DEV_ID_82576_FIBER 0x10E6 41#define E1000_DEV_ID_82576_FIBER 0x10E6
42#define E1000_DEV_ID_82576_SERDES 0x10E7 42#define E1000_DEV_ID_82576_SERDES 0x10E7
43#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8 43#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
44#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526
44#define E1000_DEV_ID_82576_NS 0x150A 45#define E1000_DEV_ID_82576_NS 0x150A
45#define E1000_DEV_ID_82576_NS_SERDES 0x1518 46#define E1000_DEV_ID_82576_NS_SERDES 0x1518
46#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D 47#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index a1775705b24c..3b772b822a5d 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -267,7 +267,6 @@ struct igb_adapter {
267 267
268 /* TX */ 268 /* TX */
269 struct igb_ring *tx_ring[16]; 269 struct igb_ring *tx_ring[16];
270 unsigned long tx_queue_len;
271 u32 tx_timeout_count; 270 u32 tx_timeout_count;
272 271
273 /* RX */ 272 /* RX */
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 0ed25f059a00..01c65c7447e1 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -72,6 +72,7 @@ static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = {
72 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 }, 72 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_FIBER), board_82575 },
73 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 }, 73 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES), board_82575 },
74 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES_QUAD), board_82575 }, 74 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_SERDES_QUAD), board_82575 },
75 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER_ET2), board_82575 },
75 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 }, 76 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_QUAD_COPPER), board_82575 },
76 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 }, 77 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 },
77 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 }, 78 { PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 },
@@ -1104,9 +1105,6 @@ static void igb_configure(struct igb_adapter *adapter)
1104 struct igb_ring *ring = adapter->rx_ring[i]; 1105 struct igb_ring *ring = adapter->rx_ring[i];
1105 igb_alloc_rx_buffers_adv(ring, igb_desc_unused(ring)); 1106 igb_alloc_rx_buffers_adv(ring, igb_desc_unused(ring));
1106 } 1107 }
1107
1108
1109 adapter->tx_queue_len = netdev->tx_queue_len;
1110} 1108}
1111 1109
1112/** 1110/**
@@ -1212,7 +1210,6 @@ void igb_down(struct igb_adapter *adapter)
1212 del_timer_sync(&adapter->watchdog_timer); 1210 del_timer_sync(&adapter->watchdog_timer);
1213 del_timer_sync(&adapter->phy_info_timer); 1211 del_timer_sync(&adapter->phy_info_timer);
1214 1212
1215 netdev->tx_queue_len = adapter->tx_queue_len;
1216 netif_carrier_off(netdev); 1213 netif_carrier_off(netdev);
1217 1214
1218 /* record the stats before reset*/ 1215 /* record the stats before reset*/
@@ -3105,17 +3102,13 @@ static void igb_watchdog_task(struct work_struct *work)
3105 ((ctrl & E1000_CTRL_RFCE) ? "RX" : 3102 ((ctrl & E1000_CTRL_RFCE) ? "RX" :
3106 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None"))); 3103 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None")));
3107 3104
3108 /* tweak tx_queue_len according to speed/duplex and 3105 /* adjust timeout factor according to speed/duplex */
3109 * adjust the timeout factor */
3110 netdev->tx_queue_len = adapter->tx_queue_len;
3111 adapter->tx_timeout_factor = 1; 3106 adapter->tx_timeout_factor = 1;
3112 switch (adapter->link_speed) { 3107 switch (adapter->link_speed) {
3113 case SPEED_10: 3108 case SPEED_10:
3114 netdev->tx_queue_len = 10;
3115 adapter->tx_timeout_factor = 14; 3109 adapter->tx_timeout_factor = 14;
3116 break; 3110 break;
3117 case SPEED_100: 3111 case SPEED_100:
3118 netdev->tx_queue_len = 100;
3119 /* maybe add some timeout factor ? */ 3112 /* maybe add some timeout factor ? */
3120 break; 3113 break;
3121 } 3114 }
@@ -3962,7 +3955,7 @@ void igb_update_stats(struct igb_adapter *adapter)
3962 struct net_device_stats *net_stats = igb_get_stats(adapter->netdev); 3955 struct net_device_stats *net_stats = igb_get_stats(adapter->netdev);
3963 struct e1000_hw *hw = &adapter->hw; 3956 struct e1000_hw *hw = &adapter->hw;
3964 struct pci_dev *pdev = adapter->pdev; 3957 struct pci_dev *pdev = adapter->pdev;
3965 u32 rnbc, reg; 3958 u32 reg, mpc;
3966 u16 phy_tmp; 3959 u16 phy_tmp;
3967 int i; 3960 int i;
3968 u64 bytes, packets; 3961 u64 bytes, packets;
@@ -4020,7 +4013,9 @@ void igb_update_stats(struct igb_adapter *adapter)
4020 adapter->stats.symerrs += rd32(E1000_SYMERRS); 4013 adapter->stats.symerrs += rd32(E1000_SYMERRS);
4021 adapter->stats.sec += rd32(E1000_SEC); 4014 adapter->stats.sec += rd32(E1000_SEC);
4022 4015
4023 adapter->stats.mpc += rd32(E1000_MPC); 4016 mpc = rd32(E1000_MPC);
4017 adapter->stats.mpc += mpc;
4018 net_stats->rx_fifo_errors += mpc;
4024 adapter->stats.scc += rd32(E1000_SCC); 4019 adapter->stats.scc += rd32(E1000_SCC);
4025 adapter->stats.ecol += rd32(E1000_ECOL); 4020 adapter->stats.ecol += rd32(E1000_ECOL);
4026 adapter->stats.mcc += rd32(E1000_MCC); 4021 adapter->stats.mcc += rd32(E1000_MCC);
@@ -4035,9 +4030,7 @@ void igb_update_stats(struct igb_adapter *adapter)
4035 adapter->stats.gptc += rd32(E1000_GPTC); 4030 adapter->stats.gptc += rd32(E1000_GPTC);
4036 adapter->stats.gotc += rd32(E1000_GOTCL); 4031 adapter->stats.gotc += rd32(E1000_GOTCL);
4037 rd32(E1000_GOTCH); /* clear GOTCL */ 4032 rd32(E1000_GOTCH); /* clear GOTCL */
4038 rnbc = rd32(E1000_RNBC); 4033 adapter->stats.rnbc += rd32(E1000_RNBC);
4039 adapter->stats.rnbc += rnbc;
4040 net_stats->rx_fifo_errors += rnbc;
4041 adapter->stats.ruc += rd32(E1000_RUC); 4034 adapter->stats.ruc += rd32(E1000_RUC);
4042 adapter->stats.rfc += rd32(E1000_RFC); 4035 adapter->stats.rfc += rd32(E1000_RFC);
4043 adapter->stats.rjc += rd32(E1000_RJC); 4036 adapter->stats.rjc += rd32(E1000_RJC);
@@ -5109,7 +5102,7 @@ static void igb_receive_skb(struct igb_q_vector *q_vector,
5109{ 5102{
5110 struct igb_adapter *adapter = q_vector->adapter; 5103 struct igb_adapter *adapter = q_vector->adapter;
5111 5104
5112 if (vlan_tag) 5105 if (vlan_tag && adapter->vlgrp)
5113 vlan_gro_receive(&q_vector->napi, adapter->vlgrp, 5106 vlan_gro_receive(&q_vector->napi, adapter->vlgrp,
5114 vlan_tag, skb); 5107 vlan_tag, skb);
5115 else 5108 else
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 1f30e163bd9c..b405a00817c6 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -39,6 +39,7 @@
39#define IXGBE_82599_MC_TBL_SIZE 128 39#define IXGBE_82599_MC_TBL_SIZE 128
40#define IXGBE_82599_VFT_TBL_SIZE 128 40#define IXGBE_82599_VFT_TBL_SIZE 128
41 41
42void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
42s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, 43s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
43 ixgbe_link_speed speed, 44 ixgbe_link_speed speed,
44 bool autoneg, 45 bool autoneg,
@@ -68,7 +69,9 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
68 if (hw->phy.multispeed_fiber) { 69 if (hw->phy.multispeed_fiber) {
69 /* Set up dual speed SFP+ support */ 70 /* Set up dual speed SFP+ support */
70 mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber; 71 mac->ops.setup_link = &ixgbe_setup_mac_link_multispeed_fiber;
72 mac->ops.flap_tx_laser = &ixgbe_flap_tx_laser_multispeed_fiber;
71 } else { 73 } else {
74 mac->ops.flap_tx_laser = NULL;
72 if ((mac->ops.get_media_type(hw) == 75 if ((mac->ops.get_media_type(hw) ==
73 ixgbe_media_type_backplane) && 76 ixgbe_media_type_backplane) &&
74 (hw->phy.smart_speed == ixgbe_smart_speed_auto || 77 (hw->phy.smart_speed == ixgbe_smart_speed_auto ||
@@ -413,6 +416,41 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
413} 416}
414 417
415/** 418/**
419 * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser
420 * @hw: pointer to hardware structure
421 *
422 * When the driver changes the link speeds that it can support,
423 * it sets autotry_restart to true to indicate that we need to
424 * initiate a new autotry session with the link partner. To do
425 * so, we set the speed then disable and re-enable the tx laser, to
426 * alert the link partner that it also needs to restart autotry on its
427 * end. This is consistent with true clause 37 autoneg, which also
428 * involves a loss of signal.
429 **/
430void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
431{
432 u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
433
434 hw_dbg(hw, "ixgbe_flap_tx_laser_multispeed_fiber\n");
435
436 if (hw->mac.autotry_restart) {
437 /* Disable tx laser; allow 100us to go dark per spec */
438 esdp_reg |= IXGBE_ESDP_SDP3;
439 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
440 IXGBE_WRITE_FLUSH(hw);
441 udelay(100);
442
443 /* Enable tx laser; allow 100ms to light up */
444 esdp_reg &= ~IXGBE_ESDP_SDP3;
445 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
446 IXGBE_WRITE_FLUSH(hw);
447 msleep(100);
448
449 hw->mac.autotry_restart = false;
450 }
451}
452
453/**
416 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed 454 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
417 * @hw: pointer to hardware structure 455 * @hw: pointer to hardware structure
418 * @speed: new link speed 456 * @speed: new link speed
@@ -440,16 +478,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
440 speed &= phy_link_speed; 478 speed &= phy_link_speed;
441 479
442 /* 480 /*
443 * When the driver changes the link speeds that it can support,
444 * it sets autotry_restart to true to indicate that we need to
445 * initiate a new autotry session with the link partner. To do
446 * so, we set the speed then disable and re-enable the tx laser, to
447 * alert the link partner that it also needs to restart autotry on its
448 * end. This is consistent with true clause 37 autoneg, which also
449 * involves a loss of signal.
450 */
451
452 /*
453 * Try each speed one by one, highest priority first. We do this in 481 * Try each speed one by one, highest priority first. We do this in
454 * software because 10gb fiber doesn't support speed autonegotiation. 482 * software because 10gb fiber doesn't support speed autonegotiation.
455 */ 483 */
@@ -466,6 +494,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
466 /* Set the module link speed */ 494 /* Set the module link speed */
467 esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); 495 esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5);
468 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); 496 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
497 IXGBE_WRITE_FLUSH(hw);
469 498
470 /* Allow module to change analog characteristics (1G->10G) */ 499 /* Allow module to change analog characteristics (1G->10G) */
471 msleep(40); 500 msleep(40);
@@ -478,19 +507,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
478 return status; 507 return status;
479 508
480 /* Flap the tx laser if it has not already been done */ 509 /* Flap the tx laser if it has not already been done */
481 if (hw->mac.autotry_restart) { 510 hw->mac.ops.flap_tx_laser(hw);
482 /* Disable tx laser; allow 100us to go dark per spec */
483 esdp_reg |= IXGBE_ESDP_SDP3;
484 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
485 udelay(100);
486
487 /* Enable tx laser; allow 2ms to light up per spec */
488 esdp_reg &= ~IXGBE_ESDP_SDP3;
489 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
490 msleep(2);
491
492 hw->mac.autotry_restart = false;
493 }
494 511
495 /* 512 /*
496 * Wait for the controller to acquire link. Per IEEE 802.3ap, 513 * Wait for the controller to acquire link. Per IEEE 802.3ap,
@@ -525,6 +542,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
525 esdp_reg &= ~IXGBE_ESDP_SDP5; 542 esdp_reg &= ~IXGBE_ESDP_SDP5;
526 esdp_reg |= IXGBE_ESDP_SDP5_DIR; 543 esdp_reg |= IXGBE_ESDP_SDP5_DIR;
527 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); 544 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
545 IXGBE_WRITE_FLUSH(hw);
528 546
529 /* Allow module to change analog characteristics (10G->1G) */ 547 /* Allow module to change analog characteristics (10G->1G) */
530 msleep(40); 548 msleep(40);
@@ -537,19 +555,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
537 return status; 555 return status;
538 556
539 /* Flap the tx laser if it has not already been done */ 557 /* Flap the tx laser if it has not already been done */
540 if (hw->mac.autotry_restart) { 558 hw->mac.ops.flap_tx_laser(hw);
541 /* Disable tx laser; allow 100us to go dark per spec */
542 esdp_reg |= IXGBE_ESDP_SDP3;
543 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
544 udelay(100);
545
546 /* Enable tx laser; allow 2ms to light up per spec */
547 esdp_reg &= ~IXGBE_ESDP_SDP3;
548 IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg);
549 msleep(2);
550
551 hw->mac.autotry_restart = false;
552 }
553 559
554 /* Wait for the link partner to also set speed */ 560 /* Wait for the link partner to also set speed */
555 msleep(100); 561 msleep(100);
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 4123dec0dfb7..700cfc0aa1b9 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -614,9 +614,9 @@ int ixgbe_fcoe_enable(struct net_device *netdev)
614 netdev->vlan_features |= NETIF_F_FSO; 614 netdev->vlan_features |= NETIF_F_FSO;
615 netdev->vlan_features |= NETIF_F_FCOE_MTU; 615 netdev->vlan_features |= NETIF_F_FCOE_MTU;
616 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; 616 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
617 netdev_features_change(netdev);
618 617
619 ixgbe_init_interrupt_scheme(adapter); 618 ixgbe_init_interrupt_scheme(adapter);
619 netdev_features_change(netdev);
620 620
621 if (netif_running(netdev)) 621 if (netif_running(netdev))
622 netdev->netdev_ops->ndo_open(netdev); 622 netdev->netdev_ops->ndo_open(netdev);
@@ -660,11 +660,11 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
660 netdev->vlan_features &= ~NETIF_F_FSO; 660 netdev->vlan_features &= ~NETIF_F_FSO;
661 netdev->vlan_features &= ~NETIF_F_FCOE_MTU; 661 netdev->vlan_features &= ~NETIF_F_FCOE_MTU;
662 netdev->fcoe_ddp_xid = 0; 662 netdev->fcoe_ddp_xid = 0;
663 netdev_features_change(netdev);
664 663
665 ixgbe_cleanup_fcoe(adapter); 664 ixgbe_cleanup_fcoe(adapter);
666
667 ixgbe_init_interrupt_scheme(adapter); 665 ixgbe_init_interrupt_scheme(adapter);
666 netdev_features_change(netdev);
667
668 if (netif_running(netdev)) 668 if (netif_running(netdev))
669 netdev->netdev_ops->ndo_open(netdev); 669 netdev->netdev_ops->ndo_open(netdev);
670 rc = 0; 670 rc = 0;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 684af371462d..d75c46ff31f6 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -935,10 +935,12 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
935 if (skb->prev) 935 if (skb->prev)
936 skb = ixgbe_transform_rsc_queue(skb, &(rx_ring->rsc_count)); 936 skb = ixgbe_transform_rsc_queue(skb, &(rx_ring->rsc_count));
937 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 937 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
938 if (IXGBE_RSC_CB(skb)->dma) 938 if (IXGBE_RSC_CB(skb)->dma) {
939 pci_unmap_single(pdev, IXGBE_RSC_CB(skb)->dma, 939 pci_unmap_single(pdev, IXGBE_RSC_CB(skb)->dma,
940 rx_ring->rx_buf_len, 940 rx_ring->rx_buf_len,
941 PCI_DMA_FROMDEVICE); 941 PCI_DMA_FROMDEVICE);
942 IXGBE_RSC_CB(skb)->dma = 0;
943 }
942 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) 944 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)
943 rx_ring->rsc_count += skb_shinfo(skb)->nr_frags; 945 rx_ring->rsc_count += skb_shinfo(skb)->nr_frags;
944 else 946 else
@@ -3126,10 +3128,12 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
3126 rx_buffer_info->skb = NULL; 3128 rx_buffer_info->skb = NULL;
3127 do { 3129 do {
3128 struct sk_buff *this = skb; 3130 struct sk_buff *this = skb;
3129 if (IXGBE_RSC_CB(this)->dma) 3131 if (IXGBE_RSC_CB(this)->dma) {
3130 pci_unmap_single(pdev, IXGBE_RSC_CB(this)->dma, 3132 pci_unmap_single(pdev, IXGBE_RSC_CB(this)->dma,
3131 rx_ring->rx_buf_len, 3133 rx_ring->rx_buf_len,
3132 PCI_DMA_FROMDEVICE); 3134 PCI_DMA_FROMDEVICE);
3135 IXGBE_RSC_CB(this)->dma = 0;
3136 }
3133 skb = skb->prev; 3137 skb = skb->prev;
3134 dev_kfree_skb(this); 3138 dev_kfree_skb(this);
3135 } while (skb); 3139 } while (skb);
@@ -5018,6 +5022,7 @@ static void ixgbe_multispeed_fiber_task(struct work_struct *work)
5018 autoneg = hw->phy.autoneg_advertised; 5022 autoneg = hw->phy.autoneg_advertised;
5019 if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) 5023 if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
5020 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation); 5024 hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiation);
5025 hw->mac.autotry_restart = false;
5021 if (hw->mac.ops.setup_link) 5026 if (hw->mac.ops.setup_link)
5022 hw->mac.ops.setup_link(hw, autoneg, negotiation, true); 5027 hw->mac.ops.setup_link(hw, autoneg, negotiation, true);
5023 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; 5028 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
@@ -6245,9 +6250,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
6245 case IXGBE_DEV_ID_82599_KX4: 6250 case IXGBE_DEV_ID_82599_KX4:
6246 adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX | 6251 adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
6247 IXGBE_WUFC_MC | IXGBE_WUFC_BC); 6252 IXGBE_WUFC_MC | IXGBE_WUFC_BC);
6248 /* Enable ACPI wakeup in GRC */
6249 IXGBE_WRITE_REG(hw, IXGBE_GRC,
6250 (IXGBE_READ_REG(hw, IXGBE_GRC) & ~IXGBE_GRC_APME));
6251 break; 6253 break;
6252 default: 6254 default:
6253 adapter->wol = 0; 6255 adapter->wol = 0;
@@ -6380,6 +6382,16 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
6380 del_timer_sync(&adapter->sfp_timer); 6382 del_timer_sync(&adapter->sfp_timer);
6381 cancel_work_sync(&adapter->watchdog_task); 6383 cancel_work_sync(&adapter->watchdog_task);
6382 cancel_work_sync(&adapter->sfp_task); 6384 cancel_work_sync(&adapter->sfp_task);
6385 if (adapter->hw.phy.multispeed_fiber) {
6386 struct ixgbe_hw *hw = &adapter->hw;
6387 /*
6388 * Restart clause 37 autoneg, disable and re-enable
6389 * the tx laser, to clear & alert the link partner
6390 * that it needs to restart autotry
6391 */
6392 hw->mac.autotry_restart = true;
6393 hw->mac.ops.flap_tx_laser(hw);
6394 }
6383 cancel_work_sync(&adapter->multispeed_fiber_task); 6395 cancel_work_sync(&adapter->multispeed_fiber_task);
6384 cancel_work_sync(&adapter->sfp_config_module_task); 6396 cancel_work_sync(&adapter->sfp_config_module_task);
6385 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE || 6397 if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 2be907466593..0ed5ab37cc53 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -2397,6 +2397,7 @@ struct ixgbe_mac_operations {
2397 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32); 2397 s32 (*enable_rx_dma)(struct ixgbe_hw *, u32);
2398 2398
2399 /* Link */ 2399 /* Link */
2400 void (*flap_tx_laser)(struct ixgbe_hw *);
2400 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool); 2401 s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
2401 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool); 2402 s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
2402 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, 2403 s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
diff --git a/drivers/net/ixgbevf/ethtool.c b/drivers/net/ixgbevf/ethtool.c
index 399be0c34c36..6fdd651abcd1 100644
--- a/drivers/net/ixgbevf/ethtool.c
+++ b/drivers/net/ixgbevf/ethtool.c
@@ -46,22 +46,32 @@ struct ixgbe_stats {
46 int sizeof_stat; 46 int sizeof_stat;
47 int stat_offset; 47 int stat_offset;
48 int base_stat_offset; 48 int base_stat_offset;
49 int saved_reset_offset;
49}; 50};
50 51
51#define IXGBEVF_STAT(m, b) sizeof(((struct ixgbevf_adapter *)0)->m), \ 52#define IXGBEVF_STAT(m, b, r) sizeof(((struct ixgbevf_adapter *)0)->m), \
52 offsetof(struct ixgbevf_adapter, m), \ 53 offsetof(struct ixgbevf_adapter, m), \
53 offsetof(struct ixgbevf_adapter, b) 54 offsetof(struct ixgbevf_adapter, b), \
55 offsetof(struct ixgbevf_adapter, r)
54static struct ixgbe_stats ixgbe_gstrings_stats[] = { 56static struct ixgbe_stats ixgbe_gstrings_stats[] = {
55 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc)}, 57 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc,
56 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc)}, 58 stats.saved_reset_vfgprc)},
57 {"rx_bytes", IXGBEVF_STAT(stats.vfgorc, stats.base_vfgorc)}, 59 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc,
58 {"tx_bytes", IXGBEVF_STAT(stats.vfgotc, stats.base_vfgotc)}, 60 stats.saved_reset_vfgptc)},
59 {"tx_busy", IXGBEVF_STAT(tx_busy, zero_base)}, 61 {"rx_bytes", IXGBEVF_STAT(stats.vfgorc, stats.base_vfgorc,
60 {"multicast", IXGBEVF_STAT(stats.vfmprc, stats.base_vfmprc)}, 62 stats.saved_reset_vfgorc)},
61 {"rx_csum_offload_good", IXGBEVF_STAT(hw_csum_rx_good, zero_base)}, 63 {"tx_bytes", IXGBEVF_STAT(stats.vfgotc, stats.base_vfgotc,
62 {"rx_csum_offload_errors", IXGBEVF_STAT(hw_csum_rx_error, zero_base)}, 64 stats.saved_reset_vfgotc)},
63 {"tx_csum_offload_ctxt", IXGBEVF_STAT(hw_csum_tx_good, zero_base)}, 65 {"tx_busy", IXGBEVF_STAT(tx_busy, zero_base, zero_base)},
64 {"rx_header_split", IXGBEVF_STAT(rx_hdr_split, zero_base)}, 66 {"multicast", IXGBEVF_STAT(stats.vfmprc, stats.base_vfmprc,
67 stats.saved_reset_vfmprc)},
68 {"rx_csum_offload_good", IXGBEVF_STAT(hw_csum_rx_good, zero_base,
69 zero_base)},
70 {"rx_csum_offload_errors", IXGBEVF_STAT(hw_csum_rx_error, zero_base,
71 zero_base)},
72 {"tx_csum_offload_ctxt", IXGBEVF_STAT(hw_csum_tx_good, zero_base,
73 zero_base)},
74 {"rx_header_split", IXGBEVF_STAT(rx_hdr_split, zero_base, zero_base)},
65}; 75};
66 76
67#define IXGBE_QUEUE_STATS_LEN 0 77#define IXGBE_QUEUE_STATS_LEN 0
@@ -455,10 +465,14 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
455 ixgbe_gstrings_stats[i].stat_offset; 465 ixgbe_gstrings_stats[i].stat_offset;
456 char *b = (char *)adapter + 466 char *b = (char *)adapter +
457 ixgbe_gstrings_stats[i].base_stat_offset; 467 ixgbe_gstrings_stats[i].base_stat_offset;
468 char *r = (char *)adapter +
469 ixgbe_gstrings_stats[i].saved_reset_offset;
458 data[i] = ((ixgbe_gstrings_stats[i].sizeof_stat == 470 data[i] = ((ixgbe_gstrings_stats[i].sizeof_stat ==
459 sizeof(u64)) ? *(u64 *)p : *(u32 *)p) - 471 sizeof(u64)) ? *(u64 *)p : *(u32 *)p) -
460 ((ixgbe_gstrings_stats[i].sizeof_stat == 472 ((ixgbe_gstrings_stats[i].sizeof_stat ==
461 sizeof(u64)) ? *(u64 *)b : *(u32 *)b); 473 sizeof(u64)) ? *(u64 *)b : *(u32 *)b) +
474 ((ixgbe_gstrings_stats[i].sizeof_stat ==
475 sizeof(u64)) ? *(u64 *)r : *(u32 *)r);
462 } 476 }
463} 477}
464 478
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index ca653c49b765..d6cbd943a6f0 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -965,7 +965,7 @@ static irqreturn_t ixgbevf_msix_mbx(int irq, void *data)
965 965
966 if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG) 966 if ((msg & IXGBE_MBVFICR_VFREQ_MASK) == IXGBE_PF_CONTROL_MSG)
967 mod_timer(&adapter->watchdog_timer, 967 mod_timer(&adapter->watchdog_timer,
968 round_jiffies(jiffies + 10)); 968 round_jiffies(jiffies + 1));
969 969
970 return IRQ_HANDLED; 970 return IRQ_HANDLED;
971} 971}
@@ -1610,6 +1610,44 @@ static inline void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
1610 (adapter->rx_ring[rxr].count - 1)); 1610 (adapter->rx_ring[rxr].count - 1));
1611} 1611}
1612 1612
1613static void ixgbevf_save_reset_stats(struct ixgbevf_adapter *adapter)
1614{
1615 /* Only save pre-reset stats if there are some */
1616 if (adapter->stats.vfgprc || adapter->stats.vfgptc) {
1617 adapter->stats.saved_reset_vfgprc += adapter->stats.vfgprc -
1618 adapter->stats.base_vfgprc;
1619 adapter->stats.saved_reset_vfgptc += adapter->stats.vfgptc -
1620 adapter->stats.base_vfgptc;
1621 adapter->stats.saved_reset_vfgorc += adapter->stats.vfgorc -
1622 adapter->stats.base_vfgorc;
1623 adapter->stats.saved_reset_vfgotc += adapter->stats.vfgotc -
1624 adapter->stats.base_vfgotc;
1625 adapter->stats.saved_reset_vfmprc += adapter->stats.vfmprc -
1626 adapter->stats.base_vfmprc;
1627 }
1628}
1629
1630static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
1631{
1632 struct ixgbe_hw *hw = &adapter->hw;
1633
1634 adapter->stats.last_vfgprc = IXGBE_READ_REG(hw, IXGBE_VFGPRC);
1635 adapter->stats.last_vfgorc = IXGBE_READ_REG(hw, IXGBE_VFGORC_LSB);
1636 adapter->stats.last_vfgorc |=
1637 (((u64)(IXGBE_READ_REG(hw, IXGBE_VFGORC_MSB))) << 32);
1638 adapter->stats.last_vfgptc = IXGBE_READ_REG(hw, IXGBE_VFGPTC);
1639 adapter->stats.last_vfgotc = IXGBE_READ_REG(hw, IXGBE_VFGOTC_LSB);
1640 adapter->stats.last_vfgotc |=
1641 (((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
1642 adapter->stats.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
1643
1644 adapter->stats.base_vfgprc = adapter->stats.last_vfgprc;
1645 adapter->stats.base_vfgorc = adapter->stats.last_vfgorc;
1646 adapter->stats.base_vfgptc = adapter->stats.last_vfgptc;
1647 adapter->stats.base_vfgotc = adapter->stats.last_vfgotc;
1648 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc;
1649}
1650
1613static int ixgbevf_up_complete(struct ixgbevf_adapter *adapter) 1651static int ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1614{ 1652{
1615 struct net_device *netdev = adapter->netdev; 1653 struct net_device *netdev = adapter->netdev;
@@ -1656,6 +1694,9 @@ static int ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
1656 /* enable transmits */ 1694 /* enable transmits */
1657 netif_tx_start_all_queues(netdev); 1695 netif_tx_start_all_queues(netdev);
1658 1696
1697 ixgbevf_save_reset_stats(adapter);
1698 ixgbevf_init_last_counter_stats(adapter);
1699
1659 /* bring the link up in the watchdog, this could race with our first 1700 /* bring the link up in the watchdog, this could race with our first
1660 * link up interrupt but shouldn't be a problem */ 1701 * link up interrupt but shouldn't be a problem */
1661 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; 1702 adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
@@ -2228,27 +2269,6 @@ out:
2228 return err; 2269 return err;
2229} 2270}
2230 2271
2231static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter)
2232{
2233 struct ixgbe_hw *hw = &adapter->hw;
2234
2235 adapter->stats.last_vfgprc = IXGBE_READ_REG(hw, IXGBE_VFGPRC);
2236 adapter->stats.last_vfgorc = IXGBE_READ_REG(hw, IXGBE_VFGORC_LSB);
2237 adapter->stats.last_vfgorc |=
2238 (((u64)(IXGBE_READ_REG(hw, IXGBE_VFGORC_MSB))) << 32);
2239 adapter->stats.last_vfgptc = IXGBE_READ_REG(hw, IXGBE_VFGPTC);
2240 adapter->stats.last_vfgotc = IXGBE_READ_REG(hw, IXGBE_VFGOTC_LSB);
2241 adapter->stats.last_vfgotc |=
2242 (((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
2243 adapter->stats.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
2244
2245 adapter->stats.base_vfgprc = adapter->stats.last_vfgprc;
2246 adapter->stats.base_vfgorc = adapter->stats.last_vfgorc;
2247 adapter->stats.base_vfgptc = adapter->stats.last_vfgptc;
2248 adapter->stats.base_vfgotc = adapter->stats.last_vfgotc;
2249 adapter->stats.base_vfmprc = adapter->stats.last_vfmprc;
2250}
2251
2252#define UPDATE_VF_COUNTER_32bit(reg, last_counter, counter) \ 2272#define UPDATE_VF_COUNTER_32bit(reg, last_counter, counter) \
2253 { \ 2273 { \
2254 u32 current_counter = IXGBE_READ_REG(hw, reg); \ 2274 u32 current_counter = IXGBE_READ_REG(hw, reg); \
@@ -2399,7 +2419,7 @@ static void ixgbevf_watchdog_task(struct work_struct *work)
2399 if (!netif_carrier_ok(netdev)) { 2419 if (!netif_carrier_ok(netdev)) {
2400 hw_dbg(&adapter->hw, "NIC Link is Up %s, ", 2420 hw_dbg(&adapter->hw, "NIC Link is Up %s, ",
2401 ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) ? 2421 ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) ?
2402 "10 Gbps" : "1 Gbps")); 2422 "10 Gbps\n" : "1 Gbps\n"));
2403 netif_carrier_on(netdev); 2423 netif_carrier_on(netdev);
2404 netif_tx_wake_all_queues(netdev); 2424 netif_tx_wake_all_queues(netdev);
2405 } else { 2425 } else {
@@ -2416,9 +2436,9 @@ static void ixgbevf_watchdog_task(struct work_struct *work)
2416 } 2436 }
2417 } 2437 }
2418 2438
2419pf_has_reset:
2420 ixgbevf_update_stats(adapter); 2439 ixgbevf_update_stats(adapter);
2421 2440
2441pf_has_reset:
2422 /* Force detection of hung controller every watchdog period */ 2442 /* Force detection of hung controller every watchdog period */
2423 adapter->detect_tx_hung = true; 2443 adapter->detect_tx_hung = true;
2424 2444
@@ -2675,7 +2695,7 @@ static int ixgbevf_open(struct net_device *netdev)
2675 if (hw->adapter_stopped) { 2695 if (hw->adapter_stopped) {
2676 err = IXGBE_ERR_MBX; 2696 err = IXGBE_ERR_MBX;
2677 printk(KERN_ERR "Unable to start - perhaps the PF" 2697 printk(KERN_ERR "Unable to start - perhaps the PF"
2678 "Driver isn't up yet\n"); 2698 " Driver isn't up yet\n");
2679 goto err_setup_reset; 2699 goto err_setup_reset;
2680 } 2700 }
2681 } 2701 }
@@ -3390,8 +3410,6 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
3390 /* setup the private structure */ 3410 /* setup the private structure */
3391 err = ixgbevf_sw_init(adapter); 3411 err = ixgbevf_sw_init(adapter);
3392 3412
3393 ixgbevf_init_last_counter_stats(adapter);
3394
3395#ifdef MAX_SKB_FRAGS 3413#ifdef MAX_SKB_FRAGS
3396 netdev->features = NETIF_F_SG | 3414 netdev->features = NETIF_F_SG |
3397 NETIF_F_IP_CSUM | 3415 NETIF_F_IP_CSUM |
@@ -3449,6 +3467,8 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev,
3449 3467
3450 adapter->netdev_registered = true; 3468 adapter->netdev_registered = true;
3451 3469
3470 ixgbevf_init_last_counter_stats(adapter);
3471
3452 /* print the MAC address */ 3472 /* print the MAC address */
3453 hw_dbg(hw, "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", 3473 hw_dbg(hw, "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
3454 netdev->dev_addr[0], 3474 netdev->dev_addr[0],
diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h
index 799600e92700..1f31b052d4b4 100644
--- a/drivers/net/ixgbevf/vf.h
+++ b/drivers/net/ixgbevf/vf.h
@@ -157,6 +157,12 @@ struct ixgbevf_hw_stats {
157 u64 vfgorc; 157 u64 vfgorc;
158 u64 vfgotc; 158 u64 vfgotc;
159 u64 vfmprc; 159 u64 vfmprc;
160
161 u64 saved_reset_vfgprc;
162 u64 saved_reset_vfgptc;
163 u64 saved_reset_vfgorc;
164 u64 saved_reset_vfgotc;
165 u64 saved_reset_vfmprc;
160}; 166};
161 167
162struct ixgbevf_info { 168struct ixgbevf_info {
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 0f31497833df..c0b59a555384 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -946,6 +946,8 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx)
946 jme->jme_vlan_rx(skb, jme->vlgrp, 946 jme->jme_vlan_rx(skb, jme->vlgrp,
947 le16_to_cpu(rxdesc->descwb.vlan)); 947 le16_to_cpu(rxdesc->descwb.vlan));
948 NET_STAT(jme).rx_bytes += 4; 948 NET_STAT(jme).rx_bytes += 4;
949 } else {
950 dev_kfree_skb(skb);
949 } 951 }
950 } else { 952 } else {
951 jme->jme_rx(skb); 953 jme->jme_rx(skb);
@@ -2081,12 +2083,45 @@ jme_tx_timeout(struct net_device *netdev)
2081 jme_reset_link(jme); 2083 jme_reset_link(jme);
2082} 2084}
2083 2085
2086static inline void jme_pause_rx(struct jme_adapter *jme)
2087{
2088 atomic_dec(&jme->link_changing);
2089
2090 jme_set_rx_pcc(jme, PCC_OFF);
2091 if (test_bit(JME_FLAG_POLL, &jme->flags)) {
2092 JME_NAPI_DISABLE(jme);
2093 } else {
2094 tasklet_disable(&jme->rxclean_task);
2095 tasklet_disable(&jme->rxempty_task);
2096 }
2097}
2098
2099static inline void jme_resume_rx(struct jme_adapter *jme)
2100{
2101 struct dynpcc_info *dpi = &(jme->dpi);
2102
2103 if (test_bit(JME_FLAG_POLL, &jme->flags)) {
2104 JME_NAPI_ENABLE(jme);
2105 } else {
2106 tasklet_hi_enable(&jme->rxclean_task);
2107 tasklet_hi_enable(&jme->rxempty_task);
2108 }
2109 dpi->cur = PCC_P1;
2110 dpi->attempt = PCC_P1;
2111 dpi->cnt = 0;
2112 jme_set_rx_pcc(jme, PCC_P1);
2113
2114 atomic_inc(&jme->link_changing);
2115}
2116
2084static void 2117static void
2085jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) 2118jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
2086{ 2119{
2087 struct jme_adapter *jme = netdev_priv(netdev); 2120 struct jme_adapter *jme = netdev_priv(netdev);
2088 2121
2122 jme_pause_rx(jme);
2089 jme->vlgrp = grp; 2123 jme->vlgrp = grp;
2124 jme_resume_rx(jme);
2090} 2125}
2091 2126
2092static void 2127static void
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index c19db9146a2f..07ad3a457185 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -25,7 +25,7 @@
25#define __JME_H_INCLUDED__ 25#define __JME_H_INCLUDED__
26 26
27#define DRV_NAME "jme" 27#define DRV_NAME "jme"
28#define DRV_VERSION "1.0.5" 28#define DRV_VERSION "1.0.6"
29#define PFX DRV_NAME ": " 29#define PFX DRV_NAME ": "
30 30
31#define PCI_DEVICE_ID_JMICRON_JMC250 0x0250 31#define PCI_DEVICE_ID_JMICRON_JMC250 0x0250
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 0573e0bb4444..13cc1ca261d9 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -976,7 +976,6 @@ static void ks8851_set_rx_mode(struct net_device *dev)
976 crc >>= (32 - 6); /* get top six bits */ 976 crc >>= (32 - 6); /* get top six bits */
977 977
978 rxctrl.mchash[crc >> 4] |= (1 << (crc & 0xf)); 978 rxctrl.mchash[crc >> 4] |= (1 << (crc & 0xf));
979 mcptr = mcptr->next;
980 } 979 }
981 980
982 rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXPAFMA; 981 rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXPAFMA;
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 0f59099ee72f..6c5327af1bf9 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -6322,7 +6322,7 @@ static int netdev_set_eeprom(struct net_device *dev,
6322 int len; 6322 int len;
6323 6323
6324 if (eeprom->magic != EEPROM_MAGIC) 6324 if (eeprom->magic != EEPROM_MAGIC)
6325 return 1; 6325 return -EINVAL;
6326 6326
6327 len = (eeprom->offset + eeprom->len + 1) / 2; 6327 len = (eeprom->offset + eeprom->len + 1) / 2;
6328 for (i = eeprom->offset / 2; i < len; i++) 6328 for (i = eeprom->offset / 2; i < len; i++)
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 8f6e816a7395..b402a95c87c7 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -1023,6 +1023,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
1023 info->port_attr.attr.mode = S_IRUGO | S_IWUSR; 1023 info->port_attr.attr.mode = S_IRUGO | S_IWUSR;
1024 info->port_attr.show = show_port_type; 1024 info->port_attr.show = show_port_type;
1025 info->port_attr.store = set_port_type; 1025 info->port_attr.store = set_port_type;
1026 sysfs_attr_init(&info->port_attr.attr);
1026 1027
1027 err = device_create_file(&dev->pdev->dev, &info->port_attr); 1028 err = device_create_file(&dev->pdev->dev, &info->port_attr);
1028 if (err) { 1029 if (err) {
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 08780ef1c1f8..9a7a0f3c36c4 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1246,8 +1246,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1246 int pci_func_id = PCI_FUNC(pdev->devfn); 1246 int pci_func_id = PCI_FUNC(pdev->devfn);
1247 uint8_t revision_id; 1247 uint8_t revision_id;
1248 1248
1249 if (pdev->revision >= NX_P3_A0 && pdev->revision < NX_P3_B1) { 1249 if (pdev->revision >= NX_P3_A0 && pdev->revision <= NX_P3_B1) {
1250 pr_warning("%s: chip revisions between 0x%x-0x%x" 1250 pr_warning("%s: chip revisions between 0x%x-0x%x "
1251 "will not be enabled.\n", 1251 "will not be enabled.\n",
1252 module_name(THIS_MODULE), NX_P3_A0, NX_P3_B1); 1252 module_name(THIS_MODULE), NX_P3_A0, NX_P3_B1);
1253 return -ENODEV; 1253 return -ENODEV;
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index d222d7e25273..73f9a31cf94d 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1189,9 +1189,21 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
1189 } 1189 }
1190 1190
1191 if (csum) { 1191 if (csum) {
1192 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb); 1192 if (skb->len <= 45) {
1193 skb_push(skb, 4); 1193 /* workaround - hardware tx checksum does not work
1194 memcpy(skb->data, &csum_preamble, 4); 1194 * properly with extremely small packets */
1195 long csstart = skb->csum_start - skb_headroom(skb);
1196 __wsum calc = csum_partial(skb->data + csstart,
1197 skb->len - csstart, 0);
1198 *((__sum16 *)(skb->data + csstart
1199 + skb->csum_offset)) = csum_fold(calc);
1200
1201 csum = false;
1202 } else {
1203 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
1204 skb_push(skb, 4);
1205 memcpy(skb->data, &csum_preamble, 4);
1206 }
1195 } 1207 }
1196 1208
1197 skb_push(skb, 4); 1209 skb_push(skb, 4);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 3a486f3bad3d..bc278d4ee89d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -812,7 +812,7 @@ static void set_mii_flow_control(struct velocity_info *vptr)
812 812
813 case FLOW_CNTL_TX_RX: 813 case FLOW_CNTL_TX_RX:
814 MII_REG_BITS_ON(ANAR_PAUSE, MII_REG_ANAR, vptr->mac_regs); 814 MII_REG_BITS_ON(ANAR_PAUSE, MII_REG_ANAR, vptr->mac_regs);
815 MII_REG_BITS_ON(ANAR_ASMDIR, MII_REG_ANAR, vptr->mac_regs); 815 MII_REG_BITS_OFF(ANAR_ASMDIR, MII_REG_ANAR, vptr->mac_regs);
816 break; 816 break;
817 817
818 case FLOW_CNTL_DISABLE: 818 case FLOW_CNTL_DISABLE:
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index b2c8207f7bc1..294b486bc3ed 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1353,25 +1353,6 @@ static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
1353 return htype; 1353 return htype;
1354} 1354}
1355 1355
1356static bool is_pae(struct sk_buff *skb)
1357{
1358 struct ieee80211_hdr *hdr;
1359 __le16 fc;
1360
1361 hdr = (struct ieee80211_hdr *)skb->data;
1362 fc = hdr->frame_control;
1363
1364 if (ieee80211_is_data(fc)) {
1365 if (ieee80211_is_nullfunc(fc) ||
1366 /* Port Access Entity (IEEE 802.1X) */
1367 (skb->protocol == cpu_to_be16(ETH_P_PAE))) {
1368 return true;
1369 }
1370 }
1371
1372 return false;
1373}
1374
1375static int get_hw_crypto_keytype(struct sk_buff *skb) 1356static int get_hw_crypto_keytype(struct sk_buff *skb)
1376{ 1357{
1377 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 1358 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
@@ -1696,7 +1677,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
1696 goto tx_done; 1677 goto tx_done;
1697 } 1678 }
1698 1679
1699 if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) { 1680 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
1700 /* 1681 /*
1701 * Try aggregation if it's a unicast data frame 1682 * Try aggregation if it's a unicast data frame
1702 * and the destination is HT capable. 1683 * and the destination is HT capable.
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 1ed5206721ec..8c12311dbb0a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -124,7 +124,7 @@ void iwl_free_tfds_in_queue(struct iwl_priv *priv,
124 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) 124 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
125 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 125 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
126 else { 126 else {
127 IWL_ERR(priv, "free more than tfds_in_queue (%u:%d)\n", 127 IWL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n",
128 priv->stations[sta_id].tid[tid].tfds_in_queue, 128 priv->stations[sta_id].tid[tid].tfds_in_queue,
129 freed); 129 freed);
130 priv->stations[sta_id].tid[tid].tfds_in_queue = 0; 130 priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
index 0ccba57fb9fb..05e4d68eb4cc 100644
--- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c
@@ -466,7 +466,8 @@ out:
466 466
467void wl1251_debugfs_reset(struct wl1251 *wl) 467void wl1251_debugfs_reset(struct wl1251 *wl)
468{ 468{
469 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); 469 if (wl->stats.fw_stats != NULL)
470 memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats));
470 wl->stats.retry_count = 0; 471 wl->stats.retry_count = 0;
471 wl->stats.excessive_retries = 0; 472 wl->stats.excessive_retries = 0;
472} 473}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index de296452c957..997668558e79 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -655,8 +655,8 @@ void pci_create_legacy_files(struct pci_bus *b)
655 goto legacy_io_err; 655 goto legacy_io_err;
656 656
657 /* Allocated above after the legacy_io struct */ 657 /* Allocated above after the legacy_io struct */
658 sysfs_bin_attr_init(b->legacy_mem);
659 b->legacy_mem = b->legacy_io + 1; 658 b->legacy_mem = b->legacy_io + 1;
659 sysfs_bin_attr_init(b->legacy_mem);
660 b->legacy_mem->attr.name = "legacy_mem"; 660 b->legacy_mem->attr.name = "legacy_mem";
661 b->legacy_mem->size = 1024*1024; 661 b->legacy_mem->size = 1024*1024;
662 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; 662 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 5d228071ec69..fb904f444d90 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -361,7 +361,6 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
361 struct at91_cf_socket *cf = platform_get_drvdata(pdev); 361 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
362 struct at91_cf_data *board = cf->board; 362 struct at91_cf_data *board = cf->board;
363 363
364 pcmcia_socket_dev_suspend(&pdev->dev);
365 if (device_may_wakeup(&pdev->dev)) { 364 if (device_may_wakeup(&pdev->dev)) {
366 enable_irq_wake(board->det_pin); 365 enable_irq_wake(board->det_pin);
367 if (board->irq_pin) 366 if (board->irq_pin)
@@ -381,7 +380,6 @@ static int at91_cf_resume(struct platform_device *pdev)
381 disable_irq_wake(board->irq_pin); 380 disable_irq_wake(board->irq_pin);
382 } 381 }
383 382
384 pcmcia_socket_dev_resume(&pdev->dev);
385 return 0; 383 return 0;
386} 384}
387 385
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 171c8a654887..ac4d089430fd 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -510,17 +510,6 @@ static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
510 return ret; 510 return ret;
511} 511}
512 512
513static int au1x00_drv_pcmcia_suspend(struct platform_device *dev,
514 pm_message_t state)
515{
516 return pcmcia_socket_dev_suspend(&dev->dev);
517}
518
519static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
520{
521 return pcmcia_socket_dev_resume(&dev->dev);
522}
523
524static struct platform_driver au1x00_pcmcia_driver = { 513static struct platform_driver au1x00_pcmcia_driver = {
525 .driver = { 514 .driver = {
526 .name = "au1x00-pcmcia", 515 .name = "au1x00-pcmcia",
@@ -528,8 +517,6 @@ static struct platform_driver au1x00_pcmcia_driver = {
528 }, 517 },
529 .probe = au1x00_drv_pcmcia_probe, 518 .probe = au1x00_drv_pcmcia_probe,
530 .remove = au1x00_drv_pcmcia_remove, 519 .remove = au1x00_drv_pcmcia_remove,
531 .suspend = au1x00_drv_pcmcia_suspend,
532 .resume = au1x00_drv_pcmcia_resume,
533}; 520};
534 521
535 522
diff --git a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
index 2482ce7ac6dc..93f9ddeb0c36 100644
--- a/drivers/pcmcia/bfin_cf_pcmcia.c
+++ b/drivers/pcmcia/bfin_cf_pcmcia.c
@@ -300,16 +300,6 @@ static int __devexit bfin_cf_remove(struct platform_device *pdev)
300 return 0; 300 return 0;
301} 301}
302 302
303static int bfin_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
304{
305 return pcmcia_socket_dev_suspend(&pdev->dev);
306}
307
308static int bfin_cf_resume(struct platform_device *pdev)
309{
310 return pcmcia_socket_dev_resume(&pdev->dev);
311}
312
313static struct platform_driver bfin_cf_driver = { 303static struct platform_driver bfin_cf_driver = {
314 .driver = { 304 .driver = {
315 .name = (char *)driver_name, 305 .name = (char *)driver_name,
@@ -317,8 +307,6 @@ static struct platform_driver bfin_cf_driver = {
317 }, 307 },
318 .probe = bfin_cf_probe, 308 .probe = bfin_cf_probe,
319 .remove = __devexit_p(bfin_cf_remove), 309 .remove = __devexit_p(bfin_cf_remove),
320 .suspend = bfin_cf_suspend,
321 .resume = bfin_cf_resume,
322}; 310};
323 311
324static int __init bfin_cf_init(void) 312static int __init bfin_cf_init(void)
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index e679e708db63..75ed866e6953 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -76,65 +76,6 @@ DECLARE_RWSEM(pcmcia_socket_list_rwsem);
76EXPORT_SYMBOL(pcmcia_socket_list_rwsem); 76EXPORT_SYMBOL(pcmcia_socket_list_rwsem);
77 77
78 78
79/*
80 * Low-level PCMCIA socket drivers need to register with the PCCard
81 * core using pcmcia_register_socket.
82 *
83 * socket drivers are expected to use the following callbacks in their
84 * .drv struct:
85 * - pcmcia_socket_dev_suspend
86 * - pcmcia_socket_dev_resume
87 * These functions check for the appropriate struct pcmcia_soket arrays,
88 * and pass them to the low-level functions pcmcia_{suspend,resume}_socket
89 */
90static int socket_early_resume(struct pcmcia_socket *skt);
91static int socket_late_resume(struct pcmcia_socket *skt);
92static int socket_resume(struct pcmcia_socket *skt);
93static int socket_suspend(struct pcmcia_socket *skt);
94
95static void pcmcia_socket_dev_run(struct device *dev,
96 int (*cb)(struct pcmcia_socket *))
97{
98 struct pcmcia_socket *socket;
99
100 down_read(&pcmcia_socket_list_rwsem);
101 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
102 if (socket->dev.parent != dev)
103 continue;
104 mutex_lock(&socket->skt_mutex);
105 cb(socket);
106 mutex_unlock(&socket->skt_mutex);
107 }
108 up_read(&pcmcia_socket_list_rwsem);
109}
110
111int pcmcia_socket_dev_suspend(struct device *dev)
112{
113 pcmcia_socket_dev_run(dev, socket_suspend);
114 return 0;
115}
116EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
117
118void pcmcia_socket_dev_early_resume(struct device *dev)
119{
120 pcmcia_socket_dev_run(dev, socket_early_resume);
121}
122EXPORT_SYMBOL(pcmcia_socket_dev_early_resume);
123
124void pcmcia_socket_dev_late_resume(struct device *dev)
125{
126 pcmcia_socket_dev_run(dev, socket_late_resume);
127}
128EXPORT_SYMBOL(pcmcia_socket_dev_late_resume);
129
130int pcmcia_socket_dev_resume(struct device *dev)
131{
132 pcmcia_socket_dev_run(dev, socket_resume);
133 return 0;
134}
135EXPORT_SYMBOL(pcmcia_socket_dev_resume);
136
137
138struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt) 79struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
139{ 80{
140 struct device *dev = get_device(&skt->dev); 81 struct device *dev = get_device(&skt->dev);
@@ -578,12 +519,18 @@ static int socket_early_resume(struct pcmcia_socket *skt)
578 519
579static int socket_late_resume(struct pcmcia_socket *skt) 520static int socket_late_resume(struct pcmcia_socket *skt)
580{ 521{
522 int ret;
523
581 mutex_lock(&skt->ops_mutex); 524 mutex_lock(&skt->ops_mutex);
582 skt->state &= ~SOCKET_SUSPEND; 525 skt->state &= ~SOCKET_SUSPEND;
583 mutex_unlock(&skt->ops_mutex); 526 mutex_unlock(&skt->ops_mutex);
584 527
585 if (!(skt->state & SOCKET_PRESENT)) 528 if (!(skt->state & SOCKET_PRESENT)) {
586 return socket_insert(skt); 529 ret = socket_insert(skt);
530 if (ret == -ENODEV)
531 ret = 0;
532 return ret;
533 }
587 534
588 if (skt->resume_status) { 535 if (skt->resume_status) {
589 socket_shutdown(skt); 536 socket_shutdown(skt);
@@ -919,11 +866,66 @@ static void pcmcia_release_socket_class(struct class *data)
919} 866}
920 867
921 868
869#ifdef CONFIG_PM
870
871static int __pcmcia_pm_op(struct device *dev,
872 int (*callback) (struct pcmcia_socket *skt))
873{
874 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
875 int ret;
876
877 mutex_lock(&s->skt_mutex);
878 ret = callback(s);
879 mutex_unlock(&s->skt_mutex);
880
881 return ret;
882}
883
884static int pcmcia_socket_dev_suspend_noirq(struct device *dev)
885{
886 return __pcmcia_pm_op(dev, socket_suspend);
887}
888
889static int pcmcia_socket_dev_resume_noirq(struct device *dev)
890{
891 return __pcmcia_pm_op(dev, socket_early_resume);
892}
893
894static int pcmcia_socket_dev_resume(struct device *dev)
895{
896 return __pcmcia_pm_op(dev, socket_late_resume);
897}
898
899static const struct dev_pm_ops pcmcia_socket_pm_ops = {
900 /* dev_resume may be called with IRQs enabled */
901 SET_SYSTEM_SLEEP_PM_OPS(NULL,
902 pcmcia_socket_dev_resume)
903
904 /* late suspend must be called with IRQs disabled */
905 .suspend_noirq = pcmcia_socket_dev_suspend_noirq,
906 .freeze_noirq = pcmcia_socket_dev_suspend_noirq,
907 .poweroff_noirq = pcmcia_socket_dev_suspend_noirq,
908
909 /* early resume must be called with IRQs disabled */
910 .resume_noirq = pcmcia_socket_dev_resume_noirq,
911 .thaw_noirq = pcmcia_socket_dev_resume_noirq,
912 .restore_noirq = pcmcia_socket_dev_resume_noirq,
913};
914
915#define PCMCIA_SOCKET_CLASS_PM_OPS (&pcmcia_socket_pm_ops)
916
917#else /* CONFIG_PM */
918
919#define PCMCIA_SOCKET_CLASS_PM_OPS NULL
920
921#endif /* CONFIG_PM */
922
922struct class pcmcia_socket_class = { 923struct class pcmcia_socket_class = {
923 .name = "pcmcia_socket", 924 .name = "pcmcia_socket",
924 .dev_uevent = pcmcia_socket_uevent, 925 .dev_uevent = pcmcia_socket_uevent,
925 .dev_release = pcmcia_release_socket, 926 .dev_release = pcmcia_release_socket,
926 .class_release = pcmcia_release_socket_class, 927 .class_release = pcmcia_release_socket_class,
928 .pm = PCMCIA_SOCKET_CLASS_PM_OPS,
927}; 929};
928EXPORT_SYMBOL(pcmcia_socket_class); 930EXPORT_SYMBOL(pcmcia_socket_class);
929 931
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
index 9254ab0b29b1..a520193b6453 100644
--- a/drivers/pcmcia/db1xxx_ss.c
+++ b/drivers/pcmcia/db1xxx_ss.c
@@ -558,37 +558,10 @@ static int __devexit db1x_pcmcia_socket_remove(struct platform_device *pdev)
558 return 0; 558 return 0;
559} 559}
560 560
561#ifdef CONFIG_PM
562static int db1x_pcmcia_suspend(struct device *dev)
563{
564 return pcmcia_socket_dev_suspend(dev);
565}
566
567static int db1x_pcmcia_resume(struct device *dev)
568{
569 return pcmcia_socket_dev_resume(dev);
570}
571
572static struct dev_pm_ops db1x_pcmcia_pmops = {
573 .resume = db1x_pcmcia_resume,
574 .suspend = db1x_pcmcia_suspend,
575 .thaw = db1x_pcmcia_resume,
576 .freeze = db1x_pcmcia_suspend,
577};
578
579#define DB1XXX_SS_PMOPS &db1x_pcmcia_pmops
580
581#else
582
583#define DB1XXX_SS_PMOPS NULL
584
585#endif
586
587static struct platform_driver db1x_pcmcia_socket_driver = { 561static struct platform_driver db1x_pcmcia_socket_driver = {
588 .driver = { 562 .driver = {
589 .name = "db1xxx_pcmcia", 563 .name = "db1xxx_pcmcia",
590 .owner = THIS_MODULE, 564 .owner = THIS_MODULE,
591 .pm = DB1XXX_SS_PMOPS
592 }, 565 },
593 .probe = db1x_pcmcia_socket_probe, 566 .probe = db1x_pcmcia_socket_probe,
594 .remove = __devexit_p(db1x_pcmcia_socket_remove), 567 .remove = __devexit_p(db1x_pcmcia_socket_remove),
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index ad93ebd7b2a2..52d33b2a5bc5 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -509,8 +509,12 @@ struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int fu
509 p_dev->device_no = (s->device_count++); 509 p_dev->device_no = (s->device_count++);
510 mutex_unlock(&s->ops_mutex); 510 mutex_unlock(&s->ops_mutex);
511 511
512 /* max of 2 devices per card */ 512 /* max of 2 PFC devices */
513 if (p_dev->device_no >= 2) 513 if ((p_dev->device_no >= 2) && (function == 0))
514 goto err_free;
515
516 /* max of 4 devices overall */
517 if (p_dev->device_no >= 4)
514 goto err_free; 518 goto err_free;
515 519
516 p_dev->socket = s; 520 p_dev->socket = s;
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index f5da62653313..3003bb3dfcc0 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -39,27 +39,11 @@ static struct pci_device_id i82092aa_pci_ids[] = {
39}; 39};
40MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 40MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
41 41
42#ifdef CONFIG_PM
43static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state)
44{
45 return pcmcia_socket_dev_suspend(&dev->dev);
46}
47
48static int i82092aa_socket_resume (struct pci_dev *dev)
49{
50 return pcmcia_socket_dev_resume(&dev->dev);
51}
52#endif
53
54static struct pci_driver i82092aa_pci_driver = { 42static struct pci_driver i82092aa_pci_driver = {
55 .name = "i82092aa", 43 .name = "i82092aa",
56 .id_table = i82092aa_pci_ids, 44 .id_table = i82092aa_pci_ids,
57 .probe = i82092aa_pci_probe, 45 .probe = i82092aa_pci_probe,
58 .remove = __devexit_p(i82092aa_pci_remove), 46 .remove = __devexit_p(i82092aa_pci_remove),
59#ifdef CONFIG_PM
60 .suspend = i82092aa_socket_suspend,
61 .resume = i82092aa_socket_resume,
62#endif
63}; 47};
64 48
65 49
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index c13fd9360511..d53d9b5659c7 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -1223,16 +1223,7 @@ static int pcic_init(struct pcmcia_socket *s)
1223 return 0; 1223 return 0;
1224} 1224}
1225 1225
1226static int i82365_drv_pcmcia_suspend(struct platform_device *dev,
1227 pm_message_t state)
1228{
1229 return pcmcia_socket_dev_suspend(&dev->dev);
1230}
1231 1226
1232static int i82365_drv_pcmcia_resume(struct platform_device *dev)
1233{
1234 return pcmcia_socket_dev_resume(&dev->dev);
1235}
1236static struct pccard_operations pcic_operations = { 1227static struct pccard_operations pcic_operations = {
1237 .init = pcic_init, 1228 .init = pcic_init,
1238 .get_status = pcic_get_status, 1229 .get_status = pcic_get_status,
@@ -1248,8 +1239,6 @@ static struct platform_driver i82365_driver = {
1248 .name = "i82365", 1239 .name = "i82365",
1249 .owner = THIS_MODULE, 1240 .owner = THIS_MODULE,
1250 }, 1241 },
1251 .suspend = i82365_drv_pcmcia_suspend,
1252 .resume = i82365_drv_pcmcia_resume,
1253}; 1242};
1254 1243
1255static struct platform_device *i82365_device; 1244static struct platform_device *i82365_device;
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 0ece2cd4a85e..ab21264468d6 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -685,16 +685,7 @@ static struct pccard_operations pcc_operations = {
685 .set_mem_map = pcc_set_mem_map, 685 .set_mem_map = pcc_set_mem_map,
686}; 686};
687 687
688static int cfc_drv_pcmcia_suspend(struct platform_device *dev,
689 pm_message_t state)
690{
691 return pcmcia_socket_dev_suspend(&dev->dev);
692}
693 688
694static int cfc_drv_pcmcia_resume(struct platform_device *dev)
695{
696 return pcmcia_socket_dev_resume(&dev->dev);
697}
698/*====================================================================*/ 689/*====================================================================*/
699 690
700static struct platform_driver pcc_driver = { 691static struct platform_driver pcc_driver = {
@@ -702,8 +693,6 @@ static struct platform_driver pcc_driver = {
702 .name = "cfc", 693 .name = "cfc",
703 .owner = THIS_MODULE, 694 .owner = THIS_MODULE,
704 }, 695 },
705 .suspend = cfc_drv_pcmcia_suspend,
706 .resume = cfc_drv_pcmcia_resume,
707}; 696};
708 697
709static struct platform_device pcc_device = { 698static struct platform_device pcc_device = {
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 72844c5a6d05..0caf3db7c700 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -663,16 +663,6 @@ static struct pccard_operations pcc_operations = {
663 .set_mem_map = pcc_set_mem_map, 663 .set_mem_map = pcc_set_mem_map,
664}; 664};
665 665
666static int pcc_drv_pcmcia_suspend(struct platform_device *dev,
667 pm_message_t state)
668{
669 return pcmcia_socket_dev_suspend(&dev->dev);
670}
671
672static int pcc_drv_pcmcia_resume(struct platform_device *dev)
673{
674 return pcmcia_socket_dev_resume(&dev->dev);
675}
676/*====================================================================*/ 666/*====================================================================*/
677 667
678static struct platform_driver pcc_driver = { 668static struct platform_driver pcc_driver = {
@@ -680,8 +670,6 @@ static struct platform_driver pcc_driver = {
680 .name = "pcc", 670 .name = "pcc",
681 .owner = THIS_MODULE, 671 .owner = THIS_MODULE,
682 }, 672 },
683 .suspend = pcc_drv_pcmcia_suspend,
684 .resume = pcc_drv_pcmcia_resume,
685}; 673};
686 674
687static struct platform_device pcc_device = { 675static struct platform_device pcc_device = {
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 61c215918128..01ef7de15322 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1288,21 +1288,6 @@ static int m8xx_remove(struct of_device *ofdev)
1288 return 0; 1288 return 0;
1289} 1289}
1290 1290
1291#ifdef CONFIG_PM
1292static int m8xx_suspend(struct platform_device *pdev, pm_message_t state)
1293{
1294 return pcmcia_socket_dev_suspend(&pdev->dev);
1295}
1296
1297static int m8xx_resume(struct platform_device *pdev)
1298{
1299 return pcmcia_socket_dev_resume(&pdev->dev);
1300}
1301#else
1302#define m8xx_suspend NULL
1303#define m8xx_resume NULL
1304#endif
1305
1306static const struct of_device_id m8xx_pcmcia_match[] = { 1291static const struct of_device_id m8xx_pcmcia_match[] = {
1307 { 1292 {
1308 .type = "pcmcia", 1293 .type = "pcmcia",
@@ -1318,8 +1303,6 @@ static struct of_platform_driver m8xx_pcmcia_driver = {
1318 .match_table = m8xx_pcmcia_match, 1303 .match_table = m8xx_pcmcia_match,
1319 .probe = m8xx_probe, 1304 .probe = m8xx_probe,
1320 .remove = m8xx_remove, 1305 .remove = m8xx_remove,
1321 .suspend = m8xx_suspend,
1322 .resume = m8xx_resume,
1323}; 1306};
1324 1307
1325static int __init m8xx_init(void) 1308static int __init m8xx_init(void)
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 3ef991552398..9edc396577b9 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -330,24 +330,12 @@ static int __exit omap_cf_remove(struct platform_device *pdev)
330 return 0; 330 return 0;
331} 331}
332 332
333static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
334{
335 return pcmcia_socket_dev_suspend(&pdev->dev);
336}
337
338static int omap_cf_resume(struct platform_device *pdev)
339{
340 return pcmcia_socket_dev_resume(&pdev->dev);
341}
342
343static struct platform_driver omap_cf_driver = { 333static struct platform_driver omap_cf_driver = {
344 .driver = { 334 .driver = {
345 .name = (char *) driver_name, 335 .name = (char *) driver_name,
346 .owner = THIS_MODULE, 336 .owner = THIS_MODULE,
347 }, 337 },
348 .remove = __exit_p(omap_cf_remove), 338 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend,
350 .resume = omap_cf_resume,
351}; 339};
352 340
353static int __init omap_cf_init(void) 341static int __init omap_cf_init(void)
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 7ba57a565cd7..4a34268cc512 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -14,13 +14,13 @@
14#include <linux/workqueue.h> 14#include <linux/workqueue.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/io.h>
17 18
18#include <pcmcia/cs_types.h> 19#include <pcmcia/cs_types.h>
19#include <pcmcia/ss.h> 20#include <pcmcia/ss.h>
20#include <pcmcia/cs.h> 21#include <pcmcia/cs.h>
21 22
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/io.h>
24 24
25#include "pd6729.h" 25#include "pd6729.h"
26#include "i82365.h" 26#include "i82365.h"
@@ -222,9 +222,9 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev)
222 ? SS_READY : 0; 222 ? SS_READY : 0;
223 } 223 }
224 224
225 if (events) { 225 if (events)
226 pcmcia_parse_events(&socket[i].socket, events); 226 pcmcia_parse_events(&socket[i].socket, events);
227 } 227
228 active |= events; 228 active |= events;
229 } 229 }
230 230
@@ -256,9 +256,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
256 status = indirect_read(socket, I365_STATUS); 256 status = indirect_read(socket, I365_STATUS);
257 *value = 0; 257 *value = 0;
258 258
259 if ((status & I365_CS_DETECT) == I365_CS_DETECT) { 259 if ((status & I365_CS_DETECT) == I365_CS_DETECT)
260 *value |= SS_DETECT; 260 *value |= SS_DETECT;
261 }
262 261
263 /* 262 /*
264 * IO cards have a different meaning of bits 0,1 263 * IO cards have a different meaning of bits 0,1
@@ -308,7 +307,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
308 socket->card_irq = state->io_irq; 307 socket->card_irq = state->io_irq;
309 308
310 reg = 0; 309 reg = 0;
311 /* The reset bit has "inverse" logic */ 310 /* The reset bit has "inverse" logic */
312 if (!(state->flags & SS_RESET)) 311 if (!(state->flags & SS_RESET))
313 reg |= I365_PC_RESET; 312 reg |= I365_PC_RESET;
314 if (state->flags & SS_IOCARD) 313 if (state->flags & SS_IOCARD)
@@ -380,7 +379,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
380 indirect_write(socket, I365_POWER, reg); 379 indirect_write(socket, I365_POWER, reg);
381 380
382 if (irq_mode == 1) { 381 if (irq_mode == 1) {
383 /* all interrupts are to be done as PCI interrupts */ 382 /* all interrupts are to be done as PCI interrupts */
384 data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ; 383 data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ;
385 } else 384 } else
386 data = 0; 385 data = 0;
@@ -391,9 +390,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
391 /* Enable specific interrupt events */ 390 /* Enable specific interrupt events */
392 391
393 reg = 0x00; 392 reg = 0x00;
394 if (state->csc_mask & SS_DETECT) { 393 if (state->csc_mask & SS_DETECT)
395 reg |= I365_CSC_DETECT; 394 reg |= I365_CSC_DETECT;
396 } 395
397 if (state->flags & SS_IOCARD) { 396 if (state->flags & SS_IOCARD) {
398 if (state->csc_mask & SS_STSCHG) 397 if (state->csc_mask & SS_STSCHG)
399 reg |= I365_CSC_STSCHG; 398 reg |= I365_CSC_STSCHG;
@@ -450,9 +449,12 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,
450 449
451 ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); 450 ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map);
452 451
453 if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map); 452 if (io->flags & MAP_0WS)
454 if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map); 453 ioctl |= I365_IOCTL_0WS(map);
455 if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map); 454 if (io->flags & MAP_16BIT)
455 ioctl |= I365_IOCTL_16BIT(map);
456 if (io->flags & MAP_AUTOSZ)
457 ioctl |= I365_IOCTL_IOCS16(map);
456 458
457 indirect_write(socket, I365_IOCTL, ioctl); 459 indirect_write(socket, I365_IOCTL, ioctl);
458 460
@@ -497,7 +499,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
497 499
498 /* write the stop address */ 500 /* write the stop address */
499 501
500 i= (mem->res->end >> 12) & 0x0fff; 502 i = (mem->res->end >> 12) & 0x0fff;
501 switch (to_cycles(mem->speed)) { 503 switch (to_cycles(mem->speed)) {
502 case 0: 504 case 0:
503 break; 505 break;
@@ -563,7 +565,7 @@ static int pd6729_init(struct pcmcia_socket *sock)
563 565
564/* the pccard structure and its functions */ 566/* the pccard structure and its functions */
565static struct pccard_operations pd6729_operations = { 567static struct pccard_operations pd6729_operations = {
566 .init = pd6729_init, 568 .init = pd6729_init,
567 .get_status = pd6729_get_status, 569 .get_status = pd6729_get_status,
568 .set_socket = pd6729_set_socket, 570 .set_socket = pd6729_set_socket,
569 .set_io_map = pd6729_set_io_map, 571 .set_io_map = pd6729_set_io_map,
@@ -578,8 +580,13 @@ static irqreturn_t pd6729_test(int irq, void *dev)
578 580
579static int pd6729_check_irq(int irq) 581static int pd6729_check_irq(int irq)
580{ 582{
581 if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test) 583 int ret;
582 != 0) return -1; 584
585 ret = request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x",
586 pd6729_test);
587 if (ret)
588 return -1;
589
583 free_irq(irq, pd6729_test); 590 free_irq(irq, pd6729_test);
584 return 0; 591 return 0;
585} 592}
@@ -591,7 +598,7 @@ static u_int __devinit pd6729_isa_scan(void)
591 598
592 if (irq_mode == 1) { 599 if (irq_mode == 1) {
593 printk(KERN_INFO "pd6729: PCI card interrupts, " 600 printk(KERN_INFO "pd6729: PCI card interrupts, "
594 "PCI status changes\n"); 601 "PCI status changes\n");
595 return 0; 602 return 0;
596 } 603 }
597 604
@@ -607,9 +614,10 @@ static u_int __devinit pd6729_isa_scan(void)
607 if (mask & (1<<i)) 614 if (mask & (1<<i))
608 printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i); 615 printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i);
609 616
610 if (mask == 0) printk("none!"); 617 if (mask == 0)
611 618 printk("none!");
612 printk(" polling status changes.\n"); 619 else
620 printk(" polling status changes.\n");
613 621
614 return mask; 622 return mask;
615} 623}
@@ -624,11 +632,16 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
624 632
625 socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, 633 socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
626 GFP_KERNEL); 634 GFP_KERNEL);
627 if (!socket) 635 if (!socket) {
636 dev_warn(&dev->dev, "failed to kzalloc socket.\n");
628 return -ENOMEM; 637 return -ENOMEM;
638 }
629 639
630 if ((ret = pci_enable_device(dev))) 640 ret = pci_enable_device(dev);
641 if (ret) {
642 dev_warn(&dev->dev, "failed to enable pci_device.\n");
631 goto err_out_free_mem; 643 goto err_out_free_mem;
644 }
632 645
633 if (!pci_resource_start(dev, 0)) { 646 if (!pci_resource_start(dev, 0)) {
634 dev_warn(&dev->dev, "refusing to load the driver as the " 647 dev_warn(&dev->dev, "refusing to load the driver as the "
@@ -639,7 +652,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
639 dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " 652 dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
640 "on irq %d\n", 653 "on irq %d\n",
641 (unsigned long long)pci_resource_start(dev, 0), dev->irq); 654 (unsigned long long)pci_resource_start(dev, 0), dev->irq);
642 /* 655 /*
643 * Since we have no memory BARs some firmware may not 656 * Since we have no memory BARs some firmware may not
644 * have had PCI_COMMAND_MEMORY enabled, yet the device needs it. 657 * have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
645 */ 658 */
@@ -685,8 +698,9 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
685 pci_set_drvdata(dev, socket); 698 pci_set_drvdata(dev, socket);
686 if (irq_mode == 1) { 699 if (irq_mode == 1) {
687 /* Register the interrupt handler */ 700 /* Register the interrupt handler */
688 if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, 701 ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
689 "pd6729", socket))) { 702 "pd6729", socket);
703 if (ret) {
690 dev_err(&dev->dev, "Failed to register irq %d\n", 704 dev_err(&dev->dev, "Failed to register irq %d\n",
691 dev->irq); 705 dev->irq);
692 goto err_out_free_res; 706 goto err_out_free_res;
@@ -750,18 +764,6 @@ static void __devexit pd6729_pci_remove(struct pci_dev *dev)
750 kfree(socket); 764 kfree(socket);
751} 765}
752 766
753#ifdef CONFIG_PM
754static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state)
755{
756 return pcmcia_socket_dev_suspend(&dev->dev);
757}
758
759static int pd6729_socket_resume(struct pci_dev *dev)
760{
761 return pcmcia_socket_dev_resume(&dev->dev);
762}
763#endif
764
765static struct pci_device_id pd6729_pci_ids[] = { 767static struct pci_device_id pd6729_pci_ids[] = {
766 { 768 {
767 .vendor = PCI_VENDOR_ID_CIRRUS, 769 .vendor = PCI_VENDOR_ID_CIRRUS,
@@ -778,10 +780,6 @@ static struct pci_driver pd6729_pci_driver = {
778 .id_table = pd6729_pci_ids, 780 .id_table = pd6729_pci_ids,
779 .probe = pd6729_pci_probe, 781 .probe = pd6729_pci_probe,
780 .remove = __devexit_p(pd6729_pci_remove), 782 .remove = __devexit_p(pd6729_pci_remove),
781#ifdef CONFIG_PM
782 .suspend = pd6729_socket_suspend,
783 .resume = pd6729_socket_resume,
784#endif
785}; 783};
786 784
787static int pd6729_module_init(void) 785static int pd6729_module_init(void)
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 76e640bccde8..0a876fabfe44 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -325,19 +325,13 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev)
325 return 0; 325 return 0;
326} 326}
327 327
328static int pxa2xx_drv_pcmcia_suspend(struct device *dev)
329{
330 return pcmcia_socket_dev_suspend(dev);
331}
332
333static int pxa2xx_drv_pcmcia_resume(struct device *dev) 328static int pxa2xx_drv_pcmcia_resume(struct device *dev)
334{ 329{
335 pxa2xx_configure_sockets(dev); 330 pxa2xx_configure_sockets(dev);
336 return pcmcia_socket_dev_resume(dev); 331 return 0;
337} 332}
338 333
339static const struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = { 334static const struct dev_pm_ops pxa2xx_drv_pcmcia_pm_ops = {
340 .suspend = pxa2xx_drv_pcmcia_suspend,
341 .resume = pxa2xx_drv_pcmcia_resume, 335 .resume = pxa2xx_drv_pcmcia_resume,
342}; 336};
343 337
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index b4968ca5bc9d..2e47991eccf6 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -810,6 +810,13 @@ static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long
810 unsigned long size = end - start + 1; 810 unsigned long size = end - start + 1;
811 int ret = 0; 811 int ret = 0;
812 812
813#if defined(CONFIG_X86)
814 /* on x86, avoid anything < 0x100 for it is often used for
815 * legacy platform devices */
816 if (start < 0x100)
817 start = 0x100;
818#endif
819
813 if (end < start) 820 if (end < start)
814 return -EINVAL; 821 return -EINVAL;
815 822
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index 8db86b90c200..518896241429 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -95,17 +95,6 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
95 return 0; 95 return 0;
96} 96}
97 97
98static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
99 pm_message_t state)
100{
101 return pcmcia_socket_dev_suspend(&dev->dev);
102}
103
104static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
105{
106 return pcmcia_socket_dev_resume(&dev->dev);
107}
108
109static struct platform_driver sa11x0_pcmcia_driver = { 98static struct platform_driver sa11x0_pcmcia_driver = {
110 .driver = { 99 .driver = {
111 .name = "sa11x0-pcmcia", 100 .name = "sa11x0-pcmcia",
@@ -113,8 +102,6 @@ static struct platform_driver sa11x0_pcmcia_driver = {
113 }, 102 },
114 .probe = sa11x0_drv_pcmcia_probe, 103 .probe = sa11x0_drv_pcmcia_probe,
115 .remove = sa11x0_drv_pcmcia_remove, 104 .remove = sa11x0_drv_pcmcia_remove,
116 .suspend = sa11x0_drv_pcmcia_suspend,
117 .resume = sa11x0_drv_pcmcia_resume,
118}; 105};
119 106
120/* sa11x0_pcmcia_init() 107/* sa11x0_pcmcia_init()
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index db79ca61cf96..799e9793e49e 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -213,16 +213,6 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
213 return 0; 213 return 0;
214} 214}
215 215
216static int pcmcia_suspend(struct sa1111_dev *dev, pm_message_t state)
217{
218 return pcmcia_socket_dev_suspend(&dev->dev);
219}
220
221static int pcmcia_resume(struct sa1111_dev *dev)
222{
223 return pcmcia_socket_dev_resume(&dev->dev);
224}
225
226static struct sa1111_driver pcmcia_driver = { 216static struct sa1111_driver pcmcia_driver = {
227 .drv = { 217 .drv = {
228 .name = "sa1111-pcmcia", 218 .name = "sa1111-pcmcia",
@@ -230,8 +220,6 @@ static struct sa1111_driver pcmcia_driver = {
230 .devid = SA1111_DEVID_PCMCIA, 220 .devid = SA1111_DEVID_PCMCIA,
231 .probe = pcmcia_probe, 221 .probe = pcmcia_probe,
232 .remove = __devexit_p(pcmcia_remove), 222 .remove = __devexit_p(pcmcia_remove),
233 .suspend = pcmcia_suspend,
234 .resume = pcmcia_resume,
235}; 223};
236 224
237static int __init sa1111_drv_pcmcia_init(void) 225static int __init sa1111_drv_pcmcia_init(void)
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 12c49ee135e1..bac85f3236bb 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -348,16 +348,6 @@ static int __init get_tcic_id(void)
348 return id; 348 return id;
349} 349}
350 350
351static int tcic_drv_pcmcia_suspend(struct platform_device *dev,
352 pm_message_t state)
353{
354 return pcmcia_socket_dev_suspend(&dev->dev);
355}
356
357static int tcic_drv_pcmcia_resume(struct platform_device *dev)
358{
359 return pcmcia_socket_dev_resume(&dev->dev);
360}
361/*====================================================================*/ 351/*====================================================================*/
362 352
363static struct platform_driver tcic_driver = { 353static struct platform_driver tcic_driver = {
@@ -365,8 +355,6 @@ static struct platform_driver tcic_driver = {
365 .name = "tcic-pcmcia", 355 .name = "tcic-pcmcia",
366 .owner = THIS_MODULE, 356 .owner = THIS_MODULE,
367 }, 357 },
368 .suspend = tcic_drv_pcmcia_suspend,
369 .resume = tcic_drv_pcmcia_resume,
370}; 358};
371 359
372static struct platform_device tcic_device = { 360static struct platform_device tcic_device = {
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index aaccdb9f4ba1..86e4a1a3c642 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -705,24 +705,11 @@ static int __devinit vrc4171_card_setup(char *options)
705 705
706__setup("vrc4171_card=", vrc4171_card_setup); 706__setup("vrc4171_card=", vrc4171_card_setup);
707 707
708static int vrc4171_card_suspend(struct platform_device *dev,
709 pm_message_t state)
710{
711 return pcmcia_socket_dev_suspend(&dev->dev);
712}
713
714static int vrc4171_card_resume(struct platform_device *dev)
715{
716 return pcmcia_socket_dev_resume(&dev->dev);
717}
718
719static struct platform_driver vrc4171_card_driver = { 708static struct platform_driver vrc4171_card_driver = {
720 .driver = { 709 .driver = {
721 .name = vrc4171_card_name, 710 .name = vrc4171_card_name,
722 .owner = THIS_MODULE, 711 .owner = THIS_MODULE,
723 }, 712 },
724 .suspend = vrc4171_card_suspend,
725 .resume = vrc4171_card_resume,
726}; 713};
727 714
728static int __devinit vrc4171_card_init(void) 715static int __devinit vrc4171_card_init(void)
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 418988ab6edf..f19ad02374d9 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1290,12 +1290,9 @@ static int yenta_dev_suspend_noirq(struct device *dev)
1290{ 1290{
1291 struct pci_dev *pdev = to_pci_dev(dev); 1291 struct pci_dev *pdev = to_pci_dev(dev);
1292 struct yenta_socket *socket = pci_get_drvdata(pdev); 1292 struct yenta_socket *socket = pci_get_drvdata(pdev);
1293 int ret;
1294
1295 ret = pcmcia_socket_dev_suspend(dev);
1296 1293
1297 if (!socket) 1294 if (!socket)
1298 return ret; 1295 return 0;
1299 1296
1300 if (socket->type && socket->type->save_state) 1297 if (socket->type && socket->type->save_state)
1301 socket->type->save_state(socket); 1298 socket->type->save_state(socket);
@@ -1312,7 +1309,7 @@ static int yenta_dev_suspend_noirq(struct device *dev)
1312 */ 1309 */
1313 /* pci_set_power_state(dev, 3); */ 1310 /* pci_set_power_state(dev, 3); */
1314 1311
1315 return ret; 1312 return 0;
1316} 1313}
1317 1314
1318static int yenta_dev_resume_noirq(struct device *dev) 1315static int yenta_dev_resume_noirq(struct device *dev)
@@ -1336,26 +1333,16 @@ static int yenta_dev_resume_noirq(struct device *dev)
1336 if (socket->type && socket->type->restore_state) 1333 if (socket->type && socket->type->restore_state)
1337 socket->type->restore_state(socket); 1334 socket->type->restore_state(socket);
1338 1335
1339 pcmcia_socket_dev_early_resume(dev);
1340 return 0;
1341}
1342
1343static int yenta_dev_resume(struct device *dev)
1344{
1345 pcmcia_socket_dev_late_resume(dev);
1346 return 0; 1336 return 0;
1347} 1337}
1348 1338
1349static const struct dev_pm_ops yenta_pm_ops = { 1339static const struct dev_pm_ops yenta_pm_ops = {
1350 .suspend_noirq = yenta_dev_suspend_noirq, 1340 .suspend_noirq = yenta_dev_suspend_noirq,
1351 .resume_noirq = yenta_dev_resume_noirq, 1341 .resume_noirq = yenta_dev_resume_noirq,
1352 .resume = yenta_dev_resume,
1353 .freeze_noirq = yenta_dev_suspend_noirq, 1342 .freeze_noirq = yenta_dev_suspend_noirq,
1354 .thaw_noirq = yenta_dev_resume_noirq, 1343 .thaw_noirq = yenta_dev_resume_noirq,
1355 .thaw = yenta_dev_resume,
1356 .poweroff_noirq = yenta_dev_suspend_noirq, 1344 .poweroff_noirq = yenta_dev_suspend_noirq,
1357 .restore_noirq = yenta_dev_resume_noirq, 1345 .restore_noirq = yenta_dev_resume_noirq,
1358 .restore = yenta_dev_resume,
1359}; 1346};
1360 1347
1361#define YENTA_PM_OPS (&yenta_pm_ops) 1348#define YENTA_PM_OPS (&yenta_pm_ops)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c7bbe30010f7..5af16c2bb540 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1038,6 +1038,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
1038 goto overflow_err; 1038 goto overflow_err;
1039 1039
1040 regulator->dev = dev; 1040 regulator->dev = dev;
1041 sysfs_attr_init(&regulator->dev_attr.attr);
1041 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL); 1042 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
1042 if (regulator->dev_attr.attr.name == NULL) 1043 if (regulator->dev_attr.attr.name == NULL)
1043 goto attr_name_err; 1044 goto attr_name_err;
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index f5532ed79272..b20b3e1d821a 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -45,7 +45,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val);
45 LP3971_BUCK2 -> 4 45 LP3971_BUCK2 -> 4
46 LP3971_BUCK3 -> 6 46 LP3971_BUCK3 -> 6
47*/ 47*/
48#define BUCK_VOL_CHANGE_SHIFT(x) (((1 << x) & ~0x01) << 1) 48#define BUCK_VOL_CHANGE_SHIFT(x) (((!!x) << 2) | (x & ~0x01))
49#define BUCK_VOL_CHANGE_FLAG_GO 0x01 49#define BUCK_VOL_CHANGE_FLAG_GO 0x01
50#define BUCK_VOL_CHANGE_FLAG_TARGET 0x02 50#define BUCK_VOL_CHANGE_FLAG_TARGET 0x02
51#define BUCK_VOL_CHANGE_FLAG_MASK 0x03 51#define BUCK_VOL_CHANGE_FLAG_MASK 0x03
@@ -187,7 +187,8 @@ static int lp3971_ldo_set_voltage(struct regulator_dev *dev,
187 return -EINVAL; 187 return -EINVAL;
188 188
189 return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo), 189 return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo),
190 LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo), val); 190 LDO_VOL_CONTR_MASK << LDO_VOL_CONTR_SHIFT(ldo),
191 val << LDO_VOL_CONTR_SHIFT(ldo));
191} 192}
192 193
193static struct regulator_ops lp3971_ldo_ops = { 194static struct regulator_ops lp3971_ldo_ops = {
@@ -439,6 +440,10 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
439 lp3971->num_regulators = pdata->num_regulators; 440 lp3971->num_regulators = pdata->num_regulators;
440 lp3971->rdev = kcalloc(pdata->num_regulators, 441 lp3971->rdev = kcalloc(pdata->num_regulators,
441 sizeof(struct regulator_dev *), GFP_KERNEL); 442 sizeof(struct regulator_dev *), GFP_KERNEL);
443 if (!lp3971->rdev) {
444 err = -ENOMEM;
445 goto err_nomem;
446 }
442 447
443 /* Instantiate the regulators */ 448 /* Instantiate the regulators */
444 for (i = 0; i < pdata->num_regulators; i++) { 449 for (i = 0; i < pdata->num_regulators; i++) {
@@ -461,6 +466,7 @@ error:
461 regulator_unregister(lp3971->rdev[i]); 466 regulator_unregister(lp3971->rdev[i]);
462 kfree(lp3971->rdev); 467 kfree(lp3971->rdev);
463 lp3971->rdev = NULL; 468 lp3971->rdev = NULL;
469err_nomem:
464 return err; 470 return err;
465} 471}
466 472
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index a49fc952c9a9..c0b09e15edb6 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -243,8 +243,8 @@ static int __devexit max1586_pmic_remove(struct i2c_client *client)
243 for (i = 0; i <= MAX1586_V6; i++) 243 for (i = 0; i <= MAX1586_V6; i++)
244 if (rdev[i]) 244 if (rdev[i])
245 regulator_unregister(rdev[i]); 245 regulator_unregister(rdev[i]);
246 kfree(rdev);
247 i2c_set_clientdata(client, NULL); 246 i2c_set_clientdata(client, NULL);
247 kfree(rdev);
248 248
249 return 0; 249 return 0;
250} 250}
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 3ebdf698c648..833aaedc7e64 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -356,6 +356,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
356 dev_info(info->dev, "Max8649 regulator device is detected.\n"); 356 dev_info(info->dev, "Max8649 regulator device is detected.\n");
357 return 0; 357 return 0;
358out: 358out:
359 i2c_set_clientdata(client, NULL);
359 kfree(info); 360 kfree(info);
360 return ret; 361 return ret;
361} 362}
@@ -367,9 +368,9 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
367 if (info) { 368 if (info) {
368 if (info->regulator) 369 if (info->regulator)
369 regulator_unregister(info->regulator); 370 regulator_unregister(info->regulator);
371 i2c_set_clientdata(client, NULL);
370 kfree(info); 372 kfree(info);
371 } 373 }
372 i2c_set_clientdata(client, NULL);
373 374
374 return 0; 375 return 0;
375} 376}
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index f12f1bb62138..47f90b2fc290 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -470,8 +470,8 @@ static int __devexit max8660_remove(struct i2c_client *client)
470 for (i = 0; i < MAX8660_V_END; i++) 470 for (i = 0; i < MAX8660_V_END; i++)
471 if (rdev[i]) 471 if (rdev[i])
472 regulator_unregister(rdev[i]); 472 regulator_unregister(rdev[i]);
473 kfree(rdev);
474 i2c_set_clientdata(client, NULL); 473 i2c_set_clientdata(client, NULL);
474 kfree(rdev);
475 475
476 return 0; 476 return 0;
477} 477}
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index 67873f08ed40..b6218f11c957 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -230,7 +230,7 @@ static struct max8925_regulator_info max8925_regulator_info[] = {
230 MAX8925_LDO(20, 750, 3900, 50), 230 MAX8925_LDO(20, 750, 3900, 50),
231}; 231};
232 232
233static inline struct max8925_regulator_info *find_regulator_info(int id) 233static struct max8925_regulator_info * __devinit find_regulator_info(int id)
234{ 234{
235 struct max8925_regulator_info *ri; 235 struct max8925_regulator_info *ri;
236 int i; 236 int i;
@@ -247,7 +247,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
247{ 247{
248 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); 248 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
249 struct max8925_platform_data *pdata = chip->dev->platform_data; 249 struct max8925_platform_data *pdata = chip->dev->platform_data;
250 struct max8925_regulator_info *ri = NULL; 250 struct max8925_regulator_info *ri;
251 struct regulator_dev *rdev; 251 struct regulator_dev *rdev;
252 252
253 ri = find_regulator_info(pdev->id); 253 ri = find_regulator_info(pdev->id);
@@ -274,7 +274,9 @@ static int __devexit max8925_regulator_remove(struct platform_device *pdev)
274{ 274{
275 struct regulator_dev *rdev = platform_get_drvdata(pdev); 275 struct regulator_dev *rdev = platform_get_drvdata(pdev);
276 276
277 platform_set_drvdata(pdev, NULL);
277 regulator_unregister(rdev); 278 regulator_unregister(rdev);
279
278 return 0; 280 return 0;
279} 281}
280 282
diff --git a/drivers/rtc/rtc-mc13783.c b/drivers/rtc/rtc-mc13783.c
index d60c81b7b693..1379c7faa448 100644
--- a/drivers/rtc/rtc-mc13783.c
+++ b/drivers/rtc/rtc-mc13783.c
@@ -319,35 +319,38 @@ static int __devinit mc13783_rtc_probe(struct platform_device *pdev)
319{ 319{
320 int ret; 320 int ret;
321 struct mc13783_rtc *priv; 321 struct mc13783_rtc *priv;
322 struct mc13783 *mc13783;
322 int rtcrst_pending; 323 int rtcrst_pending;
323 324
324 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 325 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
325 if (!priv) 326 if (!priv)
326 return -ENOMEM; 327 return -ENOMEM;
327 328
328 priv->mc13783 = dev_get_drvdata(pdev->dev.parent); 329 mc13783 = dev_get_drvdata(pdev->dev.parent);
330 priv->mc13783 = mc13783;
331
329 platform_set_drvdata(pdev, priv); 332 platform_set_drvdata(pdev, priv);
330 333
331 mc13783_lock(priv->mc13783); 334 mc13783_lock(mc13783);
332 335
333 ret = mc13783_irq_request(priv->mc13783, MC13783_IRQ_RTCRST, 336 ret = mc13783_irq_request(mc13783, MC13783_IRQ_RTCRST,
334 mc13783_rtc_reset_handler, DRIVER_NAME, priv); 337 mc13783_rtc_reset_handler, DRIVER_NAME, priv);
335 if (ret) 338 if (ret)
336 goto err_reset_irq_request; 339 goto err_reset_irq_request;
337 340
338 ret = mc13783_irq_status(priv->mc13783, MC13783_IRQ_RTCRST, 341 ret = mc13783_irq_status(mc13783, MC13783_IRQ_RTCRST,
339 NULL, &rtcrst_pending); 342 NULL, &rtcrst_pending);
340 if (ret) 343 if (ret)
341 goto err_reset_irq_status; 344 goto err_reset_irq_status;
342 345
343 priv->valid = !rtcrst_pending; 346 priv->valid = !rtcrst_pending;
344 347
345 ret = mc13783_irq_request_nounmask(priv->mc13783, MC13783_IRQ_1HZ, 348 ret = mc13783_irq_request_nounmask(mc13783, MC13783_IRQ_1HZ,
346 mc13783_rtc_update_handler, DRIVER_NAME, priv); 349 mc13783_rtc_update_handler, DRIVER_NAME, priv);
347 if (ret) 350 if (ret)
348 goto err_update_irq_request; 351 goto err_update_irq_request;
349 352
350 ret = mc13783_irq_request_nounmask(priv->mc13783, MC13783_IRQ_TODA, 353 ret = mc13783_irq_request_nounmask(mc13783, MC13783_IRQ_TODA,
351 mc13783_rtc_alarm_handler, DRIVER_NAME, priv); 354 mc13783_rtc_alarm_handler, DRIVER_NAME, priv);
352 if (ret) 355 if (ret)
353 goto err_alarm_irq_request; 356 goto err_alarm_irq_request;
@@ -357,22 +360,22 @@ static int __devinit mc13783_rtc_probe(struct platform_device *pdev)
357 if (IS_ERR(priv->rtc)) { 360 if (IS_ERR(priv->rtc)) {
358 ret = PTR_ERR(priv->rtc); 361 ret = PTR_ERR(priv->rtc);
359 362
360 mc13783_irq_free(priv->mc13783, MC13783_IRQ_TODA, priv); 363 mc13783_irq_free(mc13783, MC13783_IRQ_TODA, priv);
361err_alarm_irq_request: 364err_alarm_irq_request:
362 365
363 mc13783_irq_free(priv->mc13783, MC13783_IRQ_1HZ, priv); 366 mc13783_irq_free(mc13783, MC13783_IRQ_1HZ, priv);
364err_update_irq_request: 367err_update_irq_request:
365 368
366err_reset_irq_status: 369err_reset_irq_status:
367 370
368 mc13783_irq_free(priv->mc13783, MC13783_IRQ_RTCRST, priv); 371 mc13783_irq_free(mc13783, MC13783_IRQ_RTCRST, priv);
369err_reset_irq_request: 372err_reset_irq_request:
370 373
371 platform_set_drvdata(pdev, NULL); 374 platform_set_drvdata(pdev, NULL);
372 kfree(priv); 375 kfree(priv);
373 } 376 }
374 377
375 mc13783_unlock(priv->mc13783); 378 mc13783_unlock(mc13783);
376 379
377 return ret; 380 return ret;
378} 381}
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index 51224f76b980..b3736b8aad39 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -2287,7 +2287,8 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
2287 2287
2288 if (cqr->cpmode == 1) { 2288 if (cqr->cpmode == 1) {
2289 cplength = 0; 2289 cplength = 0;
2290 datasize = sizeof(struct tcw) + sizeof(struct tsb); 2290 /* TCW needs to be 64 byte aligned, so leave enough room */
2291 datasize = 64 + sizeof(struct tcw) + sizeof(struct tsb);
2291 } else { 2292 } else {
2292 cplength = 2; 2293 cplength = 2;
2293 datasize = 0; 2294 datasize = 0;
@@ -2316,8 +2317,8 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr)
2316 if (cqr->cpmode == 1) { 2317 if (cqr->cpmode == 1) {
2317 /* make a shallow copy of the original tcw but set new tsb */ 2318 /* make a shallow copy of the original tcw but set new tsb */
2318 erp->cpmode = 1; 2319 erp->cpmode = 1;
2319 erp->cpaddr = erp->data; 2320 erp->cpaddr = PTR_ALIGN(erp->data, 64);
2320 tcw = erp->data; 2321 tcw = erp->cpaddr;
2321 tsb = (struct tsb *) &tcw[1]; 2322 tsb = (struct tsb *) &tcw[1];
2322 *tcw = *((struct tcw *)cqr->cpaddr); 2323 *tcw = *((struct tcw *)cqr->cpaddr);
2323 tcw->tsb = (long)tsb; 2324 tcw->tsb = (long)tsb;
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 01f4e7a34aa8..0cb233116855 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -3155,11 +3155,11 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device,
3155 3155
3156 tsb = NULL; 3156 tsb = NULL;
3157 sense = NULL; 3157 sense = NULL;
3158 if (irb->scsw.tm.tcw) 3158 if (irb->scsw.tm.tcw && (irb->scsw.tm.fcxs == 0x01))
3159 tsb = tcw_get_tsb( 3159 tsb = tcw_get_tsb(
3160 (struct tcw *)(unsigned long)irb->scsw.tm.tcw); 3160 (struct tcw *)(unsigned long)irb->scsw.tm.tcw);
3161 3161
3162 if (tsb && (irb->scsw.tm.fcxs == 0x01)) { 3162 if (tsb) {
3163 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 3163 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
3164 " tsb->length %d\n", tsb->length); 3164 " tsb->length %d\n", tsb->length);
3165 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 3165 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index 740fe405c395..f449c696e503 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -84,6 +84,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
84 rc = copy_from_user(buf, buffer, sizeof(buf)); 84 rc = copy_from_user(buf, buffer, sizeof(buf));
85 if (rc != 0) 85 if (rc != 0)
86 return -EFAULT; 86 return -EFAULT;
87 buf[len - 1] = '\0';
87 if (strict_strtoul(buf, 0, &val) != 0) 88 if (strict_strtoul(buf, 0, &val) != 0)
88 return -EINVAL; 89 return -EINVAL;
89 if (val != 0 && val != 1) 90 if (val != 0 && val != 1)
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index fc7ae05ce48a..4b60ede07f0e 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -308,6 +308,13 @@ struct assign_storage_sccb {
308 u16 rn; 308 u16 rn;
309} __packed; 309} __packed;
310 310
311int arch_get_memory_phys_device(unsigned long start_pfn)
312{
313 if (!rzm)
314 return 0;
315 return PFN_PHYS(start_pfn) >> ilog2(rzm);
316}
317
311static unsigned long long rn2addr(u16 rn) 318static unsigned long long rn2addr(u16 rn)
312{ 319{
313 return (unsigned long long) (rn - 1) * rzm; 320 return (unsigned long long) (rn - 1) * rzm;
@@ -704,13 +711,6 @@ int sclp_chp_deconfigure(struct chp_id chpid)
704 return do_chp_configure(SCLP_CMDW_DECONFIGURE_CHPATH | chpid.id << 8); 711 return do_chp_configure(SCLP_CMDW_DECONFIGURE_CHPATH | chpid.id << 8);
705} 712}
706 713
707int arch_get_memory_phys_device(unsigned long start_pfn)
708{
709 if (!rzm)
710 return 0;
711 return PFN_PHYS(start_pfn) / rzm;
712}
713
714struct chp_info_sccb { 714struct chp_info_sccb {
715 struct sccb_header header; 715 struct sccb_header header;
716 u8 recognized[SCLP_CHP_INFO_MASK_SIZE]; 716 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 3438658b66b7..3166d85914f2 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -141,33 +141,6 @@ static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)
141 return memcpy_hsa(dest, src, count, TO_KERNEL); 141 return memcpy_hsa(dest, src, count, TO_KERNEL);
142} 142}
143 143
144static int memcpy_real(void *dest, unsigned long src, size_t count)
145{
146 unsigned long flags;
147 int rc = -EFAULT;
148 register unsigned long _dest asm("2") = (unsigned long) dest;
149 register unsigned long _len1 asm("3") = (unsigned long) count;
150 register unsigned long _src asm("4") = src;
151 register unsigned long _len2 asm("5") = (unsigned long) count;
152
153 if (count == 0)
154 return 0;
155 flags = __raw_local_irq_stnsm(0xf8UL); /* switch to real mode */
156 asm volatile (
157 "0: mvcle %1,%2,0x0\n"
158 "1: jo 0b\n"
159 " lhi %0,0x0\n"
160 "2:\n"
161 EX_TABLE(1b,2b)
162 : "+d" (rc), "+d" (_dest), "+d" (_src), "+d" (_len1),
163 "+d" (_len2), "=m" (*((long*)dest))
164 : "m" (*((long*)src))
165 : "cc", "memory");
166 __raw_local_irq_ssm(flags);
167
168 return rc;
169}
170
171static int memcpy_real_user(void __user *dest, unsigned long src, size_t count) 144static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
172{ 145{
173 static char buf[4096]; 146 static char buf[4096];
@@ -175,7 +148,7 @@ static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
175 148
176 while (offs < count) { 149 while (offs < count) {
177 size = min(sizeof(buf), count - offs); 150 size = min(sizeof(buf), count - offs);
178 if (memcpy_real(buf, src + offs, size)) 151 if (memcpy_real(buf, (void *) src + offs, size))
179 return -EFAULT; 152 return -EFAULT;
180 if (copy_to_user(dest + offs, buf, size)) 153 if (copy_to_user(dest + offs, buf, size))
181 return -EFAULT; 154 return -EFAULT;
@@ -663,7 +636,7 @@ static int __init zcore_reipl_init(void)
663 if (ipib_info.ipib < ZFCPDUMP_HSA_SIZE) 636 if (ipib_info.ipib < ZFCPDUMP_HSA_SIZE)
664 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); 637 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE);
665 else 638 else
666 rc = memcpy_real(ipl_block, ipib_info.ipib, PAGE_SIZE); 639 rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE);
667 if (rc) { 640 if (rc) {
668 free_page((unsigned long) ipl_block); 641 free_page((unsigned long) ipl_block);
669 return rc; 642 return rc;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index a9802e76b5fa..722eac18f382 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -61,7 +61,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
61 void __iomem *pram; 61 void __iomem *pram;
62 unsigned long offset; 62 unsigned long offset;
63 struct resource res; 63 struct resource res;
64 unsigned long len; 64 resource_size_t len;
65 65
66 /* Don't remap parameter RAM if it has already been initialized 66 /* Don't remap parameter RAM if it has already been initialized
67 * during console setup. 67 * during console setup.
@@ -74,7 +74,7 @@ void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
74 if (of_address_to_resource(np, 1, &res)) 74 if (of_address_to_resource(np, 1, &res))
75 return NULL; 75 return NULL;
76 76
77 len = 1 + res.end - res.start; 77 len = resource_size(&res);
78 pram = ioremap(res.start, len); 78 pram = ioremap(res.start, len);
79 if (!pram) 79 if (!pram)
80 return NULL; 80 return NULL;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 980f39449ee5..309de6be8204 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -50,7 +50,6 @@
50#include <linux/list.h> 50#include <linux/list.h>
51#include <linux/dmaengine.h> 51#include <linux/dmaengine.h>
52#include <linux/scatterlist.h> 52#include <linux/scatterlist.h>
53#include <linux/timer.h>
54 53
55#ifdef CONFIG_SUPERH 54#ifdef CONFIG_SUPERH
56#include <asm/sh_bios.h> 55#include <asm/sh_bios.h>
@@ -780,10 +779,6 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
780 if ((ssr_status & SCxSR_BRK(port)) && err_enabled) 779 if ((ssr_status & SCxSR_BRK(port)) && err_enabled)
781 ret = sci_br_interrupt(irq, ptr); 780 ret = sci_br_interrupt(irq, ptr);
782 781
783 WARN_ONCE(ret == IRQ_NONE,
784 "%s: %d IRQ %d, status %x, control %x\n", __func__,
785 irq, port->line, ssr_status, scr_status);
786
787 return ret; 782 return ret;
788} 783}
789 784
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index fad67d33b0bd..f70c49f915fa 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -31,7 +31,9 @@
31# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 31# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
32#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 32#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 33 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
34 defined(CONFIG_ARCH_SHMOBILE) 34 defined(CONFIG_ARCH_SH7367) || \
35 defined(CONFIG_ARCH_SH7377) || \
36 defined(CONFIG_ARCH_SH7372)
35# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ 37# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
36# define PORT_PTCR 0xA405011EUL 38# define PORT_PTCR 0xA405011EUL
37# define PORT_PVCR 0xA4050122UL 39# define PORT_PVCR 0xA4050122UL
@@ -94,7 +96,9 @@
94# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 96# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
95#elif defined(CONFIG_CPU_SUBTYPE_SH7724) 97#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
96# define SCIF_ORER 0x0001 /* overrun error bit */ 98# define SCIF_ORER 0x0001 /* overrun error bit */
97# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 99# define SCSCR_INIT(port) ((port)->type == PORT_SCIFA ? \
100 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
101 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ )
98#elif defined(CONFIG_CPU_SUBTYPE_SH4_202) 102#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
99# define SCSPTR2 0xffe80020 /* 16 bit SCIF */ 103# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
100# define SCIF_ORER 0x0001 /* overrun error bit */ 104# define SCIF_ORER 0x0001 /* overrun error bit */
@@ -197,6 +201,8 @@
197 defined(CONFIG_CPU_SUBTYPE_SH7786) || \ 201 defined(CONFIG_CPU_SUBTYPE_SH7786) || \
198 defined(CONFIG_CPU_SUBTYPE_SHX3) 202 defined(CONFIG_CPU_SUBTYPE_SHX3)
199#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */ 203#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
204#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
205#define SCI_CTRL_FLAGS_REIE ((port)->type == PORT_SCIFA ? 0 : 8)
200#else 206#else
201#define SCI_CTRL_FLAGS_REIE 0 207#define SCI_CTRL_FLAGS_REIE 0
202#endif 208#endif
@@ -230,7 +236,9 @@
230#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 236#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
231 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 237 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
232 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 238 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
233 defined(CONFIG_ARCH_SHMOBILE) 239 defined(CONFIG_ARCH_SH7367) || \
240 defined(CONFIG_ARCH_SH7377) || \
241 defined(CONFIG_ARCH_SH7372)
234# define SCIF_ORER 0x0200 242# define SCIF_ORER 0x0200
235# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) 243# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
236# define SCIF_RFDC_MASK 0x007f 244# define SCIF_RFDC_MASK 0x007f
@@ -264,7 +272,9 @@
264#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 272#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
265 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 273 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
266 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 274 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
267 defined(CONFIG_ARCH_SHMOBILE) 275 defined(CONFIG_ARCH_SH7367) || \
276 defined(CONFIG_ARCH_SH7377) || \
277 defined(CONFIG_ARCH_SH7372)
268# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc) 278# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
269# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73) 279# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
270# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf) 280# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
@@ -359,7 +369,10 @@
359 SCI_OUT(sci_size, sci_offset, value); \ 369 SCI_OUT(sci_size, sci_offset, value); \
360 } 370 }
361 371
362#if defined(CONFIG_CPU_SH3) || defined(CONFIG_ARCH_SHMOBILE) 372#if defined(CONFIG_CPU_SH3) || \
373 defined(CONFIG_ARCH_SH7367) || \
374 defined(CONFIG_ARCH_SH7377) || \
375 defined(CONFIG_ARCH_SH7372)
363#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 376#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
364#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \ 377#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
365 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \ 378 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
@@ -370,7 +383,9 @@
370#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 383#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
371 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 384 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
372 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 385 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
373 defined(CONFIG_ARCH_SHMOBILE) 386 defined(CONFIG_ARCH_SH7367) || \
387 defined(CONFIG_ARCH_SH7377) || \
388 defined(CONFIG_ARCH_SH7372)
374#define SCIF_FNS(name, scif_offset, scif_size) \ 389#define SCIF_FNS(name, scif_offset, scif_size) \
375 CPU_SCIF_FNS(name, scif_offset, scif_size) 390 CPU_SCIF_FNS(name, scif_offset, scif_size)
376#else 391#else
@@ -406,7 +421,9 @@
406#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 421#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
407 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 422 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
408 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 423 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
409 defined(CONFIG_ARCH_SHMOBILE) 424 defined(CONFIG_ARCH_SH7367) || \
425 defined(CONFIG_ARCH_SH7377) || \
426 defined(CONFIG_ARCH_SH7372)
410 427
411SCIF_FNS(SCSMR, 0x00, 16) 428SCIF_FNS(SCSMR, 0x00, 16)
412SCIF_FNS(SCBRR, 0x04, 8) 429SCIF_FNS(SCBRR, 0x04, 8)
@@ -589,7 +606,9 @@ static inline int sci_rxd_in(struct uart_port *port)
589#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 606#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
590 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 607 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
591 defined(CONFIG_CPU_SUBTYPE_SH7721) || \ 608 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
592 defined(CONFIG_ARCH_SHMOBILE) 609 defined(CONFIG_ARCH_SH7367) || \
610 defined(CONFIG_ARCH_SH7377) || \
611 defined(CONFIG_ARCH_SH7372)
593#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) 612#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
594#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\ 613#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
595 defined(CONFIG_CPU_SUBTYPE_SH7724) 614 defined(CONFIG_CPU_SUBTYPE_SH7724)
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c
index c2750391fd34..a3d8677af6a5 100644
--- a/drivers/sh/intc.c
+++ b/drivers/sh/intc.c
@@ -2,7 +2,7 @@
2 * Shared interrupt handling code for IPR and INTC2 types of IRQs. 2 * Shared interrupt handling code for IPR and INTC2 types of IRQs.
3 * 3 *
4 * Copyright (C) 2007, 2008 Magnus Damm 4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009 Paul Mundt 5 * Copyright (C) 2009, 2010 Paul Mundt
6 * 6 *
7 * Based on intc2.c and ipr.c 7 * Based on intc2.c and ipr.c
8 * 8 *
@@ -26,6 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/topology.h> 27#include <linux/topology.h>
28#include <linux/bitmap.h> 28#include <linux/bitmap.h>
29#include <linux/cpumask.h>
29 30
30#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ 31#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
31 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ 32 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -234,6 +235,10 @@ static inline void _intc_enable(unsigned int irq, unsigned long handle)
234 unsigned int cpu; 235 unsigned int cpu;
235 236
236 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) { 237 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
238#ifdef CONFIG_SMP
239 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
240 continue;
241#endif
237 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu); 242 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
238 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\ 243 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
239 [_INTC_FN(handle)], irq); 244 [_INTC_FN(handle)], irq);
@@ -253,6 +258,10 @@ static void intc_disable(unsigned int irq)
253 unsigned int cpu; 258 unsigned int cpu;
254 259
255 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) { 260 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
261#ifdef CONFIG_SMP
262 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
263 continue;
264#endif
256 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu); 265 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
257 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\ 266 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\
258 [_INTC_FN(handle)], irq); 267 [_INTC_FN(handle)], irq);
@@ -301,6 +310,23 @@ static int intc_set_wake(unsigned int irq, unsigned int on)
301 return 0; /* allow wakeup, but setup hardware in intc_suspend() */ 310 return 0; /* allow wakeup, but setup hardware in intc_suspend() */
302} 311}
303 312
313#ifdef CONFIG_SMP
314/*
315 * This is held with the irq desc lock held, so we don't require any
316 * additional locking here at the intc desc level. The affinity mask is
317 * later tested in the enable/disable paths.
318 */
319static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask)
320{
321 if (!cpumask_intersects(cpumask, cpu_online_mask))
322 return -1;
323
324 cpumask_copy(irq_to_desc(irq)->affinity, cpumask);
325
326 return 0;
327}
328#endif
329
304static void intc_mask_ack(unsigned int irq) 330static void intc_mask_ack(unsigned int irq)
305{ 331{
306 struct intc_desc_int *d = get_intc_desc(irq); 332 struct intc_desc_int *d = get_intc_desc(irq);
@@ -847,6 +873,9 @@ void __init register_intc_controller(struct intc_desc *desc)
847 d->chip.shutdown = intc_disable; 873 d->chip.shutdown = intc_disable;
848 d->chip.set_type = intc_set_sense; 874 d->chip.set_type = intc_set_sense;
849 d->chip.set_wake = intc_set_wake; 875 d->chip.set_wake = intc_set_wake;
876#ifdef CONFIG_SMP
877 d->chip.set_affinity = intc_set_affinity;
878#endif
850 879
851 if (hw->ack_regs) { 880 if (hw->ack_regs) {
852 for (i = 0; i < hw->nr_ack_regs; i++) 881 for (i = 0; i < hw->nr_ack_regs; i++)
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 975d556b4787..be6331e2c276 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1441,7 +1441,7 @@ static int acm_resume(struct usb_interface *intf)
1441 wb = acm->delayed_wb; 1441 wb = acm->delayed_wb;
1442 acm->delayed_wb = NULL; 1442 acm->delayed_wb = NULL;
1443 spin_unlock_irq(&acm->write_lock); 1443 spin_unlock_irq(&acm->write_lock);
1444 acm_start_wb(acm, acm->delayed_wb); 1444 acm_start_wb(acm, wb);
1445 } else { 1445 } else {
1446 spin_unlock_irq(&acm->write_lock); 1446 spin_unlock_irq(&acm->write_lock);
1447 } 1447 }
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 18aafcb08fc8..189141ca4e05 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -52,7 +52,8 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
52#define WDM_READ 4 52#define WDM_READ 4
53#define WDM_INT_STALL 5 53#define WDM_INT_STALL 5
54#define WDM_POLL_RUNNING 6 54#define WDM_POLL_RUNNING 6
55 55#define WDM_RESPONDING 7
56#define WDM_SUSPENDING 8
56 57
57#define WDM_MAX 16 58#define WDM_MAX 16
58 59
@@ -87,9 +88,7 @@ struct wdm_device {
87 int count; 88 int count;
88 dma_addr_t shandle; 89 dma_addr_t shandle;
89 dma_addr_t ihandle; 90 dma_addr_t ihandle;
90 struct mutex wlock; 91 struct mutex lock;
91 struct mutex rlock;
92 struct mutex plock;
93 wait_queue_head_t wait; 92 wait_queue_head_t wait;
94 struct work_struct rxwork; 93 struct work_struct rxwork;
95 int werr; 94 int werr;
@@ -117,21 +116,22 @@ static void wdm_in_callback(struct urb *urb)
117 int status = urb->status; 116 int status = urb->status;
118 117
119 spin_lock(&desc->iuspin); 118 spin_lock(&desc->iuspin);
119 clear_bit(WDM_RESPONDING, &desc->flags);
120 120
121 if (status) { 121 if (status) {
122 switch (status) { 122 switch (status) {
123 case -ENOENT: 123 case -ENOENT:
124 dev_dbg(&desc->intf->dev, 124 dev_dbg(&desc->intf->dev,
125 "nonzero urb status received: -ENOENT"); 125 "nonzero urb status received: -ENOENT");
126 break; 126 goto skip_error;
127 case -ECONNRESET: 127 case -ECONNRESET:
128 dev_dbg(&desc->intf->dev, 128 dev_dbg(&desc->intf->dev,
129 "nonzero urb status received: -ECONNRESET"); 129 "nonzero urb status received: -ECONNRESET");
130 break; 130 goto skip_error;
131 case -ESHUTDOWN: 131 case -ESHUTDOWN:
132 dev_dbg(&desc->intf->dev, 132 dev_dbg(&desc->intf->dev,
133 "nonzero urb status received: -ESHUTDOWN"); 133 "nonzero urb status received: -ESHUTDOWN");
134 break; 134 goto skip_error;
135 case -EPIPE: 135 case -EPIPE:
136 dev_err(&desc->intf->dev, 136 dev_err(&desc->intf->dev,
137 "nonzero urb status received: -EPIPE\n"); 137 "nonzero urb status received: -EPIPE\n");
@@ -147,6 +147,7 @@ static void wdm_in_callback(struct urb *urb)
147 desc->reslength = urb->actual_length; 147 desc->reslength = urb->actual_length;
148 memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); 148 memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength);
149 desc->length += desc->reslength; 149 desc->length += desc->reslength;
150skip_error:
150 wake_up(&desc->wait); 151 wake_up(&desc->wait);
151 152
152 set_bit(WDM_READ, &desc->flags); 153 set_bit(WDM_READ, &desc->flags);
@@ -229,13 +230,16 @@ static void wdm_int_callback(struct urb *urb)
229 desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 230 desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
230 spin_lock(&desc->iuspin); 231 spin_lock(&desc->iuspin);
231 clear_bit(WDM_READ, &desc->flags); 232 clear_bit(WDM_READ, &desc->flags);
232 if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { 233 set_bit(WDM_RESPONDING, &desc->flags);
234 if (!test_bit(WDM_DISCONNECTING, &desc->flags)
235 && !test_bit(WDM_SUSPENDING, &desc->flags)) {
233 rv = usb_submit_urb(desc->response, GFP_ATOMIC); 236 rv = usb_submit_urb(desc->response, GFP_ATOMIC);
234 dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", 237 dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d",
235 __func__, rv); 238 __func__, rv);
236 } 239 }
237 spin_unlock(&desc->iuspin); 240 spin_unlock(&desc->iuspin);
238 if (rv < 0) { 241 if (rv < 0) {
242 clear_bit(WDM_RESPONDING, &desc->flags);
239 if (rv == -EPERM) 243 if (rv == -EPERM)
240 return; 244 return;
241 if (rv == -ENOMEM) { 245 if (rv == -ENOMEM) {
@@ -305,14 +309,38 @@ static ssize_t wdm_write
305 if (we < 0) 309 if (we < 0)
306 return -EIO; 310 return -EIO;
307 311
308 r = mutex_lock_interruptible(&desc->wlock); /* concurrent writes */ 312 desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
313 if (!buf) {
314 rv = -ENOMEM;
315 goto outnl;
316 }
317
318 r = copy_from_user(buf, buffer, count);
319 if (r > 0) {
320 kfree(buf);
321 rv = -EFAULT;
322 goto outnl;
323 }
324
325 /* concurrent writes and disconnect */
326 r = mutex_lock_interruptible(&desc->lock);
309 rv = -ERESTARTSYS; 327 rv = -ERESTARTSYS;
310 if (r) 328 if (r) {
329 kfree(buf);
311 goto outnl; 330 goto outnl;
331 }
332
333 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
334 kfree(buf);
335 rv = -ENODEV;
336 goto outnp;
337 }
312 338
313 r = usb_autopm_get_interface(desc->intf); 339 r = usb_autopm_get_interface(desc->intf);
314 if (r < 0) 340 if (r < 0) {
341 kfree(buf);
315 goto outnp; 342 goto outnp;
343 }
316 344
317 if (!file->f_flags && O_NONBLOCK) 345 if (!file->f_flags && O_NONBLOCK)
318 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, 346 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE,
@@ -320,24 +348,8 @@ static ssize_t wdm_write
320 else 348 else
321 if (test_bit(WDM_IN_USE, &desc->flags)) 349 if (test_bit(WDM_IN_USE, &desc->flags))
322 r = -EAGAIN; 350 r = -EAGAIN;
323 if (r < 0) 351 if (r < 0) {
324 goto out;
325
326 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
327 rv = -ENODEV;
328 goto out;
329 }
330
331 desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
332 if (!buf) {
333 rv = -ENOMEM;
334 goto out;
335 }
336
337 r = copy_from_user(buf, buffer, count);
338 if (r > 0) {
339 kfree(buf); 352 kfree(buf);
340 rv = -EFAULT;
341 goto out; 353 goto out;
342 } 354 }
343 355
@@ -374,7 +386,7 @@ static ssize_t wdm_write
374out: 386out:
375 usb_autopm_put_interface(desc->intf); 387 usb_autopm_put_interface(desc->intf);
376outnp: 388outnp:
377 mutex_unlock(&desc->wlock); 389 mutex_unlock(&desc->lock);
378outnl: 390outnl:
379 return rv < 0 ? rv : count; 391 return rv < 0 ? rv : count;
380} 392}
@@ -387,7 +399,7 @@ static ssize_t wdm_read
387 struct wdm_device *desc = file->private_data; 399 struct wdm_device *desc = file->private_data;
388 400
389 401
390 rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ 402 rv = mutex_lock_interruptible(&desc->lock); /*concurrent reads */
391 if (rv < 0) 403 if (rv < 0)
392 return -ERESTARTSYS; 404 return -ERESTARTSYS;
393 405
@@ -424,11 +436,8 @@ retry:
424 spin_lock_irq(&desc->iuspin); 436 spin_lock_irq(&desc->iuspin);
425 437
426 if (desc->rerr) { /* read completed, error happened */ 438 if (desc->rerr) { /* read completed, error happened */
427 int t = desc->rerr;
428 desc->rerr = 0; 439 desc->rerr = 0;
429 spin_unlock_irq(&desc->iuspin); 440 spin_unlock_irq(&desc->iuspin);
430 dev_err(&desc->intf->dev,
431 "reading had resulted in %d\n", t);
432 rv = -EIO; 441 rv = -EIO;
433 goto err; 442 goto err;
434 } 443 }
@@ -465,9 +474,7 @@ retry:
465 rv = cntr; 474 rv = cntr;
466 475
467err: 476err:
468 mutex_unlock(&desc->rlock); 477 mutex_unlock(&desc->lock);
469 if (rv < 0 && rv != -EAGAIN)
470 dev_err(&desc->intf->dev, "wdm_read: exit error\n");
471 return rv; 478 return rv;
472} 479}
473 480
@@ -533,7 +540,7 @@ static int wdm_open(struct inode *inode, struct file *file)
533 } 540 }
534 intf->needs_remote_wakeup = 1; 541 intf->needs_remote_wakeup = 1;
535 542
536 mutex_lock(&desc->plock); 543 mutex_lock(&desc->lock);
537 if (!desc->count++) { 544 if (!desc->count++) {
538 rv = usb_submit_urb(desc->validity, GFP_KERNEL); 545 rv = usb_submit_urb(desc->validity, GFP_KERNEL);
539 if (rv < 0) { 546 if (rv < 0) {
@@ -544,7 +551,7 @@ static int wdm_open(struct inode *inode, struct file *file)
544 } else { 551 } else {
545 rv = 0; 552 rv = 0;
546 } 553 }
547 mutex_unlock(&desc->plock); 554 mutex_unlock(&desc->lock);
548 usb_autopm_put_interface(desc->intf); 555 usb_autopm_put_interface(desc->intf);
549out: 556out:
550 mutex_unlock(&wdm_mutex); 557 mutex_unlock(&wdm_mutex);
@@ -556,9 +563,9 @@ static int wdm_release(struct inode *inode, struct file *file)
556 struct wdm_device *desc = file->private_data; 563 struct wdm_device *desc = file->private_data;
557 564
558 mutex_lock(&wdm_mutex); 565 mutex_lock(&wdm_mutex);
559 mutex_lock(&desc->plock); 566 mutex_lock(&desc->lock);
560 desc->count--; 567 desc->count--;
561 mutex_unlock(&desc->plock); 568 mutex_unlock(&desc->lock);
562 569
563 if (!desc->count) { 570 if (!desc->count) {
564 dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); 571 dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
@@ -655,9 +662,7 @@ next_desc:
655 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); 662 desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
656 if (!desc) 663 if (!desc)
657 goto out; 664 goto out;
658 mutex_init(&desc->wlock); 665 mutex_init(&desc->lock);
659 mutex_init(&desc->rlock);
660 mutex_init(&desc->plock);
661 spin_lock_init(&desc->iuspin); 666 spin_lock_init(&desc->iuspin);
662 init_waitqueue_head(&desc->wait); 667 init_waitqueue_head(&desc->wait);
663 desc->wMaxCommand = maxcom; 668 desc->wMaxCommand = maxcom;
@@ -771,14 +776,17 @@ static void wdm_disconnect(struct usb_interface *intf)
771 /* to terminate pending flushes */ 776 /* to terminate pending flushes */
772 clear_bit(WDM_IN_USE, &desc->flags); 777 clear_bit(WDM_IN_USE, &desc->flags);
773 spin_unlock_irqrestore(&desc->iuspin, flags); 778 spin_unlock_irqrestore(&desc->iuspin, flags);
774 cancel_work_sync(&desc->rxwork); 779 mutex_lock(&desc->lock);
775 kill_urbs(desc); 780 kill_urbs(desc);
781 cancel_work_sync(&desc->rxwork);
782 mutex_unlock(&desc->lock);
776 wake_up_all(&desc->wait); 783 wake_up_all(&desc->wait);
777 if (!desc->count) 784 if (!desc->count)
778 cleanup(desc); 785 cleanup(desc);
779 mutex_unlock(&wdm_mutex); 786 mutex_unlock(&wdm_mutex);
780} 787}
781 788
789#ifdef CONFIG_PM
782static int wdm_suspend(struct usb_interface *intf, pm_message_t message) 790static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
783{ 791{
784 struct wdm_device *desc = usb_get_intfdata(intf); 792 struct wdm_device *desc = usb_get_intfdata(intf);
@@ -786,22 +794,30 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
786 794
787 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); 795 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
788 796
789 mutex_lock(&desc->plock); 797 /* if this is an autosuspend the caller does the locking */
790#ifdef CONFIG_PM 798 if (!(message.event & PM_EVENT_AUTO))
799 mutex_lock(&desc->lock);
800 spin_lock_irq(&desc->iuspin);
801
791 if ((message.event & PM_EVENT_AUTO) && 802 if ((message.event & PM_EVENT_AUTO) &&
792 test_bit(WDM_IN_USE, &desc->flags)) { 803 (test_bit(WDM_IN_USE, &desc->flags)
804 || test_bit(WDM_RESPONDING, &desc->flags))) {
805 spin_unlock_irq(&desc->iuspin);
793 rv = -EBUSY; 806 rv = -EBUSY;
794 } else { 807 } else {
795#endif 808
796 cancel_work_sync(&desc->rxwork); 809 set_bit(WDM_SUSPENDING, &desc->flags);
810 spin_unlock_irq(&desc->iuspin);
811 /* callback submits work - order is essential */
797 kill_urbs(desc); 812 kill_urbs(desc);
798#ifdef CONFIG_PM 813 cancel_work_sync(&desc->rxwork);
799 } 814 }
800#endif 815 if (!(message.event & PM_EVENT_AUTO))
801 mutex_unlock(&desc->plock); 816 mutex_unlock(&desc->lock);
802 817
803 return rv; 818 return rv;
804} 819}
820#endif
805 821
806static int recover_from_urb_loss(struct wdm_device *desc) 822static int recover_from_urb_loss(struct wdm_device *desc)
807{ 823{
@@ -815,23 +831,27 @@ static int recover_from_urb_loss(struct wdm_device *desc)
815 } 831 }
816 return rv; 832 return rv;
817} 833}
834
835#ifdef CONFIG_PM
818static int wdm_resume(struct usb_interface *intf) 836static int wdm_resume(struct usb_interface *intf)
819{ 837{
820 struct wdm_device *desc = usb_get_intfdata(intf); 838 struct wdm_device *desc = usb_get_intfdata(intf);
821 int rv; 839 int rv;
822 840
823 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); 841 dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor);
824 mutex_lock(&desc->plock); 842
843 clear_bit(WDM_SUSPENDING, &desc->flags);
825 rv = recover_from_urb_loss(desc); 844 rv = recover_from_urb_loss(desc);
826 mutex_unlock(&desc->plock); 845
827 return rv; 846 return rv;
828} 847}
848#endif
829 849
830static int wdm_pre_reset(struct usb_interface *intf) 850static int wdm_pre_reset(struct usb_interface *intf)
831{ 851{
832 struct wdm_device *desc = usb_get_intfdata(intf); 852 struct wdm_device *desc = usb_get_intfdata(intf);
833 853
834 mutex_lock(&desc->plock); 854 mutex_lock(&desc->lock);
835 return 0; 855 return 0;
836} 856}
837 857
@@ -841,7 +861,7 @@ static int wdm_post_reset(struct usb_interface *intf)
841 int rv; 861 int rv;
842 862
843 rv = recover_from_urb_loss(desc); 863 rv = recover_from_urb_loss(desc);
844 mutex_unlock(&desc->plock); 864 mutex_unlock(&desc->lock);
845 return 0; 865 return 0;
846} 866}
847 867
@@ -849,9 +869,11 @@ static struct usb_driver wdm_driver = {
849 .name = "cdc_wdm", 869 .name = "cdc_wdm",
850 .probe = wdm_probe, 870 .probe = wdm_probe,
851 .disconnect = wdm_disconnect, 871 .disconnect = wdm_disconnect,
872#ifdef CONFIG_PM
852 .suspend = wdm_suspend, 873 .suspend = wdm_suspend,
853 .resume = wdm_resume, 874 .resume = wdm_resume,
854 .reset_resume = wdm_resume, 875 .reset_resume = wdm_resume,
876#endif
855 .pre_reset = wdm_pre_reset, 877 .pre_reset = wdm_pre_reset,
856 .post_reset = wdm_post_reset, 878 .post_reset = wdm_post_reset,
857 .id_table = wdm_ids, 879 .id_table = wdm_ids,
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e909ff7b9094..3466fdc5bb11 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1207,6 +1207,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1207 free_async(as); 1207 free_async(as);
1208 return -ENOMEM; 1208 return -ENOMEM;
1209 } 1209 }
1210 /* Isochronous input data may end up being discontiguous
1211 * if some of the packets are short. Clear the buffer so
1212 * that the gaps don't leak kernel data to userspace.
1213 */
1214 if (is_in && uurb->type == USBDEVFS_URB_TYPE_ISO)
1215 memset(as->urb->transfer_buffer, 0,
1216 uurb->buffer_length);
1210 } 1217 }
1211 as->urb->dev = ps->dev; 1218 as->urb->dev = ps->dev;
1212 as->urb->pipe = (uurb->type << 30) | 1219 as->urb->pipe = (uurb->type << 30) |
@@ -1345,10 +1352,14 @@ static int processcompl(struct async *as, void __user * __user *arg)
1345 void __user *addr = as->userurb; 1352 void __user *addr = as->userurb;
1346 unsigned int i; 1353 unsigned int i;
1347 1354
1348 if (as->userbuffer && urb->actual_length) 1355 if (as->userbuffer && urb->actual_length) {
1349 if (copy_to_user(as->userbuffer, urb->transfer_buffer, 1356 if (urb->number_of_packets > 0) /* Isochronous */
1350 urb->actual_length)) 1357 i = urb->transfer_buffer_length;
1358 else /* Non-Isoc */
1359 i = urb->actual_length;
1360 if (copy_to_user(as->userbuffer, urb->transfer_buffer, i))
1351 goto err_out; 1361 goto err_out;
1362 }
1352 if (put_user(as->status, &userurb->status)) 1363 if (put_user(as->status, &userurb->status))
1353 goto err_out; 1364 goto err_out;
1354 if (put_user(urb->actual_length, &userurb->actual_length)) 1365 if (put_user(urb->actual_length, &userurb->actual_length))
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 27080561a1c2..45a32dadb406 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -453,6 +453,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
453 if (urb->interval > (1 << 15)) 453 if (urb->interval > (1 << 15))
454 return -EINVAL; 454 return -EINVAL;
455 max = 1 << 15; 455 max = 1 << 15;
456 break;
456 case USB_SPEED_WIRELESS: 457 case USB_SPEED_WIRELESS:
457 if (urb->interval > 16) 458 if (urb->interval > 16)
458 return -EINVAL; 459 return -EINVAL;
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 7460cd797f45..11a3e0fa4331 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -747,7 +747,7 @@ config USB_MASS_STORAGE
747 which may be used with composite framework. 747 which may be used with composite framework.
748 748
749 Say "y" to link the driver statically, or "m" to build 749 Say "y" to link the driver statically, or "m" to build
750 a dynamically linked module called "g_file_storage". If unsure, 750 a dynamically linked module called "g_mass_storage". If unsure,
751 consider File-backed Storage Gadget. 751 consider File-backed Storage Gadget.
752 752
753config USB_G_SERIAL 753config USB_G_SERIAL
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 65a5f94cbc04..3568de210f79 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -266,7 +266,7 @@ struct usb_ep * __init usb_ep_autoconfig (
266 } 266 }
267 267
268#ifdef CONFIG_BLACKFIN 268#ifdef CONFIG_BLACKFIN
269 } else if (gadget_is_musbhsfc(gadget) || gadget_is_musbhdrc(gadget)) { 269 } else if (gadget_is_musbhdrc(gadget)) {
270 if ((USB_ENDPOINT_XFER_BULK == type) || 270 if ((USB_ENDPOINT_XFER_BULK == type) ||
271 (USB_ENDPOINT_XFER_ISOC == type)) { 271 (USB_ENDPOINT_XFER_ISOC == type)) {
272 if (USB_DIR_IN & desc->bEndpointAddress) 272 if (USB_DIR_IN & desc->bEndpointAddress)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 5a3cdd08f1d0..f4911c09022e 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2910,7 +2910,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
2910} 2910}
2911 2911
2912 2912
2913static int fsg_bind(struct usb_configuration *c, struct usb_function *f) 2913static int __init fsg_bind(struct usb_configuration *c, struct usb_function *f)
2914{ 2914{
2915 struct fsg_dev *fsg = fsg_from_func(f); 2915 struct fsg_dev *fsg = fsg_from_func(f);
2916 struct usb_gadget *gadget = c->cdev->gadget; 2916 struct usb_gadget *gadget = c->cdev->gadget;
@@ -2954,7 +2954,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
2954autoconf_fail: 2954autoconf_fail:
2955 ERROR(fsg, "unable to autoconfigure all endpoints\n"); 2955 ERROR(fsg, "unable to autoconfigure all endpoints\n");
2956 rc = -ENOTSUPP; 2956 rc = -ENOTSUPP;
2957 fsg_unbind(c, f);
2958 return rc; 2957 return rc;
2959} 2958}
2960 2959
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
index 1edbc12fff18..e511fec9f26d 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -136,6 +136,12 @@
136#define gadget_is_r8a66597(g) 0 136#define gadget_is_r8a66597(g) 0
137#endif 137#endif
138 138
139#ifdef CONFIG_USB_S3C_HSOTG
140#define gadget_is_s3c_hsotg(g) (!strcmp("s3c-hsotg", (g)->name))
141#else
142#define gadget_is_s3c_hsotg(g) 0
143#endif
144
139 145
140/** 146/**
141 * usb_gadget_controller_number - support bcdDevice id convention 147 * usb_gadget_controller_number - support bcdDevice id convention
@@ -192,6 +198,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
192 return 0x24; 198 return 0x24;
193 else if (gadget_is_r8a66597(gadget)) 199 else if (gadget_is_r8a66597(gadget))
194 return 0x25; 200 return 0x25;
201 else if (gadget_is_s3c_hsotg(gadget))
202 return 0x26;
195 return -ENOENT; 203 return -ENOENT;
196} 204}
197 205
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index e8edc640381e..1088d08c7ed8 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1768,7 +1768,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1768 * usb_gadget_driver_{register,unregister}() must change. 1768 * usb_gadget_driver_{register,unregister}() must change.
1769 */ 1769 */
1770 if (the_controller) { 1770 if (the_controller) {
1771 WARNING(dev, "ignoring %s\n", pci_name(pdev)); 1771 pr_warning("ignoring %s\n", pci_name(pdev));
1772 return -EBUSY; 1772 return -EBUSY;
1773 } 1773 }
1774 if (!pdev->irq) { 1774 if (!pdev->irq) {
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 76496f5d272c..a930d7fd7e7a 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -211,8 +211,6 @@ static int __init cdc_do_config(struct usb_configuration *c)
211 ret = fsg_add(c->cdev, c, fsg_common); 211 ret = fsg_add(c->cdev, c, fsg_common);
212 if (ret < 0) 212 if (ret < 0)
213 return ret; 213 return ret;
214 if (ret < 0)
215 return ret;
216 214
217 return 0; 215 return 0;
218} 216}
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 8b45145b9136..5e13d23b5f0c 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -23,6 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/err.h>
26#include <linux/io.h> 27#include <linux/io.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28#include <linux/clk.h> 29#include <linux/clk.h>
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 4e0c67f1f51b..b6315aa47f7a 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -12,7 +12,7 @@ fhci-objs := fhci-hcd.o fhci-hub.o fhci-q.o fhci-mem.o \
12ifeq ($(CONFIG_FHCI_DEBUG),y) 12ifeq ($(CONFIG_FHCI_DEBUG),y)
13fhci-objs += fhci-dbg.o 13fhci-objs += fhci-dbg.o
14endif 14endif
15xhci-objs := xhci-hcd.o xhci-mem.o xhci-pci.o xhci-ring.o xhci-hub.o xhci-dbg.o 15xhci-hcd-objs := xhci.o xhci-mem.o xhci-pci.o xhci-ring.o xhci-hub.o xhci-dbg.o
16 16
17obj-$(CONFIG_USB_WHCI_HCD) += whci/ 17obj-$(CONFIG_USB_WHCI_HCD) += whci/
18 18
@@ -25,7 +25,7 @@ obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o
25obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o 25obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
26obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o 26obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
27obj-$(CONFIG_USB_FHCI_HCD) += fhci.o 27obj-$(CONFIG_USB_FHCI_HCD) += fhci.o
28obj-$(CONFIG_USB_XHCI_HCD) += xhci.o 28obj-$(CONFIG_USB_XHCI_HCD) += xhci-hcd.o
29obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o 29obj-$(CONFIG_USB_SL811_HCD) += sl811-hcd.o
30obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o 30obj-$(CONFIG_USB_SL811_CS) += sl811_cs.o
31obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o 31obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d8d6d3461d32..dc55a62859c6 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -995,7 +995,7 @@ rescan:
995 /* endpoints can be iso streams. for now, we don't 995 /* endpoints can be iso streams. for now, we don't
996 * accelerate iso completions ... so spin a while. 996 * accelerate iso completions ... so spin a while.
997 */ 997 */
998 if (qh->hw->hw_info1 == 0) { 998 if (qh->hw == NULL) {
999 ehci_vdbg (ehci, "iso delay\n"); 999 ehci_vdbg (ehci, "iso delay\n");
1000 goto idle_timeout; 1000 goto idle_timeout;
1001 } 1001 }
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 39340ae00ac4..a0aaaaff2560 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1123,8 +1123,8 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb)
1123 urb->interval); 1123 urb->interval);
1124 } 1124 }
1125 1125
1126 /* if dev->ep [epnum] is a QH, info1.maxpacket is nonzero */ 1126 /* if dev->ep [epnum] is a QH, hw is set */
1127 } else if (unlikely (stream->hw_info1 != 0)) { 1127 } else if (unlikely (stream->hw != NULL)) {
1128 ehci_dbg (ehci, "dev %s ep%d%s, not iso??\n", 1128 ehci_dbg (ehci, "dev %s ep%d%s, not iso??\n",
1129 urb->dev->devpath, epnum, 1129 urb->dev->devpath, epnum,
1130 usb_pipein(urb->pipe) ? "in" : "out"); 1130 usb_pipein(urb->pipe) ? "in" : "out");
@@ -1565,13 +1565,27 @@ itd_patch(
1565static inline void 1565static inline void
1566itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd) 1566itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd)
1567{ 1567{
1568 /* always prepend ITD/SITD ... only QH tree is order-sensitive */ 1568 union ehci_shadow *prev = &ehci->pshadow[frame];
1569 itd->itd_next = ehci->pshadow [frame]; 1569 __hc32 *hw_p = &ehci->periodic[frame];
1570 itd->hw_next = ehci->periodic [frame]; 1570 union ehci_shadow here = *prev;
1571 ehci->pshadow [frame].itd = itd; 1571 __hc32 type = 0;
1572
1573 /* skip any iso nodes which might belong to previous microframes */
1574 while (here.ptr) {
1575 type = Q_NEXT_TYPE(ehci, *hw_p);
1576 if (type == cpu_to_hc32(ehci, Q_TYPE_QH))
1577 break;
1578 prev = periodic_next_shadow(ehci, prev, type);
1579 hw_p = shadow_next_periodic(ehci, &here, type);
1580 here = *prev;
1581 }
1582
1583 itd->itd_next = here;
1584 itd->hw_next = *hw_p;
1585 prev->itd = itd;
1572 itd->frame = frame; 1586 itd->frame = frame;
1573 wmb (); 1587 wmb ();
1574 ehci->periodic[frame] = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); 1588 *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD);
1575} 1589}
1576 1590
1577/* fit urb's itds into the selected schedule slot; activate as needed */ 1591/* fit urb's itds into the selected schedule slot; activate as needed */
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 2d85e21ff282..b1dce96dd621 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -394,9 +394,8 @@ struct ehci_iso_sched {
394 * acts like a qh would, if EHCI had them for ISO. 394 * acts like a qh would, if EHCI had them for ISO.
395 */ 395 */
396struct ehci_iso_stream { 396struct ehci_iso_stream {
397 /* first two fields match QH, but info1 == 0 */ 397 /* first field matches ehci_hq, but is NULL */
398 __hc32 hw_next; 398 struct ehci_qh_hw *hw;
399 __hc32 hw_info1;
400 399
401 u32 refcount; 400 u32 refcount;
402 u8 bEndpointAddress; 401 u8 bEndpointAddress;
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index bee558aed427..f71a73a93d0c 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -418,7 +418,7 @@ static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb)
418 418
419/* this function must be called with interrupt disabled */ 419/* this function must be called with interrupt disabled */
420static void free_usb_address(struct r8a66597 *r8a66597, 420static void free_usb_address(struct r8a66597 *r8a66597,
421 struct r8a66597_device *dev) 421 struct r8a66597_device *dev, int reset)
422{ 422{
423 int port; 423 int port;
424 424
@@ -430,7 +430,13 @@ static void free_usb_address(struct r8a66597 *r8a66597,
430 dev->state = USB_STATE_DEFAULT; 430 dev->state = USB_STATE_DEFAULT;
431 r8a66597->address_map &= ~(1 << dev->address); 431 r8a66597->address_map &= ~(1 << dev->address);
432 dev->address = 0; 432 dev->address = 0;
433 dev_set_drvdata(&dev->udev->dev, NULL); 433 /*
434 * Only when resetting USB, it is necessary to erase drvdata. When
435 * a usb device with usb hub is disconnect, "dev->udev" is already
436 * freed on usb_desconnect(). So we cannot access the data.
437 */
438 if (reset)
439 dev_set_drvdata(&dev->udev->dev, NULL);
434 list_del(&dev->device_list); 440 list_del(&dev->device_list);
435 kfree(dev); 441 kfree(dev);
436 442
@@ -1069,7 +1075,7 @@ static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port)
1069 struct r8a66597_device *dev = r8a66597->root_hub[port].dev; 1075 struct r8a66597_device *dev = r8a66597->root_hub[port].dev;
1070 1076
1071 disable_r8a66597_pipe_all(r8a66597, dev); 1077 disable_r8a66597_pipe_all(r8a66597, dev);
1072 free_usb_address(r8a66597, dev); 1078 free_usb_address(r8a66597, dev, 0);
1073 1079
1074 start_root_hub_sampling(r8a66597, port, 0); 1080 start_root_hub_sampling(r8a66597, port, 0);
1075} 1081}
@@ -2085,7 +2091,7 @@ static void update_usb_address_map(struct r8a66597 *r8a66597,
2085 spin_lock_irqsave(&r8a66597->lock, flags); 2091 spin_lock_irqsave(&r8a66597->lock, flags);
2086 dev = get_r8a66597_device(r8a66597, addr); 2092 dev = get_r8a66597_device(r8a66597, addr);
2087 disable_r8a66597_pipe_all(r8a66597, dev); 2093 disable_r8a66597_pipe_all(r8a66597, dev);
2088 free_usb_address(r8a66597, dev); 2094 free_usb_address(r8a66597, dev, 0);
2089 put_child_connect_map(r8a66597, addr); 2095 put_child_connect_map(r8a66597, addr);
2090 spin_unlock_irqrestore(&r8a66597->lock, flags); 2096 spin_unlock_irqrestore(&r8a66597->lock, flags);
2091 } 2097 }
@@ -2228,7 +2234,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
2228 rh->port |= (1 << USB_PORT_FEAT_RESET); 2234 rh->port |= (1 << USB_PORT_FEAT_RESET);
2229 2235
2230 disable_r8a66597_pipe_all(r8a66597, dev); 2236 disable_r8a66597_pipe_all(r8a66597, dev);
2231 free_usb_address(r8a66597, dev); 2237 free_usb_address(r8a66597, dev, 1);
2232 2238
2233 r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, 2239 r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT,
2234 get_dvstctr_reg(port)); 2240 get_dvstctr_reg(port));
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 49f7d72f8b1b..bba9b19ed1b9 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -566,8 +566,13 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
566 if (interval < 3) 566 if (interval < 3)
567 interval = 3; 567 interval = 3;
568 if ((1 << interval) != 8*ep->desc.bInterval) 568 if ((1 << interval) != 8*ep->desc.bInterval)
569 dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n", 569 dev_warn(&udev->dev,
570 ep->desc.bEndpointAddress, 1 << interval); 570 "ep %#x - rounding interval"
571 " to %d microframes, "
572 "ep desc says %d microframes\n",
573 ep->desc.bEndpointAddress,
574 1 << interval,
575 8*ep->desc.bInterval);
571 } 576 }
572 break; 577 break;
573 default: 578 default:
diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci.c
index 4cb69e0af834..492a61c2c79d 100644
--- a/drivers/usb/host/xhci-hcd.c
+++ b/drivers/usb/host/xhci.c
@@ -1173,6 +1173,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
1173 cmd_completion = &virt_dev->cmd_completion; 1173 cmd_completion = &virt_dev->cmd_completion;
1174 cmd_status = &virt_dev->cmd_status; 1174 cmd_status = &virt_dev->cmd_status;
1175 } 1175 }
1176 init_completion(cmd_completion);
1176 1177
1177 if (!ctx_change) 1178 if (!ctx_change)
1178 ret = xhci_queue_configure_endpoint(xhci, in_ctx->dma, 1179 ret = xhci_queue_configure_endpoint(xhci, in_ctx->dma,
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b4bbf8f2c238..0e8b8ab1d168 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -379,7 +379,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
379 u8 devctl, u8 power) 379 u8 devctl, u8 power)
380{ 380{
381 irqreturn_t handled = IRQ_NONE; 381 irqreturn_t handled = IRQ_NONE;
382 void __iomem *mbase = musb->mregs;
383 382
384 DBG(3, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, 383 DBG(3, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl,
385 int_usb); 384 int_usb);
@@ -394,6 +393,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
394 393
395 if (devctl & MUSB_DEVCTL_HM) { 394 if (devctl & MUSB_DEVCTL_HM) {
396#ifdef CONFIG_USB_MUSB_HDRC_HCD 395#ifdef CONFIG_USB_MUSB_HDRC_HCD
396 void __iomem *mbase = musb->mregs;
397
397 switch (musb->xceiv->state) { 398 switch (musb->xceiv->state) {
398 case OTG_STATE_A_SUSPEND: 399 case OTG_STATE_A_SUSPEND:
399 /* remote wakeup? later, GetPortStatus 400 /* remote wakeup? later, GetPortStatus
@@ -471,6 +472,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
471#ifdef CONFIG_USB_MUSB_HDRC_HCD 472#ifdef CONFIG_USB_MUSB_HDRC_HCD
472 /* see manual for the order of the tests */ 473 /* see manual for the order of the tests */
473 if (int_usb & MUSB_INTR_SESSREQ) { 474 if (int_usb & MUSB_INTR_SESSREQ) {
475 void __iomem *mbase = musb->mregs;
476
474 DBG(1, "SESSION_REQUEST (%s)\n", otg_state_string(musb)); 477 DBG(1, "SESSION_REQUEST (%s)\n", otg_state_string(musb));
475 478
476 /* IRQ arrives from ID pin sense or (later, if VBUS power 479 /* IRQ arrives from ID pin sense or (later, if VBUS power
@@ -519,6 +522,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
519 case OTG_STATE_A_WAIT_BCON: 522 case OTG_STATE_A_WAIT_BCON:
520 case OTG_STATE_A_WAIT_VRISE: 523 case OTG_STATE_A_WAIT_VRISE:
521 if (musb->vbuserr_retry) { 524 if (musb->vbuserr_retry) {
525 void __iomem *mbase = musb->mregs;
526
522 musb->vbuserr_retry--; 527 musb->vbuserr_retry--;
523 ignore = 1; 528 ignore = 1;
524 devctl |= MUSB_DEVCTL_SESSION; 529 devctl |= MUSB_DEVCTL_SESSION;
@@ -622,6 +627,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
622 627
623 if (int_usb & MUSB_INTR_CONNECT) { 628 if (int_usb & MUSB_INTR_CONNECT) {
624 struct usb_hcd *hcd = musb_to_hcd(musb); 629 struct usb_hcd *hcd = musb_to_hcd(musb);
630 void __iomem *mbase = musb->mregs;
625 631
626 handled = IRQ_HANDLED; 632 handled = IRQ_HANDLED;
627 musb->is_active = 1; 633 musb->is_active = 1;
@@ -2007,7 +2013,6 @@ bad_config:
2007 /* host side needs more setup */ 2013 /* host side needs more setup */
2008 if (is_host_enabled(musb)) { 2014 if (is_host_enabled(musb)) {
2009 struct usb_hcd *hcd = musb_to_hcd(musb); 2015 struct usb_hcd *hcd = musb_to_hcd(musb);
2010 u8 busctl;
2011 2016
2012 otg_set_host(musb->xceiv, &hcd->self); 2017 otg_set_host(musb->xceiv, &hcd->self);
2013 2018
@@ -2018,9 +2023,9 @@ bad_config:
2018 2023
2019 /* program PHY to use external vBus if required */ 2024 /* program PHY to use external vBus if required */
2020 if (plat->extvbus) { 2025 if (plat->extvbus) {
2021 busctl = musb_readb(musb->mregs, MUSB_ULPI_BUSCONTROL); 2026 u8 busctl = musb_read_ulpi_buscontrol(musb->mregs);
2022 busctl |= MUSB_ULPI_USE_EXTVBUS; 2027 busctl |= MUSB_ULPI_USE_EXTVBUS;
2023 musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, busctl); 2028 musb_write_ulpi_buscontrol(musb->mregs, busctl);
2024 } 2029 }
2025 } 2030 }
2026 2031
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index d849fb81c131..cd9f4a9a06c6 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -469,7 +469,7 @@ struct musb_csr_regs {
469 469
470struct musb_context_registers { 470struct musb_context_registers {
471 471
472#if defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP2430) 472#ifdef CONFIG_PM
473 u32 otg_sysconfig, otg_forcestandby; 473 u32 otg_sysconfig, otg_forcestandby;
474#endif 474#endif
475 u8 power; 475 u8 power;
@@ -483,7 +483,7 @@ struct musb_context_registers {
483 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; 483 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
484}; 484};
485 485
486#if defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP2430) 486#ifdef CONFIG_PM
487extern void musb_platform_save_context(struct musb *musb, 487extern void musb_platform_save_context(struct musb *musb,
488 struct musb_context_registers *musb_context); 488 struct musb_context_registers *musb_context);
489extern void musb_platform_restore_context(struct musb *musb, 489extern void musb_platform_restore_context(struct musb *musb,
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 3421cf9858b5..dec896e888db 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1689,7 +1689,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
1689 dma->desired_mode = 1; 1689 dma->desired_mode = 1;
1690 if (rx_count < hw_ep->max_packet_sz_rx) { 1690 if (rx_count < hw_ep->max_packet_sz_rx) {
1691 length = rx_count; 1691 length = rx_count;
1692 dma->bDesiredMode = 0; 1692 dma->desired_mode = 0;
1693 } else { 1693 } else {
1694 length = urb->transfer_buffer_length; 1694 length = urb->transfer_buffer_length;
1695 } 1695 }
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index 8d8062b10e2f..fa55aacc385d 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -326,6 +326,11 @@ static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off)
326 musb_writew(mbase, MUSB_RXFIFOADD, c_off); 326 musb_writew(mbase, MUSB_RXFIFOADD, c_off);
327} 327}
328 328
329static inline void musb_write_ulpi_buscontrol(void __iomem *mbase, u8 val)
330{
331 musb_writeb(mbase, MUSB_ULPI_BUSCONTROL, val);
332}
333
329static inline u8 musb_read_txfifosz(void __iomem *mbase) 334static inline u8 musb_read_txfifosz(void __iomem *mbase)
330{ 335{
331 return musb_readb(mbase, MUSB_TXFIFOSZ); 336 return musb_readb(mbase, MUSB_TXFIFOSZ);
@@ -346,6 +351,11 @@ static inline u16 musb_read_rxfifoadd(void __iomem *mbase)
346 return musb_readw(mbase, MUSB_RXFIFOADD); 351 return musb_readw(mbase, MUSB_RXFIFOADD);
347} 352}
348 353
354static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase)
355{
356 return musb_readb(mbase, MUSB_ULPI_BUSCONTROL);
357}
358
349static inline u8 musb_read_configdata(void __iomem *mbase) 359static inline u8 musb_read_configdata(void __iomem *mbase)
350{ 360{
351 musb_writeb(mbase, MUSB_INDEX, 0); 361 musb_writeb(mbase, MUSB_INDEX, 0);
@@ -510,20 +520,33 @@ static inline void musb_write_rxfifoadd(void __iomem *mbase, u16 c_off)
510{ 520{
511} 521}
512 522
523static inline void musb_write_ulpi_buscontrol(void __iomem *mbase, u8 val)
524{
525}
526
513static inline u8 musb_read_txfifosz(void __iomem *mbase) 527static inline u8 musb_read_txfifosz(void __iomem *mbase)
514{ 528{
529 return 0;
515} 530}
516 531
517static inline u16 musb_read_txfifoadd(void __iomem *mbase) 532static inline u16 musb_read_txfifoadd(void __iomem *mbase)
518{ 533{
534 return 0;
519} 535}
520 536
521static inline u8 musb_read_rxfifosz(void __iomem *mbase) 537static inline u8 musb_read_rxfifosz(void __iomem *mbase)
522{ 538{
539 return 0;
523} 540}
524 541
525static inline u16 musb_read_rxfifoadd(void __iomem *mbase) 542static inline u16 musb_read_rxfifoadd(void __iomem *mbase)
526{ 543{
544 return 0;
545}
546
547static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase)
548{
549 return 0;
527} 550}
528 551
529static inline u8 musb_read_configdata(void __iomem *mbase) 552static inline u8 musb_read_configdata(void __iomem *mbase)
@@ -577,22 +600,27 @@ static inline void musb_write_txhubport(void __iomem *mbase, u8 epnum,
577 600
578static inline u8 musb_read_rxfunaddr(void __iomem *mbase, u8 epnum) 601static inline u8 musb_read_rxfunaddr(void __iomem *mbase, u8 epnum)
579{ 602{
603 return 0;
580} 604}
581 605
582static inline u8 musb_read_rxhubaddr(void __iomem *mbase, u8 epnum) 606static inline u8 musb_read_rxhubaddr(void __iomem *mbase, u8 epnum)
583{ 607{
608 return 0;
584} 609}
585 610
586static inline u8 musb_read_rxhubport(void __iomem *mbase, u8 epnum) 611static inline u8 musb_read_rxhubport(void __iomem *mbase, u8 epnum)
587{ 612{
613 return 0;
588} 614}
589 615
590static inline u8 musb_read_txfunaddr(void __iomem *mbase, u8 epnum) 616static inline u8 musb_read_txfunaddr(void __iomem *mbase, u8 epnum)
591{ 617{
618 return 0;
592} 619}
593 620
594static inline u8 musb_read_txhubaddr(void __iomem *mbase, u8 epnum) 621static inline u8 musb_read_txhubaddr(void __iomem *mbase, u8 epnum)
595{ 622{
623 return 0;
596} 624}
597 625
598static inline void musb_read_txhubport(void __iomem *mbase, u8 epnum) 626static inline void musb_read_txhubport(void __iomem *mbase, u8 epnum)
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index c78b255e3f83..a0ecb42cb33a 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -474,14 +474,14 @@ config USB_SERIAL_OTI6858
474 474
475config USB_SERIAL_QCAUX 475config USB_SERIAL_QCAUX
476 tristate "USB Qualcomm Auxiliary Serial Port Driver" 476 tristate "USB Qualcomm Auxiliary Serial Port Driver"
477 ---help--- 477 help
478 Say Y here if you want to use the auxiliary serial ports provided 478 Say Y here if you want to use the auxiliary serial ports provided
479 by many modems based on Qualcomm chipsets. These ports often use 479 by many modems based on Qualcomm chipsets. These ports often use
480 a proprietary protocol called DM and cannot be used for AT- or 480 a proprietary protocol called DM and cannot be used for AT- or
481 PPP-based communication. 481 PPP-based communication.
482 482
483 To compile this driver as a module, choose M here: the 483 To compile this driver as a module, choose M here: the
484 module will be called moto_modem. If unsure, choose N. 484 module will be called qcaux. If unsure, choose N.
485 485
486config USB_SERIAL_QUALCOMM 486config USB_SERIAL_QUALCOMM
487 tristate "USB Qualcomm Serial modem" 487 tristate "USB Qualcomm Serial modem"
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index b22ac3258523..f347da2ef00a 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -181,6 +181,7 @@ static int usb_console_setup(struct console *co, char *options)
181 /* The console is special in terms of closing the device so 181 /* The console is special in terms of closing the device so
182 * indicate this port is now acting as a system console. */ 182 * indicate this port is now acting as a system console. */
183 port->console = 1; 183 port->console = 1;
184 port->port.console = 1;
184 185
185 mutex_unlock(&serial->disc_mutex); 186 mutex_unlock(&serial->disc_mutex);
186 return retval; 187 return retval;
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 507382b0a9ed..ec9b0449ccf6 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -313,11 +313,6 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
313 return -EPROTO; 313 return -EPROTO;
314 } 314 }
315 315
316 /* Single data value */
317 result = usb_control_msg(serial->dev,
318 usb_sndctrlpipe(serial->dev, 0),
319 request, REQTYPE_HOST_TO_DEVICE, data[0],
320 0, NULL, 0, 300);
321 return 0; 316 return 0;
322} 317}
323 318
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 6af0dfa5f5ac..1d7c4fac02e8 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -91,7 +91,7 @@ struct ftdi_private {
91 unsigned long tx_outstanding_bytes; 91 unsigned long tx_outstanding_bytes;
92 unsigned long tx_outstanding_urbs; 92 unsigned long tx_outstanding_urbs;
93 unsigned short max_packet_size; 93 unsigned short max_packet_size;
94 struct mutex cfg_lock; /* Avoid mess by parallel calls of config ioctl() */ 94 struct mutex cfg_lock; /* Avoid mess by parallel calls of config ioctl() and change_speed() */
95}; 95};
96 96
97/* struct ftdi_sio_quirk is used by devices requiring special attention. */ 97/* struct ftdi_sio_quirk is used by devices requiring special attention. */
@@ -658,6 +658,7 @@ static struct usb_device_id id_table_combined [] = {
658 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 658 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
659 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, 659 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
660 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, 660 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
661 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
661 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 662 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
662 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 663 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
663 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 664 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
@@ -1272,8 +1273,8 @@ check_and_exit:
1272 (priv->flags & ASYNC_SPD_MASK)) || 1273 (priv->flags & ASYNC_SPD_MASK)) ||
1273 (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && 1274 (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
1274 (old_priv.custom_divisor != priv->custom_divisor))) { 1275 (old_priv.custom_divisor != priv->custom_divisor))) {
1275 mutex_unlock(&priv->cfg_lock);
1276 change_speed(tty, port); 1276 change_speed(tty, port);
1277 mutex_unlock(&priv->cfg_lock);
1277 } 1278 }
1278 else 1279 else
1279 mutex_unlock(&priv->cfg_lock); 1280 mutex_unlock(&priv->cfg_lock);
@@ -2264,9 +2265,11 @@ static void ftdi_set_termios(struct tty_struct *tty,
2264 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 2265 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2265 } else { 2266 } else {
2266 /* set the baudrate determined before */ 2267 /* set the baudrate determined before */
2268 mutex_lock(&priv->cfg_lock);
2267 if (change_speed(tty, port)) 2269 if (change_speed(tty, port))
2268 dev_err(&port->dev, "%s urb failed to set baudrate\n", 2270 dev_err(&port->dev, "%s urb failed to set baudrate\n",
2269 __func__); 2271 __func__);
2272 mutex_unlock(&priv->cfg_lock);
2270 /* Ensure RTS and DTR are raised when baudrate changed from 0 */ 2273 /* Ensure RTS and DTR are raised when baudrate changed from 0 */
2271 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) 2274 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0)
2272 set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 2275 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 0727e198503e..75482cbc3998 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -501,6 +501,13 @@
501#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ 501#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */
502 502
503/* 503/*
504 * Contec products (http://www.contec.com)
505 * Submitted by Daniel Sangorrin
506 */
507#define CONTEC_VID 0x06CE /* Vendor ID */
508#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */
509
510/*
504 * Definitions for B&B Electronics products. 511 * Definitions for B&B Electronics products.
505 */ 512 */
506#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ 513#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 89fac36684c5..f804acb138ec 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -130,7 +130,7 @@ int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port
130 spin_unlock_irqrestore(&port->lock, flags); 130 spin_unlock_irqrestore(&port->lock, flags);
131 131
132 /* if we have a bulk endpoint, start reading from it */ 132 /* if we have a bulk endpoint, start reading from it */
133 if (serial->num_bulk_in) { 133 if (port->bulk_in_size) {
134 /* Start reading from the device */ 134 /* Start reading from the device */
135 usb_fill_bulk_urb(port->read_urb, serial->dev, 135 usb_fill_bulk_urb(port->read_urb, serial->dev,
136 usb_rcvbulkpipe(serial->dev, 136 usb_rcvbulkpipe(serial->dev,
@@ -159,10 +159,10 @@ static void generic_cleanup(struct usb_serial_port *port)
159 dbg("%s - port %d", __func__, port->number); 159 dbg("%s - port %d", __func__, port->number);
160 160
161 if (serial->dev) { 161 if (serial->dev) {
162 /* shutdown any bulk reads that might be going on */ 162 /* shutdown any bulk transfers that might be going on */
163 if (serial->num_bulk_out) 163 if (port->bulk_out_size)
164 usb_kill_urb(port->write_urb); 164 usb_kill_urb(port->write_urb);
165 if (serial->num_bulk_in) 165 if (port->bulk_in_size)
166 usb_kill_urb(port->read_urb); 166 usb_kill_urb(port->read_urb);
167 } 167 }
168} 168}
@@ -333,15 +333,15 @@ int usb_serial_generic_write(struct tty_struct *tty,
333 333
334 dbg("%s - port %d", __func__, port->number); 334 dbg("%s - port %d", __func__, port->number);
335 335
336 /* only do something if we have a bulk out endpoint */
337 if (!port->bulk_out_size)
338 return -ENODEV;
339
336 if (count == 0) { 340 if (count == 0) {
337 dbg("%s - write request of 0 bytes", __func__); 341 dbg("%s - write request of 0 bytes", __func__);
338 return 0; 342 return 0;
339 } 343 }
340 344
341 /* only do something if we have a bulk out endpoint */
342 if (!serial->num_bulk_out)
343 return 0;
344
345 if (serial->type->max_in_flight_urbs) 345 if (serial->type->max_in_flight_urbs)
346 return usb_serial_multi_urb_write(tty, port, 346 return usb_serial_multi_urb_write(tty, port,
347 buf, count); 347 buf, count);
@@ -364,14 +364,19 @@ int usb_serial_generic_write_room(struct tty_struct *tty)
364 int room = 0; 364 int room = 0;
365 365
366 dbg("%s - port %d", __func__, port->number); 366 dbg("%s - port %d", __func__, port->number);
367
368 if (!port->bulk_out_size)
369 return 0;
370
367 spin_lock_irqsave(&port->lock, flags); 371 spin_lock_irqsave(&port->lock, flags);
368 if (serial->type->max_in_flight_urbs) { 372 if (serial->type->max_in_flight_urbs) {
369 if (port->urbs_in_flight < serial->type->max_in_flight_urbs) 373 if (port->urbs_in_flight < serial->type->max_in_flight_urbs)
370 room = port->bulk_out_size * 374 room = port->bulk_out_size *
371 (serial->type->max_in_flight_urbs - 375 (serial->type->max_in_flight_urbs -
372 port->urbs_in_flight); 376 port->urbs_in_flight);
373 } else if (serial->num_bulk_out) 377 } else {
374 room = kfifo_avail(&port->write_fifo); 378 room = kfifo_avail(&port->write_fifo);
379 }
375 spin_unlock_irqrestore(&port->lock, flags); 380 spin_unlock_irqrestore(&port->lock, flags);
376 381
377 dbg("%s - returns %d", __func__, room); 382 dbg("%s - returns %d", __func__, room);
@@ -382,15 +387,18 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
382{ 387{
383 struct usb_serial_port *port = tty->driver_data; 388 struct usb_serial_port *port = tty->driver_data;
384 struct usb_serial *serial = port->serial; 389 struct usb_serial *serial = port->serial;
385 int chars = 0;
386 unsigned long flags; 390 unsigned long flags;
391 int chars;
387 392
388 dbg("%s - port %d", __func__, port->number); 393 dbg("%s - port %d", __func__, port->number);
389 394
395 if (!port->bulk_out_size)
396 return 0;
397
390 spin_lock_irqsave(&port->lock, flags); 398 spin_lock_irqsave(&port->lock, flags);
391 if (serial->type->max_in_flight_urbs) 399 if (serial->type->max_in_flight_urbs)
392 chars = port->tx_bytes_flight; 400 chars = port->tx_bytes_flight;
393 else if (serial->num_bulk_out) 401 else
394 chars = kfifo_len(&port->write_fifo); 402 chars = kfifo_len(&port->write_fifo);
395 spin_unlock_irqrestore(&port->lock, flags); 403 spin_unlock_irqrestore(&port->lock, flags);
396 404
@@ -415,11 +423,13 @@ void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port,
415 ((serial->type->read_bulk_callback) ? 423 ((serial->type->read_bulk_callback) ?
416 serial->type->read_bulk_callback : 424 serial->type->read_bulk_callback :
417 usb_serial_generic_read_bulk_callback), port); 425 usb_serial_generic_read_bulk_callback), port);
426
418 result = usb_submit_urb(urb, mem_flags); 427 result = usb_submit_urb(urb, mem_flags);
419 if (result) 428 if (result && result != -EPERM) {
420 dev_err(&port->dev, 429 dev_err(&port->dev,
421 "%s - failed resubmitting read urb, error %d\n", 430 "%s - failed resubmitting read urb, error %d\n",
422 __func__, result); 431 __func__, result);
432 }
423} 433}
424EXPORT_SYMBOL_GPL(usb_serial_generic_resubmit_read_urb); 434EXPORT_SYMBOL_GPL(usb_serial_generic_resubmit_read_urb);
425 435
@@ -498,23 +508,18 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
498 if (port->urbs_in_flight < 0) 508 if (port->urbs_in_flight < 0)
499 port->urbs_in_flight = 0; 509 port->urbs_in_flight = 0;
500 spin_unlock_irqrestore(&port->lock, flags); 510 spin_unlock_irqrestore(&port->lock, flags);
501
502 if (status) {
503 dbg("%s - nonzero multi-urb write bulk status "
504 "received: %d", __func__, status);
505 return;
506 }
507 } else { 511 } else {
508 port->write_urb_busy = 0; 512 port->write_urb_busy = 0;
509 513
510 if (status) { 514 if (status)
511 dbg("%s - nonzero multi-urb write bulk status "
512 "received: %d", __func__, status);
513 kfifo_reset_out(&port->write_fifo); 515 kfifo_reset_out(&port->write_fifo);
514 } else 516 else
515 usb_serial_generic_write_start(port); 517 usb_serial_generic_write_start(port);
516 } 518 }
517 519
520 if (status)
521 dbg("%s - non-zero urb status: %d", __func__, status);
522
518 usb_serial_port_softint(port); 523 usb_serial_port_softint(port);
519} 524}
520EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); 525EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 847b805d63a3..950cb311ca94 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -288,7 +288,9 @@ static int option_resume(struct usb_serial *serial);
288 288
289#define QUALCOMM_VENDOR_ID 0x05C6 289#define QUALCOMM_VENDOR_ID 0x05C6
290 290
291#define MAXON_VENDOR_ID 0x16d8 291#define CMOTECH_VENDOR_ID 0x16d8
292#define CMOTECH_PRODUCT_6008 0x6008
293#define CMOTECH_PRODUCT_6280 0x6280
292 294
293#define TELIT_VENDOR_ID 0x1bc7 295#define TELIT_VENDOR_ID 0x1bc7
294#define TELIT_PRODUCT_UC864E 0x1003 296#define TELIT_PRODUCT_UC864E 0x1003
@@ -309,6 +311,7 @@ static int option_resume(struct usb_serial *serial);
309#define DLINK_VENDOR_ID 0x1186 311#define DLINK_VENDOR_ID 0x1186
310#define DLINK_PRODUCT_DWM_652 0x3e04 312#define DLINK_PRODUCT_DWM_652 0x3e04
311#define DLINK_PRODUCT_DWM_652_U5 0xce16 313#define DLINK_PRODUCT_DWM_652_U5 0xce16
314#define DLINK_PRODUCT_DWM_652_U5A 0xce1e
312 315
313#define QISDA_VENDOR_ID 0x1da5 316#define QISDA_VENDOR_ID 0x1da5
314#define QISDA_PRODUCT_H21_4512 0x4512 317#define QISDA_PRODUCT_H21_4512 0x4512
@@ -332,6 +335,24 @@ static int option_resume(struct usb_serial *serial);
332#define ALCATEL_VENDOR_ID 0x1bbb 335#define ALCATEL_VENDOR_ID 0x1bbb
333#define ALCATEL_PRODUCT_X060S 0x0000 336#define ALCATEL_PRODUCT_X060S 0x0000
334 337
338#define PIRELLI_VENDOR_ID 0x1266
339#define PIRELLI_PRODUCT_C100_1 0x1002
340#define PIRELLI_PRODUCT_C100_2 0x1003
341#define PIRELLI_PRODUCT_1004 0x1004
342#define PIRELLI_PRODUCT_1005 0x1005
343#define PIRELLI_PRODUCT_1006 0x1006
344#define PIRELLI_PRODUCT_1007 0x1007
345#define PIRELLI_PRODUCT_1008 0x1008
346#define PIRELLI_PRODUCT_1009 0x1009
347#define PIRELLI_PRODUCT_100A 0x100a
348#define PIRELLI_PRODUCT_100B 0x100b
349#define PIRELLI_PRODUCT_100C 0x100c
350#define PIRELLI_PRODUCT_100D 0x100d
351#define PIRELLI_PRODUCT_100E 0x100e
352#define PIRELLI_PRODUCT_100F 0x100f
353#define PIRELLI_PRODUCT_1011 0x1011
354#define PIRELLI_PRODUCT_1012 0x1012
355
335/* Airplus products */ 356/* Airplus products */
336#define AIRPLUS_VENDOR_ID 0x1011 357#define AIRPLUS_VENDOR_ID 0x1011
337#define AIRPLUS_PRODUCT_MCD650 0x3198 358#define AIRPLUS_PRODUCT_MCD650 0x3198
@@ -547,7 +568,8 @@ static const struct usb_device_id option_ids[] = {
547 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, 568 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
548 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ 569 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */
549 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 570 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
550 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ 571 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
572 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) },
551 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, 573 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
552 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, 574 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) },
553 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 575 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
@@ -659,6 +681,7 @@ static const struct usb_device_id option_ids[] = {
659 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, 681 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
660 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, 682 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
661 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ 683 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
684 { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5A) },
662 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, 685 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) },
663 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, 686 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
664 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, 687 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
@@ -666,7 +689,6 @@ static const struct usb_device_id option_ids[] = {
666 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, 689 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
667 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ 690 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
668 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, 691 { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
669 { USB_DEVICE(ALINK_VENDOR_ID, 0xce16) },
670 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, 692 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
671 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, 693 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
672 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 694 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
@@ -675,6 +697,24 @@ static const struct usb_device_id option_ids[] = {
675 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist 697 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
676 }, 698 },
677 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, 699 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
700 /* Pirelli */
701 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)},
702 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2)},
703 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1004)},
704 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1005)},
705 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1006)},
706 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1007)},
707 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1008)},
708 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1009)},
709 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100A)},
710 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100B) },
711 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100C) },
712 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100D) },
713 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100E) },
714 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) },
715 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)},
716 { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)},
717
678 { } /* Terminating entry */ 718 { } /* Terminating entry */
679}; 719};
680MODULE_DEVICE_TABLE(usb, option_ids); 720MODULE_DEVICE_TABLE(usb, option_ids);
@@ -798,12 +838,19 @@ static int option_probe(struct usb_serial *serial,
798 const struct usb_device_id *id) 838 const struct usb_device_id *id)
799{ 839{
800 struct option_intf_private *data; 840 struct option_intf_private *data;
841
801 /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ 842 /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */
802 if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && 843 if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID &&
803 serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && 844 serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 &&
804 serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8) 845 serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8)
805 return -ENODEV; 846 return -ENODEV;
806 847
848 /* Bandrich modem and AT command interface is 0xff */
849 if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID ||
850 serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) &&
851 serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
852 return -ENODEV;
853
807 data = serial->private = kzalloc(sizeof(struct option_intf_private), GFP_KERNEL); 854 data = serial->private = kzalloc(sizeof(struct option_intf_private), GFP_KERNEL);
808 if (!data) 855 if (!data)
809 return -ENOMEM; 856 return -ENOMEM;
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 310ff6ec6567..53a2d5a935a2 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -47,6 +47,35 @@ static const struct usb_device_id id_table[] = {
47 {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ 47 {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */
48 {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ 48 {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */
49 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ 49 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */
50 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */
51 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
52 {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */
53 {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
54 {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */
55 {USB_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
56 {USB_DEVICE(0x03f0, 0x241d)}, /* HP Gobi 2000 QDL device (VP412) */
57 {USB_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
58 {USB_DEVICE(0x05c6, 0x9214)}, /* Acer Gobi 2000 QDL device (VP413) */
59 {USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
60 {USB_DEVICE(0x05c6, 0x9264)}, /* Asus Gobi 2000 QDL device (VR305) */
61 {USB_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
62 {USB_DEVICE(0x05c6, 0x9234)}, /* Top Global Gobi 2000 QDL device (VR306) */
63 {USB_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
64 {USB_DEVICE(0x05c6, 0x9274)}, /* iRex Technologies Gobi 2000 QDL device (VR307) */
65 {USB_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
66 {USB_DEVICE(0x1199, 0x9000)}, /* Sierra Wireless Gobi 2000 QDL device (VT773) */
67 {USB_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
68 {USB_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
69 {USB_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
70 {USB_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
71 {USB_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
72 {USB_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
73 {USB_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
74 {USB_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
75 {USB_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
76 {USB_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
77 {USB_DEVICE(0x16d8, 0x8001)}, /* CMDTech Gobi 2000 QDL device (VU922) */
78 {USB_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
50 { } /* Terminating entry */ 79 { } /* Terminating entry */
51}; 80};
52MODULE_DEVICE_TABLE(usb, id_table); 81MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 98b549b1cab2..ccf1dbbb87ef 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -374,6 +374,15 @@ UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x0074,
374 US_SC_DEVICE, US_PR_DEVICE, NULL, 374 US_SC_DEVICE, US_PR_DEVICE, NULL,
375 US_FL_FIX_INQUIRY), 375 US_FL_FIX_INQUIRY),
376 376
377/* Reported by Ondrej Zary <linux@rainbow-software.org>
378 * The device reports one sector more and breaks when that sector is accessed
379 */
380UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c,
381 "ScanLogic",
382 "SL11R-IDE",
383 US_SC_DEVICE, US_PR_DEVICE, NULL,
384 US_FL_FIX_CAPACITY),
385
377/* Reported by Kriston Fincher <kriston@airmail.net> 386/* Reported by Kriston Fincher <kriston@airmail.net>
378 * Patch submitted by Sean Millichamp <sean@bruenor.org> 387 * Patch submitted by Sean Millichamp <sean@bruenor.org>
379 * This is to support the Panasonic PalmCam PV-SD4090 388 * This is to support the Panasonic PalmCam PV-SD4090
@@ -1380,20 +1389,6 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100,
1380 US_SC_DEVICE, US_PR_DEVICE, NULL, 1389 US_SC_DEVICE, US_PR_DEVICE, NULL,
1381 US_FL_IGNORE_RESIDUE ), 1390 US_FL_IGNORE_RESIDUE ),
1382 1391
1383/* Jeremy Katz <katzj@redhat.com>:
1384 * The Blackberry Pearl can run in two modes; a usb-storage only mode
1385 * and a mode that allows access via mass storage and to its database.
1386 * The berry_charge module will set the device to dual mode and thus we
1387 * should ignore its native mode if that module is built
1388 */
1389#ifdef CONFIG_USB_BERRY_CHARGE
1390UNUSUAL_DEV( 0x0fca, 0x0006, 0x0001, 0x0001,
1391 "RIM",
1392 "Blackberry Pearl",
1393 US_SC_DEVICE, US_PR_DEVICE, NULL,
1394 US_FL_IGNORE_DEVICE ),
1395#endif
1396
1397/* Reported by Michael Stattmann <michael@stattmann.com> */ 1392/* Reported by Michael Stattmann <michael@stattmann.com> */
1398UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, 1393UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1399 "Sony Ericsson", 1394 "Sony Ericsson",
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index e7eeb63fab23..b409c228f254 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -891,7 +891,7 @@ static int hwarc_post_reset(struct usb_interface *iface)
891} 891}
892 892
893/** USB device ID's that we handle */ 893/** USB device ID's that we handle */
894static struct usb_device_id hwarc_id_table[] = { 894static const struct usb_device_id hwarc_id_table[] = {
895 /* D-Link DUB-1210 */ 895 /* D-Link DUB-1210 */
896 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3d02, 0xe0, 0x01, 0x02), 896 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3d02, 0xe0, 0x01, 0x02),
897 .driver_info = WUSB_QUIRK_WHCI_CMD_EVT }, 897 .driver_info = WUSB_QUIRK_WHCI_CMD_EVT },
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index 0bb665a0c024..a99e211a1b87 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -120,8 +120,7 @@ int i1480_usb_write(struct i1480 *i1480, u32 memory_address,
120 result = usb_control_msg( 120 result = usb_control_msg(
121 i1480_usb->usb_dev, usb_sndctrlpipe(i1480_usb->usb_dev, 0), 121 i1480_usb->usb_dev, usb_sndctrlpipe(i1480_usb->usb_dev, 0),
122 0xf0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 122 0xf0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
123 cpu_to_le16(memory_address & 0xffff), 123 memory_address, (memory_address >> 16),
124 cpu_to_le16((memory_address >> 16) & 0xffff),
125 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */); 124 i1480->cmd_buf, buffer_size, 100 /* FIXME: arbitrary */);
126 if (result < 0) 125 if (result < 0)
127 break; 126 break;
@@ -166,8 +165,7 @@ int i1480_usb_read(struct i1480 *i1480, u32 addr, size_t size)
166 result = usb_control_msg( 165 result = usb_control_msg(
167 i1480_usb->usb_dev, usb_rcvctrlpipe(i1480_usb->usb_dev, 0), 166 i1480_usb->usb_dev, usb_rcvctrlpipe(i1480_usb->usb_dev, 0),
168 0xf0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 167 0xf0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
169 cpu_to_le16(itr_addr & 0xffff), 168 itr_addr, (itr_addr >> 16),
170 cpu_to_le16((itr_addr >> 16) & 0xffff),
171 i1480->cmd_buf + itr, itr_size, 169 i1480->cmd_buf + itr, itr_size,
172 100 /* FIXME: arbitrary */); 170 100 /* FIXME: arbitrary */);
173 if (result < 0) { 171 if (result < 0) {
@@ -413,6 +411,10 @@ error:
413 return result; 411 return result;
414} 412}
415 413
414MODULE_FIRMWARE("i1480-pre-phy-0.0.bin");
415MODULE_FIRMWARE("i1480-usb-0.0.bin");
416MODULE_FIRMWARE("i1480-phy-0.0.bin");
417
416#define i1480_USB_DEV(v, p) \ 418#define i1480_USB_DEV(v, p) \
417{ \ 419{ \
418 .match_flags = USB_DEVICE_ID_MATCH_DEVICE \ 420 .match_flags = USB_DEVICE_ID_MATCH_DEVICE \
@@ -430,7 +432,7 @@ error:
430 432
431 433
432/** USB device ID's that we handle */ 434/** USB device ID's that we handle */
433static struct usb_device_id i1480_usb_id_table[] = { 435static const struct usb_device_id i1480_usb_id_table[] = {
434 i1480_USB_DEV(0x8086, 0xdf3b), 436 i1480_USB_DEV(0x8086, 0xdf3b),
435 i1480_USB_DEV(0x15a9, 0x0005), 437 i1480_USB_DEV(0x15a9, 0x0005),
436 i1480_USB_DEV(0x07d1, 0x3802), 438 i1480_USB_DEV(0x07d1, 0x3802),
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index aa42fcee4c4f..75164866c2d8 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -259,6 +259,63 @@ out:
259} 259}
260 260
261 261
262static ssize_t wlp_get_attribute(struct wlp *wlp, u16 type_code,
263 struct wlp_attr_hdr *attr_hdr, void *value, ssize_t value_len,
264 ssize_t buflen)
265{
266 struct device *dev = &wlp->rc->uwb_dev.dev;
267 ssize_t attr_len = sizeof(*attr_hdr) + value_len;
268 if (buflen < 0)
269 return -EINVAL;
270 if (buflen < attr_len) {
271 dev_err(dev, "WLP: Not enough space in buffer to parse"
272 " attribute field. Need %d, received %zu\n",
273 (int)attr_len, buflen);
274 return -EIO;
275 }
276 if (wlp_check_attr_hdr(wlp, attr_hdr, type_code, value_len) < 0) {
277 dev_err(dev, "WLP: Header verification failed. \n");
278 return -EINVAL;
279 }
280 memcpy(value, (void *)attr_hdr + sizeof(*attr_hdr), value_len);
281 return attr_len;
282}
283
284static ssize_t wlp_vget_attribute(struct wlp *wlp, u16 type_code,
285 struct wlp_attr_hdr *attr_hdr, void *value, ssize_t max_value_len,
286 ssize_t buflen)
287{
288 struct device *dev = &wlp->rc->uwb_dev.dev;
289 size_t len;
290 if (buflen < 0)
291 return -EINVAL;
292 if (buflen < sizeof(*attr_hdr)) {
293 dev_err(dev, "WLP: Not enough space in buffer to parse"
294 " header.\n");
295 return -EIO;
296 }
297 if (le16_to_cpu(attr_hdr->type) != type_code) {
298 dev_err(dev, "WLP: Unexpected attribute type. Got %u, "
299 "expected %u.\n", le16_to_cpu(attr_hdr->type),
300 type_code);
301 return -EINVAL;
302 }
303 len = le16_to_cpu(attr_hdr->length);
304 if (len > max_value_len) {
305 dev_err(dev, "WLP: Attribute larger than maximum "
306 "allowed. Received %zu, max is %d.\n", len,
307 (int)max_value_len);
308 return -EFBIG;
309 }
310 if (buflen < sizeof(*attr_hdr) + len) {
311 dev_err(dev, "WLP: Not enough space in buffer to parse "
312 "variable data.\n");
313 return -EIO;
314 }
315 memcpy(value, (void *)attr_hdr + sizeof(*attr_hdr), len);
316 return sizeof(*attr_hdr) + len;
317}
318
262/** 319/**
263 * Get value of attribute from fixed size attribute field. 320 * Get value of attribute from fixed size attribute field.
264 * 321 *
@@ -274,22 +331,8 @@ out:
274ssize_t wlp_get_##name(struct wlp *wlp, struct wlp_attr_##name *attr, \ 331ssize_t wlp_get_##name(struct wlp *wlp, struct wlp_attr_##name *attr, \
275 type *value, ssize_t buflen) \ 332 type *value, ssize_t buflen) \
276{ \ 333{ \
277 struct device *dev = &wlp->rc->uwb_dev.dev; \ 334 return wlp_get_attribute(wlp, (type_code), &attr->hdr, \
278 if (buflen < 0) \ 335 value, sizeof(*value), buflen); \
279 return -EINVAL; \
280 if (buflen < sizeof(*attr)) { \
281 dev_err(dev, "WLP: Not enough space in buffer to parse" \
282 " attribute field. Need %d, received %zu\n", \
283 (int)sizeof(*attr), buflen); \
284 return -EIO; \
285 } \
286 if (wlp_check_attr_hdr(wlp, &attr->hdr, type_code, \
287 sizeof(attr->name)) < 0) { \
288 dev_err(dev, "WLP: Header verification failed. \n"); \
289 return -EINVAL; \
290 } \
291 *value = attr->name; \
292 return sizeof(*attr); \
293} 336}
294 337
295#define wlp_get_sparse(type, type_code, name) \ 338#define wlp_get_sparse(type, type_code, name) \
@@ -313,35 +356,8 @@ static ssize_t wlp_get_##name(struct wlp *wlp, \
313 struct wlp_attr_##name *attr, \ 356 struct wlp_attr_##name *attr, \
314 type_val *value, ssize_t buflen) \ 357 type_val *value, ssize_t buflen) \
315{ \ 358{ \
316 struct device *dev = &wlp->rc->uwb_dev.dev; \ 359 return wlp_vget_attribute(wlp, (type_code), &attr->hdr, \
317 size_t len; \ 360 value, (max), buflen); \
318 if (buflen < 0) \
319 return -EINVAL; \
320 if (buflen < sizeof(*attr)) { \
321 dev_err(dev, "WLP: Not enough space in buffer to parse" \
322 " header.\n"); \
323 return -EIO; \
324 } \
325 if (le16_to_cpu(attr->hdr.type) != type_code) { \
326 dev_err(dev, "WLP: Unexpected attribute type. Got %u, " \
327 "expected %u.\n", le16_to_cpu(attr->hdr.type), \
328 type_code); \
329 return -EINVAL; \
330 } \
331 len = le16_to_cpu(attr->hdr.length); \
332 if (len > max) { \
333 dev_err(dev, "WLP: Attribute larger than maximum " \
334 "allowed. Received %zu, max is %d.\n", len, \
335 (int)max); \
336 return -EFBIG; \
337 } \
338 if (buflen < sizeof(*attr) + len) { \
339 dev_err(dev, "WLP: Not enough space in buffer to parse "\
340 "variable data.\n"); \
341 return -EIO; \
342 } \
343 memcpy(value, (void *) attr + sizeof(*attr), len); \
344 return sizeof(*attr) + len; \
345} 361}
346 362
347wlp_get(u8, WLP_ATTR_WLP_VER, version) 363wlp_get(u8, WLP_ATTR_WLP_VER, version)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index ad37da2b6cb5..a6a88dfd5029 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -125,7 +125,7 @@ static void handle_tx(struct vhost_net *net)
125 mutex_lock(&vq->mutex); 125 mutex_lock(&vq->mutex);
126 vhost_disable_notify(vq); 126 vhost_disable_notify(vq);
127 127
128 if (wmem < sock->sk->sk_sndbuf * 2) 128 if (wmem < sock->sk->sk_sndbuf / 2)
129 tx_poll_stop(net); 129 tx_poll_stop(net);
130 hdr_size = vq->hdr_size; 130 hdr_size = vq->hdr_size;
131 131
@@ -508,12 +508,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
508 /* Verify that ring has been setup correctly. */ 508 /* Verify that ring has been setup correctly. */
509 if (!vhost_vq_access_ok(vq)) { 509 if (!vhost_vq_access_ok(vq)) {
510 r = -EFAULT; 510 r = -EFAULT;
511 goto err; 511 goto err_vq;
512 } 512 }
513 sock = get_socket(fd); 513 sock = get_socket(fd);
514 if (IS_ERR(sock)) { 514 if (IS_ERR(sock)) {
515 r = PTR_ERR(sock); 515 r = PTR_ERR(sock);
516 goto err; 516 goto err_vq;
517 } 517 }
518 518
519 /* start polling new socket */ 519 /* start polling new socket */
@@ -524,12 +524,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
524 vhost_net_disable_vq(n, vq); 524 vhost_net_disable_vq(n, vq);
525 rcu_assign_pointer(vq->private_data, sock); 525 rcu_assign_pointer(vq->private_data, sock);
526 vhost_net_enable_vq(n, vq); 526 vhost_net_enable_vq(n, vq);
527 mutex_unlock(&vq->mutex);
528done: 527done:
529 if (oldsock) { 528 if (oldsock) {
530 vhost_net_flush_vq(n, index); 529 vhost_net_flush_vq(n, index);
531 fput(oldsock->file); 530 fput(oldsock->file);
532 } 531 }
532
533err_vq:
534 mutex_unlock(&vq->mutex);
533err: 535err:
534 mutex_unlock(&n->dev.mutex); 536 mutex_unlock(&n->dev.mutex);
535 return r; 537 return r;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 7cd55e078794..7bd7a1e4409d 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -476,8 +476,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
476 if (r < 0) 476 if (r < 0)
477 break; 477 break;
478 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); 478 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
479 if (IS_ERR(eventfp)) 479 if (IS_ERR(eventfp)) {
480 return PTR_ERR(eventfp); 480 r = PTR_ERR(eventfp);
481 break;
482 }
481 if (eventfp != vq->kick) { 483 if (eventfp != vq->kick) {
482 pollstop = filep = vq->kick; 484 pollstop = filep = vq->kick;
483 pollstart = vq->kick = eventfp; 485 pollstart = vq->kick = eventfp;
@@ -489,8 +491,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
489 if (r < 0) 491 if (r < 0)
490 break; 492 break;
491 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); 493 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
492 if (IS_ERR(eventfp)) 494 if (IS_ERR(eventfp)) {
493 return PTR_ERR(eventfp); 495 r = PTR_ERR(eventfp);
496 break;
497 }
494 if (eventfp != vq->call) { 498 if (eventfp != vq->call) {
495 filep = vq->call; 499 filep = vq->call;
496 ctx = vq->call_ctx; 500 ctx = vq->call_ctx;
@@ -505,8 +509,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
505 if (r < 0) 509 if (r < 0)
506 break; 510 break;
507 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); 511 eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd);
508 if (IS_ERR(eventfp)) 512 if (IS_ERR(eventfp)) {
509 return PTR_ERR(eventfp); 513 r = PTR_ERR(eventfp);
514 break;
515 }
510 if (eventfp != vq->error) { 516 if (eventfp != vq->error) {
511 filep = vq->error; 517 filep = vq->error;
512 vq->error = eventfp; 518 vq->error = eventfp;
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h
index cc781c00f75d..e4c4d89b7860 100644
--- a/drivers/video/geode/lxfb.h
+++ b/drivers/video/geode/lxfb.h
@@ -365,6 +365,8 @@ enum fp_registers {
365 FP_CRC, /* 0x458 */ 365 FP_CRC, /* 0x458 */
366}; 366};
367 367
368#define FP_PT2_HSP (1 << 22)
369#define FP_PT2_VSP (1 << 23)
368#define FP_PT2_SCRC (1 << 27) /* shfclk free */ 370#define FP_PT2_SCRC (1 << 27) /* shfclk free */
369 371
370#define FP_PM_P (1 << 24) /* panel power ctl */ 372#define FP_PM_P (1 << 24) /* panel power ctl */
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c
index 0e5d8c7c3eba..bc35a95e59d4 100644
--- a/drivers/video/geode/lxfb_ops.c
+++ b/drivers/video/geode/lxfb_ops.c
@@ -274,7 +274,15 @@ static void lx_graphics_enable(struct fb_info *info)
274 u32 msrlo, msrhi; 274 u32 msrlo, msrhi;
275 275
276 write_fp(par, FP_PT1, 0); 276 write_fp(par, FP_PT1, 0);
277 write_fp(par, FP_PT2, FP_PT2_SCRC); 277 temp = FP_PT2_SCRC;
278
279 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
280 temp |= FP_PT2_HSP;
281
282 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
283 temp |= FP_PT2_VSP;
284
285 write_fp(par, FP_PT2, temp);
278 write_fp(par, FP_DFC, FP_DFC_BC); 286 write_fp(par, FP_DFC, FP_DFC_BC);
279 287
280 msrlo = MSR_LX_MSR_PADSEL_TFT_SEL_LOW; 288 msrlo = MSR_LX_MSR_PADSEL_TFT_SEL_LOW;
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c
index c59e4baed8b2..300eff5de1b4 100644
--- a/drivers/video/omap2/displays/panel-generic.c
+++ b/drivers/video/omap2/displays/panel-generic.c
@@ -116,6 +116,24 @@ static int generic_panel_resume(struct omap_dss_device *dssdev)
116 return 0; 116 return 0;
117} 117}
118 118
119static void generic_panel_set_timings(struct omap_dss_device *dssdev,
120 struct omap_video_timings *timings)
121{
122 dpi_set_timings(dssdev, timings);
123}
124
125static void generic_panel_get_timings(struct omap_dss_device *dssdev,
126 struct omap_video_timings *timings)
127{
128 *timings = dssdev->panel.timings;
129}
130
131static int generic_panel_check_timings(struct omap_dss_device *dssdev,
132 struct omap_video_timings *timings)
133{
134 return dpi_check_timings(dssdev, timings);
135}
136
119static struct omap_dss_driver generic_driver = { 137static struct omap_dss_driver generic_driver = {
120 .probe = generic_panel_probe, 138 .probe = generic_panel_probe,
121 .remove = generic_panel_remove, 139 .remove = generic_panel_remove,
@@ -125,6 +143,10 @@ static struct omap_dss_driver generic_driver = {
125 .suspend = generic_panel_suspend, 143 .suspend = generic_panel_suspend,
126 .resume = generic_panel_resume, 144 .resume = generic_panel_resume,
127 145
146 .set_timings = generic_panel_set_timings,
147 .get_timings = generic_panel_get_timings,
148 .check_timings = generic_panel_check_timings,
149
128 .driver = { 150 .driver = {
129 .name = "generic_panel", 151 .name = "generic_panel",
130 .owner = THIS_MODULE, 152 .owner = THIS_MODULE,
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 8254a4232a53..54344184dd73 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -590,6 +590,9 @@ int dss_init(bool skip_init)
590 } 590 }
591 } 591 }
592 592
593 dss.dsi_clk_source = DSS_SRC_DSS1_ALWON_FCLK;
594 dss.dispc_clk_source = DSS_SRC_DSS1_ALWON_FCLK;
595
593 dss_save_context(); 596 dss_save_context();
594 597
595 rev = dss_read_reg(DSS_REVISION); 598 rev = dss_read_reg(DSS_REVISION);
diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c
index 55a4de5e5d10..b266ffae0bde 100644
--- a/drivers/video/omap2/vram.c
+++ b/drivers/video/omap2/vram.c
@@ -511,13 +511,14 @@ static u32 omap_vram_sdram_size __initdata;
511static u32 omap_vram_def_sdram_size __initdata; 511static u32 omap_vram_def_sdram_size __initdata;
512static u32 omap_vram_def_sdram_start __initdata; 512static u32 omap_vram_def_sdram_start __initdata;
513 513
514static void __init omap_vram_early_vram(char **p) 514static int __init omap_vram_early_vram(char *p)
515{ 515{
516 omap_vram_def_sdram_size = memparse(*p, p); 516 omap_vram_def_sdram_size = memparse(p, &p);
517 if (**p == ',') 517 if (*p == ',')
518 omap_vram_def_sdram_start = simple_strtoul((*p) + 1, p, 16); 518 omap_vram_def_sdram_start = simple_strtoul(p + 1, &p, 16);
519 return 0;
519} 520}
520__early_param("vram=", omap_vram_early_vram); 521early_param("vram", omap_vram_early_vram);
521 522
522/* 523/*
523 * Called from map_io. We need to call to this early enough so that we 524 * Called from map_io. We need to call to this early enough so that we
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
index 75285d3f393c..c91a7f70f7b0 100644
--- a/drivers/video/pxa168fb.c
+++ b/drivers/video/pxa168fb.c
@@ -668,7 +668,7 @@ static int __init pxa168fb_probe(struct platform_device *pdev)
668 /* 668 /*
669 * Map LCD controller registers. 669 * Map LCD controller registers.
670 */ 670 */
671 fbi->reg_base = ioremap_nocache(res->start, res->end - res->start); 671 fbi->reg_base = ioremap_nocache(res->start, resource_size(res));
672 if (fbi->reg_base == NULL) { 672 if (fbi->reg_base == NULL) {
673 ret = -ENOMEM; 673 ret = -ENOMEM;
674 goto failed; 674 goto failed;