aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_at91.c48
-rw-r--r--drivers/atm/solos-pci.c4
-rw-r--r--drivers/base/regmap/regcache.c4
-rw-r--r--drivers/block/nvme.c2
-rw-r--r--drivers/bluetooth/btusb.c4
-rw-r--r--drivers/cpuidle/Kconfig2
-rw-r--r--drivers/edac/i3200_edac.c15
-rw-r--r--drivers/hwmon/ads1015.c3
-rw-r--r--drivers/hwmon/f75375s.c7
-rw-r--r--drivers/hwmon/max6639.c22
-rw-r--r--drivers/hwmon/pmbus/max34440.c2
-rw-r--r--drivers/i2c/busses/i2c-tegra.c2
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/at91_ide.c366
-rw-r--r--drivers/macintosh/adb.c4
-rw-r--r--drivers/media/radio/wl128x/Kconfig4
-rw-r--r--drivers/media/rc/imon.c26
-rw-r--r--drivers/media/video/hdpvr/hdpvr-core.c18
-rw-r--r--drivers/media/video/hdpvr/hdpvr-video.c46
-rw-r--r--drivers/media/video/hdpvr/hdpvr.h1
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c2
-rw-r--r--drivers/mmc/card/block.c1
-rw-r--r--drivers/mmc/core/core.c49
-rw-r--r--drivers/mmc/core/host.h21
-rw-r--r--drivers/mmc/core/mmc.c26
-rw-r--r--drivers/mmc/core/sd.c22
-rw-r--r--drivers/mmc/core/sdio.c7
-rw-r--r--drivers/mmc/core/sdio_irq.c10
-rw-r--r--drivers/mmc/host/atmel-mci.c3
-rw-r--r--drivers/mmc/host/dw_mmc.c144
-rw-r--r--drivers/mmc/host/of_mmc_spi.c4
-rw-r--r--drivers/mmc/host/sdhci-of-esdhc.c32
-rw-r--r--drivers/mmc/host/sdhci-pci.c2
-rw-r--r--drivers/mmc/host/sdhci-pltfm.c10
-rw-r--r--drivers/mmc/host/sh_mmcif.c16
-rw-r--r--drivers/mmc/host/tmio_mmc.h7
-rw-r--r--drivers/mmc/host/tmio_mmc_dma.c12
-rw-r--r--drivers/mmc/host/tmio_mmc_pio.c6
-rw-r--r--drivers/net/can/sja1000/sja1000.c13
-rw-r--r--drivers/net/ethernet/3com/3c59x.c2
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/b44.c2
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c17
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c8
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c6
-rw-r--r--drivers/net/ethernet/cisco/enic/cq_enet_desc.h2
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_pp.c2
-rw-r--r--drivers/net/ethernet/freescale/fec.c2
-rw-r--r--drivers/net/ethernet/jme.c10
-rw-r--r--drivers/net/ethernet/jme.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c12
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c21
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c2
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c14
-rw-r--r--drivers/net/ethernet/octeon/octeon_mgmt.c4
-rw-r--r--drivers/net/ethernet/sfc/rx.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/enh_desc.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/norm_desc.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h5
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c7
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c205
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c6
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c23
-rw-r--r--drivers/net/ethernet/ti/cpmac.c4
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c6
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c3
-rw-r--r--drivers/net/phy/icplus.c55
-rw-r--r--drivers/net/ppp/ppp_generic.c23
-rw-r--r--drivers/net/usb/cdc_ether.c7
-rw-r--r--drivers/net/usb/hso.c2
-rw-r--r--drivers/net/usb/ipheth.c5
-rw-r--r--drivers/net/usb/zaurus.c12
-rw-r--r--drivers/net/veth.c4
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c8
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c4
-rw-r--r--drivers/pci/iov.c3
-rw-r--r--drivers/pci/probe.c5
-rw-r--r--drivers/pci/remove.c28
-rw-r--r--drivers/pci/xen-pcifront.c10
-rw-r--r--drivers/pinctrl/core.c2
-rw-r--r--drivers/platform/x86/ibm_rtl.c15
-rw-r--r--drivers/platform/x86/intel_ips.c15
-rw-r--r--drivers/regulator/max8649.c2
-rw-r--r--drivers/regulator/mc13xxx-regulator-core.c2
-rw-r--r--drivers/rtc/rtc-at91sam9.c13
-rw-r--r--drivers/s390/char/con3215.c22
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c25
-rw-r--r--drivers/scsi/ipr.c24
-rw-r--r--drivers/scsi/isci/host.c4
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c13
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c50
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h13
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c15
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c19
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.c23
-rw-r--r--drivers/scsi/scsi_pm.c16
-rw-r--r--drivers/scsi/scsi_priv.h1
-rw-r--r--drivers/scsi/scsi_scan.c4
-rw-r--r--drivers/sh/clk/cpg.c2
-rw-r--r--drivers/usb/core/hcd-pci.c5
-rw-r--r--drivers/usb/core/hcd.c6
-rw-r--r--drivers/usb/core/hub.c30
-rw-r--r--drivers/usb/host/pci-quirks.c11
-rw-r--r--drivers/usb/host/xhci-hub.c2
-rw-r--r--drivers/usb/host/xhci-mem.c32
-rw-r--r--drivers/usb/host/xhci.c5
-rw-r--r--drivers/usb/serial/cp210x.c2
-rw-r--r--drivers/usb/serial/option.c143
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c6
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h4
-rw-r--r--drivers/usb/storage/usb.c90
-rw-r--r--drivers/usb/storage/usb.h7
-rw-r--r--drivers/video/pvr2fb.c2
-rw-r--r--drivers/xen/cpu_hotplug.c3
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c8
-rw-r--r--drivers/xen/xen-pciback/xenbus.c5
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c4
131 files changed, 986 insertions, 1223 deletions
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index a7d91a72ee35..53d3770a0b1b 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -207,11 +207,11 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev,
207{ 207{
208 int ret = 0; 208 int ret = 0;
209 int use_iordy; 209 int use_iordy;
210 struct sam9_smc_config smc;
210 unsigned int t6z; /* data tristate time in ns */ 211 unsigned int t6z; /* data tristate time in ns */
211 unsigned int cycle; /* SMC Cycle width in MCK ticks */ 212 unsigned int cycle; /* SMC Cycle width in MCK ticks */
212 unsigned int setup; /* SMC Setup width in MCK ticks */ 213 unsigned int setup; /* SMC Setup width in MCK ticks */
213 unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */ 214 unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */
214 unsigned int cs_setup = 0;/* CS4 or CS5 setup width in MCK ticks */
215 unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/ 215 unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/
216 unsigned int tdf_cycles; /* SMC TDF MCK ticks */ 216 unsigned int tdf_cycles; /* SMC TDF MCK ticks */
217 unsigned long mck_hz; /* MCK frequency in Hz */ 217 unsigned long mck_hz; /* MCK frequency in Hz */
@@ -244,26 +244,20 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev,
244 } 244 }
245 245
246 dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles); 246 dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles);
247 info->mode |= AT91_SMC_TDF_(tdf_cycles); 247
248 248 /* SMC Setup Register */
249 /* write SMC Setup Register */ 249 smc.nwe_setup = smc.nrd_setup = setup;
250 at91_sys_write(AT91_SMC_SETUP(info->cs), 250 smc.ncs_write_setup = smc.ncs_read_setup = 0;
251 AT91_SMC_NWESETUP_(setup) | 251 /* SMC Pulse Register */
252 AT91_SMC_NRDSETUP_(setup) | 252 smc.nwe_pulse = smc.nrd_pulse = pulse;
253 AT91_SMC_NCS_WRSETUP_(cs_setup) | 253 smc.ncs_write_pulse = smc.ncs_read_pulse = cs_pulse;
254 AT91_SMC_NCS_RDSETUP_(cs_setup)); 254 /* SMC Cycle Register */
255 /* write SMC Pulse Register */ 255 smc.write_cycle = smc.read_cycle = cycle;
256 at91_sys_write(AT91_SMC_PULSE(info->cs), 256 /* SMC Mode Register*/
257 AT91_SMC_NWEPULSE_(pulse) | 257 smc.tdf_cycles = tdf_cycles;
258 AT91_SMC_NRDPULSE_(pulse) | 258 smc.mode = info->mode;
259 AT91_SMC_NCS_WRPULSE_(cs_pulse) | 259
260 AT91_SMC_NCS_RDPULSE_(cs_pulse)); 260 sam9_smc_configure(0, info->cs, &smc);
261 /* write SMC Cycle Register */
262 at91_sys_write(AT91_SMC_CYCLE(info->cs),
263 AT91_SMC_NWECYCLE_(cycle) |
264 AT91_SMC_NRDCYCLE_(cycle));
265 /* write SMC Mode Register*/
266 at91_sys_write(AT91_SMC_MODE(info->cs), info->mode);
267} 261}
268 262
269static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) 263static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev)
@@ -288,20 +282,20 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev,
288 struct at91_ide_info *info = dev->link->ap->host->private_data; 282 struct at91_ide_info *info = dev->link->ap->host->private_data;
289 unsigned int consumed; 283 unsigned int consumed;
290 unsigned long flags; 284 unsigned long flags;
291 unsigned int mode; 285 struct sam9_smc_config smc;
292 286
293 local_irq_save(flags); 287 local_irq_save(flags);
294 mode = at91_sys_read(AT91_SMC_MODE(info->cs)); 288 sam9_smc_read_mode(0, info->cs, &smc);
295 289
296 /* set 16bit mode before writing data */ 290 /* set 16bit mode before writing data */
297 at91_sys_write(AT91_SMC_MODE(info->cs), 291 smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16;
298 (mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16); 292 sam9_smc_write_mode(0, info->cs, &smc);
299 293
300 consumed = ata_sff_data_xfer(dev, buf, buflen, rw); 294 consumed = ata_sff_data_xfer(dev, buf, buflen, rw);
301 295
302 /* restore 8bit mode after data is written */ 296 /* restore 8bit mode after data is written */
303 at91_sys_write(AT91_SMC_MODE(info->cs), 297 smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8;
304 (mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8); 298 sam9_smc_write_mode(0, info->cs, &smc);
305 299
306 local_irq_restore(flags); 300 local_irq_restore(flags);
307 return consumed; 301 return consumed;
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 5d1d07645132..e8cd652d2017 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1206,9 +1206,9 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
1206 1206
1207 out_unmap_both: 1207 out_unmap_both:
1208 pci_set_drvdata(dev, NULL); 1208 pci_set_drvdata(dev, NULL);
1209 pci_iounmap(dev, card->config_regs);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->buffers); 1209 pci_iounmap(dev, card->buffers);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->config_regs);
1212 out_release_regions: 1212 out_release_regions:
1213 pci_release_regions(dev); 1213 pci_release_regions(dev);
1214 out: 1214 out:
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 1ead66186b7c..d1daa5e9fadf 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -53,7 +53,7 @@ static int regcache_hw_init(struct regmap *map)
53 for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) { 53 for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) {
54 val = regcache_get_val(map->reg_defaults_raw, 54 val = regcache_get_val(map->reg_defaults_raw,
55 i, map->cache_word_size); 55 i, map->cache_word_size);
56 if (!val) 56 if (regmap_volatile(map, i))
57 continue; 57 continue;
58 count++; 58 count++;
59 } 59 }
@@ -70,7 +70,7 @@ static int regcache_hw_init(struct regmap *map)
70 for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { 70 for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) {
71 val = regcache_get_val(map->reg_defaults_raw, 71 val = regcache_get_val(map->reg_defaults_raw,
72 i, map->cache_word_size); 72 i, map->cache_word_size);
73 if (!val) 73 if (regmap_volatile(map, i))
74 continue; 74 continue;
75 map->reg_defaults[j].reg = i; 75 map->reg_defaults[j].reg = i;
76 map->reg_defaults[j].def = val; 76 map->reg_defaults[j].def = val;
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index c1dc4d86c221..1f3c1a7d132a 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -41,6 +41,8 @@
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/version.h> 42#include <linux/version.h>
43 43
44#include <asm-generic/io-64-nonatomic-lo-hi.h>
45
44#define NVME_Q_DEPTH 1024 46#define NVME_Q_DEPTH 1024
45#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) 47#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
46#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) 48#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f00f596c1029..789c9b579aea 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = {
102 102
103 /* Broadcom BCM20702A0 */ 103 /* Broadcom BCM20702A0 */
104 { USB_DEVICE(0x0a5c, 0x21e3) }, 104 { USB_DEVICE(0x0a5c, 0x21e3) },
105 { USB_DEVICE(0x0a5c, 0x21f3) },
105 { USB_DEVICE(0x413c, 0x8197) }, 106 { USB_DEVICE(0x413c, 0x8197) },
106 107
107 { } /* Terminating entry */ 108 { } /* Terminating entry */
@@ -726,9 +727,6 @@ static int btusb_send_frame(struct sk_buff *skb)
726 usb_fill_bulk_urb(urb, data->udev, pipe, 727 usb_fill_bulk_urb(urb, data->udev, pipe,
727 skb->data, skb->len, btusb_tx_complete, skb); 728 skb->data, skb->len, btusb_tx_complete, skb);
728 729
729 if (skb->priority >= HCI_PRIO_MAX - 1)
730 urb->transfer_flags = URB_ISO_ASAP;
731
732 hdev->stat.acl_tx++; 730 hdev->stat.acl_tx++;
733 break; 731 break;
734 732
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index 7dbc4a83c45c..78a666d1e5f5 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -1,7 +1,7 @@
1 1
2config CPU_IDLE 2config CPU_IDLE
3 bool "CPU idle PM support" 3 bool "CPU idle PM support"
4 default ACPI 4 default y if ACPI || PPC_PSERIES
5 help 5 help
6 CPU idle is a generic framework for supporting software-controlled 6 CPU idle is a generic framework for supporting software-controlled
7 idle processor power management. It includes modular cross-platform 7 idle processor power management. It includes modular cross-platform
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c
index aa08497a075a..73f55e2008c2 100644
--- a/drivers/edac/i3200_edac.c
+++ b/drivers/edac/i3200_edac.c
@@ -15,6 +15,8 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include "edac_core.h" 16#include "edac_core.h"
17 17
18#include <asm-generic/io-64-nonatomic-lo-hi.h>
19
18#define I3200_REVISION "1.1" 20#define I3200_REVISION "1.1"
19 21
20#define EDAC_MOD_STR "i3200_edac" 22#define EDAC_MOD_STR "i3200_edac"
@@ -101,19 +103,6 @@ struct i3200_priv {
101 103
102static int nr_channels; 104static int nr_channels;
103 105
104#ifndef readq
105static inline __u64 readq(const volatile void __iomem *addr)
106{
107 const volatile u32 __iomem *p = addr;
108 u32 low, high;
109
110 low = readl(p);
111 high = readl(p + 1);
112
113 return low + ((u64)high << 32);
114}
115#endif
116
117static int how_many_channels(struct pci_dev *pdev) 106static int how_many_channels(struct pci_dev *pdev)
118{ 107{
119 unsigned char capid0_8b; /* 8th byte of CAPID0 */ 108 unsigned char capid0_8b; /* 8th byte of CAPID0 */
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
index eedca3cf9968..dd87ae96c262 100644
--- a/drivers/hwmon/ads1015.c
+++ b/drivers/hwmon/ads1015.c
@@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
271 continue; 271 continue;
272 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr); 272 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
273 if (err) 273 if (err)
274 goto exit_free; 274 goto exit_remove;
275 } 275 }
276 276
277 data->hwmon_dev = hwmon_device_register(&client->dev); 277 data->hwmon_dev = hwmon_device_register(&client->dev);
@@ -285,7 +285,6 @@ static int ads1015_probe(struct i2c_client *client,
285exit_remove: 285exit_remove:
286 for (k = 0; k < ADS1015_CHANNELS; ++k) 286 for (k = 0; k < ADS1015_CHANNELS; ++k)
287 device_remove_file(&client->dev, &ads1015_in[k].dev_attr); 287 device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
288exit_free:
289 kfree(data); 288 kfree(data);
290exit: 289exit:
291 return err; 290 return err;
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f609b5727ba9..6bab2001ef3b 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -340,8 +340,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
340 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 340 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
341 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 341 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
342 data->pwm[nr] = 255; 342 data->pwm[nr] = 255;
343 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
344 data->pwm[nr]);
345 break; 343 break;
346 case 1: /* PWM */ 344 case 1: /* PWM */
347 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 345 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
@@ -361,8 +359,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
361 case 0: /* full speed */ 359 case 0: /* full speed */
362 fanmode |= (3 << FAN_CTRL_MODE(nr)); 360 fanmode |= (3 << FAN_CTRL_MODE(nr));
363 data->pwm[nr] = 255; 361 data->pwm[nr] = 255;
364 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
365 data->pwm[nr]);
366 break; 362 break;
367 case 1: /* PWM */ 363 case 1: /* PWM */
368 fanmode |= (3 << FAN_CTRL_MODE(nr)); 364 fanmode |= (3 << FAN_CTRL_MODE(nr));
@@ -377,6 +373,9 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
377 373
378 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 374 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
379 data->pwm_enable[nr] = val; 375 data->pwm_enable[nr] = val;
376 if (val == 0)
377 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
378 data->pwm[nr]);
380 return 0; 379 return 0;
381} 380}
382 381
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index e10a092c603c..a6760bacd915 100644
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -72,8 +72,8 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END };
72 72
73static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; 73static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
74 74
75#define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \ 75#define FAN_FROM_REG(val, rpm_range) ((val) == 0 || (val) == 255 ? \
76 (val) == 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val))) 76 0 : (rpm_ranges[rpm_range] * 30) / (val))
77#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255) 77#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255)
78 78
79/* 79/*
@@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct device *dev,
333 return PTR_ERR(data); 333 return PTR_ERR(data);
334 334
335 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index], 335 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index],
336 data->ppr, data->rpm_range)); 336 data->rpm_range));
337} 337}
338 338
339static ssize_t show_alarm(struct device *dev, 339static ssize_t show_alarm(struct device *dev,
@@ -429,9 +429,9 @@ static int max6639_init_client(struct i2c_client *client)
429 struct max6639_data *data = i2c_get_clientdata(client); 429 struct max6639_data *data = i2c_get_clientdata(client);
430 struct max6639_platform_data *max6639_info = 430 struct max6639_platform_data *max6639_info =
431 client->dev.platform_data; 431 client->dev.platform_data;
432 int i = 0; 432 int i;
433 int rpm_range = 1; /* default: 4000 RPM */ 433 int rpm_range = 1; /* default: 4000 RPM */
434 int err = 0; 434 int err;
435 435
436 /* Reset chip to default values, see below for GCONFIG setup */ 436 /* Reset chip to default values, see below for GCONFIG setup */
437 err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, 437 err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
@@ -446,11 +446,6 @@ static int max6639_init_client(struct i2c_client *client)
446 else 446 else
447 data->ppr = 2; 447 data->ppr = 2;
448 data->ppr -= 1; 448 data->ppr -= 1;
449 err = i2c_smbus_write_byte_data(client,
450 MAX6639_REG_FAN_PPR(i),
451 data->ppr << 5);
452 if (err)
453 goto exit;
454 449
455 if (max6639_info) 450 if (max6639_info)
456 rpm_range = rpm_range_to_reg(max6639_info->rpm_range); 451 rpm_range = rpm_range_to_reg(max6639_info->rpm_range);
@@ -458,6 +453,13 @@ static int max6639_init_client(struct i2c_client *client)
458 453
459 for (i = 0; i < 2; i++) { 454 for (i = 0; i < 2; i++) {
460 455
456 /* Set Fan pulse per revolution */
457 err = i2c_smbus_write_byte_data(client,
458 MAX6639_REG_FAN_PPR(i),
459 data->ppr << 6);
460 if (err)
461 goto exit;
462
461 /* Fans config PWM, RPM */ 463 /* Fans config PWM, RPM */
462 err = i2c_smbus_write_byte_data(client, 464 err = i2c_smbus_write_byte_data(client,
463 MAX6639_REG_FAN_CONFIG1(i), 465 MAX6639_REG_FAN_CONFIG1(i),
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index beaf5a8d9c45..9b97a5b3cf3d 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -82,7 +82,7 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
82 case PMBUS_VIRT_RESET_TEMP_HISTORY: 82 case PMBUS_VIRT_RESET_TEMP_HISTORY:
83 ret = pmbus_write_word_data(client, page, 83 ret = pmbus_write_word_data(client, page,
84 MAX34440_MFR_TEMPERATURE_PEAK, 84 MAX34440_MFR_TEMPERATURE_PEAK,
85 0xffff); 85 0x8000);
86 break; 86 break;
87 default: 87 default:
88 ret = -ENODATA; 88 ret = -ENODATA;
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 6381604696d3..0ab4a9548745 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -755,7 +755,7 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
755 755
756static struct platform_driver tegra_i2c_driver = { 756static struct platform_driver tegra_i2c_driver = {
757 .probe = tegra_i2c_probe, 757 .probe = tegra_i2c_probe,
758 .remove = tegra_i2c_remove, 758 .remove = __devexit_p(tegra_i2c_remove),
759#ifdef CONFIG_PM 759#ifdef CONFIG_PM
760 .suspend = tegra_i2c_suspend, 760 .suspend = tegra_i2c_suspend,
761 .resume = tegra_i2c_resume, 761 .resume = tegra_i2c_resume,
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 7f879b2397b0..af8d016c37ea 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -116,4 +116,3 @@ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
116 116
117obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o 117obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o
118obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o 118obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o
119obj-$(CONFIG_BLK_DEV_IDE_AT91) += at91_ide.o
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
deleted file mode 100644
index 41d415529479..000000000000
--- a/drivers/ide/at91_ide.c
+++ /dev/null
@@ -1,366 +0,0 @@
1/*
2 * IDE host driver for AT91 (SAM9, CAP9, AT572D940HF) Static Memory Controller
3 * with Compact Flash True IDE logic
4 *
5 * Copyright (c) 2008, 2009 Kelvatek Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 */
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/clk.h>
26#include <linux/err.h>
27#include <linux/ide.h>
28#include <linux/platform_device.h>
29
30#include <mach/board.h>
31#include <asm/gpio.h>
32#include <mach/at91sam9_smc.h>
33
34#define DRV_NAME "at91_ide"
35
36#define perr(fmt, args...) pr_err(DRV_NAME ": " fmt, ##args)
37#define pdbg(fmt, args...) pr_debug("%s " fmt, __func__, ##args)
38
39/*
40 * Access to IDE device is possible through EBI Static Memory Controller
41 * with Compact Flash logic. For details see EBI and SMC datasheet sections
42 * of any microcontroller from AT91SAM9 family.
43 *
44 * Within SMC chip select address space, lines A[23:21] distinguish Compact
45 * Flash modes (I/O, common memory, attribute memory, True IDE). IDE modes are:
46 * 0x00c0000 - True IDE
47 * 0x00e0000 - Alternate True IDE (Alt Status Register)
48 *
49 * On True IDE mode Task File and Data Register are mapped at the same address.
50 * To distinguish access between these two different bus data width is used:
51 * 8Bit for Task File, 16Bit for Data I/O.
52 *
53 * After initialization we do 8/16 bit flipping (changes in SMC MODE register)
54 * only inside IDE callback routines which are serialized by IDE layer,
55 * so no additional locking needed.
56 */
57
58#define TASK_FILE 0x00c00000
59#define ALT_MODE 0x00e00000
60#define REGS_SIZE 8
61
62#define enter_16bit(cs, mode) do { \
63 mode = at91_sys_read(AT91_SMC_MODE(cs)); \
64 at91_sys_write(AT91_SMC_MODE(cs), mode | AT91_SMC_DBW_16); \
65} while (0)
66
67#define leave_16bit(cs, mode) at91_sys_write(AT91_SMC_MODE(cs), mode);
68
69static void set_smc_timings(const u8 chipselect, const u16 cycle,
70 const u16 setup, const u16 pulse,
71 const u16 data_float, int use_iordy)
72{
73 unsigned long mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
74 AT91_SMC_BAT_SELECT;
75
76 /* disable or enable waiting for IORDY signal */
77 if (use_iordy)
78 mode |= AT91_SMC_EXNWMODE_READY;
79
80 /* add data float cycles if needed */
81 if (data_float)
82 mode |= AT91_SMC_TDF_(data_float);
83
84 at91_sys_write(AT91_SMC_MODE(chipselect), mode);
85
86 /* setup timings in SMC */
87 at91_sys_write(AT91_SMC_SETUP(chipselect), AT91_SMC_NWESETUP_(setup) |
88 AT91_SMC_NCS_WRSETUP_(0) |
89 AT91_SMC_NRDSETUP_(setup) |
90 AT91_SMC_NCS_RDSETUP_(0));
91 at91_sys_write(AT91_SMC_PULSE(chipselect), AT91_SMC_NWEPULSE_(pulse) |
92 AT91_SMC_NCS_WRPULSE_(cycle) |
93 AT91_SMC_NRDPULSE_(pulse) |
94 AT91_SMC_NCS_RDPULSE_(cycle));
95 at91_sys_write(AT91_SMC_CYCLE(chipselect), AT91_SMC_NWECYCLE_(cycle) |
96 AT91_SMC_NRDCYCLE_(cycle));
97}
98
99static unsigned int calc_mck_cycles(unsigned int ns, unsigned int mck_hz)
100{
101 u64 tmp = ns;
102
103 tmp *= mck_hz;
104 tmp += 1000*1000*1000 - 1; /* round up */
105 do_div(tmp, 1000*1000*1000);
106 return (unsigned int) tmp;
107}
108
109static void apply_timings(const u8 chipselect, const u8 pio,
110 const struct ide_timing *timing, int use_iordy)
111{
112 unsigned int t0, t1, t2, t6z;
113 unsigned int cycle, setup, pulse, data_float;
114 unsigned int mck_hz;
115 struct clk *mck;
116
117 /* see table 22 of Compact Flash standard 4.1 for the meaning,
118 * we do not stretch active (t2) time, so setup (t1) + hold time (th)
119 * assure at least minimal recovery (t2i) time */
120 t0 = timing->cyc8b;
121 t1 = timing->setup;
122 t2 = timing->act8b;
123 t6z = (pio < 5) ? 30 : 20;
124
125 pdbg("t0=%u t1=%u t2=%u t6z=%u\n", t0, t1, t2, t6z);
126
127 mck = clk_get(NULL, "mck");
128 BUG_ON(IS_ERR(mck));
129 mck_hz = clk_get_rate(mck);
130 pdbg("mck_hz=%u\n", mck_hz);
131
132 cycle = calc_mck_cycles(t0, mck_hz);
133 setup = calc_mck_cycles(t1, mck_hz);
134 pulse = calc_mck_cycles(t2, mck_hz);
135 data_float = calc_mck_cycles(t6z, mck_hz);
136
137 pdbg("cycle=%u setup=%u pulse=%u data_float=%u\n",
138 cycle, setup, pulse, data_float);
139
140 set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy);
141}
142
143static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
144 void *buf, unsigned int len)
145{
146 ide_hwif_t *hwif = drive->hwif;
147 struct ide_io_ports *io_ports = &hwif->io_ports;
148 u8 chipselect = hwif->select_data;
149 unsigned long mode;
150
151 pdbg("cs %u buf %p len %d\n", chipselect, buf, len);
152
153 len++;
154
155 enter_16bit(chipselect, mode);
156 readsw((void __iomem *)io_ports->data_addr, buf, len / 2);
157 leave_16bit(chipselect, mode);
158}
159
160static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
161 void *buf, unsigned int len)
162{
163 ide_hwif_t *hwif = drive->hwif;
164 struct ide_io_ports *io_ports = &hwif->io_ports;
165 u8 chipselect = hwif->select_data;
166 unsigned long mode;
167
168 pdbg("cs %u buf %p len %d\n", chipselect, buf, len);
169
170 enter_16bit(chipselect, mode);
171 writesw((void __iomem *)io_ports->data_addr, buf, len / 2);
172 leave_16bit(chipselect, mode);
173}
174
175static void at91_ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
176{
177 struct ide_timing *timing;
178 u8 chipselect = hwif->select_data;
179 int use_iordy = 0;
180 const u8 pio = drive->pio_mode - XFER_PIO_0;
181
182 pdbg("chipselect %u pio %u\n", chipselect, pio);
183
184 timing = ide_timing_find_mode(XFER_PIO_0 + pio);
185 BUG_ON(!timing);
186
187 if (ide_pio_need_iordy(drive, pio))
188 use_iordy = 1;
189
190 apply_timings(chipselect, pio, timing, use_iordy);
191}
192
193static const struct ide_tp_ops at91_ide_tp_ops = {
194 .exec_command = ide_exec_command,
195 .read_status = ide_read_status,
196 .read_altstatus = ide_read_altstatus,
197 .write_devctl = ide_write_devctl,
198
199 .dev_select = ide_dev_select,
200 .tf_load = ide_tf_load,
201 .tf_read = ide_tf_read,
202
203 .input_data = at91_ide_input_data,
204 .output_data = at91_ide_output_data,
205};
206
207static const struct ide_port_ops at91_ide_port_ops = {
208 .set_pio_mode = at91_ide_set_pio_mode,
209};
210
211static const struct ide_port_info at91_ide_port_info __initdata = {
212 .port_ops = &at91_ide_port_ops,
213 .tp_ops = &at91_ide_tp_ops,
214 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE |
215 IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS,
216 .pio_mask = ATA_PIO6,
217 .chipset = ide_generic,
218};
219
220/*
221 * If interrupt is delivered through GPIO, IRQ are triggered on falling
222 * and rising edge of signal. Whereas IDE device request interrupt on high
223 * level (rising edge in our case). This mean we have fake interrupts, so
224 * we need to check interrupt pin and exit instantly from ISR when line
225 * is on low level.
226 */
227
228irqreturn_t at91_irq_handler(int irq, void *dev_id)
229{
230 int ntries = 8;
231 int pin_val1, pin_val2;
232
233 /* additional deglitch, line can be noisy in badly designed PCB */
234 do {
235 pin_val1 = at91_get_gpio_value(irq);
236 pin_val2 = at91_get_gpio_value(irq);
237 } while (pin_val1 != pin_val2 && --ntries > 0);
238
239 if (pin_val1 == 0 || ntries <= 0)
240 return IRQ_HANDLED;
241
242 return ide_intr(irq, dev_id);
243}
244
245static int __init at91_ide_probe(struct platform_device *pdev)
246{
247 int ret;
248 struct ide_hw hw, *hws[] = { &hw };
249 struct ide_host *host;
250 struct resource *res;
251 unsigned long tf_base = 0, ctl_base = 0;
252 struct at91_cf_data *board = pdev->dev.platform_data;
253
254 if (!board)
255 return -ENODEV;
256
257 if (board->det_pin && at91_get_gpio_value(board->det_pin) != 0) {
258 perr("no device detected\n");
259 return -ENODEV;
260 }
261
262 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
263 if (!res) {
264 perr("can't get memory resource\n");
265 return -ENODEV;
266 }
267
268 if (!devm_request_mem_region(&pdev->dev, res->start + TASK_FILE,
269 REGS_SIZE, "ide") ||
270 !devm_request_mem_region(&pdev->dev, res->start + ALT_MODE,
271 REGS_SIZE, "alt")) {
272 perr("memory resources in use\n");
273 return -EBUSY;
274 }
275
276 pdbg("chipselect %u irq %u res %08lx\n", board->chipselect,
277 board->irq_pin, (unsigned long) res->start);
278
279 tf_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + TASK_FILE,
280 REGS_SIZE);
281 ctl_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + ALT_MODE,
282 REGS_SIZE);
283 if (!tf_base || !ctl_base) {
284 perr("can't map memory regions\n");
285 return -EBUSY;
286 }
287
288 memset(&hw, 0, sizeof(hw));
289
290 if (board->flags & AT91_IDE_SWAP_A0_A2) {
291 /* workaround for stupid hardware bug */
292 hw.io_ports.data_addr = tf_base + 0;
293 hw.io_ports.error_addr = tf_base + 4;
294 hw.io_ports.nsect_addr = tf_base + 2;
295 hw.io_ports.lbal_addr = tf_base + 6;
296 hw.io_ports.lbam_addr = tf_base + 1;
297 hw.io_ports.lbah_addr = tf_base + 5;
298 hw.io_ports.device_addr = tf_base + 3;
299 hw.io_ports.command_addr = tf_base + 7;
300 hw.io_ports.ctl_addr = ctl_base + 3;
301 } else
302 ide_std_init_ports(&hw, tf_base, ctl_base + 6);
303
304 hw.irq = board->irq_pin;
305 hw.dev = &pdev->dev;
306
307 host = ide_host_alloc(&at91_ide_port_info, hws, 1);
308 if (!host) {
309 perr("failed to allocate ide host\n");
310 return -ENOMEM;
311 }
312
313 /* setup Static Memory Controller - PIO 0 as default */
314 apply_timings(board->chipselect, 0, ide_timing_find_mode(XFER_PIO_0), 0);
315
316 /* with GPIO interrupt we have to do quirks in handler */
317 if (gpio_is_valid(board->irq_pin))
318 host->irq_handler = at91_irq_handler;
319
320 host->ports[0]->select_data = board->chipselect;
321
322 ret = ide_host_register(host, &at91_ide_port_info, hws);
323 if (ret) {
324 perr("failed to register ide host\n");
325 goto err_free_host;
326 }
327 platform_set_drvdata(pdev, host);
328 return 0;
329
330err_free_host:
331 ide_host_free(host);
332 return ret;
333}
334
335static int __exit at91_ide_remove(struct platform_device *pdev)
336{
337 struct ide_host *host = platform_get_drvdata(pdev);
338
339 ide_host_remove(host);
340 return 0;
341}
342
343static struct platform_driver at91_ide_driver = {
344 .driver = {
345 .name = DRV_NAME,
346 .owner = THIS_MODULE,
347 },
348 .remove = __exit_p(at91_ide_remove),
349};
350
351static int __init at91_ide_init(void)
352{
353 return platform_driver_probe(&at91_ide_driver, at91_ide_probe);
354}
355
356static void __exit at91_ide_exit(void)
357{
358 platform_driver_unregister(&at91_ide_driver);
359}
360
361module_init(at91_ide_init);
362module_exit(at91_ide_exit);
363
364MODULE_LICENSE("GPL");
365MODULE_AUTHOR("Stanislaw Gruszka <stf_xl@wp.pl>");
366
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 75049e765191..b026896206ca 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -710,7 +710,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
710 req = NULL; 710 req = NULL;
711 spin_lock_irqsave(&state->lock, flags); 711 spin_lock_irqsave(&state->lock, flags);
712 add_wait_queue(&state->wait_queue, &wait); 712 add_wait_queue(&state->wait_queue, &wait);
713 current->state = TASK_INTERRUPTIBLE; 713 set_current_state(TASK_INTERRUPTIBLE);
714 714
715 for (;;) { 715 for (;;) {
716 req = state->completed; 716 req = state->completed;
@@ -734,7 +734,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
734 spin_lock_irqsave(&state->lock, flags); 734 spin_lock_irqsave(&state->lock, flags);
735 } 735 }
736 736
737 current->state = TASK_RUNNING; 737 set_current_state(TASK_RUNNING);
738 remove_wait_queue(&state->wait_queue, &wait); 738 remove_wait_queue(&state->wait_queue, &wait);
739 spin_unlock_irqrestore(&state->lock, flags); 739 spin_unlock_irqrestore(&state->lock, flags);
740 740
diff --git a/drivers/media/radio/wl128x/Kconfig b/drivers/media/radio/wl128x/Kconfig
index 86b28579f0c7..ea1e6545df36 100644
--- a/drivers/media/radio/wl128x/Kconfig
+++ b/drivers/media/radio/wl128x/Kconfig
@@ -4,8 +4,8 @@
4menu "Texas Instruments WL128x FM driver (ST based)" 4menu "Texas Instruments WL128x FM driver (ST based)"
5config RADIO_WL128X 5config RADIO_WL128X
6 tristate "Texas Instruments WL128x FM Radio" 6 tristate "Texas Instruments WL128x FM Radio"
7 depends on VIDEO_V4L2 && RFKILL 7 depends on VIDEO_V4L2 && RFKILL && GPIOLIB
8 select TI_ST if NET && GPIOLIB 8 select TI_ST if NET
9 help 9 help
10 Choose Y here if you have this FM radio chip. 10 Choose Y here if you have this FM radio chip.
11 11
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 3aeb29a7ce11..7f26fdf2e54e 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -47,7 +47,7 @@
47#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" 47#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"
48#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" 48#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display"
49#define MOD_NAME "imon" 49#define MOD_NAME "imon"
50#define MOD_VERSION "0.9.3" 50#define MOD_VERSION "0.9.4"
51 51
52#define DISPLAY_MINOR_BASE 144 52#define DISPLAY_MINOR_BASE 144
53#define DEVICE_NAME "lcd%d" 53#define DEVICE_NAME "lcd%d"
@@ -1658,9 +1658,17 @@ static void usb_rx_callback_intf0(struct urb *urb)
1658 return; 1658 return;
1659 1659
1660 ictx = (struct imon_context *)urb->context; 1660 ictx = (struct imon_context *)urb->context;
1661 if (!ictx || !ictx->dev_present_intf0) 1661 if (!ictx)
1662 return; 1662 return;
1663 1663
1664 /*
1665 * if we get a callback before we're done configuring the hardware, we
1666 * can't yet process the data, as there's nowhere to send it, but we
1667 * still need to submit a new rx URB to avoid wedging the hardware
1668 */
1669 if (!ictx->dev_present_intf0)
1670 goto out;
1671
1664 switch (urb->status) { 1672 switch (urb->status) {
1665 case -ENOENT: /* usbcore unlink successful! */ 1673 case -ENOENT: /* usbcore unlink successful! */
1666 return; 1674 return;
@@ -1678,6 +1686,7 @@ static void usb_rx_callback_intf0(struct urb *urb)
1678 break; 1686 break;
1679 } 1687 }
1680 1688
1689out:
1681 usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC); 1690 usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC);
1682} 1691}
1683 1692
@@ -1690,9 +1699,17 @@ static void usb_rx_callback_intf1(struct urb *urb)
1690 return; 1699 return;
1691 1700
1692 ictx = (struct imon_context *)urb->context; 1701 ictx = (struct imon_context *)urb->context;
1693 if (!ictx || !ictx->dev_present_intf1) 1702 if (!ictx)
1694 return; 1703 return;
1695 1704
1705 /*
1706 * if we get a callback before we're done configuring the hardware, we
1707 * can't yet process the data, as there's nowhere to send it, but we
1708 * still need to submit a new rx URB to avoid wedging the hardware
1709 */
1710 if (!ictx->dev_present_intf1)
1711 goto out;
1712
1696 switch (urb->status) { 1713 switch (urb->status) {
1697 case -ENOENT: /* usbcore unlink successful! */ 1714 case -ENOENT: /* usbcore unlink successful! */
1698 return; 1715 return;
@@ -1710,6 +1727,7 @@ static void usb_rx_callback_intf1(struct urb *urb)
1710 break; 1727 break;
1711 } 1728 }
1712 1729
1730out:
1713 usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC); 1731 usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC);
1714} 1732}
1715 1733
@@ -2242,7 +2260,7 @@ find_endpoint_failed:
2242 mutex_unlock(&ictx->lock); 2260 mutex_unlock(&ictx->lock);
2243 usb_free_urb(rx_urb); 2261 usb_free_urb(rx_urb);
2244rx_urb_alloc_failed: 2262rx_urb_alloc_failed:
2245 dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret); 2263 dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret);
2246 2264
2247 return NULL; 2265 return NULL;
2248} 2266}
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c
index e5eb56a5b618..6510110f53d0 100644
--- a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -154,10 +154,20 @@ static int device_authorization(struct hdpvr_device *dev)
154 } 154 }
155#endif 155#endif
156 156
157 dev->fw_ver = dev->usbc_buf[1];
158
157 v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n", 159 v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n",
158 dev->usbc_buf[1], &dev->usbc_buf[2]); 160 dev->fw_ver, &dev->usbc_buf[2]);
161
162 if (dev->fw_ver > 0x15) {
163 dev->options.brightness = 0x80;
164 dev->options.contrast = 0x40;
165 dev->options.hue = 0xf;
166 dev->options.saturation = 0x40;
167 dev->options.sharpness = 0x80;
168 }
159 169
160 switch (dev->usbc_buf[1]) { 170 switch (dev->fw_ver) {
161 case HDPVR_FIRMWARE_VERSION: 171 case HDPVR_FIRMWARE_VERSION:
162 dev->flags &= ~HDPVR_FLAG_AC3_CAP; 172 dev->flags &= ~HDPVR_FLAG_AC3_CAP;
163 break; 173 break;
@@ -169,7 +179,7 @@ static int device_authorization(struct hdpvr_device *dev)
169 default: 179 default:
170 v4l2_info(&dev->v4l2_dev, "untested firmware, the driver might" 180 v4l2_info(&dev->v4l2_dev, "untested firmware, the driver might"
171 " not work.\n"); 181 " not work.\n");
172 if (dev->usbc_buf[1] >= HDPVR_FIRMWARE_VERSION_AC3) 182 if (dev->fw_ver >= HDPVR_FIRMWARE_VERSION_AC3)
173 dev->flags |= HDPVR_FLAG_AC3_CAP; 183 dev->flags |= HDPVR_FLAG_AC3_CAP;
174 else 184 else
175 dev->flags &= ~HDPVR_FLAG_AC3_CAP; 185 dev->flags &= ~HDPVR_FLAG_AC3_CAP;
@@ -270,6 +280,8 @@ static const struct hdpvr_options hdpvr_default_options = {
270 .bitrate_mode = HDPVR_CONSTANT, 280 .bitrate_mode = HDPVR_CONSTANT,
271 .gop_mode = HDPVR_SIMPLE_IDR_GOP, 281 .gop_mode = HDPVR_SIMPLE_IDR_GOP,
272 .audio_codec = V4L2_MPEG_AUDIO_ENCODING_AAC, 282 .audio_codec = V4L2_MPEG_AUDIO_ENCODING_AAC,
283 /* original picture controls for firmware version <= 0x15 */
284 /* updated in device_authorization() for newer firmware */
273 .brightness = 0x86, 285 .brightness = 0x86,
274 .contrast = 0x80, 286 .contrast = 0x80,
275 .hue = 0x80, 287 .hue = 0x80,
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index 087f7c08cb85..11ffe9cc1780 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -283,12 +283,13 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
283 283
284 hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00); 284 hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
285 285
286 dev->status = STATUS_STREAMING;
287
286 INIT_WORK(&dev->worker, hdpvr_transmit_buffers); 288 INIT_WORK(&dev->worker, hdpvr_transmit_buffers);
287 queue_work(dev->workqueue, &dev->worker); 289 queue_work(dev->workqueue, &dev->worker);
288 290
289 v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, 291 v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
290 "streaming started\n"); 292 "streaming started\n");
291 dev->status = STATUS_STREAMING;
292 293
293 return 0; 294 return 0;
294 } 295 }
@@ -722,21 +723,39 @@ static const s32 supported_v4l2_ctrls[] = {
722}; 723};
723 724
724static int fill_queryctrl(struct hdpvr_options *opt, struct v4l2_queryctrl *qc, 725static int fill_queryctrl(struct hdpvr_options *opt, struct v4l2_queryctrl *qc,
725 int ac3) 726 int ac3, int fw_ver)
726{ 727{
727 int err; 728 int err;
728 729
730 if (fw_ver > 0x15) {
731 switch (qc->id) {
732 case V4L2_CID_BRIGHTNESS:
733 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
734 case V4L2_CID_CONTRAST:
735 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x40);
736 case V4L2_CID_SATURATION:
737 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x40);
738 case V4L2_CID_HUE:
739 return v4l2_ctrl_query_fill(qc, 0x0, 0x1e, 1, 0xf);
740 case V4L2_CID_SHARPNESS:
741 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
742 }
743 } else {
744 switch (qc->id) {
745 case V4L2_CID_BRIGHTNESS:
746 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x86);
747 case V4L2_CID_CONTRAST:
748 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
749 case V4L2_CID_SATURATION:
750 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
751 case V4L2_CID_HUE:
752 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
753 case V4L2_CID_SHARPNESS:
754 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
755 }
756 }
757
729 switch (qc->id) { 758 switch (qc->id) {
730 case V4L2_CID_BRIGHTNESS:
731 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x86);
732 case V4L2_CID_CONTRAST:
733 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
734 case V4L2_CID_SATURATION:
735 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
736 case V4L2_CID_HUE:
737 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
738 case V4L2_CID_SHARPNESS:
739 return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80);
740 case V4L2_CID_MPEG_AUDIO_ENCODING: 759 case V4L2_CID_MPEG_AUDIO_ENCODING:
741 return v4l2_ctrl_query_fill( 760 return v4l2_ctrl_query_fill(
742 qc, V4L2_MPEG_AUDIO_ENCODING_AAC, 761 qc, V4L2_MPEG_AUDIO_ENCODING_AAC,
@@ -794,7 +813,8 @@ static int vidioc_queryctrl(struct file *file, void *private_data,
794 813
795 if (qc->id == supported_v4l2_ctrls[i]) 814 if (qc->id == supported_v4l2_ctrls[i])
796 return fill_queryctrl(&dev->options, qc, 815 return fill_queryctrl(&dev->options, qc,
797 dev->flags & HDPVR_FLAG_AC3_CAP); 816 dev->flags & HDPVR_FLAG_AC3_CAP,
817 dev->fw_ver);
798 818
799 if (qc->id < supported_v4l2_ctrls[i]) 819 if (qc->id < supported_v4l2_ctrls[i])
800 break; 820 break;
diff --git a/drivers/media/video/hdpvr/hdpvr.h b/drivers/media/video/hdpvr/hdpvr.h
index d6439db1d18b..fea3c6926997 100644
--- a/drivers/media/video/hdpvr/hdpvr.h
+++ b/drivers/media/video/hdpvr/hdpvr.h
@@ -113,6 +113,7 @@ struct hdpvr_device {
113 /* usb control transfer buffer and lock */ 113 /* usb control transfer buffer and lock */
114 struct mutex usbc_mutex; 114 struct mutex usbc_mutex;
115 u8 *usbc_buf; 115 u8 *usbc_buf;
116 u8 fw_ver;
116}; 117};
117 118
118static inline struct hdpvr_device *to_hdpvr_dev(struct v4l2_device *v4l2_dev) 119static inline struct hdpvr_device *to_hdpvr_dev(struct v4l2_device *v4l2_dev)
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index a74a79701d34..eaabc27f0fa2 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -1407,7 +1407,7 @@ static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event)
1407static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc) 1407static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc)
1408{ 1408{
1409 struct isp_pipeline *pipe = to_isp_pipeline(&ccdc->subdev.entity); 1409 struct isp_pipeline *pipe = to_isp_pipeline(&ccdc->subdev.entity);
1410 struct video_device *vdev = &ccdc->subdev.devnode; 1410 struct video_device *vdev = ccdc->subdev.devnode;
1411 struct v4l2_event event; 1411 struct v4l2_event event;
1412 1412
1413 memset(&event, 0, sizeof(event)); 1413 memset(&event, 0, sizeof(event));
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 0cad48a284a8..c6a383d0244d 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1694,6 +1694,7 @@ static int mmc_add_disk(struct mmc_blk_data *md)
1694 1694
1695 md->power_ro_lock.show = power_ro_lock_show; 1695 md->power_ro_lock.show = power_ro_lock_show;
1696 md->power_ro_lock.store = power_ro_lock_store; 1696 md->power_ro_lock.store = power_ro_lock_store;
1697 sysfs_attr_init(&md->power_ro_lock.attr);
1697 md->power_ro_lock.attr.mode = mode; 1698 md->power_ro_lock.attr.mode = mode;
1698 md->power_ro_lock.attr.name = 1699 md->power_ro_lock.attr.name =
1699 "ro_lock_until_next_power_on"; 1700 "ro_lock_until_next_power_on";
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f545a3e6eb80..690255c7d4dc 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -290,8 +290,11 @@ static void mmc_wait_for_req_done(struct mmc_host *host,
290static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq, 290static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq,
291 bool is_first_req) 291 bool is_first_req)
292{ 292{
293 if (host->ops->pre_req) 293 if (host->ops->pre_req) {
294 mmc_host_clk_hold(host);
294 host->ops->pre_req(host, mrq, is_first_req); 295 host->ops->pre_req(host, mrq, is_first_req);
296 mmc_host_clk_release(host);
297 }
295} 298}
296 299
297/** 300/**
@@ -306,8 +309,11 @@ static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq,
306static void mmc_post_req(struct mmc_host *host, struct mmc_request *mrq, 309static void mmc_post_req(struct mmc_host *host, struct mmc_request *mrq,
307 int err) 310 int err)
308{ 311{
309 if (host->ops->post_req) 312 if (host->ops->post_req) {
313 mmc_host_clk_hold(host);
310 host->ops->post_req(host, mrq, err); 314 host->ops->post_req(host, mrq, err);
315 mmc_host_clk_release(host);
316 }
311} 317}
312 318
313/** 319/**
@@ -620,7 +626,9 @@ int mmc_host_enable(struct mmc_host *host)
620 int err; 626 int err;
621 627
622 host->en_dis_recurs = 1; 628 host->en_dis_recurs = 1;
629 mmc_host_clk_hold(host);
623 err = host->ops->enable(host); 630 err = host->ops->enable(host);
631 mmc_host_clk_release(host);
624 host->en_dis_recurs = 0; 632 host->en_dis_recurs = 0;
625 633
626 if (err) { 634 if (err) {
@@ -640,7 +648,9 @@ static int mmc_host_do_disable(struct mmc_host *host, int lazy)
640 int err; 648 int err;
641 649
642 host->en_dis_recurs = 1; 650 host->en_dis_recurs = 1;
651 mmc_host_clk_hold(host);
643 err = host->ops->disable(host, lazy); 652 err = host->ops->disable(host, lazy);
653 mmc_host_clk_release(host);
644 host->en_dis_recurs = 0; 654 host->en_dis_recurs = 0;
645 655
646 if (err < 0) { 656 if (err < 0) {
@@ -1121,6 +1131,10 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
1121 * might not allow this operation 1131 * might not allow this operation
1122 */ 1132 */
1123 voltage = regulator_get_voltage(supply); 1133 voltage = regulator_get_voltage(supply);
1134
1135 if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
1136 min_uV = max_uV = voltage;
1137
1124 if (voltage < 0) 1138 if (voltage < 0)
1125 result = voltage; 1139 result = voltage;
1126 else if (voltage < min_uV || voltage > max_uV) 1140 else if (voltage < min_uV || voltage > max_uV)
@@ -1203,8 +1217,11 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, bool cmd11
1203 1217
1204 host->ios.signal_voltage = signal_voltage; 1218 host->ios.signal_voltage = signal_voltage;
1205 1219
1206 if (host->ops->start_signal_voltage_switch) 1220 if (host->ops->start_signal_voltage_switch) {
1221 mmc_host_clk_hold(host);
1207 err = host->ops->start_signal_voltage_switch(host, &host->ios); 1222 err = host->ops->start_signal_voltage_switch(host, &host->ios);
1223 mmc_host_clk_release(host);
1224 }
1208 1225
1209 return err; 1226 return err;
1210} 1227}
@@ -1239,6 +1256,7 @@ static void mmc_poweroff_notify(struct mmc_host *host)
1239 int err = 0; 1256 int err = 0;
1240 1257
1241 card = host->card; 1258 card = host->card;
1259 mmc_claim_host(host);
1242 1260
1243 /* 1261 /*
1244 * Send power notify command only if card 1262 * Send power notify command only if card
@@ -1269,6 +1287,7 @@ static void mmc_poweroff_notify(struct mmc_host *host)
1269 /* Set the card state to no notification after the poweroff */ 1287 /* Set the card state to no notification after the poweroff */
1270 card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; 1288 card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION;
1271 } 1289 }
1290 mmc_release_host(host);
1272} 1291}
1273 1292
1274/* 1293/*
@@ -1327,12 +1346,28 @@ static void mmc_power_up(struct mmc_host *host)
1327 1346
1328void mmc_power_off(struct mmc_host *host) 1347void mmc_power_off(struct mmc_host *host)
1329{ 1348{
1349 int err = 0;
1330 mmc_host_clk_hold(host); 1350 mmc_host_clk_hold(host);
1331 1351
1332 host->ios.clock = 0; 1352 host->ios.clock = 0;
1333 host->ios.vdd = 0; 1353 host->ios.vdd = 0;
1334 1354
1335 mmc_poweroff_notify(host); 1355 /*
1356 * For eMMC 4.5 device send AWAKE command before
1357 * POWER_OFF_NOTIFY command, because in sleep state
1358 * eMMC 4.5 devices respond to only RESET and AWAKE cmd
1359 */
1360 if (host->card && mmc_card_is_sleep(host->card) &&
1361 host->bus_ops->resume) {
1362 err = host->bus_ops->resume(host);
1363
1364 if (!err)
1365 mmc_poweroff_notify(host);
1366 else
1367 pr_warning("%s: error %d during resume "
1368 "(continue with poweroff sequence)\n",
1369 mmc_hostname(host), err);
1370 }
1336 1371
1337 /* 1372 /*
1338 * Reset ocr mask to be the highest possible voltage supported for 1373 * Reset ocr mask to be the highest possible voltage supported for
@@ -2386,12 +2421,6 @@ int mmc_suspend_host(struct mmc_host *host)
2386 */ 2421 */
2387 if (mmc_try_claim_host(host)) { 2422 if (mmc_try_claim_host(host)) {
2388 if (host->bus_ops->suspend) { 2423 if (host->bus_ops->suspend) {
2389 /*
2390 * For eMMC 4.5 device send notify command
2391 * before sleep, because in sleep state eMMC 4.5
2392 * devices respond to only RESET and AWAKE cmd
2393 */
2394 mmc_poweroff_notify(host);
2395 err = host->bus_ops->suspend(host); 2424 err = host->bus_ops->suspend(host);
2396 } 2425 }
2397 mmc_do_release_host(host); 2426 mmc_do_release_host(host);
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index fb8a5cd2e4a1..08a7852ade44 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -14,27 +14,6 @@
14 14
15int mmc_register_host_class(void); 15int mmc_register_host_class(void);
16void mmc_unregister_host_class(void); 16void mmc_unregister_host_class(void);
17
18#ifdef CONFIG_MMC_CLKGATE
19void mmc_host_clk_hold(struct mmc_host *host);
20void mmc_host_clk_release(struct mmc_host *host);
21unsigned int mmc_host_clk_rate(struct mmc_host *host);
22
23#else
24static inline void mmc_host_clk_hold(struct mmc_host *host)
25{
26}
27
28static inline void mmc_host_clk_release(struct mmc_host *host)
29{
30}
31
32static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
33{
34 return host->ios.clock;
35}
36#endif
37
38void mmc_host_deeper_disable(struct work_struct *work); 17void mmc_host_deeper_disable(struct work_struct *work);
39 18
40#endif 19#endif
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 59b9ba52e66a..a48066344fa8 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -376,7 +376,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
376 } 376 }
377 377
378 card->ext_csd.raw_hc_erase_gap_size = 378 card->ext_csd.raw_hc_erase_gap_size =
379 ext_csd[EXT_CSD_PARTITION_ATTRIBUTE]; 379 ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
380 card->ext_csd.raw_sec_trim_mult = 380 card->ext_csd.raw_sec_trim_mult =
381 ext_csd[EXT_CSD_SEC_TRIM_MULT]; 381 ext_csd[EXT_CSD_SEC_TRIM_MULT];
382 card->ext_csd.raw_sec_erase_mult = 382 card->ext_csd.raw_sec_erase_mult =
@@ -551,7 +551,7 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
551 goto out; 551 goto out;
552 552
553 /* only compare read only fields */ 553 /* only compare read only fields */
554 err = (!(card->ext_csd.raw_partition_support == 554 err = !((card->ext_csd.raw_partition_support ==
555 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && 555 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
556 (card->ext_csd.raw_erased_mem_count == 556 (card->ext_csd.raw_erased_mem_count ==
557 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && 557 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&
@@ -1006,7 +1006,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1006 err = mmc_select_hs200(card); 1006 err = mmc_select_hs200(card);
1007 else if (host->caps & MMC_CAP_MMC_HIGHSPEED) 1007 else if (host->caps & MMC_CAP_MMC_HIGHSPEED)
1008 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1008 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1009 EXT_CSD_HS_TIMING, 1, 0); 1009 EXT_CSD_HS_TIMING, 1,
1010 card->ext_csd.generic_cmd6_time);
1010 1011
1011 if (err && err != -EBADMSG) 1012 if (err && err != -EBADMSG)
1012 goto free_card; 1013 goto free_card;
@@ -1116,7 +1117,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1116 * Activate wide bus and DDR (if supported). 1117 * Activate wide bus and DDR (if supported).
1117 */ 1118 */
1118 if (!mmc_card_hs200(card) && 1119 if (!mmc_card_hs200(card) &&
1119 (card->csd.mmca_vsn >= CSD_SPEC_VER_3) && 1120 (card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
1120 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { 1121 (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
1121 static unsigned ext_csd_bits[][2] = { 1122 static unsigned ext_csd_bits[][2] = {
1122 { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 }, 1123 { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 },
@@ -1315,11 +1316,13 @@ static int mmc_suspend(struct mmc_host *host)
1315 BUG_ON(!host->card); 1316 BUG_ON(!host->card);
1316 1317
1317 mmc_claim_host(host); 1318 mmc_claim_host(host);
1318 if (mmc_card_can_sleep(host)) 1319 if (mmc_card_can_sleep(host)) {
1319 err = mmc_card_sleep(host); 1320 err = mmc_card_sleep(host);
1320 else if (!mmc_host_is_spi(host)) 1321 if (!err)
1322 mmc_card_set_sleep(host->card);
1323 } else if (!mmc_host_is_spi(host))
1321 mmc_deselect_cards(host); 1324 mmc_deselect_cards(host);
1322 host->card->state &= ~MMC_STATE_HIGHSPEED; 1325 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1323 mmc_release_host(host); 1326 mmc_release_host(host);
1324 1327
1325 return err; 1328 return err;
@@ -1339,7 +1342,11 @@ static int mmc_resume(struct mmc_host *host)
1339 BUG_ON(!host->card); 1342 BUG_ON(!host->card);
1340 1343
1341 mmc_claim_host(host); 1344 mmc_claim_host(host);
1342 err = mmc_init_card(host, host->ocr, host->card); 1345 if (mmc_card_is_sleep(host->card)) {
1346 err = mmc_card_awake(host);
1347 mmc_card_clr_sleep(host->card);
1348 } else
1349 err = mmc_init_card(host, host->ocr, host->card);
1343 mmc_release_host(host); 1350 mmc_release_host(host);
1344 1351
1345 return err; 1352 return err;
@@ -1349,7 +1356,8 @@ static int mmc_power_restore(struct mmc_host *host)
1349{ 1356{
1350 int ret; 1357 int ret;
1351 1358
1352 host->card->state &= ~MMC_STATE_HIGHSPEED; 1359 host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
1360 mmc_card_clr_sleep(host->card);
1353 mmc_claim_host(host); 1361 mmc_claim_host(host);
1354 ret = mmc_init_card(host, host->ocr, host->card); 1362 ret = mmc_init_card(host, host->ocr, host->card);
1355 mmc_release_host(host); 1363 mmc_release_host(host);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index c63ad03c29c7..5017f9354ce2 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -451,9 +451,11 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status)
451 * information and let the hardware specific code 451 * information and let the hardware specific code
452 * return what is possible given the options 452 * return what is possible given the options
453 */ 453 */
454 mmc_host_clk_hold(card->host);
454 drive_strength = card->host->ops->select_drive_strength( 455 drive_strength = card->host->ops->select_drive_strength(
455 card->sw_caps.uhs_max_dtr, 456 card->sw_caps.uhs_max_dtr,
456 host_drv_type, card_drv_type); 457 host_drv_type, card_drv_type);
458 mmc_host_clk_release(card->host);
457 459
458 err = mmc_sd_switch(card, 1, 2, drive_strength, status); 460 err = mmc_sd_switch(card, 1, 2, drive_strength, status);
459 if (err) 461 if (err)
@@ -660,9 +662,12 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
660 goto out; 662 goto out;
661 663
662 /* SPI mode doesn't define CMD19 */ 664 /* SPI mode doesn't define CMD19 */
663 if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) 665 if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) {
666 mmc_host_clk_hold(card->host);
664 err = card->host->ops->execute_tuning(card->host, 667 err = card->host->ops->execute_tuning(card->host,
665 MMC_SEND_TUNING_BLOCK); 668 MMC_SEND_TUNING_BLOCK);
669 mmc_host_clk_release(card->host);
670 }
666 671
667out: 672out:
668 kfree(status); 673 kfree(status);
@@ -850,8 +855,11 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card,
850 if (!reinit) { 855 if (!reinit) {
851 int ro = -1; 856 int ro = -1;
852 857
853 if (host->ops->get_ro) 858 if (host->ops->get_ro) {
859 mmc_host_clk_hold(card->host);
854 ro = host->ops->get_ro(host); 860 ro = host->ops->get_ro(host);
861 mmc_host_clk_release(card->host);
862 }
855 863
856 if (ro < 0) { 864 if (ro < 0) {
857 pr_warning("%s: host does not " 865 pr_warning("%s: host does not "
@@ -967,8 +975,11 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
967 * Since initialization is now complete, enable preset 975 * Since initialization is now complete, enable preset
968 * value registers for UHS-I cards. 976 * value registers for UHS-I cards.
969 */ 977 */
970 if (host->ops->enable_preset_value) 978 if (host->ops->enable_preset_value) {
979 mmc_host_clk_hold(card->host);
971 host->ops->enable_preset_value(host, true); 980 host->ops->enable_preset_value(host, true);
981 mmc_host_clk_release(card->host);
982 }
972 } else { 983 } else {
973 /* 984 /*
974 * Attempt to change to high-speed (if supported) 985 * Attempt to change to high-speed (if supported)
@@ -1151,8 +1162,11 @@ int mmc_attach_sd(struct mmc_host *host)
1151 return err; 1162 return err;
1152 1163
1153 /* Disable preset value enable if already set since last time */ 1164 /* Disable preset value enable if already set since last time */
1154 if (host->ops->enable_preset_value) 1165 if (host->ops->enable_preset_value) {
1166 mmc_host_clk_hold(host);
1155 host->ops->enable_preset_value(host, false); 1167 host->ops->enable_preset_value(host, false);
1168 mmc_host_clk_release(host);
1169 }
1156 1170
1157 err = mmc_send_app_op_cond(host, 0, &ocr); 1171 err = mmc_send_app_op_cond(host, 0, &ocr);
1158 if (err) 1172 if (err)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index bd7bacc950dc..12cde6ee17f5 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -98,10 +98,11 @@ fail:
98 return ret; 98 return ret;
99} 99}
100 100
101static int sdio_read_cccr(struct mmc_card *card) 101static int sdio_read_cccr(struct mmc_card *card, u32 ocr)
102{ 102{
103 int ret; 103 int ret;
104 int cccr_vsn; 104 int cccr_vsn;
105 int uhs = ocr & R4_18V_PRESENT;
105 unsigned char data; 106 unsigned char data;
106 unsigned char speed; 107 unsigned char speed;
107 108
@@ -149,7 +150,7 @@ static int sdio_read_cccr(struct mmc_card *card)
149 card->scr.sda_spec3 = 0; 150 card->scr.sda_spec3 = 0;
150 card->sw_caps.sd3_bus_mode = 0; 151 card->sw_caps.sd3_bus_mode = 0;
151 card->sw_caps.sd3_drv_type = 0; 152 card->sw_caps.sd3_drv_type = 0;
152 if (cccr_vsn >= SDIO_CCCR_REV_3_00) { 153 if (cccr_vsn >= SDIO_CCCR_REV_3_00 && uhs) {
153 card->scr.sda_spec3 = 1; 154 card->scr.sda_spec3 = 1;
154 ret = mmc_io_rw_direct(card, 0, 0, 155 ret = mmc_io_rw_direct(card, 0, 0,
155 SDIO_CCCR_UHS, 0, &data); 156 SDIO_CCCR_UHS, 0, &data);
@@ -712,7 +713,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
712 /* 713 /*
713 * Read the common registers. 714 * Read the common registers.
714 */ 715 */
715 err = sdio_read_cccr(card); 716 err = sdio_read_cccr(card, ocr);
716 if (err) 717 if (err)
717 goto remove; 718 goto remove;
718 719
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index 68f81b9ee0fb..f573e7f9f740 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -146,15 +146,21 @@ static int sdio_irq_thread(void *_host)
146 } 146 }
147 147
148 set_current_state(TASK_INTERRUPTIBLE); 148 set_current_state(TASK_INTERRUPTIBLE);
149 if (host->caps & MMC_CAP_SDIO_IRQ) 149 if (host->caps & MMC_CAP_SDIO_IRQ) {
150 mmc_host_clk_hold(host);
150 host->ops->enable_sdio_irq(host, 1); 151 host->ops->enable_sdio_irq(host, 1);
152 mmc_host_clk_release(host);
153 }
151 if (!kthread_should_stop()) 154 if (!kthread_should_stop())
152 schedule_timeout(period); 155 schedule_timeout(period);
153 set_current_state(TASK_RUNNING); 156 set_current_state(TASK_RUNNING);
154 } while (!kthread_should_stop()); 157 } while (!kthread_should_stop());
155 158
156 if (host->caps & MMC_CAP_SDIO_IRQ) 159 if (host->caps & MMC_CAP_SDIO_IRQ) {
160 mmc_host_clk_hold(host);
157 host->ops->enable_sdio_irq(host, 0); 161 host->ops->enable_sdio_irq(host, 0);
162 mmc_host_clk_release(host);
163 }
158 164
159 pr_debug("%s: IRQ thread exiting with code %d\n", 165 pr_debug("%s: IRQ thread exiting with code %d\n",
160 mmc_hostname(host), ret); 166 mmc_hostname(host), ret);
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index fcfe1eb5acc8..6985cdb0bb26 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -969,11 +969,14 @@ static void atmci_start_request(struct atmel_mci *host,
969 host->data_status = 0; 969 host->data_status = 0;
970 970
971 if (host->need_reset) { 971 if (host->need_reset) {
972 iflags = atmci_readl(host, ATMCI_IMR);
973 iflags &= (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB);
972 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); 974 atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
973 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN); 975 atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
974 atmci_writel(host, ATMCI_MR, host->mode_reg); 976 atmci_writel(host, ATMCI_MR, host->mode_reg);
975 if (host->caps.has_cfg_reg) 977 if (host->caps.has_cfg_reg)
976 atmci_writel(host, ATMCI_CFG, host->cfg_reg); 978 atmci_writel(host, ATMCI_CFG, host->cfg_reg);
979 atmci_writel(host, ATMCI_IER, iflags);
977 host->need_reset = false; 980 host->need_reset = false;
978 } 981 }
979 atmci_writel(host, ATMCI_SDCR, slot->sdc_reg); 982 atmci_writel(host, ATMCI_SDCR, slot->sdc_reg);
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 0e342793ff14..8bec1c36b159 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -22,7 +22,6 @@
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/scatterlist.h>
26#include <linux/seq_file.h> 25#include <linux/seq_file.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/stat.h> 27#include <linux/stat.h>
@@ -502,8 +501,14 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
502 host->dir_status = DW_MCI_SEND_STATUS; 501 host->dir_status = DW_MCI_SEND_STATUS;
503 502
504 if (dw_mci_submit_data_dma(host, data)) { 503 if (dw_mci_submit_data_dma(host, data)) {
504 int flags = SG_MITER_ATOMIC;
505 if (host->data->flags & MMC_DATA_READ)
506 flags |= SG_MITER_TO_SG;
507 else
508 flags |= SG_MITER_FROM_SG;
509
510 sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags);
505 host->sg = data->sg; 511 host->sg = data->sg;
506 host->pio_offset = 0;
507 host->part_buf_start = 0; 512 host->part_buf_start = 0;
508 host->part_buf_count = 0; 513 host->part_buf_count = 0;
509 514
@@ -972,6 +977,7 @@ static void dw_mci_tasklet_func(unsigned long priv)
972 * generates a block interrupt, hence setting 977 * generates a block interrupt, hence setting
973 * the scatter-gather pointer to NULL. 978 * the scatter-gather pointer to NULL.
974 */ 979 */
980 sg_miter_stop(&host->sg_miter);
975 host->sg = NULL; 981 host->sg = NULL;
976 ctrl = mci_readl(host, CTRL); 982 ctrl = mci_readl(host, CTRL);
977 ctrl |= SDMMC_CTRL_FIFO_RESET; 983 ctrl |= SDMMC_CTRL_FIFO_RESET;
@@ -1311,54 +1317,44 @@ static void dw_mci_pull_data(struct dw_mci *host, void *buf, int cnt)
1311 1317
1312static void dw_mci_read_data_pio(struct dw_mci *host) 1318static void dw_mci_read_data_pio(struct dw_mci *host)
1313{ 1319{
1314 struct scatterlist *sg = host->sg; 1320 struct sg_mapping_iter *sg_miter = &host->sg_miter;
1315 void *buf = sg_virt(sg); 1321 void *buf;
1316 unsigned int offset = host->pio_offset; 1322 unsigned int offset;
1317 struct mmc_data *data = host->data; 1323 struct mmc_data *data = host->data;
1318 int shift = host->data_shift; 1324 int shift = host->data_shift;
1319 u32 status; 1325 u32 status;
1320 unsigned int nbytes = 0, len; 1326 unsigned int nbytes = 0, len;
1327 unsigned int remain, fcnt;
1321 1328
1322 do { 1329 do {
1323 len = host->part_buf_count + 1330 if (!sg_miter_next(sg_miter))
1324 (SDMMC_GET_FCNT(mci_readl(host, STATUS)) << shift); 1331 goto done;
1325 if (offset + len <= sg->length) { 1332
1333 host->sg = sg_miter->__sg;
1334 buf = sg_miter->addr;
1335 remain = sg_miter->length;
1336 offset = 0;
1337
1338 do {
1339 fcnt = (SDMMC_GET_FCNT(mci_readl(host, STATUS))
1340 << shift) + host->part_buf_count;
1341 len = min(remain, fcnt);
1342 if (!len)
1343 break;
1326 dw_mci_pull_data(host, (void *)(buf + offset), len); 1344 dw_mci_pull_data(host, (void *)(buf + offset), len);
1327
1328 offset += len; 1345 offset += len;
1329 nbytes += len; 1346 nbytes += len;
1330 1347 remain -= len;
1331 if (offset == sg->length) { 1348 } while (remain);
1332 flush_dcache_page(sg_page(sg)); 1349 sg_miter->consumed = offset;
1333 host->sg = sg = sg_next(sg);
1334 if (!sg)
1335 goto done;
1336
1337 offset = 0;
1338 buf = sg_virt(sg);
1339 }
1340 } else {
1341 unsigned int remaining = sg->length - offset;
1342 dw_mci_pull_data(host, (void *)(buf + offset),
1343 remaining);
1344 nbytes += remaining;
1345
1346 flush_dcache_page(sg_page(sg));
1347 host->sg = sg = sg_next(sg);
1348 if (!sg)
1349 goto done;
1350
1351 offset = len - remaining;
1352 buf = sg_virt(sg);
1353 dw_mci_pull_data(host, buf, offset);
1354 nbytes += offset;
1355 }
1356 1350
1357 status = mci_readl(host, MINTSTS); 1351 status = mci_readl(host, MINTSTS);
1358 mci_writel(host, RINTSTS, SDMMC_INT_RXDR); 1352 mci_writel(host, RINTSTS, SDMMC_INT_RXDR);
1359 if (status & DW_MCI_DATA_ERROR_FLAGS) { 1353 if (status & DW_MCI_DATA_ERROR_FLAGS) {
1360 host->data_status = status; 1354 host->data_status = status;
1361 data->bytes_xfered += nbytes; 1355 data->bytes_xfered += nbytes;
1356 sg_miter_stop(sg_miter);
1357 host->sg = NULL;
1362 smp_wmb(); 1358 smp_wmb();
1363 1359
1364 set_bit(EVENT_DATA_ERROR, &host->pending_events); 1360 set_bit(EVENT_DATA_ERROR, &host->pending_events);
@@ -1367,65 +1363,66 @@ static void dw_mci_read_data_pio(struct dw_mci *host)
1367 return; 1363 return;
1368 } 1364 }
1369 } while (status & SDMMC_INT_RXDR); /*if the RXDR is ready read again*/ 1365 } while (status & SDMMC_INT_RXDR); /*if the RXDR is ready read again*/
1370 host->pio_offset = offset;
1371 data->bytes_xfered += nbytes; 1366 data->bytes_xfered += nbytes;
1367
1368 if (!remain) {
1369 if (!sg_miter_next(sg_miter))
1370 goto done;
1371 sg_miter->consumed = 0;
1372 }
1373 sg_miter_stop(sg_miter);
1372 return; 1374 return;
1373 1375
1374done: 1376done:
1375 data->bytes_xfered += nbytes; 1377 data->bytes_xfered += nbytes;
1378 sg_miter_stop(sg_miter);
1379 host->sg = NULL;
1376 smp_wmb(); 1380 smp_wmb();
1377 set_bit(EVENT_XFER_COMPLETE, &host->pending_events); 1381 set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
1378} 1382}
1379 1383
1380static void dw_mci_write_data_pio(struct dw_mci *host) 1384static void dw_mci_write_data_pio(struct dw_mci *host)
1381{ 1385{
1382 struct scatterlist *sg = host->sg; 1386 struct sg_mapping_iter *sg_miter = &host->sg_miter;
1383 void *buf = sg_virt(sg); 1387 void *buf;
1384 unsigned int offset = host->pio_offset; 1388 unsigned int offset;
1385 struct mmc_data *data = host->data; 1389 struct mmc_data *data = host->data;
1386 int shift = host->data_shift; 1390 int shift = host->data_shift;
1387 u32 status; 1391 u32 status;
1388 unsigned int nbytes = 0, len; 1392 unsigned int nbytes = 0, len;
1393 unsigned int fifo_depth = host->fifo_depth;
1394 unsigned int remain, fcnt;
1389 1395
1390 do { 1396 do {
1391 len = ((host->fifo_depth - 1397 if (!sg_miter_next(sg_miter))
1392 SDMMC_GET_FCNT(mci_readl(host, STATUS))) << shift) 1398 goto done;
1393 - host->part_buf_count; 1399
1394 if (offset + len <= sg->length) { 1400 host->sg = sg_miter->__sg;
1401 buf = sg_miter->addr;
1402 remain = sg_miter->length;
1403 offset = 0;
1404
1405 do {
1406 fcnt = ((fifo_depth -
1407 SDMMC_GET_FCNT(mci_readl(host, STATUS)))
1408 << shift) - host->part_buf_count;
1409 len = min(remain, fcnt);
1410 if (!len)
1411 break;
1395 host->push_data(host, (void *)(buf + offset), len); 1412 host->push_data(host, (void *)(buf + offset), len);
1396
1397 offset += len; 1413 offset += len;
1398 nbytes += len; 1414 nbytes += len;
1399 if (offset == sg->length) { 1415 remain -= len;
1400 host->sg = sg = sg_next(sg); 1416 } while (remain);
1401 if (!sg) 1417 sg_miter->consumed = offset;
1402 goto done;
1403
1404 offset = 0;
1405 buf = sg_virt(sg);
1406 }
1407 } else {
1408 unsigned int remaining = sg->length - offset;
1409
1410 host->push_data(host, (void *)(buf + offset),
1411 remaining);
1412 nbytes += remaining;
1413
1414 host->sg = sg = sg_next(sg);
1415 if (!sg)
1416 goto done;
1417
1418 offset = len - remaining;
1419 buf = sg_virt(sg);
1420 host->push_data(host, (void *)buf, offset);
1421 nbytes += offset;
1422 }
1423 1418
1424 status = mci_readl(host, MINTSTS); 1419 status = mci_readl(host, MINTSTS);
1425 mci_writel(host, RINTSTS, SDMMC_INT_TXDR); 1420 mci_writel(host, RINTSTS, SDMMC_INT_TXDR);
1426 if (status & DW_MCI_DATA_ERROR_FLAGS) { 1421 if (status & DW_MCI_DATA_ERROR_FLAGS) {
1427 host->data_status = status; 1422 host->data_status = status;
1428 data->bytes_xfered += nbytes; 1423 data->bytes_xfered += nbytes;
1424 sg_miter_stop(sg_miter);
1425 host->sg = NULL;
1429 1426
1430 smp_wmb(); 1427 smp_wmb();
1431 1428
@@ -1435,12 +1432,20 @@ static void dw_mci_write_data_pio(struct dw_mci *host)
1435 return; 1432 return;
1436 } 1433 }
1437 } while (status & SDMMC_INT_TXDR); /* if TXDR write again */ 1434 } while (status & SDMMC_INT_TXDR); /* if TXDR write again */
1438 host->pio_offset = offset;
1439 data->bytes_xfered += nbytes; 1435 data->bytes_xfered += nbytes;
1436
1437 if (!remain) {
1438 if (!sg_miter_next(sg_miter))
1439 goto done;
1440 sg_miter->consumed = 0;
1441 }
1442 sg_miter_stop(sg_miter);
1440 return; 1443 return;
1441 1444
1442done: 1445done:
1443 data->bytes_xfered += nbytes; 1446 data->bytes_xfered += nbytes;
1447 sg_miter_stop(sg_miter);
1448 host->sg = NULL;
1444 smp_wmb(); 1449 smp_wmb();
1445 set_bit(EVENT_XFER_COMPLETE, &host->pending_events); 1450 set_bit(EVENT_XFER_COMPLETE, &host->pending_events);
1446} 1451}
@@ -1643,6 +1648,7 @@ static void dw_mci_work_routine_card(struct work_struct *work)
1643 * block interrupt, hence setting the 1648 * block interrupt, hence setting the
1644 * scatter-gather pointer to NULL. 1649 * scatter-gather pointer to NULL.
1645 */ 1650 */
1651 sg_miter_stop(&host->sg_miter);
1646 host->sg = NULL; 1652 host->sg = NULL;
1647 1653
1648 ctrl = mci_readl(host, CTRL); 1654 ctrl = mci_readl(host, CTRL);
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index ab66f2454dc4..1534b582c419 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -113,8 +113,8 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
113 const int j = i * 2; 113 const int j = i * 2;
114 u32 mask; 114 u32 mask;
115 115
116 mask = mmc_vddrange_to_ocrmask(voltage_ranges[j], 116 mask = mmc_vddrange_to_ocrmask(be32_to_cpu(voltage_ranges[j]),
117 voltage_ranges[j + 1]); 117 be32_to_cpu(voltage_ranges[j + 1]));
118 if (!mask) { 118 if (!mask) {
119 ret = -EINVAL; 119 ret = -EINVAL;
120 dev_err(dev, "OF: voltage-range #%d is invalid\n", i); 120 dev_err(dev, "OF: voltage-range #%d is invalid\n", i);
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index ff4adc018041..5d876ff86f37 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -38,6 +38,23 @@ static u8 esdhc_readb(struct sdhci_host *host, int reg)
38 int base = reg & ~0x3; 38 int base = reg & ~0x3;
39 int shift = (reg & 0x3) * 8; 39 int shift = (reg & 0x3) * 8;
40 u8 ret = (in_be32(host->ioaddr + base) >> shift) & 0xff; 40 u8 ret = (in_be32(host->ioaddr + base) >> shift) & 0xff;
41
42 /*
43 * "DMA select" locates at offset 0x28 in SD specification, but on
44 * P5020 or P3041, it locates at 0x29.
45 */
46 if (reg == SDHCI_HOST_CONTROL) {
47 u32 dma_bits;
48
49 dma_bits = in_be32(host->ioaddr + reg);
50 /* DMA select is 22,23 bits in Protocol Control Register */
51 dma_bits = (dma_bits >> 5) & SDHCI_CTRL_DMA_MASK;
52
53 /* fixup the result */
54 ret &= ~SDHCI_CTRL_DMA_MASK;
55 ret |= dma_bits;
56 }
57
41 return ret; 58 return ret;
42} 59}
43 60
@@ -56,6 +73,21 @@ static void esdhc_writew(struct sdhci_host *host, u16 val, int reg)
56 73
57static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg) 74static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg)
58{ 75{
76 /*
77 * "DMA select" location is offset 0x28 in SD specification, but on
78 * P5020 or P3041, it's located at 0x29.
79 */
80 if (reg == SDHCI_HOST_CONTROL) {
81 u32 dma_bits;
82
83 /* DMA select is 22,23 bits in Protocol Control Register */
84 dma_bits = (val & SDHCI_CTRL_DMA_MASK) << 5;
85 clrsetbits_be32(host->ioaddr + reg , SDHCI_CTRL_DMA_MASK << 5,
86 dma_bits);
87 val &= ~SDHCI_CTRL_DMA_MASK;
88 val |= in_be32(host->ioaddr + reg) & SDHCI_CTRL_DMA_MASK;
89 }
90
59 /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */ 91 /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */
60 if (reg == SDHCI_HOST_CONTROL) 92 if (reg == SDHCI_HOST_CONTROL)
61 val &= ~ESDHC_HOST_CONTROL_RES; 93 val &= ~ESDHC_HOST_CONTROL_RES;
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 7165e6a09274..6ebdc4010e7c 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -250,7 +250,7 @@ static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
250 250
251static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot) 251static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot)
252{ 252{
253 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD; 253 slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE;
254 return 0; 254 return 0;
255} 255}
256 256
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 03970bcb3495..c5c2a48bdd94 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -2,7 +2,7 @@
2 * sdhci-pltfm.c Support for SDHCI platform devices 2 * sdhci-pltfm.c Support for SDHCI platform devices
3 * Copyright (c) 2009 Intel Corporation 3 * Copyright (c) 2009 Intel Corporation
4 * 4 *
5 * Copyright (c) 2007 Freescale Semiconductor, Inc. 5 * Copyright (c) 2007, 2011 Freescale Semiconductor, Inc.
6 * Copyright (c) 2009 MontaVista Software, Inc. 6 * Copyright (c) 2009 MontaVista Software, Inc.
7 * 7 *
8 * Authors: Xiaobo Xie <X.Xie@freescale.com> 8 * Authors: Xiaobo Xie <X.Xie@freescale.com>
@@ -71,6 +71,14 @@ void sdhci_get_of_property(struct platform_device *pdev)
71 if (sdhci_of_wp_inverted(np)) 71 if (sdhci_of_wp_inverted(np))
72 host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT; 72 host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
73 73
74 if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
75 host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
76
77 if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
78 of_device_is_compatible(np, "fsl,p1010-esdhc") ||
79 of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
80 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
81
74 clk = of_get_property(np, "clock-frequency", &size); 82 clk = of_get_property(np, "clock-frequency", &size);
75 if (clk && size == sizeof(*clk) && *clk) 83 if (clk && size == sizeof(*clk) && *clk)
76 pltfm_host->clock = be32_to_cpup(clk); 84 pltfm_host->clock = be32_to_cpup(clk);
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index f5d8b53be333..352d4797865b 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1327,7 +1327,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1327 if (ret < 0) 1327 if (ret < 0)
1328 goto clean_up2; 1328 goto clean_up2;
1329 1329
1330 mmc_add_host(mmc); 1330 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
1331 1331
1332 sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); 1332 sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
1333 1333
@@ -1338,22 +1338,24 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1338 } 1338 }
1339 ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:int", host); 1339 ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:int", host);
1340 if (ret) { 1340 if (ret) {
1341 free_irq(irq[0], host);
1342 dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n"); 1341 dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
1343 goto clean_up3; 1342 goto clean_up4;
1344 } 1343 }
1345 1344
1346 INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); 1345 ret = mmc_add_host(mmc);
1347 1346 if (ret < 0)
1348 mmc_detect_change(host->mmc, 0); 1347 goto clean_up5;
1349 1348
1350 dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION); 1349 dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION);
1351 dev_dbg(&pdev->dev, "chip ver H'%04x\n", 1350 dev_dbg(&pdev->dev, "chip ver H'%04x\n",
1352 sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff); 1351 sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
1353 return ret; 1352 return ret;
1354 1353
1354clean_up5:
1355 free_irq(irq[1], host);
1356clean_up4:
1357 free_irq(irq[0], host);
1355clean_up3: 1358clean_up3:
1356 mmc_remove_host(mmc);
1357 pm_runtime_suspend(&pdev->dev); 1359 pm_runtime_suspend(&pdev->dev);
1358clean_up2: 1360clean_up2:
1359 pm_runtime_disable(&pdev->dev); 1361 pm_runtime_disable(&pdev->dev);
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index a95e6d901726..f96c536d130a 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -20,8 +20,8 @@
20#include <linux/mmc/tmio.h> 20#include <linux/mmc/tmio.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/spinlock.h>
24#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/spinlock.h>
25 25
26/* Definitions for values the CTRL_SDIO_STATUS register can take. */ 26/* Definitions for values the CTRL_SDIO_STATUS register can take. */
27#define TMIO_SDIO_STAT_IOIRQ 0x0001 27#define TMIO_SDIO_STAT_IOIRQ 0x0001
@@ -120,6 +120,7 @@ void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data);
120void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable); 120void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable);
121void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata); 121void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata);
122void tmio_mmc_release_dma(struct tmio_mmc_host *host); 122void tmio_mmc_release_dma(struct tmio_mmc_host *host);
123void tmio_mmc_abort_dma(struct tmio_mmc_host *host);
123#else 124#else
124static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host, 125static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host,
125 struct mmc_data *data) 126 struct mmc_data *data)
@@ -140,6 +141,10 @@ static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host,
140static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host) 141static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host)
141{ 142{
142} 143}
144
145static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
146{
147}
143#endif 148#endif
144 149
145#ifdef CONFIG_PM 150#ifdef CONFIG_PM
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 7a6e6cc8f8b8..8253ec12003e 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -34,6 +34,18 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
34#endif 34#endif
35} 35}
36 36
37void tmio_mmc_abort_dma(struct tmio_mmc_host *host)
38{
39 tmio_mmc_enable_dma(host, false);
40
41 if (host->chan_rx)
42 dmaengine_terminate_all(host->chan_rx);
43 if (host->chan_tx)
44 dmaengine_terminate_all(host->chan_tx);
45
46 tmio_mmc_enable_dma(host, true);
47}
48
37static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) 49static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host)
38{ 50{
39 struct scatterlist *sg = host->sg_ptr, *sg_tmp; 51 struct scatterlist *sg = host->sg_ptr, *sg_tmp;
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index abad01b37cfb..5f9ad74fbf80 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -41,8 +41,8 @@
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/pm_runtime.h> 42#include <linux/pm_runtime.h>
43#include <linux/scatterlist.h> 43#include <linux/scatterlist.h>
44#include <linux/workqueue.h>
45#include <linux/spinlock.h> 44#include <linux/spinlock.h>
45#include <linux/workqueue.h>
46 46
47#include "tmio_mmc.h" 47#include "tmio_mmc.h"
48 48
@@ -246,6 +246,7 @@ static void tmio_mmc_reset_work(struct work_struct *work)
246 /* Ready for new calls */ 246 /* Ready for new calls */
247 host->mrq = NULL; 247 host->mrq = NULL;
248 248
249 tmio_mmc_abort_dma(host);
249 mmc_request_done(host->mmc, mrq); 250 mmc_request_done(host->mmc, mrq);
250} 251}
251 252
@@ -272,6 +273,9 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host)
272 host->mrq = NULL; 273 host->mrq = NULL;
273 spin_unlock_irqrestore(&host->lock, flags); 274 spin_unlock_irqrestore(&host->lock, flags);
274 275
276 if (mrq->cmd->error || (mrq->data && mrq->data->error))
277 tmio_mmc_abort_dma(host);
278
275 mmc_request_done(host->mmc, mrq); 279 mmc_request_done(host->mmc, mrq);
276} 280}
277 281
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 04a3f1b756a8..192b0d118df4 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -95,11 +95,16 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags); 95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
96} 96}
97 97
98static int sja1000_is_absent(struct sja1000_priv *priv)
99{
100 return (priv->read_reg(priv, REG_MOD) == 0xFF);
101}
102
98static int sja1000_probe_chip(struct net_device *dev) 103static int sja1000_probe_chip(struct net_device *dev)
99{ 104{
100 struct sja1000_priv *priv = netdev_priv(dev); 105 struct sja1000_priv *priv = netdev_priv(dev);
101 106
102 if (priv->reg_base && (priv->read_reg(priv, 0) == 0xFF)) { 107 if (priv->reg_base && sja1000_is_absent(priv)) {
103 printk(KERN_INFO "%s: probing @0x%lX failed\n", 108 printk(KERN_INFO "%s: probing @0x%lX failed\n",
104 DRV_NAME, dev->base_addr); 109 DRV_NAME, dev->base_addr);
105 return 0; 110 return 0;
@@ -493,6 +498,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
493 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { 498 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
494 n++; 499 n++;
495 status = priv->read_reg(priv, REG_SR); 500 status = priv->read_reg(priv, REG_SR);
501 /* check for absent controller due to hw unplug */
502 if (status == 0xFF && sja1000_is_absent(priv))
503 return IRQ_NONE;
496 504
497 if (isrc & IRQ_WUI) 505 if (isrc & IRQ_WUI)
498 dev_warn(dev->dev.parent, "wakeup interrupt\n"); 506 dev_warn(dev->dev.parent, "wakeup interrupt\n");
@@ -509,6 +517,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
509 while (status & SR_RBS) { 517 while (status & SR_RBS) {
510 sja1000_rx(dev); 518 sja1000_rx(dev);
511 status = priv->read_reg(priv, REG_SR); 519 status = priv->read_reg(priv, REG_SR);
520 /* check for absent controller */
521 if (status == 0xFF && sja1000_is_absent(priv))
522 return IRQ_NONE;
512 } 523 }
513 } 524 }
514 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { 525 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 8153a3e0a1a4..f9b74c0a8492 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1842,7 +1842,7 @@ vortex_timer(unsigned long data)
1842 ok = 1; 1842 ok = 1;
1843 } 1843 }
1844 1844
1845 if (!netif_carrier_ok(dev)) 1845 if (dev->flags & IFF_SLAVE || !netif_carrier_ok(dev))
1846 next_tick = 5*HZ; 1846 next_tick = 5*HZ;
1847 1847
1848 if (vp->medialock) 1848 if (vp->medialock)
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index b8591246eb4c..1ff3c6df35a2 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2244,10 +2244,6 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
2244 dev_info(&adapter->pdev->dev, "tx locked\n"); 2244 dev_info(&adapter->pdev->dev, "tx locked\n");
2245 return NETDEV_TX_LOCKED; 2245 return NETDEV_TX_LOCKED;
2246 } 2246 }
2247 if (skb->mark == 0x01)
2248 type = atl1c_trans_high;
2249 else
2250 type = atl1c_trans_normal;
2251 2247
2252 if (atl1c_tpd_avail(adapter, type) < tpd_req) { 2248 if (atl1c_tpd_avail(adapter, type) < tpd_req) {
2253 /* no enough descriptor, just stop queue */ 2249 /* no enough descriptor, just stop queue */
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 3fb66d09ece5..cab87456a34a 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2339,7 +2339,7 @@ static inline int __init b44_pci_init(void)
2339 return err; 2339 return err;
2340} 2340}
2341 2341
2342static inline void __exit b44_pci_exit(void) 2342static inline void b44_pci_exit(void)
2343{ 2343{
2344#ifdef CONFIG_B44_PCI 2344#ifdef CONFIG_B44_PCI
2345 ssb_pcihost_unregister(&b44_pci_driver); 2345 ssb_pcihost_unregister(&b44_pci_driver);
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 986019b2c849..c7ca7ec065ee 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -797,7 +797,7 @@ static int bcm_enet_open(struct net_device *dev)
797 if (priv->has_phy) { 797 if (priv->has_phy) {
798 /* connect to PHY */ 798 /* connect to PHY */
799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, 799 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
800 priv->mac_id ? "1" : "0", priv->phy_id); 800 priv->mii_bus->id, priv->phy_id);
801 801
802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0, 802 phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0,
803 PHY_INTERFACE_MODE_MII); 803 PHY_INTERFACE_MODE_MII);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 1e3f978ee6da..254521319150 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -117,10 +117,6 @@ static int dropless_fc;
117module_param(dropless_fc, int, 0); 117module_param(dropless_fc, int, 0);
118MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring"); 118MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring");
119 119
120static int poll;
121module_param(poll, int, 0);
122MODULE_PARM_DESC(poll, " Use polling (for debug)");
123
124static int mrrs = -1; 120static int mrrs = -1;
125module_param(mrrs, int, 0); 121module_param(mrrs, int, 0);
126MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)"); 122MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)");
@@ -4834,20 +4830,11 @@ void bnx2x_drv_pulse(struct bnx2x *bp)
4834 4830
4835static void bnx2x_timer(unsigned long data) 4831static void bnx2x_timer(unsigned long data)
4836{ 4832{
4837 u8 cos;
4838 struct bnx2x *bp = (struct bnx2x *) data; 4833 struct bnx2x *bp = (struct bnx2x *) data;
4839 4834
4840 if (!netif_running(bp->dev)) 4835 if (!netif_running(bp->dev))
4841 return; 4836 return;
4842 4837
4843 if (poll) {
4844 struct bnx2x_fastpath *fp = &bp->fp[0];
4845
4846 for_each_cos_in_tx_queue(fp, cos)
4847 bnx2x_tx_int(bp, &fp->txdata[cos]);
4848 bnx2x_rx_int(fp, 1000);
4849 }
4850
4851 if (!BP_NOMCP(bp)) { 4838 if (!BP_NOMCP(bp)) {
4852 int mb_idx = BP_FW_MB_IDX(bp); 4839 int mb_idx = BP_FW_MB_IDX(bp);
4853 u32 drv_pulse; 4840 u32 drv_pulse;
@@ -10063,7 +10050,6 @@ static void __devinit bnx2x_set_modes_bitmap(struct bnx2x *bp)
10063static int __devinit bnx2x_init_bp(struct bnx2x *bp) 10050static int __devinit bnx2x_init_bp(struct bnx2x *bp)
10064{ 10051{
10065 int func; 10052 int func;
10066 int timer_interval;
10067 int rc; 10053 int rc;
10068 10054
10069 mutex_init(&bp->port.phy_mutex); 10055 mutex_init(&bp->port.phy_mutex);
@@ -10139,8 +10125,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
10139 bp->tx_ticks = (50 / BNX2X_BTR) * BNX2X_BTR; 10125 bp->tx_ticks = (50 / BNX2X_BTR) * BNX2X_BTR;
10140 bp->rx_ticks = (25 / BNX2X_BTR) * BNX2X_BTR; 10126 bp->rx_ticks = (25 / BNX2X_BTR) * BNX2X_BTR;
10141 10127
10142 timer_interval = (CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ); 10128 bp->current_interval = CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ;
10143 bp->current_interval = (poll ? poll : timer_interval);
10144 10129
10145 init_timer(&bp->timer); 10130 init_timer(&bp->timer);
10146 bp->timer.expires = jiffies + bp->current_interval; 10131 bp->timer.expires = jiffies + bp->current_interval;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index bc0121ac291e..1adef266fcd5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1081,17 +1081,17 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
1081 estats->rx_stat_ifhcinbadoctets_lo); 1081 estats->rx_stat_ifhcinbadoctets_lo);
1082 1082
1083 ADD_64(fstats->total_bytes_received_hi, 1083 ADD_64(fstats->total_bytes_received_hi,
1084 tfunc->rcv_error_bytes.hi, 1084 le32_to_cpu(tfunc->rcv_error_bytes.hi),
1085 fstats->total_bytes_received_lo, 1085 fstats->total_bytes_received_lo,
1086 tfunc->rcv_error_bytes.lo); 1086 le32_to_cpu(tfunc->rcv_error_bytes.lo));
1087 1087
1088 memcpy(estats, &(fstats->total_bytes_received_hi), 1088 memcpy(estats, &(fstats->total_bytes_received_hi),
1089 sizeof(struct host_func_stats) - 2*sizeof(u32)); 1089 sizeof(struct host_func_stats) - 2*sizeof(u32));
1090 1090
1091 ADD_64(estats->error_bytes_received_hi, 1091 ADD_64(estats->error_bytes_received_hi,
1092 tfunc->rcv_error_bytes.hi, 1092 le32_to_cpu(tfunc->rcv_error_bytes.hi),
1093 estats->error_bytes_received_lo, 1093 estats->error_bytes_received_lo,
1094 tfunc->rcv_error_bytes.lo); 1094 le32_to_cpu(tfunc->rcv_error_bytes.lo));
1095 1095
1096 ADD_64(estats->etherstatsoverrsizepkts_hi, 1096 ADD_64(estats->etherstatsoverrsizepkts_hi,
1097 estats->rx_stat_dot3statsframestoolong_hi, 1097 estats->rx_stat_dot3statsframestoolong_hi,
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index dd3a0a232ea0..818a573669e6 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3584,7 +3584,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
3584 fl6.flowi6_oif = dst_addr->sin6_scope_id; 3584 fl6.flowi6_oif = dst_addr->sin6_scope_id;
3585 3585
3586 *dst = ip6_route_output(&init_net, NULL, &fl6); 3586 *dst = ip6_route_output(&init_net, NULL, &fl6);
3587 if (*dst) 3587 if ((*dst)->error) {
3588 dst_release(*dst);
3589 *dst = NULL;
3590 return -ENETUNREACH;
3591 } else
3588 return 0; 3592 return 0;
3589#endif 3593#endif
3590 3594
diff --git a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
index c2c0680a1146..ac37cacc6136 100644
--- a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
+++ b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
@@ -157,7 +157,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,
157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0; 157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0;
158 *fcoe_enc_error = (desc->flags & 158 *fcoe_enc_error = (desc->flags &
159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0; 159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0;
160 *fcoe_eof = (u8)((desc->checksum_fcoe >> 160 *fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >>
161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) & 161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) &
162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK); 162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK);
163 *checksum = 0; 163 *checksum = 0;
diff --git a/drivers/net/ethernet/cisco/enic/enic_pp.c b/drivers/net/ethernet/cisco/enic/enic_pp.c
index 22bf03a1829e..c347b6236f8f 100644
--- a/drivers/net/ethernet/cisco/enic/enic_pp.c
+++ b/drivers/net/ethernet/cisco/enic/enic_pp.c
@@ -72,7 +72,7 @@ static int enic_set_port_profile(struct enic *enic, int vf)
72 struct enic_port_profile *pp; 72 struct enic_port_profile *pp;
73 struct vic_provinfo *vp; 73 struct vic_provinfo *vp;
74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI; 74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
75 const u16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX); 75 const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
76 char uuid_str[38]; 76 char uuid_str[38];
77 char client_mac_str[18]; 77 char client_mac_str[18];
78 u8 *client_mac; 78 u8 *client_mac;
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 1c7aad8fa19c..e92ef1bd732a 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -986,7 +986,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
986 printk(KERN_INFO 986 printk(KERN_INFO
987 "%s: no PHY, assuming direct connection to switch\n", 987 "%s: no PHY, assuming direct connection to switch\n",
988 ndev->name); 988 ndev->name);
989 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); 989 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE);
990 phy_id = 0; 990 phy_id = 0;
991 } 991 }
992 992
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 27d651a80f3f..55cbf65512c3 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -2328,19 +2328,11 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
2328 ((new_mtu) < IPV6_MIN_MTU)) 2328 ((new_mtu) < IPV6_MIN_MTU))
2329 return -EINVAL; 2329 return -EINVAL;
2330 2330
2331 if (new_mtu > 4000) {
2332 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2333 jme->reg_rxcs |= RXCS_FIFOTHNP_64QW;
2334 jme_restart_rx_engine(jme);
2335 } else {
2336 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2337 jme->reg_rxcs |= RXCS_FIFOTHNP_128QW;
2338 jme_restart_rx_engine(jme);
2339 }
2340 2331
2341 netdev->mtu = new_mtu; 2332 netdev->mtu = new_mtu;
2342 netdev_update_features(netdev); 2333 netdev_update_features(netdev);
2343 2334
2335 jme_restart_rx_engine(jme);
2344 jme_reset_link(jme); 2336 jme_reset_link(jme);
2345 2337
2346 return 0; 2338 return 0;
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h
index 4304072bd3c5..3efc897c9913 100644
--- a/drivers/net/ethernet/jme.h
+++ b/drivers/net/ethernet/jme.h
@@ -730,7 +730,7 @@ enum jme_rxcs_values {
730 RXCS_RETRYCNT_60 = 0x00000F00, 730 RXCS_RETRYCNT_60 = 0x00000F00,
731 731
732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T | 732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T |
733 RXCS_FIFOTHNP_128QW | 733 RXCS_FIFOTHNP_16QW |
734 RXCS_DMAREQSZ_128B | 734 RXCS_DMAREQSZ_128B |
735 RXCS_RETRYGAP_256ns | 735 RXCS_RETRYGAP_256ns |
736 RXCS_RETRYCNT_32, 736 RXCS_RETRYCNT_32,
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 55d7bd4e210a..9129ace02560 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -815,8 +815,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
815 int err; 815 int err;
816 int i; 816 int i;
817 817
818 priv->eq_table.uar_map = kcalloc(sizeof *priv->eq_table.uar_map, 818 priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev),
819 mlx4_num_eq_uar(dev), GFP_KERNEL); 819 sizeof *priv->eq_table.uar_map,
820 GFP_KERNEL);
820 if (!priv->eq_table.uar_map) { 821 if (!priv->eq_table.uar_map) {
821 err = -ENOMEM; 822 err = -ENOMEM;
822 goto err_out_free; 823 goto err_out_free;
@@ -1035,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1035 struct mlx4_priv *priv = mlx4_priv(dev); 1036 struct mlx4_priv *priv = mlx4_priv(dev);
1036 int vec = 0, err = 0, i; 1037 int vec = 0, err = 0, i;
1037 1038
1038 spin_lock(&priv->msix_ctl.pool_lock); 1039 mutex_lock(&priv->msix_ctl.pool_lock);
1039 for (i = 0; !vec && i < dev->caps.comp_pool; i++) { 1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) {
1040 if (~priv->msix_ctl.pool_bm & 1ULL << i) { 1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) {
1041 priv->msix_ctl.pool_bm |= 1ULL << i; 1042 priv->msix_ctl.pool_bm |= 1ULL << i;
@@ -1057,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1057 eq_set_ci(&priv->eq_table.eq[vec], 1); 1058 eq_set_ci(&priv->eq_table.eq[vec], 1);
1058 } 1059 }
1059 } 1060 }
1060 spin_unlock(&priv->msix_ctl.pool_lock); 1061 mutex_unlock(&priv->msix_ctl.pool_lock);
1061 1062
1062 if (vec) { 1063 if (vec) {
1063 *vector = vec; 1064 *vector = vec;
@@ -1078,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
1078 if (likely(i >= 0)) { 1079 if (likely(i >= 0)) {
1079 /*sanity check , making sure were not trying to free irq's 1080 /*sanity check , making sure were not trying to free irq's
1080 Belonging to a legacy EQ*/ 1081 Belonging to a legacy EQ*/
1081 spin_lock(&priv->msix_ctl.pool_lock); 1082 mutex_lock(&priv->msix_ctl.pool_lock);
1082 if (priv->msix_ctl.pool_bm & 1ULL << i) { 1083 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1083 free_irq(priv->eq_table.eq[vec].irq, 1084 free_irq(priv->eq_table.eq[vec].irq,
1084 &priv->eq_table.eq[vec]); 1085 &priv->eq_table.eq[vec]);
1085 priv->msix_ctl.pool_bm &= ~(1ULL << i); 1086 priv->msix_ctl.pool_bm &= ~(1ULL << i);
1086 } 1087 }
1087 spin_unlock(&priv->msix_ctl.pool_lock); 1088 mutex_unlock(&priv->msix_ctl.pool_lock);
1088 } 1089 }
1089 1090
1090} 1091}
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 8a21e10952ea..9ea7cabcaf3c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -685,7 +685,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
685 return err; 685 return err;
686} 686}
687 687
688static int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port) 688int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port)
689{ 689{
690 struct mlx4_cmd_mailbox *outbox = ptr; 690 struct mlx4_cmd_mailbox *outbox = ptr;
691 691
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b502fc..d498f049c74e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev,
531 for (port = 0; port < dev->caps.num_ports; port++) { 531 for (port = 0; port < dev->caps.num_ports; port++) {
532 /* Change the port type only if the new type is different 532 /* Change the port type only if the new type is different
533 * from the current, and not set to Auto */ 533 * from the current, and not set to Auto */
534 if (port_types[port] != dev->caps.port_type[port + 1]) { 534 if (port_types[port] != dev->caps.port_type[port + 1])
535 change = 1; 535 change = 1;
536 dev->caps.port_type[port + 1] = port_types[port];
537 }
538 } 536 }
539 if (change) { 537 if (change) {
540 mlx4_unregister_device(dev); 538 mlx4_unregister_device(dev);
541 for (port = 1; port <= dev->caps.num_ports; port++) { 539 for (port = 1; port <= dev->caps.num_ports; port++) {
542 mlx4_CLOSE_PORT(dev, port); 540 mlx4_CLOSE_PORT(dev, port);
541 dev->caps.port_type[port] = port_types[port - 1];
543 err = mlx4_SET_PORT(dev, port); 542 err = mlx4_SET_PORT(dev, port);
544 if (err) { 543 if (err) {
545 mlx4_err(dev, "Failed to set port %d, " 544 mlx4_err(dev, "Failed to set port %d, "
@@ -986,6 +985,9 @@ static int map_bf_area(struct mlx4_dev *dev)
986 resource_size_t bf_len; 985 resource_size_t bf_len;
987 int err = 0; 986 int err = 0;
988 987
988 if (!dev->caps.bf_reg_size)
989 return -ENXIO;
990
989 bf_start = pci_resource_start(dev->pdev, 2) + 991 bf_start = pci_resource_start(dev->pdev, 2) +
990 (dev->caps.num_uars << PAGE_SHIFT); 992 (dev->caps.num_uars << PAGE_SHIFT);
991 bf_len = pci_resource_len(dev->pdev, 2) - 993 bf_len = pci_resource_len(dev->pdev, 2) -
@@ -1825,7 +1827,7 @@ slave_start:
1825 goto err_master_mfunc; 1827 goto err_master_mfunc;
1826 1828
1827 priv->msix_ctl.pool_bm = 0; 1829 priv->msix_ctl.pool_bm = 0;
1828 spin_lock_init(&priv->msix_ctl.pool_lock); 1830 mutex_init(&priv->msix_ctl.pool_lock);
1829 1831
1830 mlx4_enable_msi_x(dev); 1832 mlx4_enable_msi_x(dev);
1831 if ((mlx4_is_mfunc(dev)) && 1833 if ((mlx4_is_mfunc(dev)) &&
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index c92269f8c057..28f8251561f4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -697,7 +697,7 @@ struct mlx4_sense {
697 697
698struct mlx4_msix_ctl { 698struct mlx4_msix_ctl {
699 u64 pool_bm; 699 u64 pool_bm;
700 spinlock_t pool_lock; 700 struct mutex pool_lock;
701}; 701};
702 702
703struct mlx4_steer { 703struct mlx4_steer {
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 8deeef98280c..25a80d71fb2a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -304,7 +304,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox
304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); 304 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
305} 305}
306 306
307static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, 307int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
308 u32 *base_mridx) 308 u32 *base_mridx)
309{ 309{
310 struct mlx4_priv *priv = mlx4_priv(dev); 310 struct mlx4_priv *priv = mlx4_priv(dev);
@@ -320,14 +320,14 @@ static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align,
320} 320}
321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range); 321EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range);
322 322
323static void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt) 323void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt)
324{ 324{
325 struct mlx4_priv *priv = mlx4_priv(dev); 325 struct mlx4_priv *priv = mlx4_priv(dev);
326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt); 326 mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt);
327} 327}
328EXPORT_SYMBOL_GPL(mlx4_mr_release_range); 328EXPORT_SYMBOL_GPL(mlx4_mr_release_range);
329 329
330static int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd, 330int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd,
331 u64 iova, u64 size, u32 access, int npages, 331 u64 iova, u64 size, u32 access, int npages,
332 int page_shift, struct mlx4_mr *mr) 332 int page_shift, struct mlx4_mr *mr)
333{ 333{
@@ -457,7 +457,7 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
457} 457}
458EXPORT_SYMBOL_GPL(mlx4_mr_alloc); 458EXPORT_SYMBOL_GPL(mlx4_mr_alloc);
459 459
460static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) 460void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr)
461{ 461{
462 int err; 462 int err;
463 463
@@ -852,7 +852,7 @@ err_free:
852} 852}
853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); 853EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
854 854
855static int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, 855int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx,
856 u32 pd, u32 access, int max_pages, 856 u32 pd, u32 access, int max_pages,
857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr) 857 int max_maps, u8 page_shift, struct mlx4_fmr *fmr)
858{ 858{
@@ -954,7 +954,7 @@ int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
954} 954}
955EXPORT_SYMBOL_GPL(mlx4_fmr_free); 955EXPORT_SYMBOL_GPL(mlx4_fmr_free);
956 956
957static int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 957int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
958{ 958{
959 if (fmr->maps) 959 if (fmr->maps)
960 return -EBUSY; 960 return -EBUSY;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index dcd819bfb2f0..bfdb7af19e49 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -73,6 +73,7 @@ struct res_gid {
73 struct list_head list; 73 struct list_head list;
74 u8 gid[16]; 74 u8 gid[16];
75 enum mlx4_protocol prot; 75 enum mlx4_protocol prot;
76 enum mlx4_steer_type steer;
76}; 77};
77 78
78enum res_qp_states { 79enum res_qp_states {
@@ -374,6 +375,7 @@ static struct res_common *alloc_qp_tr(int id)
374 375
375 ret->com.res_id = id; 376 ret->com.res_id = id;
376 ret->com.state = RES_QP_RESERVED; 377 ret->com.state = RES_QP_RESERVED;
378 ret->local_qpn = id;
377 INIT_LIST_HEAD(&ret->mcg_list); 379 INIT_LIST_HEAD(&ret->mcg_list);
378 spin_lock_init(&ret->mcg_spl); 380 spin_lock_init(&ret->mcg_spl);
379 381
@@ -2479,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave,
2479} 2481}
2480 2482
2481static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2483static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2482 u8 *gid, enum mlx4_protocol prot) 2484 u8 *gid, enum mlx4_protocol prot,
2485 enum mlx4_steer_type steer)
2483{ 2486{
2484 struct res_gid *res; 2487 struct res_gid *res;
2485 int err; 2488 int err;
@@ -2495,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2495 } else { 2498 } else {
2496 memcpy(res->gid, gid, 16); 2499 memcpy(res->gid, gid, 16);
2497 res->prot = prot; 2500 res->prot = prot;
2501 res->steer = steer;
2498 list_add_tail(&res->list, &rqp->mcg_list); 2502 list_add_tail(&res->list, &rqp->mcg_list);
2499 err = 0; 2503 err = 0;
2500 } 2504 }
@@ -2504,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2504} 2508}
2505 2509
2506static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, 2510static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
2507 u8 *gid, enum mlx4_protocol prot) 2511 u8 *gid, enum mlx4_protocol prot,
2512 enum mlx4_steer_type steer)
2508{ 2513{
2509 struct res_gid *res; 2514 struct res_gid *res;
2510 int err; 2515 int err;
2511 2516
2512 spin_lock_irq(&rqp->mcg_spl); 2517 spin_lock_irq(&rqp->mcg_spl);
2513 res = find_gid(dev, slave, rqp, gid); 2518 res = find_gid(dev, slave, rqp, gid);
2514 if (!res || res->prot != prot) 2519 if (!res || res->prot != prot || res->steer != steer)
2515 err = -EINVAL; 2520 err = -EINVAL;
2516 else { 2521 else {
2517 list_del(&res->list); 2522 list_del(&res->list);
@@ -2538,7 +2543,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2538 int attach = vhcr->op_modifier; 2543 int attach = vhcr->op_modifier;
2539 int block_loopback = vhcr->in_modifier >> 31; 2544 int block_loopback = vhcr->in_modifier >> 31;
2540 u8 steer_type_mask = 2; 2545 u8 steer_type_mask = 2;
2541 enum mlx4_steer_type type = gid[7] & steer_type_mask; 2546 enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1;
2542 2547
2543 qpn = vhcr->in_modifier & 0xffffff; 2548 qpn = vhcr->in_modifier & 0xffffff;
2544 err = get_res(dev, slave, qpn, RES_QP, &rqp); 2549 err = get_res(dev, slave, qpn, RES_QP, &rqp);
@@ -2547,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2547 2552
2548 qp.qpn = qpn; 2553 qp.qpn = qpn;
2549 if (attach) { 2554 if (attach) {
2550 err = add_mcg_res(dev, slave, rqp, gid, prot); 2555 err = add_mcg_res(dev, slave, rqp, gid, prot, type);
2551 if (err) 2556 if (err)
2552 goto ex_put; 2557 goto ex_put;
2553 2558
@@ -2556,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2556 if (err) 2561 if (err)
2557 goto ex_rem; 2562 goto ex_rem;
2558 } else { 2563 } else {
2559 err = rem_mcg_res(dev, slave, rqp, gid, prot); 2564 err = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2560 if (err) 2565 if (err)
2561 goto ex_put; 2566 goto ex_put;
2562 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); 2567 err = mlx4_qp_detach_common(dev, &qp, gid, prot, type);
@@ -2567,7 +2572,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2567 2572
2568ex_rem: 2573ex_rem:
2569 /* ignore error return below, already in error */ 2574 /* ignore error return below, already in error */
2570 err1 = rem_mcg_res(dev, slave, rqp, gid, prot); 2575 err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type);
2571ex_put: 2576ex_put:
2572 put_res(dev, slave, qpn, RES_QP); 2577 put_res(dev, slave, qpn, RES_QP);
2573 2578
@@ -2606,7 +2611,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp)
2606 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { 2611 list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) {
2607 qp.qpn = rqp->local_qpn; 2612 qp.qpn = rqp->local_qpn;
2608 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, 2613 err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot,
2609 MLX4_MC_STEER); 2614 rgid->steer);
2610 list_del(&rgid->list); 2615 list_del(&rgid->list);
2611 kfree(rgid); 2616 kfree(rgid);
2612 } 2617 }
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 6b35e7da9a9c..0c3e4005224d 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -583,7 +583,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
583 ks8851_dbg_dumpkkt(ks, rxpkt); 583 ks8851_dbg_dumpkkt(ks, rxpkt);
584 584
585 skb->protocol = eth_type_trans(skb, ks->netdev); 585 skb->protocol = eth_type_trans(skb, ks->netdev);
586 netif_rx(skb); 586 netif_rx_ni(skb);
587 587
588 ks->netdev->stats.rx_packets++; 588 ks->netdev->stats.rx_packets++;
589 ks->netdev->stats.rx_bytes += rxlen; 589 ks->netdev->stats.rx_bytes += rxlen;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index e58e78e5c930..2784bc706f1e 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -394,7 +394,6 @@ union ks_tx_hdr {
394 * @msg_enable : The message flags controlling driver output (see ethtool). 394 * @msg_enable : The message flags controlling driver output (see ethtool).
395 * @frame_cnt : number of frames received. 395 * @frame_cnt : number of frames received.
396 * @bus_width : i/o bus width. 396 * @bus_width : i/o bus width.
397 * @irq : irq number assigned to this device.
398 * @rc_rxqcr : Cached copy of KS_RXQCR. 397 * @rc_rxqcr : Cached copy of KS_RXQCR.
399 * @rc_txcr : Cached copy of KS_TXCR. 398 * @rc_txcr : Cached copy of KS_TXCR.
400 * @rc_ier : Cached copy of KS_IER. 399 * @rc_ier : Cached copy of KS_IER.
@@ -441,7 +440,6 @@ struct ks_net {
441 u32 msg_enable; 440 u32 msg_enable;
442 u32 frame_cnt; 441 u32 frame_cnt;
443 int bus_width; 442 int bus_width;
444 int irq;
445 443
446 u16 rc_rxqcr; 444 u16 rc_rxqcr;
447 u16 rc_txcr; 445 u16 rc_txcr;
@@ -907,10 +905,10 @@ static int ks_net_open(struct net_device *netdev)
907 netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__); 905 netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__);
908 906
909 /* reset the HW */ 907 /* reset the HW */
910 err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); 908 err = request_irq(netdev->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev);
911 909
912 if (err) { 910 if (err) {
913 pr_err("Failed to request IRQ: %d: %d\n", ks->irq, err); 911 pr_err("Failed to request IRQ: %d: %d\n", netdev->irq, err);
914 return err; 912 return err;
915 } 913 }
916 914
@@ -955,7 +953,7 @@ static int ks_net_stop(struct net_device *netdev)
955 953
956 /* set powermode to soft power down to save power */ 954 /* set powermode to soft power down to save power */
957 ks_set_powermode(ks, PMECR_PM_SOFTDOWN); 955 ks_set_powermode(ks, PMECR_PM_SOFTDOWN);
958 free_irq(ks->irq, netdev); 956 free_irq(netdev->irq, netdev);
959 mutex_unlock(&ks->lock); 957 mutex_unlock(&ks->lock);
960 return 0; 958 return 0;
961} 959}
@@ -1545,10 +1543,10 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1545 if (!ks->hw_addr_cmd) 1543 if (!ks->hw_addr_cmd)
1546 goto err_ioremap1; 1544 goto err_ioremap1;
1547 1545
1548 ks->irq = platform_get_irq(pdev, 0); 1546 netdev->irq = platform_get_irq(pdev, 0);
1549 1547
1550 if (ks->irq < 0) { 1548 if ((int)netdev->irq < 0) {
1551 err = ks->irq; 1549 err = netdev->irq;
1552 goto err_get_irq; 1550 goto err_get_irq;
1553 } 1551 }
1554 1552
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c
index 212f43b308a3..cd827ff4a021 100644
--- a/drivers/net/ethernet/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/octeon/octeon_mgmt.c
@@ -670,7 +670,7 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
670static int octeon_mgmt_init_phy(struct net_device *netdev) 670static int octeon_mgmt_init_phy(struct net_device *netdev)
671{ 671{
672 struct octeon_mgmt *p = netdev_priv(netdev); 672 struct octeon_mgmt *p = netdev_priv(netdev);
673 char phy_id[20]; 673 char phy_id[MII_BUS_ID_SIZE + 3];
674 674
675 if (octeon_is_simulation()) { 675 if (octeon_is_simulation()) {
676 /* No PHYs in the simulator. */ 676 /* No PHYs in the simulator. */
@@ -678,7 +678,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev)
678 return 0; 678 return 0;
679 } 679 }
680 680
681 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port); 681 snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port);
682 682
683 p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, 683 p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0,
684 PHY_INTERFACE_MODE_MII); 684 PHY_INTERFACE_MODE_MII);
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index aca349861767..fc52fca74193 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -156,11 +156,10 @@ static int efx_init_rx_buffers_skb(struct efx_rx_queue *rx_queue)
156 if (unlikely(!skb)) 156 if (unlikely(!skb))
157 return -ENOMEM; 157 return -ENOMEM;
158 158
159 /* Adjust the SKB for padding and checksum */ 159 /* Adjust the SKB for padding */
160 skb_reserve(skb, NET_IP_ALIGN); 160 skb_reserve(skb, NET_IP_ALIGN);
161 rx_buf->len = skb_len - NET_IP_ALIGN; 161 rx_buf->len = skb_len - NET_IP_ALIGN;
162 rx_buf->is_page = false; 162 rx_buf->is_page = false;
163 skb->ip_summed = CHECKSUM_UNNECESSARY;
164 163
165 rx_buf->dma_addr = pci_map_single(efx->pci_dev, 164 rx_buf->dma_addr = pci_map_single(efx->pci_dev,
166 skb->data, rx_buf->len, 165 skb->data, rx_buf->len,
@@ -496,6 +495,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel,
496 495
497 EFX_BUG_ON_PARANOID(!checksummed); 496 EFX_BUG_ON_PARANOID(!checksummed);
498 rx_buf->u.skb = NULL; 497 rx_buf->u.skb = NULL;
498 skb->ip_summed = CHECKSUM_UNNECESSARY;
499 499
500 gro_result = napi_gro_receive(napi, skb); 500 gro_result = napi_gro_receive(napi, skb);
501 } 501 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index d0b814ef0675..0319d640f728 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -67,6 +67,7 @@ struct stmmac_extra_stats {
67 unsigned long ipc_csum_error; 67 unsigned long ipc_csum_error;
68 unsigned long rx_collision; 68 unsigned long rx_collision;
69 unsigned long rx_crc; 69 unsigned long rx_crc;
70 unsigned long dribbling_bit;
70 unsigned long rx_length; 71 unsigned long rx_length;
71 unsigned long rx_mii; 72 unsigned long rx_mii;
72 unsigned long rx_multicast; 73 unsigned long rx_multicast;
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index d87976364ec5..ad1b627f8ec2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -201,7 +201,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
201 201
202 if (unlikely(p->des01.erx.dribbling)) { 202 if (unlikely(p->des01.erx.dribbling)) {
203 CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n"); 203 CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n");
204 ret = discard_frame; 204 x->dribbling_bit++;
205 } 205 }
206 if (unlikely(p->des01.erx.sa_filter_fail)) { 206 if (unlikely(p->des01.erx.sa_filter_fail)) {
207 CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); 207 CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n");
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index fda5d2b31d3a..25953bb45a73 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -104,7 +104,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
104 ret = discard_frame; 104 ret = discard_frame;
105 } 105 }
106 if (unlikely(p->des01.rx.dribbling)) 106 if (unlikely(p->des01.rx.dribbling))
107 ret = discard_frame; 107 x->dribbling_bit++;
108 108
109 if (unlikely(p->des01.rx.length_error)) { 109 if (unlikely(p->des01.rx.length_error)) {
110 x->rx_length++; 110 x->rx_length++;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 120740020e2c..b4b095fdcf29 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -21,7 +21,7 @@
21*******************************************************************************/ 21*******************************************************************************/
22 22
23#define STMMAC_RESOURCE_NAME "stmmaceth" 23#define STMMAC_RESOURCE_NAME "stmmaceth"
24#define DRV_MODULE_VERSION "Dec_2011" 24#define DRV_MODULE_VERSION "Feb_2012"
25#include <linux/stmmac.h> 25#include <linux/stmmac.h>
26#include <linux/phy.h> 26#include <linux/phy.h>
27#include "common.h" 27#include "common.h"
@@ -97,4 +97,5 @@ int stmmac_resume(struct net_device *ndev);
97int stmmac_suspend(struct net_device *ndev); 97int stmmac_suspend(struct net_device *ndev);
98int stmmac_dvr_remove(struct net_device *ndev); 98int stmmac_dvr_remove(struct net_device *ndev);
99struct stmmac_priv *stmmac_dvr_probe(struct device *device, 99struct stmmac_priv *stmmac_dvr_probe(struct device *device,
100 struct plat_stmmacenet_data *plat_dat); 100 struct plat_stmmacenet_data *plat_dat,
101 void __iomem *addr);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 9573303a706b..f98e1511660f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -47,23 +47,25 @@ struct stmmac_stats {
47 offsetof(struct stmmac_priv, xstats.m)} 47 offsetof(struct stmmac_priv, xstats.m)}
48 48
49static const struct stmmac_stats stmmac_gstrings_stats[] = { 49static const struct stmmac_stats stmmac_gstrings_stats[] = {
50 /* Transmit errors */
50 STMMAC_STAT(tx_underflow), 51 STMMAC_STAT(tx_underflow),
51 STMMAC_STAT(tx_carrier), 52 STMMAC_STAT(tx_carrier),
52 STMMAC_STAT(tx_losscarrier), 53 STMMAC_STAT(tx_losscarrier),
53 STMMAC_STAT(vlan_tag), 54 STMMAC_STAT(vlan_tag),
54 STMMAC_STAT(tx_deferred), 55 STMMAC_STAT(tx_deferred),
55 STMMAC_STAT(tx_vlan), 56 STMMAC_STAT(tx_vlan),
56 STMMAC_STAT(rx_vlan),
57 STMMAC_STAT(tx_jabber), 57 STMMAC_STAT(tx_jabber),
58 STMMAC_STAT(tx_frame_flushed), 58 STMMAC_STAT(tx_frame_flushed),
59 STMMAC_STAT(tx_payload_error), 59 STMMAC_STAT(tx_payload_error),
60 STMMAC_STAT(tx_ip_header_error), 60 STMMAC_STAT(tx_ip_header_error),
61 /* Receive errors */
61 STMMAC_STAT(rx_desc), 62 STMMAC_STAT(rx_desc),
62 STMMAC_STAT(sa_filter_fail), 63 STMMAC_STAT(sa_filter_fail),
63 STMMAC_STAT(overflow_error), 64 STMMAC_STAT(overflow_error),
64 STMMAC_STAT(ipc_csum_error), 65 STMMAC_STAT(ipc_csum_error),
65 STMMAC_STAT(rx_collision), 66 STMMAC_STAT(rx_collision),
66 STMMAC_STAT(rx_crc), 67 STMMAC_STAT(rx_crc),
68 STMMAC_STAT(dribbling_bit),
67 STMMAC_STAT(rx_length), 69 STMMAC_STAT(rx_length),
68 STMMAC_STAT(rx_mii), 70 STMMAC_STAT(rx_mii),
69 STMMAC_STAT(rx_multicast), 71 STMMAC_STAT(rx_multicast),
@@ -73,6 +75,8 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
73 STMMAC_STAT(sa_rx_filter_fail), 75 STMMAC_STAT(sa_rx_filter_fail),
74 STMMAC_STAT(rx_missed_cntr), 76 STMMAC_STAT(rx_missed_cntr),
75 STMMAC_STAT(rx_overflow_cntr), 77 STMMAC_STAT(rx_overflow_cntr),
78 STMMAC_STAT(rx_vlan),
79 /* Tx/Rx IRQ errors */
76 STMMAC_STAT(tx_undeflow_irq), 80 STMMAC_STAT(tx_undeflow_irq),
77 STMMAC_STAT(tx_process_stopped_irq), 81 STMMAC_STAT(tx_process_stopped_irq),
78 STMMAC_STAT(tx_jabber_irq), 82 STMMAC_STAT(tx_jabber_irq),
@@ -82,6 +86,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = {
82 STMMAC_STAT(rx_watchdog_irq), 86 STMMAC_STAT(rx_watchdog_irq),
83 STMMAC_STAT(tx_early_irq), 87 STMMAC_STAT(tx_early_irq),
84 STMMAC_STAT(fatal_bus_error_irq), 88 STMMAC_STAT(fatal_bus_error_irq),
89 /* Extra info */
85 STMMAC_STAT(threshold), 90 STMMAC_STAT(threshold),
86 STMMAC_STAT(tx_pkt_n), 91 STMMAC_STAT(tx_pkt_n),
87 STMMAC_STAT(rx_pkt_n), 92 STMMAC_STAT(rx_pkt_n),
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 96fa2da30763..6ee593a55a64 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -241,7 +241,7 @@ static void stmmac_adjust_link(struct net_device *dev)
241 case 1000: 241 case 1000:
242 if (likely(priv->plat->has_gmac)) 242 if (likely(priv->plat->has_gmac))
243 ctrl &= ~priv->hw->link.port; 243 ctrl &= ~priv->hw->link.port;
244 stmmac_hw_fix_mac_speed(priv); 244 stmmac_hw_fix_mac_speed(priv);
245 break; 245 break;
246 case 100: 246 case 100:
247 case 10: 247 case 10:
@@ -785,7 +785,7 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv)
785 u32 uid = ((hwid & 0x0000ff00) >> 8); 785 u32 uid = ((hwid & 0x0000ff00) >> 8);
786 u32 synid = (hwid & 0x000000ff); 786 u32 synid = (hwid & 0x000000ff);
787 787
788 pr_info("STMMAC - user ID: 0x%x, Synopsys ID: 0x%x\n", 788 pr_info("stmmac - user ID: 0x%x, Synopsys ID: 0x%x\n",
789 uid, synid); 789 uid, synid);
790 790
791 return synid; 791 return synid;
@@ -869,38 +869,6 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv)
869 return hw_cap; 869 return hw_cap;
870} 870}
871 871
872/**
873 * stmmac_mac_device_setup
874 * @dev : device pointer
875 * Description: this is to attach the GMAC or MAC 10/100
876 * main core structures that will be completed during the
877 * open step.
878 */
879static int stmmac_mac_device_setup(struct net_device *dev)
880{
881 struct stmmac_priv *priv = netdev_priv(dev);
882
883 struct mac_device_info *device;
884
885 if (priv->plat->has_gmac)
886 device = dwmac1000_setup(priv->ioaddr);
887 else
888 device = dwmac100_setup(priv->ioaddr);
889
890 if (!device)
891 return -ENOMEM;
892
893 priv->hw = device;
894 priv->hw->ring = &ring_mode_ops;
895
896 if (device_can_wakeup(priv->device)) {
897 priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */
898 enable_irq_wake(priv->wol_irq);
899 }
900
901 return 0;
902}
903
904static void stmmac_check_ether_addr(struct stmmac_priv *priv) 872static void stmmac_check_ether_addr(struct stmmac_priv *priv)
905{ 873{
906 /* verify if the MAC address is valid, in case of failures it 874 /* verify if the MAC address is valid, in case of failures it
@@ -930,20 +898,8 @@ static int stmmac_open(struct net_device *dev)
930 struct stmmac_priv *priv = netdev_priv(dev); 898 struct stmmac_priv *priv = netdev_priv(dev);
931 int ret; 899 int ret;
932 900
933 /* MAC HW device setup */
934 ret = stmmac_mac_device_setup(dev);
935 if (ret < 0)
936 return ret;
937
938 stmmac_check_ether_addr(priv); 901 stmmac_check_ether_addr(priv);
939 902
940 stmmac_verify_args();
941
942 /* Override with kernel parameters if supplied XXX CRS XXX
943 * this needs to have multiple instances */
944 if ((phyaddr >= 0) && (phyaddr <= 31))
945 priv->plat->phy_addr = phyaddr;
946
947 /* MDIO bus Registration */ 903 /* MDIO bus Registration */
948 ret = stmmac_mdio_register(dev); 904 ret = stmmac_mdio_register(dev);
949 if (ret < 0) { 905 if (ret < 0) {
@@ -976,44 +932,6 @@ static int stmmac_open(struct net_device *dev)
976 goto open_error; 932 goto open_error;
977 } 933 }
978 934
979 stmmac_get_synopsys_id(priv);
980
981 priv->hw_cap_support = stmmac_get_hw_features(priv);
982
983 if (priv->hw_cap_support) {
984 pr_info(" Support DMA HW capability register");
985
986 /* We can override some gmac/dma configuration fields: e.g.
987 * enh_desc, tx_coe (e.g. that are passed through the
988 * platform) with the values from the HW capability
989 * register (if supported).
990 */
991 priv->plat->enh_desc = priv->dma_cap.enh_desc;
992 priv->plat->tx_coe = priv->dma_cap.tx_coe;
993 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
994
995 /* By default disable wol on magic frame if not supported */
996 if (!priv->dma_cap.pmt_magic_frame)
997 priv->wolopts &= ~WAKE_MAGIC;
998
999 } else
1000 pr_info(" No HW DMA feature register supported");
1001
1002 /* Select the enhnaced/normal descriptor structures */
1003 stmmac_selec_desc_mode(priv);
1004
1005 /* PMT module is not integrated in all the MAC devices. */
1006 if (priv->plat->pmt) {
1007 pr_info(" Remote wake-up capable\n");
1008 device_set_wakeup_capable(priv->device, 1);
1009 }
1010
1011 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
1012 if (priv->rx_coe)
1013 pr_info(" Checksum Offload Engine supported\n");
1014 if (priv->plat->tx_coe)
1015 pr_info(" Checksum insertion supported\n");
1016
1017 /* Create and initialize the TX/RX descriptors chains. */ 935 /* Create and initialize the TX/RX descriptors chains. */
1018 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); 936 priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
1019 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); 937 priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
@@ -1030,14 +948,14 @@ static int stmmac_open(struct net_device *dev)
1030 948
1031 /* Copy the MAC addr into the HW */ 949 /* Copy the MAC addr into the HW */
1032 priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0); 950 priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
951
1033 /* If required, perform hw setup of the bus. */ 952 /* If required, perform hw setup of the bus. */
1034 if (priv->plat->bus_setup) 953 if (priv->plat->bus_setup)
1035 priv->plat->bus_setup(priv->ioaddr); 954 priv->plat->bus_setup(priv->ioaddr);
955
1036 /* Initialize the MAC Core */ 956 /* Initialize the MAC Core */
1037 priv->hw->mac->core_init(priv->ioaddr); 957 priv->hw->mac->core_init(priv->ioaddr);
1038 958
1039 netdev_update_features(dev);
1040
1041 /* Request the IRQ lines */ 959 /* Request the IRQ lines */
1042 ret = request_irq(dev->irq, stmmac_interrupt, 960 ret = request_irq(dev->irq, stmmac_interrupt,
1043 IRQF_SHARED, dev->name, dev); 961 IRQF_SHARED, dev->name, dev);
@@ -1047,6 +965,17 @@ static int stmmac_open(struct net_device *dev)
1047 goto open_error; 965 goto open_error;
1048 } 966 }
1049 967
968 /* Request the Wake IRQ in case of another line is used for WoL */
969 if (priv->wol_irq != dev->irq) {
970 ret = request_irq(priv->wol_irq, stmmac_interrupt,
971 IRQF_SHARED, dev->name, dev);
972 if (unlikely(ret < 0)) {
973 pr_err("%s: ERROR: allocating the ext WoL IRQ %d "
974 "(error: %d)\n", __func__, priv->wol_irq, ret);
975 goto open_error_wolirq;
976 }
977 }
978
1050 /* Enable the MAC Rx/Tx */ 979 /* Enable the MAC Rx/Tx */
1051 stmmac_set_mac(priv->ioaddr, true); 980 stmmac_set_mac(priv->ioaddr, true);
1052 981
@@ -1062,7 +991,7 @@ static int stmmac_open(struct net_device *dev)
1062#ifdef CONFIG_STMMAC_DEBUG_FS 991#ifdef CONFIG_STMMAC_DEBUG_FS
1063 ret = stmmac_init_fs(dev); 992 ret = stmmac_init_fs(dev);
1064 if (ret < 0) 993 if (ret < 0)
1065 pr_warning("\tFailed debugFS registration"); 994 pr_warning("%s: failed debugFS registration\n", __func__);
1066#endif 995#endif
1067 /* Start the ball rolling... */ 996 /* Start the ball rolling... */
1068 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); 997 DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name);
@@ -1072,6 +1001,7 @@ static int stmmac_open(struct net_device *dev)
1072#ifdef CONFIG_STMMAC_TIMER 1001#ifdef CONFIG_STMMAC_TIMER
1073 priv->tm->timer_start(tmrate); 1002 priv->tm->timer_start(tmrate);
1074#endif 1003#endif
1004
1075 /* Dump DMA/MAC registers */ 1005 /* Dump DMA/MAC registers */
1076 if (netif_msg_hw(priv)) { 1006 if (netif_msg_hw(priv)) {
1077 priv->hw->mac->dump_regs(priv->ioaddr); 1007 priv->hw->mac->dump_regs(priv->ioaddr);
@@ -1087,6 +1017,9 @@ static int stmmac_open(struct net_device *dev)
1087 1017
1088 return 0; 1018 return 0;
1089 1019
1020open_error_wolirq:
1021 free_irq(dev->irq, dev);
1022
1090open_error: 1023open_error:
1091#ifdef CONFIG_STMMAC_TIMER 1024#ifdef CONFIG_STMMAC_TIMER
1092 kfree(priv->tm); 1025 kfree(priv->tm);
@@ -1127,6 +1060,8 @@ static int stmmac_release(struct net_device *dev)
1127 1060
1128 /* Free the IRQ lines */ 1061 /* Free the IRQ lines */
1129 free_irq(dev->irq, dev); 1062 free_irq(dev->irq, dev);
1063 if (priv->wol_irq != dev->irq)
1064 free_irq(priv->wol_irq, dev);
1130 1065
1131 /* Stop TX/RX DMA and clear the descriptors */ 1066 /* Stop TX/RX DMA and clear the descriptors */
1132 priv->hw->dma->stop_tx(priv->ioaddr); 1067 priv->hw->dma->stop_tx(priv->ioaddr);
@@ -1789,13 +1724,77 @@ static const struct net_device_ops stmmac_netdev_ops = {
1789}; 1724};
1790 1725
1791/** 1726/**
1727 * stmmac_hw_init - Init the MAC device
1728 * @priv : pointer to the private device structure.
1729 * Description: this function detects which MAC device
1730 * (GMAC/MAC10-100) has to attached, checks the HW capability
1731 * (if supported) and sets the driver's features (for example
1732 * to use the ring or chaine mode or support the normal/enh
1733 * descriptor structure).
1734 */
1735static int stmmac_hw_init(struct stmmac_priv *priv)
1736{
1737 int ret = 0;
1738 struct mac_device_info *mac;
1739
1740 /* Identify the MAC HW device */
1741 if (priv->plat->has_gmac)
1742 mac = dwmac1000_setup(priv->ioaddr);
1743 else
1744 mac = dwmac100_setup(priv->ioaddr);
1745 if (!mac)
1746 return -ENOMEM;
1747
1748 priv->hw = mac;
1749
1750 /* To use the chained or ring mode */
1751 priv->hw->ring = &ring_mode_ops;
1752
1753 /* Get and dump the chip ID */
1754 stmmac_get_synopsys_id(priv);
1755
1756 /* Get the HW capability (new GMAC newer than 3.50a) */
1757 priv->hw_cap_support = stmmac_get_hw_features(priv);
1758 if (priv->hw_cap_support) {
1759 pr_info(" DMA HW capability register supported");
1760
1761 /* We can override some gmac/dma configuration fields: e.g.
1762 * enh_desc, tx_coe (e.g. that are passed through the
1763 * platform) with the values from the HW capability
1764 * register (if supported).
1765 */
1766 priv->plat->enh_desc = priv->dma_cap.enh_desc;
1767 priv->plat->tx_coe = priv->dma_cap.tx_coe;
1768 priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up;
1769 } else
1770 pr_info(" No HW DMA feature register supported");
1771
1772 /* Select the enhnaced/normal descriptor structures */
1773 stmmac_selec_desc_mode(priv);
1774
1775 priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr);
1776 if (priv->rx_coe)
1777 pr_info(" RX Checksum Offload Engine supported\n");
1778 if (priv->plat->tx_coe)
1779 pr_info(" TX Checksum insertion supported\n");
1780
1781 if (priv->plat->pmt) {
1782 pr_info(" Wake-Up On Lan supported\n");
1783 device_set_wakeup_capable(priv->device, 1);
1784 }
1785
1786 return ret;
1787}
1788
1789/**
1792 * stmmac_dvr_probe 1790 * stmmac_dvr_probe
1793 * @device: device pointer 1791 * @device: device pointer
1794 * Description: this is the main probe function used to 1792 * Description: this is the main probe function used to
1795 * call the alloc_etherdev, allocate the priv structure. 1793 * call the alloc_etherdev, allocate the priv structure.
1796 */ 1794 */
1797struct stmmac_priv *stmmac_dvr_probe(struct device *device, 1795struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1798 struct plat_stmmacenet_data *plat_dat) 1796 struct plat_stmmacenet_data *plat_dat,
1797 void __iomem *addr)
1799{ 1798{
1800 int ret = 0; 1799 int ret = 0;
1801 struct net_device *ndev = NULL; 1800 struct net_device *ndev = NULL;
@@ -1815,10 +1814,27 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1815 1814
1816 ether_setup(ndev); 1815 ether_setup(ndev);
1817 1816
1818 ndev->netdev_ops = &stmmac_netdev_ops;
1819 stmmac_set_ethtool_ops(ndev); 1817 stmmac_set_ethtool_ops(ndev);
1818 priv->pause = pause;
1819 priv->plat = plat_dat;
1820 priv->ioaddr = addr;
1821 priv->dev->base_addr = (unsigned long)addr;
1822
1823 /* Verify driver arguments */
1824 stmmac_verify_args();
1825
1826 /* Override with kernel parameters if supplied XXX CRS XXX
1827 * this needs to have multiple instances */
1828 if ((phyaddr >= 0) && (phyaddr <= 31))
1829 priv->plat->phy_addr = phyaddr;
1830
1831 /* Init MAC and get the capabilities */
1832 stmmac_hw_init(priv);
1833
1834 ndev->netdev_ops = &stmmac_netdev_ops;
1820 1835
1821 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 1836 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1837 NETIF_F_RXCSUM;
1822 ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; 1838 ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
1823 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 1839 ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
1824#ifdef STMMAC_VLAN_TAG_USED 1840#ifdef STMMAC_VLAN_TAG_USED
@@ -1830,8 +1846,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1830 if (flow_ctrl) 1846 if (flow_ctrl)
1831 priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ 1847 priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */
1832 1848
1833 priv->pause = pause;
1834 priv->plat = plat_dat;
1835 netif_napi_add(ndev, &priv->napi, stmmac_poll, 64); 1849 netif_napi_add(ndev, &priv->napi, stmmac_poll, 64);
1836 1850
1837 spin_lock_init(&priv->lock); 1851 spin_lock_init(&priv->lock);
@@ -1839,15 +1853,10 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
1839 1853
1840 ret = register_netdev(ndev); 1854 ret = register_netdev(ndev);
1841 if (ret) { 1855 if (ret) {
1842 pr_err("%s: ERROR %i registering the device\n", 1856 pr_err("%s: ERROR %i registering the device\n", __func__, ret);
1843 __func__, ret);
1844 goto error; 1857 goto error;
1845 } 1858 }
1846 1859
1847 DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n",
1848 ndev->name, (ndev->features & NETIF_F_SG) ? "on" : "off",
1849 (ndev->features & NETIF_F_IP_CSUM) ? "on" : "off");
1850
1851 return priv; 1860 return priv;
1852 1861
1853error: 1862error:
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index c796de9eed72..50ad5b80cfaf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -96,13 +96,11 @@ static int __devinit stmmac_pci_probe(struct pci_dev *pdev,
96 96
97 stmmac_default_data(); 97 stmmac_default_data();
98 98
99 priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat); 99 priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr);
100 if (!priv) { 100 if (!priv) {
101 pr_err("%s: main drivr probe failed", __func__); 101 pr_err("%s: main driver probe failed", __func__);
102 goto err_out; 102 goto err_out;
103 } 103 }
104 priv->ioaddr = addr;
105 priv->dev->base_addr = (unsigned long)addr;
106 priv->dev->irq = pdev->irq; 104 priv->dev->irq = pdev->irq;
107 priv->wol_irq = pdev->irq; 105 priv->wol_irq = pdev->irq;
108 106
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac83243649a..3aad9810237c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -59,16 +59,20 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
59 goto out_release_region; 59 goto out_release_region;
60 } 60 }
61 plat_dat = pdev->dev.platform_data; 61 plat_dat = pdev->dev.platform_data;
62 priv = stmmac_dvr_probe(&(pdev->dev), plat_dat); 62
63 /* Custom initialisation (if needed)*/
64 if (plat_dat->init) {
65 ret = plat_dat->init(pdev);
66 if (unlikely(ret))
67 goto out_unmap;
68 }
69
70 priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
63 if (!priv) { 71 if (!priv) {
64 pr_err("%s: main drivr probe failed", __func__); 72 pr_err("%s: main driver probe failed", __func__);
65 goto out_unmap; 73 goto out_unmap;
66 } 74 }
67 75
68 priv->ioaddr = addr;
69 /* Set the I/O base addr */
70 priv->dev->base_addr = (unsigned long)addr;
71
72 /* Get the MAC information */ 76 /* Get the MAC information */
73 priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); 77 priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
74 if (priv->dev->irq == -ENXIO) { 78 if (priv->dev->irq == -ENXIO) {
@@ -92,13 +96,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
92 96
93 platform_set_drvdata(pdev, priv->dev); 97 platform_set_drvdata(pdev, priv->dev);
94 98
95 /* Custom initialisation */
96 if (priv->plat->init) {
97 ret = priv->plat->init(pdev);
98 if (unlikely(ret))
99 goto out_unmap;
100 }
101
102 pr_debug("STMMAC platform driver registration completed"); 99 pr_debug("STMMAC platform driver registration completed");
103 100
104 return 0; 101 return 0;
diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 4d9a28ffd3c3..cbc8df78d84b 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1122,7 +1122,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1122 pdata = pdev->dev.platform_data; 1122 pdata = pdev->dev.platform_data;
1123 1123
1124 if (external_switch || dumb_switch) { 1124 if (external_switch || dumb_switch) {
1125 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ 1125 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
1126 phy_id = pdev->id; 1126 phy_id = pdev->id;
1127 } else { 1127 } else {
1128 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { 1128 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
@@ -1138,7 +1138,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1138 if (phy_id == PHY_MAX_ADDR) { 1138 if (phy_id == PHY_MAX_ADDR) {
1139 dev_err(&pdev->dev, "no PHY present, falling back " 1139 dev_err(&pdev->dev, "no PHY present, falling back "
1140 "to switch on MDIO bus 0\n"); 1140 "to switch on MDIO bus 0\n");
1141 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ 1141 strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */
1142 phy_id = pdev->id; 1142 phy_id = pdev->id;
1143 } 1143 }
1144 1144
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 4fa0bcb25dfc..4b2f54565f64 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1009,7 +1009,7 @@ static void emac_rx_handler(void *token, int len, int status)
1009 int ret; 1009 int ret;
1010 1010
1011 /* free and bail if we are shutting down */ 1011 /* free and bail if we are shutting down */
1012 if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { 1012 if (unlikely(!netif_running(ndev))) {
1013 dev_kfree_skb_any(skb); 1013 dev_kfree_skb_any(skb);
1014 return; 1014 return;
1015 } 1015 }
@@ -1038,7 +1038,9 @@ static void emac_rx_handler(void *token, int len, int status)
1038recycle: 1038recycle:
1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, 1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data,
1040 skb_tailroom(skb), GFP_KERNEL); 1040 skb_tailroom(skb), GFP_KERNEL);
1041 if (WARN_ON(ret < 0)) 1041
1042 WARN_ON(ret == -ENOMEM);
1043 if (unlikely(ret < 0))
1042 dev_kfree_skb_any(skb); 1044 dev_kfree_skb_any(skb);
1043} 1045}
1044 1046
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 72a854f05bb8..41a8b5a9849e 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1416,7 +1416,8 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1416 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); 1416 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
1417 udelay(50); 1417 udelay(50);
1418 1418
1419 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); 1419 snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
1420 mdio_bus->id, plat->phy);
1420 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, 1421 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
1421 PHY_INTERFACE_MODE_MII); 1422 PHY_INTERFACE_MODE_MII);
1422 if (IS_ERR(port->phydev)) { 1423 if (IS_ERR(port->phydev)) {
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index c81f136ae670..0856e1b7a849 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -30,16 +30,16 @@
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IC1001 PHY drivers"); 33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IP101G/IC1001 PHY drivers");
34MODULE_AUTHOR("Michael Barkowski"); 34MODULE_AUTHOR("Michael Barkowski");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
37/* IP101A/IP1001 */ 37/* IP101A/G - IP1001 */
38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ 38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ 39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ 40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ 41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
42#define IP101A_APS_ON 2 /* IP101A APS Mode bit */ 42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
43 43
44static int ip175c_config_init(struct phy_device *phydev) 44static int ip175c_config_init(struct phy_device *phydev)
45{ 45{
@@ -98,20 +98,24 @@ static int ip175c_config_init(struct phy_device *phydev)
98 98
99static int ip1xx_reset(struct phy_device *phydev) 99static int ip1xx_reset(struct phy_device *phydev)
100{ 100{
101 int err, bmcr; 101 int bmcr;
102 102
103 /* Software Reset PHY */ 103 /* Software Reset PHY */
104 bmcr = phy_read(phydev, MII_BMCR); 104 bmcr = phy_read(phydev, MII_BMCR);
105 if (bmcr < 0)
106 return bmcr;
105 bmcr |= BMCR_RESET; 107 bmcr |= BMCR_RESET;
106 err = phy_write(phydev, MII_BMCR, bmcr); 108 bmcr = phy_write(phydev, MII_BMCR, bmcr);
107 if (err < 0) 109 if (bmcr < 0)
108 return err; 110 return bmcr;
109 111
110 do { 112 do {
111 bmcr = phy_read(phydev, MII_BMCR); 113 bmcr = phy_read(phydev, MII_BMCR);
114 if (bmcr < 0)
115 return bmcr;
112 } while (bmcr & BMCR_RESET); 116 } while (bmcr & BMCR_RESET);
113 117
114 return err; 118 return 0;
115} 119}
116 120
117static int ip1001_config_init(struct phy_device *phydev) 121static int ip1001_config_init(struct phy_device *phydev)
@@ -124,7 +128,10 @@ static int ip1001_config_init(struct phy_device *phydev)
124 128
125 /* Enable Auto Power Saving mode */ 129 /* Enable Auto Power Saving mode */
126 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); 130 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2);
131 if (c < 0)
132 return c;
127 c |= IP1001_APS_ON; 133 c |= IP1001_APS_ON;
134 c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c);
128 if (c < 0) 135 if (c < 0)
129 return c; 136 return c;
130 137
@@ -132,14 +139,19 @@ static int ip1001_config_init(struct phy_device *phydev)
132 /* Additional delay (2ns) used to adjust RX clock phase 139 /* Additional delay (2ns) used to adjust RX clock phase
133 * at RGMII interface */ 140 * at RGMII interface */
134 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 141 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
142 if (c < 0)
143 return c;
144
135 c |= IP1001_PHASE_SEL_MASK; 145 c |= IP1001_PHASE_SEL_MASK;
136 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); 146 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
147 if (c < 0)
148 return c;
137 } 149 }
138 150
139 return c; 151 return 0;
140} 152}
141 153
142static int ip101a_config_init(struct phy_device *phydev) 154static int ip101a_g_config_init(struct phy_device *phydev)
143{ 155{
144 int c; 156 int c;
145 157
@@ -149,7 +161,7 @@ static int ip101a_config_init(struct phy_device *phydev)
149 161
150 /* Enable Auto Power Saving mode */ 162 /* Enable Auto Power Saving mode */
151 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 163 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
152 c |= IP101A_APS_ON; 164 c |= IP101A_G_APS_ON;
153 return c; 165 return c;
154} 166}
155 167
@@ -191,6 +203,7 @@ static struct phy_driver ip1001_driver = {
191 .phy_id_mask = 0x0ffffff0, 203 .phy_id_mask = 0x0ffffff0,
192 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | 204 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause |
193 SUPPORTED_Asym_Pause, 205 SUPPORTED_Asym_Pause,
206 .flags = PHY_HAS_INTERRUPT,
194 .config_init = &ip1001_config_init, 207 .config_init = &ip1001_config_init,
195 .config_aneg = &genphy_config_aneg, 208 .config_aneg = &genphy_config_aneg,
196 .read_status = &genphy_read_status, 209 .read_status = &genphy_read_status,
@@ -199,13 +212,14 @@ static struct phy_driver ip1001_driver = {
199 .driver = { .owner = THIS_MODULE,}, 212 .driver = { .owner = THIS_MODULE,},
200}; 213};
201 214
202static struct phy_driver ip101a_driver = { 215static struct phy_driver ip101a_g_driver = {
203 .phy_id = 0x02430c54, 216 .phy_id = 0x02430c54,
204 .name = "ICPlus IP101A", 217 .name = "ICPlus IP101A/G",
205 .phy_id_mask = 0x0ffffff0, 218 .phy_id_mask = 0x0ffffff0,
206 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | 219 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause |
207 SUPPORTED_Asym_Pause, 220 SUPPORTED_Asym_Pause,
208 .config_init = &ip101a_config_init, 221 .flags = PHY_HAS_INTERRUPT,
222 .config_init = &ip101a_g_config_init,
209 .config_aneg = &genphy_config_aneg, 223 .config_aneg = &genphy_config_aneg,
210 .read_status = &genphy_read_status, 224 .read_status = &genphy_read_status,
211 .suspend = genphy_suspend, 225 .suspend = genphy_suspend,
@@ -221,7 +235,7 @@ static int __init icplus_init(void)
221 if (ret < 0) 235 if (ret < 0)
222 return -ENODEV; 236 return -ENODEV;
223 237
224 ret = phy_driver_register(&ip101a_driver); 238 ret = phy_driver_register(&ip101a_g_driver);
225 if (ret < 0) 239 if (ret < 0)
226 return -ENODEV; 240 return -ENODEV;
227 241
@@ -231,7 +245,7 @@ static int __init icplus_init(void)
231static void __exit icplus_exit(void) 245static void __exit icplus_exit(void)
232{ 246{
233 phy_driver_unregister(&ip1001_driver); 247 phy_driver_unregister(&ip1001_driver);
234 phy_driver_unregister(&ip101a_driver); 248 phy_driver_unregister(&ip101a_g_driver);
235 phy_driver_unregister(&ip175c_driver); 249 phy_driver_unregister(&ip175c_driver);
236} 250}
237 251
@@ -241,6 +255,7 @@ module_exit(icplus_exit);
241static struct mdio_device_id __maybe_unused icplus_tbl[] = { 255static struct mdio_device_id __maybe_unused icplus_tbl[] = {
242 { 0x02430d80, 0x0ffffff0 }, 256 { 0x02430d80, 0x0ffffff0 },
243 { 0x02430d90, 0x0ffffff0 }, 257 { 0x02430d90, 0x0ffffff0 },
258 { 0x02430c54, 0x0ffffff0 },
244 { } 259 { }
245}; 260};
246 261
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index edfa15d2e795..486b4048850d 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp)
2024 continue; 2024 continue;
2025 } 2025 }
2026 if (PPP_MP_CB(p)->sequence != seq) { 2026 if (PPP_MP_CB(p)->sequence != seq) {
2027 u32 oldseq;
2027 /* Fragment `seq' is missing. If it is after 2028 /* Fragment `seq' is missing. If it is after
2028 minseq, it might arrive later, so stop here. */ 2029 minseq, it might arrive later, so stop here. */
2029 if (seq_after(seq, minseq)) 2030 if (seq_after(seq, minseq))
2030 break; 2031 break;
2031 /* Fragment `seq' is lost, keep going. */ 2032 /* Fragment `seq' is lost, keep going. */
2032 lost = 1; 2033 lost = 1;
2034 oldseq = seq;
2033 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)? 2035 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
2034 minseq + 1: PPP_MP_CB(p)->sequence; 2036 minseq + 1: PPP_MP_CB(p)->sequence;
2037
2038 if (ppp->debug & 1)
2039 netdev_printk(KERN_DEBUG, ppp->dev,
2040 "lost frag %u..%u\n",
2041 oldseq, seq-1);
2042
2035 goto again; 2043 goto again;
2036 } 2044 }
2037 2045
@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp)
2076 struct sk_buff *tmp2; 2084 struct sk_buff *tmp2;
2077 2085
2078 skb_queue_reverse_walk_from_safe(list, p, tmp2) { 2086 skb_queue_reverse_walk_from_safe(list, p, tmp2) {
2087 if (ppp->debug & 1)
2088 netdev_printk(KERN_DEBUG, ppp->dev,
2089 "discarding frag %u\n",
2090 PPP_MP_CB(p)->sequence);
2079 __skb_unlink(p, list); 2091 __skb_unlink(p, list);
2080 kfree_skb(p); 2092 kfree_skb(p);
2081 } 2093 }
@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp)
2091 /* If we have discarded any fragments, 2103 /* If we have discarded any fragments,
2092 signal a receive error. */ 2104 signal a receive error. */
2093 if (PPP_MP_CB(head)->sequence != ppp->nextseq) { 2105 if (PPP_MP_CB(head)->sequence != ppp->nextseq) {
2106 skb_queue_walk_safe(list, p, tmp) {
2107 if (p == head)
2108 break;
2109 if (ppp->debug & 1)
2110 netdev_printk(KERN_DEBUG, ppp->dev,
2111 "discarding frag %u\n",
2112 PPP_MP_CB(p)->sequence);
2113 __skb_unlink(p, list);
2114 kfree_skb(p);
2115 }
2116
2094 if (ppp->debug & 1) 2117 if (ppp->debug & 1)
2095 netdev_printk(KERN_DEBUG, ppp->dev, 2118 netdev_printk(KERN_DEBUG, ppp->dev,
2096 " missed pkts %u..%u\n", 2119 " missed pkts %u..%u\n",
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61efc331e..90a30026a931 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -573,6 +573,13 @@ static const struct usb_device_id products [] = {
573 .driver_info = 0, 573 .driver_info = 0,
574}, 574},
575 575
576/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
577{
578 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
579 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
580 .driver_info = 0,
581},
582
576/* 583/*
577 * WHITELIST!!! 584 * WHITELIST!!!
578 * 585 *
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 304fe78ff60e..e1324b4a0f66 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1632,7 +1632,7 @@ static int hso_get_count(struct tty_struct *tty,
1632 struct hso_serial *serial = get_serial_by_tty(tty); 1632 struct hso_serial *serial = get_serial_by_tty(tty);
1633 struct hso_tiocmget *tiocmget = serial->tiocmget; 1633 struct hso_tiocmget *tiocmget = serial->tiocmget;
1634 1634
1635 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1635 memset(icount, 0, sizeof(struct serial_icounter_struct));
1636 1636
1637 if (!tiocmget) 1637 if (!tiocmget)
1638 return -ENOENT; 1638 return -ENOENT;
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index e84662db51cc..dd78c4cbd459 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -60,6 +60,7 @@
60#define USB_PRODUCT_IPHONE_3GS 0x1294 60#define USB_PRODUCT_IPHONE_3GS 0x1294
61#define USB_PRODUCT_IPHONE_4 0x1297 61#define USB_PRODUCT_IPHONE_4 0x1297
62#define USB_PRODUCT_IPHONE_4_VZW 0x129c 62#define USB_PRODUCT_IPHONE_4_VZW 0x129c
63#define USB_PRODUCT_IPHONE_4S 0x12a0
63 64
64#define IPHETH_USBINTF_CLASS 255 65#define IPHETH_USBINTF_CLASS 255
65#define IPHETH_USBINTF_SUBCLASS 253 66#define IPHETH_USBINTF_SUBCLASS 253
@@ -103,6 +104,10 @@ static struct usb_device_id ipheth_table[] = {
103 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, 104 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
104 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 105 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
105 IPHETH_USBINTF_PROTO) }, 106 IPHETH_USBINTF_PROTO) },
107 { USB_DEVICE_AND_INTERFACE_INFO(
108 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S,
109 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
110 IPHETH_USBINTF_PROTO) },
106 { } 111 { }
107}; 112};
108MODULE_DEVICE_TABLE(usb, ipheth_table); 113MODULE_DEVICE_TABLE(usb, ipheth_table);
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index f701d4127087..c3197ce0e2ad 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -316,6 +316,11 @@ static const struct usb_device_id products [] = {
316 ZAURUS_MASTER_INTERFACE, 316 ZAURUS_MASTER_INTERFACE,
317 .driver_info = ZAURUS_PXA_INFO, 317 .driver_info = ZAURUS_PXA_INFO,
318}, { 318}, {
319 /* C-750/C-760/C-860/SL-C3000 PDA in MDLM mode */
320 USB_DEVICE_AND_INTERFACE_INFO(0x04DD, 0x9031, USB_CLASS_COMM,
321 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
322 .driver_info = (unsigned long) &bogus_mdlm_info,
323}, {
319 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 324 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
320 | USB_DEVICE_ID_MATCH_DEVICE, 325 | USB_DEVICE_ID_MATCH_DEVICE,
321 .idVendor = 0x04DD, 326 .idVendor = 0x04DD,
@@ -349,6 +354,13 @@ static const struct usb_device_id products [] = {
349 ZAURUS_MASTER_INTERFACE, 354 ZAURUS_MASTER_INTERFACE,
350 .driver_info = OLYMPUS_MXL_INFO, 355 .driver_info = OLYMPUS_MXL_INFO,
351}, 356},
357
358/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
359{
360 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
361 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
362 .driver_info = (unsigned long) &bogus_mdlm_info,
363},
352 { }, // END 364 { }, // END
353}; 365};
354MODULE_DEVICE_TABLE(usb, products); 366MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 49f4667e1fa3..4a3402898f2a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -422,7 +422,9 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
422 unregister_netdevice_queue(peer, head); 422 unregister_netdevice_queue(peer, head);
423} 423}
424 424
425static const struct nla_policy veth_policy[VETH_INFO_MAX + 1]; 425static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {
426 [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) },
427};
426 428
427static struct rtnl_link_ops veth_link_ops = { 429static struct rtnl_link_ops veth_link_ops = {
428 .kind = DRV_NAME, 430 .kind = DRV_NAME,
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index de7fc345148a..3dcd3857a36c 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -843,8 +843,8 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
843 /* for simplicity, don't copy L4 headers */ 843 /* for simplicity, don't copy L4 headers */
844 ctx->l4_hdr_size = 0; 844 ctx->l4_hdr_size = 0;
845 } 845 }
846 ctx->copy_size = ctx->eth_ip_hdr_size + 846 ctx->copy_size = min(ctx->eth_ip_hdr_size +
847 ctx->l4_hdr_size; 847 ctx->l4_hdr_size, skb->len);
848 } else { 848 } else {
849 ctx->eth_ip_hdr_size = 0; 849 ctx->eth_ip_hdr_size = 0;
850 ctx->l4_hdr_size = 0; 850 ctx->l4_hdr_size = 0;
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 635b592ad961..a427a16bb739 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1346,7 +1346,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1346 fc = hdr->frame_control; 1346 fc = hdr->frame_control;
1347 for (i = 0; i < sc->hw->max_rates; i++) { 1347 for (i = 0; i < sc->hw->max_rates; i++) {
1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; 1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i];
1349 if (!rate->count) 1349 if (rate->idx < 0 || !rate->count)
1350 break; 1350 break;
1351 1351
1352 final_ts_idx = i; 1352 final_ts_idx = i;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index c3b6c4652cd6..5b2972b43b0e 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -841,7 +841,12 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
841 ret = mwifiex_set_rf_channel(priv, channel, 841 ret = mwifiex_set_rf_channel(priv, channel,
842 priv->adapter->channel_type); 842 priv->adapter->channel_type);
843 843
844 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 844 /* As this is new association, clear locally stored
845 * keys and security related flags */
846 priv->sec_info.wpa_enabled = false;
847 priv->sec_info.wpa2_enabled = false;
848 priv->wep_key_curr_index = 0;
849 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1);
845 850
846 if (mode == NL80211_IFTYPE_ADHOC) { 851 if (mode == NL80211_IFTYPE_ADHOC) {
847 /* "privacy" is set only for ad-hoc mode */ 852 /* "privacy" is set only for ad-hoc mode */
@@ -886,6 +891,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
886 dev_dbg(priv->adapter->dev, 891 dev_dbg(priv->adapter->dev,
887 "info: setting wep encryption" 892 "info: setting wep encryption"
888 " with key len %d\n", sme->key_len); 893 " with key len %d\n", sme->key_len);
894 priv->wep_key_curr_index = sme->key_idx;
889 ret = mwifiex_set_encode(priv, sme->key, sme->key_len, 895 ret = mwifiex_set_encode(priv, sme->key, sme->key_len,
890 sme->key_idx, 0); 896 sme->key_idx, 0);
891 } 897 }
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 39e0907a3c4e..9245d882c06a 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1501,7 +1501,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
1501 return err; 1501 return err;
1502 } 1502 }
1503 1503
1504 return 1; 1504 return 0;
1505} 1505}
1506 1506
1507static int rtl_pci_start(struct ieee80211_hw *hw) 1507static int rtl_pci_start(struct ieee80211_hw *hw)
@@ -1870,7 +1870,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1870 } 1870 }
1871 1871
1872 /* Init PCI sw */ 1872 /* Init PCI sw */
1873 err = !rtl_pci_init(hw, pdev); 1873 err = rtl_pci_init(hw, pdev);
1874 if (err) { 1874 if (err) {
1875 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1875 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1876 ("Failed to init PCI.\n")); 1876 ("Failed to init PCI.\n"));
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 0321fa3b4226..0dab5ecf61bb 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -347,8 +347,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
347 return rc; 347 return rc;
348 } 348 }
349 349
350 pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz);
351
352 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE; 350 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
353 pci_cfg_access_lock(dev); 351 pci_cfg_access_lock(dev);
354 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); 352 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
@@ -466,6 +464,7 @@ found:
466 return -EIO; 464 return -EIO;
467 465
468 pgsz &= ~(pgsz - 1); 466 pgsz &= ~(pgsz - 1);
467 pci_write_config_dword(dev, pos + PCI_SRIOV_SYS_PGSIZE, pgsz);
469 468
470 nres = 0; 469 nres = 0;
471 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 470 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7cc9e2f0f47c..71eac9cd724d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -651,6 +651,11 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
651 dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n", 651 dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n",
652 secondary, subordinate, pass); 652 secondary, subordinate, pass);
653 653
654 if (!primary && (primary != bus->number) && secondary && subordinate) {
655 dev_warn(&dev->dev, "Primary bus is hard wired to 0\n");
656 primary = bus->number;
657 }
658
654 /* Check if setup is sensible at all */ 659 /* Check if setup is sensible at all */
655 if (!pass && 660 if (!pass &&
656 (primary != bus->number || secondary <= bus->number)) { 661 (primary != bus->number || secondary <= bus->number)) {
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 6def3624c688..ef8b18c48f26 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -77,6 +77,7 @@ void pci_remove_bus(struct pci_bus *pci_bus)
77} 77}
78EXPORT_SYMBOL(pci_remove_bus); 78EXPORT_SYMBOL(pci_remove_bus);
79 79
80static void __pci_remove_behind_bridge(struct pci_dev *dev);
80/** 81/**
81 * pci_remove_bus_device - remove a PCI device and any children 82 * pci_remove_bus_device - remove a PCI device and any children
82 * @dev: the device to remove 83 * @dev: the device to remove
@@ -94,7 +95,7 @@ static void __pci_remove_bus_device(struct pci_dev *dev)
94 if (dev->subordinate) { 95 if (dev->subordinate) {
95 struct pci_bus *b = dev->subordinate; 96 struct pci_bus *b = dev->subordinate;
96 97
97 pci_remove_behind_bridge(dev); 98 __pci_remove_behind_bridge(dev);
98 pci_remove_bus(b); 99 pci_remove_bus(b);
99 dev->subordinate = NULL; 100 dev->subordinate = NULL;
100 } 101 }
@@ -107,6 +108,24 @@ void pci_remove_bus_device(struct pci_dev *dev)
107 __pci_remove_bus_device(dev); 108 __pci_remove_bus_device(dev);
108} 109}
109 110
111static void __pci_remove_behind_bridge(struct pci_dev *dev)
112{
113 struct list_head *l, *n;
114
115 if (dev->subordinate)
116 list_for_each_safe(l, n, &dev->subordinate->devices)
117 __pci_remove_bus_device(pci_dev_b(l));
118}
119
120static void pci_stop_behind_bridge(struct pci_dev *dev)
121{
122 struct list_head *l, *n;
123
124 if (dev->subordinate)
125 list_for_each_safe(l, n, &dev->subordinate->devices)
126 pci_stop_bus_device(pci_dev_b(l));
127}
128
110/** 129/**
111 * pci_remove_behind_bridge - remove all devices behind a PCI bridge 130 * pci_remove_behind_bridge - remove all devices behind a PCI bridge
112 * @dev: PCI bridge device 131 * @dev: PCI bridge device
@@ -117,11 +136,8 @@ void pci_remove_bus_device(struct pci_dev *dev)
117 */ 136 */
118void pci_remove_behind_bridge(struct pci_dev *dev) 137void pci_remove_behind_bridge(struct pci_dev *dev)
119{ 138{
120 struct list_head *l, *n; 139 pci_stop_behind_bridge(dev);
121 140 __pci_remove_behind_bridge(dev);
122 if (dev->subordinate)
123 list_for_each_safe(l, n, &dev->subordinate->devices)
124 __pci_remove_bus_device(pci_dev_b(l));
125} 141}
126 142
127static void pci_stop_bus_devices(struct pci_bus *bus) 143static void pci_stop_bus_devices(struct pci_bus *bus)
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 7cf3d2fcf56a..1620088a0e7e 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -189,7 +189,7 @@ static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
189 189
190 if (verbose_request) 190 if (verbose_request)
191 dev_info(&pdev->xdev->dev, 191 dev_info(&pdev->xdev->dev,
192 "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n", 192 "read dev=%04x:%02x:%02x.%d - offset %x size %d\n",
193 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), 193 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
194 PCI_FUNC(devfn), where, size); 194 PCI_FUNC(devfn), where, size);
195 195
@@ -228,7 +228,7 @@ static int pcifront_bus_write(struct pci_bus *bus, unsigned int devfn,
228 228
229 if (verbose_request) 229 if (verbose_request)
230 dev_info(&pdev->xdev->dev, 230 dev_info(&pdev->xdev->dev,
231 "write dev=%04x:%02x:%02x.%01x - " 231 "write dev=%04x:%02x:%02x.%d - "
232 "offset %x size %d val %x\n", 232 "offset %x size %d val %x\n",
233 pci_domain_nr(bus), bus->number, 233 pci_domain_nr(bus), bus->number,
234 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val); 234 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
@@ -432,7 +432,7 @@ static int __devinit pcifront_scan_bus(struct pcifront_device *pdev,
432 d = pci_scan_single_device(b, devfn); 432 d = pci_scan_single_device(b, devfn);
433 if (d) 433 if (d)
434 dev_info(&pdev->xdev->dev, "New device on " 434 dev_info(&pdev->xdev->dev, "New device on "
435 "%04x:%02x:%02x.%02x found.\n", domain, bus, 435 "%04x:%02x:%02x.%d found.\n", domain, bus,
436 PCI_SLOT(devfn), PCI_FUNC(devfn)); 436 PCI_SLOT(devfn), PCI_FUNC(devfn));
437 } 437 }
438 438
@@ -1041,7 +1041,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
1041 pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func)); 1041 pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func));
1042 if (!pci_dev) { 1042 if (!pci_dev) {
1043 dev_dbg(&pdev->xdev->dev, 1043 dev_dbg(&pdev->xdev->dev,
1044 "Cannot get PCI device %04x:%02x:%02x.%02x\n", 1044 "Cannot get PCI device %04x:%02x:%02x.%d\n",
1045 domain, bus, slot, func); 1045 domain, bus, slot, func);
1046 continue; 1046 continue;
1047 } 1047 }
@@ -1049,7 +1049,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
1049 pci_dev_put(pci_dev); 1049 pci_dev_put(pci_dev);
1050 1050
1051 dev_dbg(&pdev->xdev->dev, 1051 dev_dbg(&pdev->xdev->dev,
1052 "PCI device %04x:%02x:%02x.%02x removed.\n", 1052 "PCI device %04x:%02x:%02x.%d removed.\n",
1053 domain, bus, slot, func); 1053 domain, bus, slot, func);
1054 } 1054 }
1055 1055
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 8fe15cf15ac8..894cd5e103da 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -189,7 +189,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
189 pindesc->pctldev = pctldev; 189 pindesc->pctldev = pctldev;
190 190
191 /* Copy basic pin info */ 191 /* Copy basic pin info */
192 if (pindesc->name) { 192 if (name) {
193 pindesc->name = name; 193 pindesc->name = name;
194 } else { 194 } else {
195 pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number); 195 pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number);
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 42a7d603c870..7481146a5b47 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -33,6 +33,8 @@
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <asm/bios_ebda.h> 34#include <asm/bios_ebda.h>
35 35
36#include <asm-generic/io-64-nonatomic-lo-hi.h>
37
36static bool force; 38static bool force;
37module_param(force, bool, 0); 39module_param(force, bool, 0);
38MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); 40MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
@@ -83,19 +85,6 @@ static void __iomem *rtl_cmd_addr;
83static u8 rtl_cmd_type; 85static u8 rtl_cmd_type;
84static u8 rtl_cmd_width; 86static u8 rtl_cmd_width;
85 87
86#ifndef readq
87static inline __u64 readq(const volatile void __iomem *addr)
88{
89 const volatile u32 __iomem *p = addr;
90 u32 low, high;
91
92 low = readl(p);
93 high = readl(p + 1);
94
95 return low + ((u64)high << 32);
96}
97#endif
98
99static void __iomem *rtl_port_map(phys_addr_t addr, unsigned long len) 88static void __iomem *rtl_port_map(phys_addr_t addr, unsigned long len)
100{ 89{
101 if (rtl_cmd_type == RTL_ADDR_TYPE_MMIO) 90 if (rtl_cmd_type == RTL_ADDR_TYPE_MMIO)
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 809a3ae943c6..88a98cff5a44 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -77,6 +77,8 @@
77#include <asm/processor.h> 77#include <asm/processor.h>
78#include "intel_ips.h" 78#include "intel_ips.h"
79 79
80#include <asm-generic/io-64-nonatomic-lo-hi.h>
81
80#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 82#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32
81 83
82/* 84/*
@@ -344,19 +346,6 @@ struct ips_driver {
344static bool 346static bool
345ips_gpu_turbo_enabled(struct ips_driver *ips); 347ips_gpu_turbo_enabled(struct ips_driver *ips);
346 348
347#ifndef readq
348static inline __u64 readq(const volatile void __iomem *addr)
349{
350 const volatile u32 __iomem *p = addr;
351 u32 low, high;
352
353 low = readl(p);
354 high = readl(p + 1);
355
356 return low + ((u64)high << 32);
357}
358#endif
359
360/** 349/**
361 * ips_cpu_busy - is CPU busy? 350 * ips_cpu_busy - is CPU busy?
362 * @ips: IPS driver struct 351 * @ips: IPS driver struct
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index b06a2399587c..d0e1180ad961 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -150,7 +150,7 @@ static int max8649_enable_time(struct regulator_dev *rdev)
150 if (ret != 0) 150 if (ret != 0)
151 return ret; 151 return ret;
152 val &= MAX8649_VOL_MASK; 152 val &= MAX8649_VOL_MASK;
153 voltage = max8649_list_voltage(rdev, (unsigned char)ret); /* uV */ 153 voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */
154 154
155 /* get rate */ 155 /* get rate */
156 ret = regmap_read(info->regmap, MAX8649_RAMP, &val); 156 ret = regmap_read(info->regmap, MAX8649_RAMP, &val);
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
index 80ecafef1bc3..62dcd0a432bb 100644
--- a/drivers/regulator/mc13xxx-regulator-core.c
+++ b/drivers/regulator/mc13xxx-regulator-core.c
@@ -254,6 +254,7 @@ int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev)
254 254
255 return num; 255 return num;
256} 256}
257EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt);
257 258
258struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt( 259struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt(
259 struct platform_device *pdev, struct mc13xxx_regulator *regulators, 260 struct platform_device *pdev, struct mc13xxx_regulator *regulators,
@@ -291,6 +292,7 @@ struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt(
291 292
292 return data; 293 return data;
293} 294}
295EXPORT_SYMBOL_GPL(mc13xxx_parse_regulators_dt);
294#endif 296#endif
295 297
296MODULE_LICENSE("GPL v2"); 298MODULE_LICENSE("GPL v2");
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index a3ad957507dc..ee3c122c0599 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -307,8 +307,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
307 device_init_wakeup(&pdev->dev, 1); 307 device_init_wakeup(&pdev->dev, 1);
308 308
309 platform_set_drvdata(pdev, rtc); 309 platform_set_drvdata(pdev, rtc);
310 rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); 310 rtc->rtt = ioremap(r->start, resource_size(r));
311 rtc->rtt += r->start; 311 if (!rtc->rtt) {
312 dev_err(&pdev->dev, "failed to map registers, aborting.\n");
313 ret = -ENOMEM;
314 goto fail;
315 }
312 316
313 mr = rtt_readl(rtc, MR); 317 mr = rtt_readl(rtc, MR);
314 318
@@ -326,7 +330,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
326 &at91_rtc_ops, THIS_MODULE); 330 &at91_rtc_ops, THIS_MODULE);
327 if (IS_ERR(rtc->rtcdev)) { 331 if (IS_ERR(rtc->rtcdev)) {
328 ret = PTR_ERR(rtc->rtcdev); 332 ret = PTR_ERR(rtc->rtcdev);
329 goto fail; 333 goto fail_register;
330 } 334 }
331 335
332 /* register irq handler after we know what name we'll use */ 336 /* register irq handler after we know what name we'll use */
@@ -351,6 +355,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
351 355
352 return 0; 356 return 0;
353 357
358fail_register:
359 iounmap(rtc->rtt);
354fail: 360fail:
355 platform_set_drvdata(pdev, NULL); 361 platform_set_drvdata(pdev, NULL);
356 kfree(rtc); 362 kfree(rtc);
@@ -371,6 +377,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
371 377
372 rtc_device_unregister(rtc->rtcdev); 378 rtc_device_unregister(rtc->rtcdev);
373 379
380 iounmap(rtc->rtt);
374 platform_set_drvdata(pdev, NULL); 381 platform_set_drvdata(pdev, NULL);
375 kfree(rtc); 382 kfree(rtc);
376 return 0; 383 return 0;
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 934458ad55e5..e71a50d4b221 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -87,6 +87,7 @@ struct raw3215_info {
87 struct tty_struct *tty; /* pointer to tty structure if present */ 87 struct tty_struct *tty; /* pointer to tty structure if present */
88 struct raw3215_req *queued_read; /* pointer to queued read requests */ 88 struct raw3215_req *queued_read; /* pointer to queued read requests */
89 struct raw3215_req *queued_write;/* pointer to queued write requests */ 89 struct raw3215_req *queued_write;/* pointer to queued write requests */
90 struct tasklet_struct tlet; /* tasklet to invoke tty_wakeup */
90 wait_queue_head_t empty_wait; /* wait queue for flushing */ 91 wait_queue_head_t empty_wait; /* wait queue for flushing */
91 struct timer_list timer; /* timer for delayed output */ 92 struct timer_list timer; /* timer for delayed output */
92 int line_pos; /* position on the line (for tabs) */ 93 int line_pos; /* position on the line (for tabs) */
@@ -334,19 +335,23 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
334} 335}
335 336
336/* 337/*
338 * Call tty_wakeup from tasklet context
339 */
340static void raw3215_wakeup(unsigned long data)
341{
342 struct raw3215_info *raw = (struct raw3215_info *) data;
343 tty_wakeup(raw->tty);
344}
345
346/*
337 * Try to start the next IO and wake up processes waiting on the tty. 347 * Try to start the next IO and wake up processes waiting on the tty.
338 */ 348 */
339static void raw3215_next_io(struct raw3215_info *raw) 349static void raw3215_next_io(struct raw3215_info *raw)
340{ 350{
341 struct tty_struct *tty;
342
343 raw3215_mk_write_req(raw); 351 raw3215_mk_write_req(raw);
344 raw3215_try_io(raw); 352 raw3215_try_io(raw);
345 tty = raw->tty; 353 if (raw->tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE)
346 if (tty != NULL && 354 tasklet_schedule(&raw->tlet);
347 RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) {
348 tty_wakeup(tty);
349 }
350} 355}
351 356
352/* 357/*
@@ -682,6 +687,7 @@ static int raw3215_probe (struct ccw_device *cdev)
682 return -ENOMEM; 687 return -ENOMEM;
683 } 688 }
684 init_waitqueue_head(&raw->empty_wait); 689 init_waitqueue_head(&raw->empty_wait);
690 tasklet_init(&raw->tlet, raw3215_wakeup, (unsigned long) raw);
685 691
686 dev_set_drvdata(&cdev->dev, raw); 692 dev_set_drvdata(&cdev->dev, raw);
687 cdev->handler = raw3215_irq; 693 cdev->handler = raw3215_irq;
@@ -901,6 +907,7 @@ static int __init con3215_init(void)
901 907
902 raw->flags |= RAW3215_FIXED; 908 raw->flags |= RAW3215_FIXED;
903 init_waitqueue_head(&raw->empty_wait); 909 init_waitqueue_head(&raw->empty_wait);
910 tasklet_init(&raw->tlet, raw3215_wakeup, (unsigned long) raw);
904 911
905 /* Request the console irq */ 912 /* Request the console irq */
906 if (raw3215_startup(raw) != 0) { 913 if (raw3215_startup(raw) != 0) {
@@ -966,6 +973,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
966 tty->closing = 1; 973 tty->closing = 1;
967 /* Shutdown the terminal */ 974 /* Shutdown the terminal */
968 raw3215_shutdown(raw); 975 raw3215_shutdown(raw);
976 tasklet_kill(&raw->tlet);
969 tty->closing = 0; 977 tty->closing = 0;
970 raw->tty = NULL; 978 raw->tty = NULL;
971} 979}
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index 53a31c753cb1..20c4557f5abd 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -364,10 +364,7 @@ static void release_controller(struct kref *kref)
364 struct rdac_controller *ctlr; 364 struct rdac_controller *ctlr;
365 ctlr = container_of(kref, struct rdac_controller, kref); 365 ctlr = container_of(kref, struct rdac_controller, kref);
366 366
367 flush_workqueue(kmpath_rdacd);
368 spin_lock(&list_lock);
369 list_del(&ctlr->node); 367 list_del(&ctlr->node);
370 spin_unlock(&list_lock);
371 kfree(ctlr); 368 kfree(ctlr);
372} 369}
373 370
@@ -376,20 +373,17 @@ static struct rdac_controller *get_controller(int index, char *array_name,
376{ 373{
377 struct rdac_controller *ctlr, *tmp; 374 struct rdac_controller *ctlr, *tmp;
378 375
379 spin_lock(&list_lock);
380
381 list_for_each_entry(tmp, &ctlr_list, node) { 376 list_for_each_entry(tmp, &ctlr_list, node) {
382 if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) && 377 if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) &&
383 (tmp->index == index) && 378 (tmp->index == index) &&
384 (tmp->host == sdev->host)) { 379 (tmp->host == sdev->host)) {
385 kref_get(&tmp->kref); 380 kref_get(&tmp->kref);
386 spin_unlock(&list_lock);
387 return tmp; 381 return tmp;
388 } 382 }
389 } 383 }
390 ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC); 384 ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC);
391 if (!ctlr) 385 if (!ctlr)
392 goto done; 386 return NULL;
393 387
394 /* initialize fields of controller */ 388 /* initialize fields of controller */
395 memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN); 389 memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN);
@@ -405,8 +399,7 @@ static struct rdac_controller *get_controller(int index, char *array_name,
405 INIT_WORK(&ctlr->ms_work, send_mode_select); 399 INIT_WORK(&ctlr->ms_work, send_mode_select);
406 INIT_LIST_HEAD(&ctlr->ms_head); 400 INIT_LIST_HEAD(&ctlr->ms_head);
407 list_add(&ctlr->node, &ctlr_list); 401 list_add(&ctlr->node, &ctlr_list);
408done: 402
409 spin_unlock(&list_lock);
410 return ctlr; 403 return ctlr;
411} 404}
412 405
@@ -517,9 +510,12 @@ static int initialize_controller(struct scsi_device *sdev,
517 index = 0; 510 index = 0;
518 else 511 else
519 index = 1; 512 index = 1;
513
514 spin_lock(&list_lock);
520 h->ctlr = get_controller(index, array_name, array_id, sdev); 515 h->ctlr = get_controller(index, array_name, array_id, sdev);
521 if (!h->ctlr) 516 if (!h->ctlr)
522 err = SCSI_DH_RES_TEMP_UNAVAIL; 517 err = SCSI_DH_RES_TEMP_UNAVAIL;
518 spin_unlock(&list_lock);
523 } 519 }
524 return err; 520 return err;
525} 521}
@@ -906,7 +902,9 @@ static int rdac_bus_attach(struct scsi_device *sdev)
906 return 0; 902 return 0;
907 903
908clean_ctlr: 904clean_ctlr:
905 spin_lock(&list_lock);
909 kref_put(&h->ctlr->kref, release_controller); 906 kref_put(&h->ctlr->kref, release_controller);
907 spin_unlock(&list_lock);
910 908
911failed: 909failed:
912 kfree(scsi_dh_data); 910 kfree(scsi_dh_data);
@@ -921,14 +919,19 @@ static void rdac_bus_detach( struct scsi_device *sdev )
921 struct rdac_dh_data *h; 919 struct rdac_dh_data *h;
922 unsigned long flags; 920 unsigned long flags;
923 921
924 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
925 scsi_dh_data = sdev->scsi_dh_data; 922 scsi_dh_data = sdev->scsi_dh_data;
923 h = (struct rdac_dh_data *) scsi_dh_data->buf;
924 if (h->ctlr && h->ctlr->ms_queued)
925 flush_workqueue(kmpath_rdacd);
926
927 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
926 sdev->scsi_dh_data = NULL; 928 sdev->scsi_dh_data = NULL;
927 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); 929 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
928 930
929 h = (struct rdac_dh_data *) scsi_dh_data->buf; 931 spin_lock(&list_lock);
930 if (h->ctlr) 932 if (h->ctlr)
931 kref_put(&h->ctlr->kref, release_controller); 933 kref_put(&h->ctlr->kref, release_controller);
934 spin_unlock(&list_lock);
932 kfree(scsi_dh_data); 935 kfree(scsi_dh_data);
933 module_put(THIS_MODULE); 936 module_put(THIS_MODULE);
934 sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME); 937 sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME);
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 67b169b7a5be..b538f0883fd2 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4613,11 +4613,13 @@ static int __ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd)
4613 ENTER; 4613 ENTER;
4614 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; 4614 ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
4615 4615
4616 dev_err(&ioa_cfg->pdev->dev, 4616 if (!ioa_cfg->in_reset_reload) {
4617 "Adapter being reset as a result of error recovery.\n"); 4617 dev_err(&ioa_cfg->pdev->dev,
4618 "Adapter being reset as a result of error recovery.\n");
4618 4619
4619 if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) 4620 if (WAIT_FOR_DUMP == ioa_cfg->sdt_state)
4620 ioa_cfg->sdt_state = GET_DUMP; 4621 ioa_cfg->sdt_state = GET_DUMP;
4622 }
4621 4623
4622 rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV); 4624 rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV);
4623 4625
@@ -4907,7 +4909,7 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
4907 struct ipr_ioa_cfg *ioa_cfg; 4909 struct ipr_ioa_cfg *ioa_cfg;
4908 struct ipr_resource_entry *res; 4910 struct ipr_resource_entry *res;
4909 struct ipr_cmd_pkt *cmd_pkt; 4911 struct ipr_cmd_pkt *cmd_pkt;
4910 u32 ioasc; 4912 u32 ioasc, int_reg;
4911 int op_found = 0; 4913 int op_found = 0;
4912 4914
4913 ENTER; 4915 ENTER;
@@ -4920,7 +4922,17 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
4920 */ 4922 */
4921 if (ioa_cfg->in_reset_reload || ioa_cfg->ioa_is_dead) 4923 if (ioa_cfg->in_reset_reload || ioa_cfg->ioa_is_dead)
4922 return FAILED; 4924 return FAILED;
4923 if (!res || !ipr_is_gscsi(res)) 4925 if (!res)
4926 return FAILED;
4927
4928 /*
4929 * If we are aborting a timed out op, chances are that the timeout was caused
4930 * by a still not detected EEH error. In such cases, reading a register will
4931 * trigger the EEH recovery infrastructure.
4932 */
4933 int_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
4934
4935 if (!ipr_is_gscsi(res))
4924 return FAILED; 4936 return FAILED;
4925 4937
4926 list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { 4938 list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) {
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c
index 1a65d6514237..418391b1c361 100644
--- a/drivers/scsi/isci/host.c
+++ b/drivers/scsi/isci/host.c
@@ -1848,9 +1848,11 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost)
1848 if (state == SCIC_RESET || 1848 if (state == SCIC_RESET ||
1849 state == SCIC_INITIALIZING || 1849 state == SCIC_INITIALIZING ||
1850 state == SCIC_INITIALIZED) { 1850 state == SCIC_INITIALIZED) {
1851 u8 oem_version = pci_info->orom ? pci_info->orom->hdr.version :
1852 ISCI_ROM_VER_1_0;
1851 1853
1852 if (sci_oem_parameters_validate(&ihost->oem_parameters, 1854 if (sci_oem_parameters_validate(&ihost->oem_parameters,
1853 pci_info->orom->hdr.version)) 1855 oem_version))
1854 return SCI_FAILURE_INVALID_PARAMETER_VALUE; 1856 return SCI_FAILURE_INVALID_PARAMETER_VALUE;
1855 1857
1856 return SCI_SUCCESS; 1858 return SCI_SUCCESS;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 0b2c95583660..a78036f5e1a6 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -4548,7 +4548,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
4548 printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n", 4548 printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n",
4549 ioc->name, __func__); 4549 ioc->name, __func__);
4550 r = 0; 4550 r = 0;
4551 goto out; 4551 goto out_unlocked;
4552 } 4552 }
4553 4553
4554 if (mpt2sas_fwfault_debug) 4554 if (mpt2sas_fwfault_debug)
@@ -4604,6 +4604,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
4604 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 4604 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
4605 mutex_unlock(&ioc->reset_in_progress_mutex); 4605 mutex_unlock(&ioc->reset_in_progress_mutex);
4606 4606
4607 out_unlocked:
4607 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: exit\n", ioc->name, 4608 dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: exit\n", ioc->name,
4608 __func__)); 4609 __func__));
4609 return r; 4610 return r;
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index a2f1b3043dfb..9f41b3b4358f 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1036,8 +1036,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr,
1036 vha->device_flags & DFLG_NO_CABLE) 1036 vha->device_flags & DFLG_NO_CABLE)
1037 len = snprintf(buf, PAGE_SIZE, "Link Down\n"); 1037 len = snprintf(buf, PAGE_SIZE, "Link Down\n");
1038 else if (atomic_read(&vha->loop_state) != LOOP_READY || 1038 else if (atomic_read(&vha->loop_state) != LOOP_READY ||
1039 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || 1039 qla2x00_reset_active(vha))
1040 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
1041 len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); 1040 len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n");
1042 else { 1041 else {
1043 len = snprintf(buf, PAGE_SIZE, "Link Up - "); 1042 len = snprintf(buf, PAGE_SIZE, "Link Up - ");
@@ -1359,8 +1358,7 @@ qla2x00_thermal_temp_show(struct device *dev,
1359 return snprintf(buf, PAGE_SIZE, "\n"); 1358 return snprintf(buf, PAGE_SIZE, "\n");
1360 1359
1361 temp = frac = 0; 1360 temp = frac = 0;
1362 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || 1361 if (qla2x00_reset_active(vha))
1363 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
1364 ql_log(ql_log_warn, vha, 0x707b, 1362 ql_log(ql_log_warn, vha, 0x707b,
1365 "ISP reset active.\n"); 1363 "ISP reset active.\n");
1366 else if (!vha->hw->flags.eeh_busy) 1364 else if (!vha->hw->flags.eeh_busy)
@@ -1379,8 +1377,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
1379 int rval = QLA_FUNCTION_FAILED; 1377 int rval = QLA_FUNCTION_FAILED;
1380 uint16_t state[5]; 1378 uint16_t state[5];
1381 1379
1382 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || 1380 if (qla2x00_reset_active(vha))
1383 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
1384 ql_log(ql_log_warn, vha, 0x707c, 1381 ql_log(ql_log_warn, vha, 0x707c,
1385 "ISP reset active.\n"); 1382 "ISP reset active.\n");
1386 else if (!vha->hw->flags.eeh_busy) 1383 else if (!vha->hw->flags.eeh_busy)
@@ -1693,9 +1690,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1693 if (IS_FWI2_CAPABLE(ha)) { 1690 if (IS_FWI2_CAPABLE(ha)) {
1694 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); 1691 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
1695 } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && 1692 } else if (atomic_read(&base_vha->loop_state) == LOOP_READY &&
1696 !test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) && 1693 !qla2x00_reset_active(vha) && !ha->dpc_active) {
1697 !test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) &&
1698 !ha->dpc_active) {
1699 /* Must be in a 'READY' state for statistics retrieval. */ 1694 /* Must be in a 'READY' state for statistics retrieval. */
1700 rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, 1695 rval = qla2x00_get_link_status(base_vha, base_vha->loop_id,
1701 stats, stats_dma); 1696 stats, stats_dma);
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index b1d0f936bf2d..1682e2e4201d 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -108,13 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
108 goto exit_fcp_prio_cfg; 108 goto exit_fcp_prio_cfg;
109 } 109 }
110 110
111 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
112 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
113 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
114 ret = -EBUSY;
115 goto exit_fcp_prio_cfg;
116 }
117
118 /* Get the sub command */ 111 /* Get the sub command */
119 oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; 112 oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1];
120 113
@@ -646,13 +639,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
646 dma_addr_t rsp_data_dma; 639 dma_addr_t rsp_data_dma;
647 uint32_t rsp_data_len; 640 uint32_t rsp_data_len;
648 641
649 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
650 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
651 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
652 ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n");
653 return -EBUSY;
654 }
655
656 if (!vha->flags.online) { 642 if (!vha->flags.online) {
657 ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); 643 ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n");
658 return -EIO; 644 return -EIO;
@@ -874,13 +860,6 @@ qla84xx_reset(struct fc_bsg_job *bsg_job)
874 int rval = 0; 860 int rval = 0;
875 uint32_t flag; 861 uint32_t flag;
876 862
877 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
878 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
879 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
880 ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n");
881 return -EBUSY;
882 }
883
884 if (!IS_QLA84XX(ha)) { 863 if (!IS_QLA84XX(ha)) {
885 ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); 864 ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n");
886 return -EINVAL; 865 return -EINVAL;
@@ -922,11 +901,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job)
922 uint32_t flag; 901 uint32_t flag;
923 uint32_t fw_ver; 902 uint32_t fw_ver;
924 903
925 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
926 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
927 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags))
928 return -EBUSY;
929
930 if (!IS_QLA84XX(ha)) { 904 if (!IS_QLA84XX(ha)) {
931 ql_dbg(ql_dbg_user, vha, 0x7032, 905 ql_dbg(ql_dbg_user, vha, 0x7032,
932 "Not 84xx, exiting.\n"); 906 "Not 84xx, exiting.\n");
@@ -1036,14 +1010,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job)
1036 uint32_t data_len = 0; 1010 uint32_t data_len = 0;
1037 uint32_t dma_direction = DMA_NONE; 1011 uint32_t dma_direction = DMA_NONE;
1038 1012
1039 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
1040 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
1041 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
1042 ql_log(ql_log_warn, vha, 0x7039,
1043 "Abort active or needed.\n");
1044 return -EBUSY;
1045 }
1046
1047 if (!IS_QLA84XX(ha)) { 1013 if (!IS_QLA84XX(ha)) {
1048 ql_log(ql_log_warn, vha, 0x703a, 1014 ql_log(ql_log_warn, vha, 0x703a,
1049 "Not 84xx, exiting.\n"); 1015 "Not 84xx, exiting.\n");
@@ -1246,13 +1212,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job)
1246 1212
1247 bsg_job->reply->reply_payload_rcv_len = 0; 1213 bsg_job->reply->reply_payload_rcv_len = 0;
1248 1214
1249 if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
1250 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
1251 test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
1252 ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n");
1253 return -EBUSY;
1254 }
1255
1256 if (!IS_IIDMA_CAPABLE(vha->hw)) { 1215 if (!IS_IIDMA_CAPABLE(vha->hw)) {
1257 ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); 1216 ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n");
1258 return -EINVAL; 1217 return -EINVAL;
@@ -1668,6 +1627,15 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job)
1668 vha = shost_priv(host); 1627 vha = shost_priv(host);
1669 } 1628 }
1670 1629
1630 if (qla2x00_reset_active(vha)) {
1631 ql_dbg(ql_dbg_user, vha, 0x709f,
1632 "BSG: ISP abort active/needed -- cmd=%d.\n",
1633 bsg_job->request->msgcode);
1634 bsg_job->reply->result = (DID_ERROR << 16);
1635 bsg_job->job_done(bsg_job);
1636 return -EBUSY;
1637 }
1638
1671 ql_dbg(ql_dbg_user, vha, 0x7000, 1639 ql_dbg(ql_dbg_user, vha, 0x7000,
1672 "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); 1640 "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode);
1673 1641
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 7c54624b5b13..45cbf0ba624d 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -19,7 +19,8 @@
19 * | DPC Thread | 0x401c | | 19 * | DPC Thread | 0x401c | |
20 * | Async Events | 0x5057 | 0x5052 | 20 * | Async Events | 0x5057 | 0x5052 |
21 * | Timer Routines | 0x6011 | 0x600e,0x600f | 21 * | Timer Routines | 0x6011 | 0x600e,0x600f |
22 * | User Space Interactions | 0x709e | | 22 * | User Space Interactions | 0x709e | 0x7018,0x702e |
23 * | | | 0x7039,0x7045 |
23 * | Task Management | 0x803c | 0x8025-0x8026 | 24 * | Task Management | 0x803c | 0x8025-0x8026 |
24 * | | | 0x800b,0x8039 | 25 * | | | 0x800b,0x8039 |
25 * | AER/EEH | 0x900f | | 26 * | AER/EEH | 0x900f | |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index a6a4eebce4a8..af1003f9de1e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -44,6 +44,7 @@
44 * ISP2100 HBAs. 44 * ISP2100 HBAs.
45 */ 45 */
46#define MAILBOX_REGISTER_COUNT_2100 8 46#define MAILBOX_REGISTER_COUNT_2100 8
47#define MAILBOX_REGISTER_COUNT_2200 24
47#define MAILBOX_REGISTER_COUNT 32 48#define MAILBOX_REGISTER_COUNT 32
48 49
49#define QLA2200A_RISC_ROM_VER 4 50#define QLA2200A_RISC_ROM_VER 4
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index 9902834e0b74..7cc4f36cd539 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -131,3 +131,16 @@ qla2x00_hba_err_chk_enabled(srb_t *sp)
131 } 131 }
132 return 0; 132 return 0;
133} 133}
134
135static inline int
136qla2x00_reset_active(scsi_qla_host_t *vha)
137{
138 scsi_qla_host_t *base_vha = pci_get_drvdata(vha->hw->pdev);
139
140 /* Test appropriate base-vha and vha flags. */
141 return test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) ||
142 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) ||
143 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) ||
144 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
145 test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
146}
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index e804585cc59c..349843ea32f6 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2090,7 +2090,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
2090 break; 2090 break;
2091 case CT_IOCB_TYPE: 2091 case CT_IOCB_TYPE:
2092 qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); 2092 qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE);
2093 clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags);
2094 break; 2093 break;
2095 case ELS_IOCB_TYPE: 2094 case ELS_IOCB_TYPE:
2096 qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE); 2095 qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 34344d3f8658..08f1d01bdc1c 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -342,6 +342,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
342 342
343 set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); 343 set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
344 clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); 344 clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
345 /* Allow next mbx cmd to come in. */
346 complete(&ha->mbx_cmd_comp);
345 if (ha->isp_ops->abort_isp(vha)) { 347 if (ha->isp_ops->abort_isp(vha)) {
346 /* Failed. retry later. */ 348 /* Failed. retry later. */
347 set_bit(ISP_ABORT_NEEDED, 349 set_bit(ISP_ABORT_NEEDED,
@@ -350,6 +352,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
350 clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); 352 clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags);
351 ql_dbg(ql_dbg_mbx, base_vha, 0x101f, 353 ql_dbg(ql_dbg_mbx, base_vha, 0x101f,
352 "Finished abort_isp.\n"); 354 "Finished abort_isp.\n");
355 goto mbx_done;
353 } 356 }
354 } 357 }
355 } 358 }
@@ -358,6 +361,7 @@ premature_exit:
358 /* Allow next mbx cmd to come in. */ 361 /* Allow next mbx cmd to come in. */
359 complete(&ha->mbx_cmd_comp); 362 complete(&ha->mbx_cmd_comp);
360 363
364mbx_done:
361 if (rval) { 365 if (rval) {
362 ql_dbg(ql_dbg_mbx, base_vha, 0x1020, 366 ql_dbg(ql_dbg_mbx, base_vha, 0x1020,
363 "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n", 367 "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n",
@@ -2581,7 +2585,8 @@ qla2x00_stop_firmware(scsi_qla_host_t *vha)
2581 ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__); 2585 ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__);
2582 2586
2583 mcp->mb[0] = MBC_STOP_FIRMWARE; 2587 mcp->mb[0] = MBC_STOP_FIRMWARE;
2584 mcp->out_mb = MBX_0; 2588 mcp->mb[1] = 0;
2589 mcp->out_mb = MBX_1|MBX_0;
2585 mcp->in_mb = MBX_0; 2590 mcp->in_mb = MBX_0;
2586 mcp->tov = 5; 2591 mcp->tov = 5;
2587 mcp->flags = 0; 2592 mcp->flags = 0;
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 1cd46cd7ff90..270ba3130fde 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1165,19 +1165,6 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
1165 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff); 1165 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff);
1166 else 1166 else
1167 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff); 1167 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff);
1168
1169 /* reset ms */
1170 val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4);
1171 val |= (1 << 1);
1172 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1173 msleep(20);
1174
1175 /* unreset ms */
1176 val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4);
1177 val &= ~(1 << 1);
1178 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1179 msleep(20);
1180
1181 qla82xx_rom_unlock(ha); 1168 qla82xx_rom_unlock(ha);
1182 1169
1183 /* Read the signature value from the flash. 1170 /* Read the signature value from the flash.
@@ -3392,7 +3379,7 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
3392 QLA82XX_CRB_PEG_NET_3 + 0x3c), 3379 QLA82XX_CRB_PEG_NET_3 + 0x3c),
3393 qla82xx_rd_32(ha, 3380 qla82xx_rd_32(ha,
3394 QLA82XX_CRB_PEG_NET_4 + 0x3c)); 3381 QLA82XX_CRB_PEG_NET_4 + 0x3c));
3395 if (LSW(MSB(halt_status)) == 0x67) 3382 if (((halt_status & 0x1fffff00) >> 8) == 0x67)
3396 ql_log(ql_log_warn, vha, 0xb052, 3383 ql_log(ql_log_warn, vha, 0xb052,
3397 "Firmware aborted with " 3384 "Firmware aborted with "
3398 "error code 0x00006700. Device is " 3385 "error code 0x00006700. Device is "
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 4ed1e4a96b95..036030c95339 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -625,6 +625,12 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
625 cmd->result = DID_NO_CONNECT << 16; 625 cmd->result = DID_NO_CONNECT << 16;
626 goto qc24_fail_command; 626 goto qc24_fail_command;
627 } 627 }
628
629 if (!fcport) {
630 cmd->result = DID_NO_CONNECT << 16;
631 goto qc24_fail_command;
632 }
633
628 if (atomic_read(&fcport->state) != FCS_ONLINE) { 634 if (atomic_read(&fcport->state) != FCS_ONLINE) {
629 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || 635 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
630 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { 636 atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
@@ -877,6 +883,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
877 883
878 spin_unlock_irqrestore(&ha->hardware_lock, flags); 884 spin_unlock_irqrestore(&ha->hardware_lock, flags);
879 if (ha->isp_ops->abort_command(sp)) { 885 if (ha->isp_ops->abort_command(sp)) {
886 ret = FAILED;
880 ql_dbg(ql_dbg_taskm, vha, 0x8003, 887 ql_dbg(ql_dbg_taskm, vha, 0x8003,
881 "Abort command mbx failed cmd=%p.\n", cmd); 888 "Abort command mbx failed cmd=%p.\n", cmd);
882 } else { 889 } else {
@@ -1124,7 +1131,6 @@ static int
1124qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) 1131qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1125{ 1132{
1126 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 1133 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
1127 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
1128 struct qla_hw_data *ha = vha->hw; 1134 struct qla_hw_data *ha = vha->hw;
1129 int ret = FAILED; 1135 int ret = FAILED;
1130 unsigned int id, lun; 1136 unsigned int id, lun;
@@ -1133,15 +1139,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1133 id = cmd->device->id; 1139 id = cmd->device->id;
1134 lun = cmd->device->lun; 1140 lun = cmd->device->lun;
1135 1141
1136 if (!fcport) {
1137 return ret;
1138 }
1139
1140 ret = fc_block_scsi_eh(cmd);
1141 if (ret != 0)
1142 return ret;
1143 ret = FAILED;
1144
1145 ql_log(ql_log_info, vha, 0x8018, 1142 ql_log(ql_log_info, vha, 0x8018,
1146 "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); 1143 "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun);
1147 1144
@@ -2047,7 +2044,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2047 ha->nvram_data_off = ~0; 2044 ha->nvram_data_off = ~0;
2048 ha->isp_ops = &qla2100_isp_ops; 2045 ha->isp_ops = &qla2100_isp_ops;
2049 } else if (IS_QLA2200(ha)) { 2046 } else if (IS_QLA2200(ha)) {
2050 ha->mbx_count = MAILBOX_REGISTER_COUNT; 2047 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200;
2051 req_length = REQUEST_ENTRY_CNT_2200; 2048 req_length = REQUEST_ENTRY_CNT_2200;
2052 rsp_length = RESPONSE_ENTRY_CNT_2100; 2049 rsp_length = RESPONSE_ENTRY_CNT_2100;
2053 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; 2050 ha->max_loop_id = SNS_LAST_LOOP_ID_2100;
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 23f33a6d52d7..29d780c38040 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.03.07.12-k" 10#define QLA2XXX_VERSION "8.03.07.13-k"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 3 13#define QLA_DRIVER_MINOR_VER 3
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 78f1111158d7..65253dfbe962 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -10,6 +10,8 @@
10#include "ql4_def.h" 10#include "ql4_def.h"
11#include "ql4_glbl.h" 11#include "ql4_glbl.h"
12 12
13#include <asm-generic/io-64-nonatomic-lo-hi.h>
14
13#define MASK(n) DMA_BIT_MASK(n) 15#define MASK(n) DMA_BIT_MASK(n)
14#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) 16#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff))
15#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) 17#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff))
@@ -655,27 +657,6 @@ static int qla4_8xxx_pci_is_same_window(struct scsi_qla_host *ha,
655 return 0; 657 return 0;
656} 658}
657 659
658#ifndef readq
659static inline __u64 readq(const volatile void __iomem *addr)
660{
661 const volatile u32 __iomem *p = addr;
662 u32 low, high;
663
664 low = readl(p);
665 high = readl(p + 1);
666
667 return low + ((u64)high << 32);
668}
669#endif
670
671#ifndef writeq
672static inline void writeq(__u64 val, volatile void __iomem *addr)
673{
674 writel(val, addr);
675 writel(val >> 32, addr+4);
676}
677#endif
678
679static int qla4_8xxx_pci_mem_read_direct(struct scsi_qla_host *ha, 660static int qla4_8xxx_pci_mem_read_direct(struct scsi_qla_host *ha,
680 u64 off, void *data, int size) 661 u64 off, void *data, int size)
681{ 662{
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index bf8bf79e6a1f..c4670642d023 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/pm_runtime.h> 8#include <linux/pm_runtime.h>
9#include <linux/export.h> 9#include <linux/export.h>
10#include <linux/async.h>
10 11
11#include <scsi/scsi.h> 12#include <scsi/scsi.h>
12#include <scsi/scsi_device.h> 13#include <scsi/scsi_device.h>
@@ -92,6 +93,19 @@ static int scsi_bus_resume_common(struct device *dev)
92 return err; 93 return err;
93} 94}
94 95
96static int scsi_bus_prepare(struct device *dev)
97{
98 if (scsi_is_sdev_device(dev)) {
99 /* sd probing uses async_schedule. Wait until it finishes. */
100 async_synchronize_full();
101
102 } else if (scsi_is_host_device(dev)) {
103 /* Wait until async scanning is finished */
104 scsi_complete_async_scans();
105 }
106 return 0;
107}
108
95static int scsi_bus_suspend(struct device *dev) 109static int scsi_bus_suspend(struct device *dev)
96{ 110{
97 return scsi_bus_suspend_common(dev, PMSG_SUSPEND); 111 return scsi_bus_suspend_common(dev, PMSG_SUSPEND);
@@ -110,6 +124,7 @@ static int scsi_bus_poweroff(struct device *dev)
110#else /* CONFIG_PM_SLEEP */ 124#else /* CONFIG_PM_SLEEP */
111 125
112#define scsi_bus_resume_common NULL 126#define scsi_bus_resume_common NULL
127#define scsi_bus_prepare NULL
113#define scsi_bus_suspend NULL 128#define scsi_bus_suspend NULL
114#define scsi_bus_freeze NULL 129#define scsi_bus_freeze NULL
115#define scsi_bus_poweroff NULL 130#define scsi_bus_poweroff NULL
@@ -218,6 +233,7 @@ void scsi_autopm_put_host(struct Scsi_Host *shost)
218#endif /* CONFIG_PM_RUNTIME */ 233#endif /* CONFIG_PM_RUNTIME */
219 234
220const struct dev_pm_ops scsi_bus_pm_ops = { 235const struct dev_pm_ops scsi_bus_pm_ops = {
236 .prepare = scsi_bus_prepare,
221 .suspend = scsi_bus_suspend, 237 .suspend = scsi_bus_suspend,
222 .resume = scsi_bus_resume_common, 238 .resume = scsi_bus_resume_common,
223 .freeze = scsi_bus_freeze, 239 .freeze = scsi_bus_freeze,
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 68eadd1c67fd..be4fa6d179b1 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -109,6 +109,7 @@ extern void scsi_exit_procfs(void);
109#endif /* CONFIG_PROC_FS */ 109#endif /* CONFIG_PROC_FS */
110 110
111/* scsi_scan.c */ 111/* scsi_scan.c */
112extern int scsi_complete_async_scans(void);
112extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, 113extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
113 unsigned int, unsigned int, int); 114 unsigned int, unsigned int, int);
114extern void scsi_forget_host(struct Scsi_Host *); 115extern void scsi_forget_host(struct Scsi_Host *);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 89da43f73c00..29c4c0480976 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1815,6 +1815,7 @@ static void scsi_finish_async_scan(struct async_scan_data *data)
1815 } 1815 }
1816 spin_unlock(&async_scan_lock); 1816 spin_unlock(&async_scan_lock);
1817 1817
1818 scsi_autopm_put_host(shost);
1818 scsi_host_put(shost); 1819 scsi_host_put(shost);
1819 kfree(data); 1820 kfree(data);
1820} 1821}
@@ -1841,7 +1842,6 @@ static int do_scan_async(void *_data)
1841 1842
1842 do_scsi_scan_host(shost); 1843 do_scsi_scan_host(shost);
1843 scsi_finish_async_scan(data); 1844 scsi_finish_async_scan(data);
1844 scsi_autopm_put_host(shost);
1845 return 0; 1845 return 0;
1846} 1846}
1847 1847
@@ -1869,7 +1869,7 @@ void scsi_scan_host(struct Scsi_Host *shost)
1869 p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); 1869 p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
1870 if (IS_ERR(p)) 1870 if (IS_ERR(p))
1871 do_scan_async(data); 1871 do_scan_async(data);
1872 /* scsi_autopm_put_host(shost) is called in do_scan_async() */ 1872 /* scsi_autopm_put_host(shost) is called in scsi_finish_async_scan() */
1873} 1873}
1874EXPORT_SYMBOL(scsi_scan_host); 1874EXPORT_SYMBOL(scsi_scan_host);
1875 1875
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 45fee368b092..92d314a73f69 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -190,7 +190,7 @@ static int __init sh_clk_init_parent(struct clk *clk)
190 return -EINVAL; 190 return -EINVAL;
191 } 191 }
192 192
193 clk->parent = clk->parent_table[val]; 193 clk_reparent(clk, clk->parent_table[val]);
194 if (!clk->parent) { 194 if (!clk->parent) {
195 pr_err("sh_clk_init_parent: unable to set parent"); 195 pr_err("sh_clk_init_parent: unable to set parent");
196 return -EINVAL; 196 return -EINVAL;
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index d136b8f4c8a7..81e2c0d9c17d 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -187,7 +187,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
187 return -ENODEV; 187 return -ENODEV;
188 dev->current_state = PCI_D0; 188 dev->current_state = PCI_D0;
189 189
190 if (!dev->irq) { 190 /* The xHCI driver supports MSI and MSI-X,
191 * so don't fail if the BIOS doesn't provide a legacy IRQ.
192 */
193 if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) {
191 dev_err(&dev->dev, 194 dev_err(&dev->dev,
192 "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", 195 "Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
193 pci_name(dev)); 196 pci_name(dev));
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index eb19cba34ac9..e1282328fc27 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2447,8 +2447,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
2447 && device_can_wakeup(&hcd->self.root_hub->dev)) 2447 && device_can_wakeup(&hcd->self.root_hub->dev))
2448 dev_dbg(hcd->self.controller, "supports USB remote wakeup\n"); 2448 dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
2449 2449
2450 /* enable irqs just before we start the controller */ 2450 /* enable irqs just before we start the controller,
2451 if (usb_hcd_is_primary_hcd(hcd)) { 2451 * if the BIOS provides legacy PCI irqs.
2452 */
2453 if (usb_hcd_is_primary_hcd(hcd) && irqnum) {
2452 retval = usb_hcd_request_irqs(hcd, irqnum, irqflags); 2454 retval = usb_hcd_request_irqs(hcd, irqnum, irqflags);
2453 if (retval) 2455 if (retval)
2454 goto err_request_irq; 2456 goto err_request_irq;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a0613d8f9be7..265c2f675d04 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -705,10 +705,26 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
705 if (type == HUB_INIT3) 705 if (type == HUB_INIT3)
706 goto init3; 706 goto init3;
707 707
708 /* After a resume, port power should still be on. 708 /* The superspeed hub except for root hub has to use Hub Depth
709 * value as an offset into the route string to locate the bits
710 * it uses to determine the downstream port number. So hub driver
711 * should send a set hub depth request to superspeed hub after
712 * the superspeed hub is set configuration in initialization or
713 * reset procedure.
714 *
715 * After a resume, port power should still be on.
709 * For any other type of activation, turn it on. 716 * For any other type of activation, turn it on.
710 */ 717 */
711 if (type != HUB_RESUME) { 718 if (type != HUB_RESUME) {
719 if (hdev->parent && hub_is_superspeed(hdev)) {
720 ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
721 HUB_SET_DEPTH, USB_RT_HUB,
722 hdev->level - 1, 0, NULL, 0,
723 USB_CTRL_SET_TIMEOUT);
724 if (ret < 0)
725 dev_err(hub->intfdev,
726 "set hub depth failed\n");
727 }
712 728
713 /* Speed up system boot by using a delayed_work for the 729 /* Speed up system boot by using a delayed_work for the
714 * hub's initial power-up delays. This is pretty awkward 730 * hub's initial power-up delays. This is pretty awkward
@@ -987,18 +1003,6 @@ static int hub_configure(struct usb_hub *hub,
987 goto fail; 1003 goto fail;
988 } 1004 }
989 1005
990 if (hub_is_superspeed(hdev) && (hdev->parent != NULL)) {
991 ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
992 HUB_SET_DEPTH, USB_RT_HUB,
993 hdev->level - 1, 0, NULL, 0,
994 USB_CTRL_SET_TIMEOUT);
995
996 if (ret < 0) {
997 message = "can't set hub depth";
998 goto fail;
999 }
1000 }
1001
1002 /* Request the entire hub descriptor. 1006 /* Request the entire hub descriptor.
1003 * hub->descriptor can handle USB_MAXCHILDREN ports, 1007 * hub->descriptor can handle USB_MAXCHILDREN ports,
1004 * but the hub can/will return fewer bytes here. 1008 * but the hub can/will return fewer bytes here.
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index ac53a662a6a3..7732d69e49e0 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -872,7 +872,17 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
872 */ 872 */
873 if (pdev->vendor == 0x184e) /* vendor Netlogic */ 873 if (pdev->vendor == 0x184e) /* vendor Netlogic */
874 return; 874 return;
875 if (pdev->class != PCI_CLASS_SERIAL_USB_UHCI &&
876 pdev->class != PCI_CLASS_SERIAL_USB_OHCI &&
877 pdev->class != PCI_CLASS_SERIAL_USB_EHCI &&
878 pdev->class != PCI_CLASS_SERIAL_USB_XHCI)
879 return;
875 880
881 if (pci_enable_device(pdev) < 0) {
882 dev_warn(&pdev->dev, "Can't enable PCI device, "
883 "BIOS handoff failed.\n");
884 return;
885 }
876 if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI) 886 if (pdev->class == PCI_CLASS_SERIAL_USB_UHCI)
877 quirk_usb_handoff_uhci(pdev); 887 quirk_usb_handoff_uhci(pdev);
878 else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI) 888 else if (pdev->class == PCI_CLASS_SERIAL_USB_OHCI)
@@ -881,5 +891,6 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
881 quirk_usb_disable_ehci(pdev); 891 quirk_usb_disable_ehci(pdev);
882 else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) 892 else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
883 quirk_usb_handoff_xhci(pdev); 893 quirk_usb_handoff_xhci(pdev);
894 pci_disable_device(pdev);
884} 895}
885DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); 896DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 35e257f79c7b..557b6f32db86 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -93,7 +93,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
93 */ 93 */
94 memset(port_removable, 0, sizeof(port_removable)); 94 memset(port_removable, 0, sizeof(port_removable));
95 for (i = 0; i < ports; i++) { 95 for (i = 0; i < ports; i++) {
96 portsc = xhci_readl(xhci, xhci->usb3_ports[i]); 96 portsc = xhci_readl(xhci, xhci->usb2_ports[i]);
97 /* If a device is removable, PORTSC reports a 0, same as in the 97 /* If a device is removable, PORTSC reports a 0, same as in the
98 * hub descriptor DeviceRemovable bits. 98 * hub descriptor DeviceRemovable bits.
99 */ 99 */
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 36cbe2226a44..383fc857491c 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1126,26 +1126,42 @@ static unsigned int xhci_parse_exponent_interval(struct usb_device *udev,
1126} 1126}
1127 1127
1128/* 1128/*
1129 * Convert bInterval expressed in frames (in 1-255 range) to exponent of 1129 * Convert bInterval expressed in microframes (in 1-255 range) to exponent of
1130 * microframes, rounded down to nearest power of 2. 1130 * microframes, rounded down to nearest power of 2.
1131 */ 1131 */
1132static unsigned int xhci_parse_frame_interval(struct usb_device *udev, 1132static unsigned int xhci_microframes_to_exponent(struct usb_device *udev,
1133 struct usb_host_endpoint *ep) 1133 struct usb_host_endpoint *ep, unsigned int desc_interval,
1134 unsigned int min_exponent, unsigned int max_exponent)
1134{ 1135{
1135 unsigned int interval; 1136 unsigned int interval;
1136 1137
1137 interval = fls(8 * ep->desc.bInterval) - 1; 1138 interval = fls(desc_interval) - 1;
1138 interval = clamp_val(interval, 3, 10); 1139 interval = clamp_val(interval, min_exponent, max_exponent);
1139 if ((1 << interval) != 8 * ep->desc.bInterval) 1140 if ((1 << interval) != desc_interval)
1140 dev_warn(&udev->dev, 1141 dev_warn(&udev->dev,
1141 "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n", 1142 "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n",
1142 ep->desc.bEndpointAddress, 1143 ep->desc.bEndpointAddress,
1143 1 << interval, 1144 1 << interval,
1144 8 * ep->desc.bInterval); 1145 desc_interval);
1145 1146
1146 return interval; 1147 return interval;
1147} 1148}
1148 1149
1150static unsigned int xhci_parse_microframe_interval(struct usb_device *udev,
1151 struct usb_host_endpoint *ep)
1152{
1153 return xhci_microframes_to_exponent(udev, ep,
1154 ep->desc.bInterval, 0, 15);
1155}
1156
1157
1158static unsigned int xhci_parse_frame_interval(struct usb_device *udev,
1159 struct usb_host_endpoint *ep)
1160{
1161 return xhci_microframes_to_exponent(udev, ep,
1162 ep->desc.bInterval * 8, 3, 10);
1163}
1164
1149/* Return the polling or NAK interval. 1165/* Return the polling or NAK interval.
1150 * 1166 *
1151 * The polling interval is expressed in "microframes". If xHCI's Interval field 1167 * The polling interval is expressed in "microframes". If xHCI's Interval field
@@ -1164,7 +1180,7 @@ static unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1164 /* Max NAK rate */ 1180 /* Max NAK rate */
1165 if (usb_endpoint_xfer_control(&ep->desc) || 1181 if (usb_endpoint_xfer_control(&ep->desc) ||
1166 usb_endpoint_xfer_bulk(&ep->desc)) { 1182 usb_endpoint_xfer_bulk(&ep->desc)) {
1167 interval = ep->desc.bInterval; 1183 interval = xhci_parse_microframe_interval(udev, ep);
1168 break; 1184 break;
1169 } 1185 }
1170 /* Fall through - SS and HS isoc/int have same decoding */ 1186 /* Fall through - SS and HS isoc/int have same decoding */
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6bbe3c3a7111..c939f5fdef9e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -352,6 +352,11 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
352 /* hcd->irq is -1, we have MSI */ 352 /* hcd->irq is -1, we have MSI */
353 return 0; 353 return 0;
354 354
355 if (!pdev->irq) {
356 xhci_err(xhci, "No msi-x/msi found and no IRQ in BIOS\n");
357 return -EINVAL;
358 }
359
355 /* fall back to legacy interrupt*/ 360 /* fall back to legacy interrupt*/
356 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, 361 ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED,
357 hcd->irq_descr, hcd); 362 hcd->irq_descr, hcd);
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 8dbf51a43c45..08a5575724cd 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -136,6 +136,8 @@ static const struct usb_device_id id_table[] = {
136 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ 136 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
137 { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */ 137 { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */
138 { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ 138 { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
139 { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
140 { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
139 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ 141 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
140 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ 142 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
141 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 143 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 39ed1f46cec0..b54afceb9611 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -788,7 +788,6 @@ static const struct usb_device_id option_ids[] = {
788 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff), 788 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff),
789 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 789 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
790 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, 790 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
791 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) },
792 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, 791 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
793 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, 792 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
794 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff), 793 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff),
@@ -803,7 +802,6 @@ static const struct usb_device_id option_ids[] = {
803 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, 802 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
804 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff), 803 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff),
805 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 804 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
806 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */
807 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, 805 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
808 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, 806 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
809 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, 807 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
@@ -828,7 +826,6 @@ static const struct usb_device_id option_ids[] = {
828 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, 826 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
829 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff), 827 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff),
830 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 828 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
831 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */
832 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, 829 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
833 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff), 830 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff),
834 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 831 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
@@ -836,7 +833,6 @@ static const struct usb_device_id option_ids[] = {
836 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, 833 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
837 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff), 834 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff),
838 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 835 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
839 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
840 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, 836 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
841 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, 837 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
842 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff), 838 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff),
@@ -846,7 +842,6 @@ static const struct usb_device_id option_ids[] = {
846 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, 842 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
847 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) }, 843 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) },
848 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, 844 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) },
849 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
850 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, 845 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) },
851 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) }, 846 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) },
852 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, 847 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) },
@@ -865,8 +860,6 @@ static const struct usb_device_id option_ids[] = {
865 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0095, 0xff, 0xff, 0xff) }, 860 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0095, 0xff, 0xff, 0xff) },
866 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) }, 861 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) },
867 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) }, 862 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) },
868 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0098, 0xff, 0xff, 0xff) },
869 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0099, 0xff, 0xff, 0xff) },
870 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff), 863 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff),
871 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 864 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
872 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, 865 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
@@ -887,28 +880,18 @@ static const struct usb_device_id option_ids[] = {
887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) }, 880 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) }, 881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) }, 882 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) },
890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0146, 0xff, 0xff, 0xff) },
891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) }, 883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) },
893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0149, 0xff, 0xff, 0xff) },
894 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0150, 0xff, 0xff, 0xff) },
895 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) }, 884 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) },
896 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
897 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) }, 885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) },
898 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) }, 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
899 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, 887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
900 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) }, 888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
901 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, 889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) },
902 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, 890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
903 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
904 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
905 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, 892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
906 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) }, 893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) },
907 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, 894 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
908 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) },
909 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
910 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) },
911 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) },
912 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) }, 895 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) },
913 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) }, 896 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) },
914 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 897 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
@@ -1083,127 +1066,27 @@ static const struct usb_device_id option_ids[] = {
1083 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, 1066 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1084 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, 1067 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1085 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, 1068 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1086 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff) }, 1069 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1087 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff) }, 1070 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1088 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1403, 0xff, 0xff, 0xff) }, 1071 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1089 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1404, 0xff, 0xff, 0xff) }, 1072
1090 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1405, 0xff, 0xff, 0xff) },
1091 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1406, 0xff, 0xff, 0xff) },
1092 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1407, 0xff, 0xff, 0xff) },
1093 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1408, 0xff, 0xff, 0xff) },
1094 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1409, 0xff, 0xff, 0xff) },
1095 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1410, 0xff, 0xff, 0xff) },
1096 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1411, 0xff, 0xff, 0xff) },
1097 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1412, 0xff, 0xff, 0xff) },
1098 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1413, 0xff, 0xff, 0xff) },
1099 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1414, 0xff, 0xff, 0xff) },
1100 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1415, 0xff, 0xff, 0xff) },
1101 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1416, 0xff, 0xff, 0xff) },
1102 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1417, 0xff, 0xff, 0xff) },
1103 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1418, 0xff, 0xff, 0xff) },
1104 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1419, 0xff, 0xff, 0xff) },
1105 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1420, 0xff, 0xff, 0xff) },
1106 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1421, 0xff, 0xff, 0xff) },
1107 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1422, 0xff, 0xff, 0xff) },
1108 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1423, 0xff, 0xff, 0xff) },
1109 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff) },
1110 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff) },
1111 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff) },
1112 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1427, 0xff, 0xff, 0xff) },
1113 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff) },
1114 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1429, 0xff, 0xff, 0xff) },
1115 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1430, 0xff, 0xff, 0xff) },
1116 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1431, 0xff, 0xff, 0xff) },
1117 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1432, 0xff, 0xff, 0xff) },
1118 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1433, 0xff, 0xff, 0xff) },
1119 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1434, 0xff, 0xff, 0xff) },
1120 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1435, 0xff, 0xff, 0xff) },
1121 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1436, 0xff, 0xff, 0xff) },
1122 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1437, 0xff, 0xff, 0xff) },
1123 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1438, 0xff, 0xff, 0xff) },
1124 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1439, 0xff, 0xff, 0xff) },
1125 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1440, 0xff, 0xff, 0xff) },
1126 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1441, 0xff, 0xff, 0xff) },
1127 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1442, 0xff, 0xff, 0xff) },
1128 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1443, 0xff, 0xff, 0xff) },
1129 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1444, 0xff, 0xff, 0xff) },
1130 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1445, 0xff, 0xff, 0xff) },
1131 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1446, 0xff, 0xff, 0xff) },
1132 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1447, 0xff, 0xff, 0xff) },
1133 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1448, 0xff, 0xff, 0xff) },
1134 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1449, 0xff, 0xff, 0xff) },
1135 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1450, 0xff, 0xff, 0xff) },
1136 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1451, 0xff, 0xff, 0xff) },
1137 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1452, 0xff, 0xff, 0xff) },
1138 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1453, 0xff, 0xff, 0xff) },
1139 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1454, 0xff, 0xff, 0xff) },
1140 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1455, 0xff, 0xff, 0xff) },
1141 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1456, 0xff, 0xff, 0xff) },
1142 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1457, 0xff, 0xff, 0xff) },
1143 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1458, 0xff, 0xff, 0xff) },
1144 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1459, 0xff, 0xff, 0xff) },
1145 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1460, 0xff, 0xff, 0xff) },
1146 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1461, 0xff, 0xff, 0xff) },
1147 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1462, 0xff, 0xff, 0xff) },
1148 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1463, 0xff, 0xff, 0xff) },
1149 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1464, 0xff, 0xff, 0xff) },
1150 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1465, 0xff, 0xff, 0xff) },
1151 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1466, 0xff, 0xff, 0xff) },
1152 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1467, 0xff, 0xff, 0xff) },
1153 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1468, 0xff, 0xff, 0xff) },
1154 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1469, 0xff, 0xff, 0xff) },
1155 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1470, 0xff, 0xff, 0xff) },
1156 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1471, 0xff, 0xff, 0xff) },
1157 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1472, 0xff, 0xff, 0xff) },
1158 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1473, 0xff, 0xff, 0xff) },
1159 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1474, 0xff, 0xff, 0xff) },
1160 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1475, 0xff, 0xff, 0xff) },
1161 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1476, 0xff, 0xff, 0xff) },
1162 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1477, 0xff, 0xff, 0xff) },
1163 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1478, 0xff, 0xff, 0xff) },
1164 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1479, 0xff, 0xff, 0xff) },
1165 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1480, 0xff, 0xff, 0xff) },
1166 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0xff, 0xff) },
1167 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1482, 0xff, 0xff, 0xff) },
1168 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1483, 0xff, 0xff, 0xff) },
1169 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1484, 0xff, 0xff, 0xff) },
1170 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1485, 0xff, 0xff, 0xff) },
1171 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1486, 0xff, 0xff, 0xff) },
1172 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1487, 0xff, 0xff, 0xff) },
1173 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1488, 0xff, 0xff, 0xff) },
1174 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1489, 0xff, 0xff, 0xff) },
1175 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1490, 0xff, 0xff, 0xff) },
1176 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1491, 0xff, 0xff, 0xff) },
1177 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1492, 0xff, 0xff, 0xff) },
1178 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1493, 0xff, 0xff, 0xff) },
1179 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1494, 0xff, 0xff, 0xff) },
1180 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1495, 0xff, 0xff, 0xff) },
1181 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1496, 0xff, 0xff, 0xff) },
1182 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1497, 0xff, 0xff, 0xff) },
1183 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1498, 0xff, 0xff, 0xff) },
1184 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1499, 0xff, 0xff, 0xff) },
1185 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1500, 0xff, 0xff, 0xff) },
1186 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1501, 0xff, 0xff, 0xff) },
1187 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1502, 0xff, 0xff, 0xff) },
1188 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1503, 0xff, 0xff, 0xff) },
1189 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1504, 0xff, 0xff, 0xff) },
1190 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1505, 0xff, 0xff, 0xff) },
1191 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1506, 0xff, 0xff, 0xff) },
1192 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1507, 0xff, 0xff, 0xff) },
1193 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1508, 0xff, 0xff, 0xff) },
1194 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1509, 0xff, 0xff, 0xff) },
1195 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1510, 0xff, 0xff, 0xff) },
1196 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */ 1073 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
1197 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) }, 1074 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
1198 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, 1075 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
1199 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, 1076 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) },
1200 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, 1077 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
1201 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 1078 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1079 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1202 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, 1080 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
1081 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff) },
1203 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, 1082 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
1204 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 1083 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
1205 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, 1084 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, 1085 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) },
1086 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1087 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) },
1088 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) },
1089
1207 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1090 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1208 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 1091 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1209 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 1092 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 8468eb769a29..75b838eff178 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -165,7 +165,7 @@ static unsigned int product_5052_count;
165/* the array dimension is the number of default entries plus */ 165/* the array dimension is the number of default entries plus */
166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ 166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
167/* null entry */ 167/* null entry */
168static struct usb_device_id ti_id_table_3410[13+TI_EXTRA_VID_PID_COUNT+1] = { 168static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -179,6 +179,7 @@ static struct usb_device_id ti_id_table_3410[13+TI_EXTRA_VID_PID_COUNT+1] = {
179 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 179 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
182 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
182}; 183};
183 184
184static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { 185static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
@@ -188,7 +189,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
188 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, 189 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
189}; 190};
190 191
191static struct usb_device_id ti_id_table_combined[17+2*TI_EXTRA_VID_PID_COUNT+1] = { 192static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = {
192 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 193 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
193 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 194 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
194 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 195 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -206,6 +207,7 @@ static struct usb_device_id ti_id_table_combined[17+2*TI_EXTRA_VID_PID_COUNT+1]
206 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 207 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
207 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 208 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
208 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 209 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
210 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
209 { } 211 { }
210}; 212};
211 213
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index 2aac1953993b..f140f1b9d5c0 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -49,6 +49,10 @@
49#define MTS_MT9234ZBA_PRODUCT_ID 0xF115 49#define MTS_MT9234ZBA_PRODUCT_ID 0xF115
50#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319 50#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
51 51
52/* Abbott Diabetics vendor and product ids */
53#define ABBOTT_VENDOR_ID 0x1a61
54#define ABBOTT_PRODUCT_ID 0x3410
55
52/* Commands */ 56/* Commands */
53#define TI_GET_VERSION 0x01 57#define TI_GET_VERSION 0x01
54#define TI_GET_PORT_STATUS 0x02 58#define TI_GET_PORT_STATUS 0x02
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 3dd7da9fd504..db51ba16dc07 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -788,15 +788,19 @@ static void quiesce_and_remove_host(struct us_data *us)
788 struct Scsi_Host *host = us_to_host(us); 788 struct Scsi_Host *host = us_to_host(us);
789 789
790 /* If the device is really gone, cut short reset delays */ 790 /* If the device is really gone, cut short reset delays */
791 if (us->pusb_dev->state == USB_STATE_NOTATTACHED) 791 if (us->pusb_dev->state == USB_STATE_NOTATTACHED) {
792 set_bit(US_FLIDX_DISCONNECTING, &us->dflags); 792 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
793 wake_up(&us->delay_wait);
794 }
793 795
794 /* Prevent SCSI-scanning (if it hasn't started yet) 796 /* Prevent SCSI scanning (if it hasn't started yet)
795 * and wait for the SCSI-scanning thread to stop. 797 * or wait for the SCSI-scanning routine to stop.
796 */ 798 */
797 set_bit(US_FLIDX_DONT_SCAN, &us->dflags); 799 cancel_delayed_work_sync(&us->scan_dwork);
798 wake_up(&us->delay_wait); 800
799 wait_for_completion(&us->scanning_done); 801 /* Balance autopm calls if scanning was cancelled */
802 if (test_bit(US_FLIDX_SCAN_PENDING, &us->dflags))
803 usb_autopm_put_interface_no_suspend(us->pusb_intf);
800 804
801 /* Removing the host will perform an orderly shutdown: caches 805 /* Removing the host will perform an orderly shutdown: caches
802 * synchronized, disks spun down, etc. 806 * synchronized, disks spun down, etc.
@@ -823,53 +827,28 @@ static void release_everything(struct us_data *us)
823 scsi_host_put(us_to_host(us)); 827 scsi_host_put(us_to_host(us));
824} 828}
825 829
826/* Thread to carry out delayed SCSI-device scanning */ 830/* Delayed-work routine to carry out SCSI-device scanning */
827static int usb_stor_scan_thread(void * __us) 831static void usb_stor_scan_dwork(struct work_struct *work)
828{ 832{
829 struct us_data *us = (struct us_data *)__us; 833 struct us_data *us = container_of(work, struct us_data,
834 scan_dwork.work);
830 struct device *dev = &us->pusb_intf->dev; 835 struct device *dev = &us->pusb_intf->dev;
831 836
832 dev_dbg(dev, "device found\n"); 837 dev_dbg(dev, "starting scan\n");
833
834 set_freezable();
835 838
836 /* 839 /* For bulk-only devices, determine the max LUN value */
837 * Wait for the timeout to expire or for a disconnect 840 if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) {
838 * 841 mutex_lock(&us->dev_mutex);
839 * We can't freeze in this thread or we risk causing khubd to 842 us->max_lun = usb_stor_Bulk_max_lun(us);
840 * fail to freeze, but we can't be non-freezable either. Nor can 843 mutex_unlock(&us->dev_mutex);
841 * khubd freeze while waiting for scanning to complete as it may
842 * hold the device lock, causing a hang when suspending devices.
843 * So instead of using wait_event_freezable(), explicitly test
844 * for (DONT_SCAN || freezing) in interruptible wait and proceed
845 * if any of DONT_SCAN, freezing or timeout has happened.
846 */
847 if (delay_use > 0) {
848 dev_dbg(dev, "waiting for device to settle "
849 "before scanning\n");
850 wait_event_interruptible_timeout(us->delay_wait,
851 test_bit(US_FLIDX_DONT_SCAN, &us->dflags) ||
852 freezing(current), delay_use * HZ);
853 } 844 }
845 scsi_scan_host(us_to_host(us));
846 dev_dbg(dev, "scan complete\n");
854 847
855 /* If the device is still connected, perform the scanning */ 848 /* Should we unbind if no devices were detected? */
856 if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) {
857
858 /* For bulk-only devices, determine the max LUN value */
859 if (us->protocol == USB_PR_BULK &&
860 !(us->fflags & US_FL_SINGLE_LUN)) {
861 mutex_lock(&us->dev_mutex);
862 us->max_lun = usb_stor_Bulk_max_lun(us);
863 mutex_unlock(&us->dev_mutex);
864 }
865 scsi_scan_host(us_to_host(us));
866 dev_dbg(dev, "scan complete\n");
867
868 /* Should we unbind if no devices were detected? */
869 }
870 849
871 usb_autopm_put_interface(us->pusb_intf); 850 usb_autopm_put_interface(us->pusb_intf);
872 complete_and_exit(&us->scanning_done, 0); 851 clear_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
873} 852}
874 853
875static unsigned int usb_stor_sg_tablesize(struct usb_interface *intf) 854static unsigned int usb_stor_sg_tablesize(struct usb_interface *intf)
@@ -916,7 +895,7 @@ int usb_stor_probe1(struct us_data **pus,
916 init_completion(&us->cmnd_ready); 895 init_completion(&us->cmnd_ready);
917 init_completion(&(us->notify)); 896 init_completion(&(us->notify));
918 init_waitqueue_head(&us->delay_wait); 897 init_waitqueue_head(&us->delay_wait);
919 init_completion(&us->scanning_done); 898 INIT_DELAYED_WORK(&us->scan_dwork, usb_stor_scan_dwork);
920 899
921 /* Associate the us_data structure with the USB device */ 900 /* Associate the us_data structure with the USB device */
922 result = associate_dev(us, intf); 901 result = associate_dev(us, intf);
@@ -947,7 +926,6 @@ EXPORT_SYMBOL_GPL(usb_stor_probe1);
947/* Second part of general USB mass-storage probing */ 926/* Second part of general USB mass-storage probing */
948int usb_stor_probe2(struct us_data *us) 927int usb_stor_probe2(struct us_data *us)
949{ 928{
950 struct task_struct *th;
951 int result; 929 int result;
952 struct device *dev = &us->pusb_intf->dev; 930 struct device *dev = &us->pusb_intf->dev;
953 931
@@ -988,20 +966,14 @@ int usb_stor_probe2(struct us_data *us)
988 goto BadDevice; 966 goto BadDevice;
989 } 967 }
990 968
991 /* Start up the thread for delayed SCSI-device scanning */ 969 /* Submit the delayed_work for SCSI-device scanning */
992 th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan");
993 if (IS_ERR(th)) {
994 dev_warn(dev,
995 "Unable to start the device-scanning thread\n");
996 complete(&us->scanning_done);
997 quiesce_and_remove_host(us);
998 result = PTR_ERR(th);
999 goto BadDevice;
1000 }
1001
1002 usb_autopm_get_interface_no_resume(us->pusb_intf); 970 usb_autopm_get_interface_no_resume(us->pusb_intf);
1003 wake_up_process(th); 971 set_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
1004 972
973 if (delay_use > 0)
974 dev_dbg(dev, "waiting for device to settle before scanning\n");
975 queue_delayed_work(system_freezable_wq, &us->scan_dwork,
976 delay_use * HZ);
1005 return 0; 977 return 0;
1006 978
1007 /* We come here if there are any problems */ 979 /* We come here if there are any problems */
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 7b0f2113632e..75f70f04f37b 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -47,6 +47,7 @@
47#include <linux/blkdev.h> 47#include <linux/blkdev.h>
48#include <linux/completion.h> 48#include <linux/completion.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/workqueue.h>
50#include <scsi/scsi_host.h> 51#include <scsi/scsi_host.h>
51 52
52struct us_data; 53struct us_data;
@@ -72,7 +73,7 @@ struct us_unusual_dev {
72#define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */ 73#define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */
73#define US_FLIDX_RESETTING 4 /* device reset in progress */ 74#define US_FLIDX_RESETTING 4 /* device reset in progress */
74#define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ 75#define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */
75#define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */ 76#define US_FLIDX_SCAN_PENDING 6 /* scanning not yet done */
76#define US_FLIDX_REDO_READ10 7 /* redo READ(10) command */ 77#define US_FLIDX_REDO_READ10 7 /* redo READ(10) command */
77#define US_FLIDX_READ10_WORKED 8 /* previous READ(10) succeeded */ 78#define US_FLIDX_READ10_WORKED 8 /* previous READ(10) succeeded */
78 79
@@ -147,8 +148,8 @@ struct us_data {
147 /* mutual exclusion and synchronization structures */ 148 /* mutual exclusion and synchronization structures */
148 struct completion cmnd_ready; /* to sleep thread on */ 149 struct completion cmnd_ready; /* to sleep thread on */
149 struct completion notify; /* thread begin/end */ 150 struct completion notify; /* thread begin/end */
150 wait_queue_head_t delay_wait; /* wait during scan, reset */ 151 wait_queue_head_t delay_wait; /* wait during reset */
151 struct completion scanning_done; /* wait for scan thread */ 152 struct delayed_work scan_dwork; /* for async scanning */
152 153
153 /* subdriver information */ 154 /* subdriver information */
154 void *extra; /* Any extra data */ 155 void *extra; /* Any extra data */
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index f9975100d56d..3a3fdc62c75b 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -1061,7 +1061,7 @@ static struct pvr2_board {
1061 int (*init)(void); 1061 int (*init)(void);
1062 void (*exit)(void); 1062 void (*exit)(void);
1063 char name[16]; 1063 char name[16];
1064} board_driver[] = { 1064} board_driver[] __refdata = {
1065#ifdef CONFIG_SH_DREAMCAST 1065#ifdef CONFIG_SH_DREAMCAST
1066 { pvr2fb_dc_init, pvr2fb_dc_exit, "Sega DC PVR2" }, 1066 { pvr2fb_dc_init, pvr2fb_dc_exit, "Sega DC PVR2" },
1067#endif 1067#endif
diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index 14e2d995e958..4dcfced107f5 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -30,7 +30,8 @@ static int vcpu_online(unsigned int cpu)
30 sprintf(dir, "cpu/%u", cpu); 30 sprintf(dir, "cpu/%u", cpu);
31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state); 31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state);
32 if (err != 1) { 32 if (err != 1) {
33 printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); 33 if (!xen_initial_domain())
34 printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
34 return err; 35 return err;
35 } 36 }
36 37
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 7944a17f5cbf..19834d1c7c36 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -884,7 +884,7 @@ static inline int str_to_quirk(const char *buf, int *domain, int *bus, int
884 int err; 884 int err;
885 885
886 err = 886 err =
887 sscanf(buf, " %04x:%02x:%02x.%1x-%08x:%1x:%08x", domain, bus, slot, 887 sscanf(buf, " %04x:%02x:%02x.%d-%08x:%1x:%08x", domain, bus, slot,
888 func, reg, size, mask); 888 func, reg, size, mask);
889 if (err == 7) 889 if (err == 7)
890 return 0; 890 return 0;
@@ -904,7 +904,7 @@ static int pcistub_device_id_add(int domain, int bus, int slot, int func)
904 pci_dev_id->bus = bus; 904 pci_dev_id->bus = bus;
905 pci_dev_id->devfn = PCI_DEVFN(slot, func); 905 pci_dev_id->devfn = PCI_DEVFN(slot, func);
906 906
907 pr_debug(DRV_NAME ": wants to seize %04x:%02x:%02x.%01x\n", 907 pr_debug(DRV_NAME ": wants to seize %04x:%02x:%02x.%d\n",
908 domain, bus, slot, func); 908 domain, bus, slot, func);
909 909
910 spin_lock_irqsave(&device_ids_lock, flags); 910 spin_lock_irqsave(&device_ids_lock, flags);
@@ -934,7 +934,7 @@ static int pcistub_device_id_remove(int domain, int bus, int slot, int func)
934 934
935 err = 0; 935 err = 0;
936 936
937 pr_debug(DRV_NAME ": removed %04x:%02x:%02x.%01x from " 937 pr_debug(DRV_NAME ": removed %04x:%02x:%02x.%d from "
938 "seize list\n", domain, bus, slot, func); 938 "seize list\n", domain, bus, slot, func);
939 } 939 }
940 } 940 }
@@ -1029,7 +1029,7 @@ static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1029 break; 1029 break;
1030 1030
1031 count += scnprintf(buf + count, PAGE_SIZE - count, 1031 count += scnprintf(buf + count, PAGE_SIZE - count,
1032 "%04x:%02x:%02x.%01x\n", 1032 "%04x:%02x:%02x.%d\n",
1033 pci_dev_id->domain, pci_dev_id->bus, 1033 pci_dev_id->domain, pci_dev_id->bus,
1034 PCI_SLOT(pci_dev_id->devfn), 1034 PCI_SLOT(pci_dev_id->devfn),
1035 PCI_FUNC(pci_dev_id->devfn)); 1035 PCI_FUNC(pci_dev_id->devfn));
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index d5dcf8d5d3d9..64b11f99eacc 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -206,6 +206,7 @@ static int xen_pcibk_publish_pci_dev(struct xen_pcibk_device *pdev,
206 goto out; 206 goto out;
207 } 207 }
208 208
209 /* Note: The PV protocol uses %02x, don't change it */
209 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str, 210 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str,
210 "%04x:%02x:%02x.%02x", domain, bus, 211 "%04x:%02x:%02x.%02x", domain, bus,
211 PCI_SLOT(devfn), PCI_FUNC(devfn)); 212 PCI_SLOT(devfn), PCI_FUNC(devfn));
@@ -229,7 +230,7 @@ static int xen_pcibk_export_device(struct xen_pcibk_device *pdev,
229 err = -EINVAL; 230 err = -EINVAL;
230 xenbus_dev_fatal(pdev->xdev, err, 231 xenbus_dev_fatal(pdev->xdev, err,
231 "Couldn't locate PCI device " 232 "Couldn't locate PCI device "
232 "(%04x:%02x:%02x.%01x)! " 233 "(%04x:%02x:%02x.%d)! "
233 "perhaps already in-use?", 234 "perhaps already in-use?",
234 domain, bus, slot, func); 235 domain, bus, slot, func);
235 goto out; 236 goto out;
@@ -274,7 +275,7 @@ static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev,
274 if (!dev) { 275 if (!dev) {
275 err = -EINVAL; 276 err = -EINVAL;
276 dev_dbg(&pdev->xdev->dev, "Couldn't locate PCI device " 277 dev_dbg(&pdev->xdev->dev, "Couldn't locate PCI device "
277 "(%04x:%02x:%02x.%01x)! not owned by this domain\n", 278 "(%04x:%02x:%02x.%d)! not owned by this domain\n",
278 domain, bus, slot, func); 279 domain, bus, slot, func);
279 goto out; 280 goto out;
280 } 281 }
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 527dc2a3b89f..89f76252a16f 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -369,6 +369,10 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
369 goto out; 369 goto out;
370 } 370 }
371 token++; 371 token++;
372 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) {
373 rc = -EILSEQ;
374 goto out;
375 }
372 376
373 if (msg_type == XS_WATCH) { 377 if (msg_type == XS_WATCH) {
374 watch = alloc_watch_adapter(path, token); 378 watch = alloc_watch_adapter(path, token);