aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci_platform.c2
-rw-r--r--drivers/ata/libata-acpi.c11
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/pata_arasan_cf.c8
-rw-r--r--drivers/ata/sata_highbank.c4
-rw-r--r--drivers/ata/sata_svw.c35
-rw-r--r--drivers/base/power/qos.c2
-rw-r--r--drivers/block/aoe/aoecmd.c2
-rw-r--r--drivers/block/floppy.c5
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c18
-rw-r--r--drivers/block/mtip32xx/mtip32xx.h6
-rw-r--r--drivers/bluetooth/ath3k.c1
-rw-r--r--drivers/bluetooth/btusb.c1
-rw-r--r--drivers/bus/omap-ocp2scp.c68
-rw-r--r--drivers/clk/ux500/u8500_clk.c50
-rw-r--r--drivers/edac/amd64_edac.h2
-rw-r--r--drivers/edac/edac_stub.c2
-rw-r--r--drivers/edac/mce_amd_inj.c4
-rw-r--r--drivers/firewire/sbp2.c2
-rw-r--r--drivers/gpio/Kconfig2
-rw-r--r--drivers/gpio/gpio-mcp23s08.c6
-rw-r--r--drivers/gpio/gpio-mvebu.c23
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c11
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c22
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c19
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c12
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv40.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nv40.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/object.h14
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/clock.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c19
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c3
-rw-r--r--drivers/gpu/drm/radeon/atombios_encoders.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_agp.c5
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c5
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c2
-rw-r--r--drivers/hid/hid-microsoft.c6
-rw-r--r--drivers/i2c/busses/i2c-at91.c7
-rw-r--r--drivers/i2c/busses/i2c-mxs.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c36
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c1
-rw-r--r--drivers/i2c/muxes/i2c-mux-pinctrl.c2
-rw-r--r--drivers/input/input-mt.c4
-rw-r--r--drivers/input/mousedev.c4
-rw-r--r--drivers/input/touchscreen/ads7846.c6
-rw-r--r--drivers/iommu/intel-iommu.c4
-rw-r--r--drivers/iommu/tegra-smmu.c1
-rw-r--r--drivers/irqchip/irq-bcm2835.c3
-rw-r--r--drivers/leds/ledtrig-cpu.c21
-rw-r--r--drivers/md/dm.c8
-rw-r--r--drivers/md/md.c27
-rw-r--r--drivers/md/raid10.c131
-rw-r--r--drivers/md/raid5.c79
-rw-r--r--drivers/mtd/devices/slram.c2
-rw-r--r--drivers/mtd/nand/nand_base.c10
-rw-r--r--drivers/mtd/ofpart.c2
-rw-r--r--drivers/mtd/onenand/onenand_base.c2
-rw-r--r--drivers/net/bonding/bond_main.c7
-rw-r--r--drivers/net/ethernet/8390/ne.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c11
-rw-r--r--drivers/net/ethernet/jme.c28
-rw-r--r--drivers/net/ethernet/micrel/ksz884x.c16
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c22
-rw-r--r--drivers/net/ethernet/sis/sis900.c2
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c17
-rw-r--r--drivers/net/ethernet/tile/tilegx.c2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c14
-rw-r--r--drivers/net/ethernet/xscale/ixp4xx_eth.c8
-rw-r--r--drivers/net/irda/sir_dev.c2
-rw-r--r--drivers/net/phy/mdio-bitbang.c1
-rw-r--r--drivers/net/phy/mdio-gpio.c11
-rw-r--r--drivers/net/team/team_mode_broadcast.c6
-rw-r--r--drivers/net/usb/cdc_ncm.c22
-rw-r--r--drivers/net/usb/smsc95xx.c4
-rw-r--r--drivers/net/vxlan.c10
-rw-r--r--drivers/net/wan/ixp4xx_hss.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c16
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/main.c2
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/rx.c23
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c8
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c11
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c11
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c1
-rw-r--r--drivers/net/xen-netfront.c98
-rw-r--r--drivers/nfc/pn533.c25
-rw-r--r--drivers/pinctrl/Kconfig2
-rw-r--r--drivers/rapidio/rio.c2
-rw-r--r--drivers/regulator/Kconfig11
-rw-r--r--drivers/regulator/Makefile1
-rw-r--r--drivers/regulator/core.c39
-rw-r--r--drivers/regulator/palmas-regulator.c37
-rw-r--r--drivers/regulator/tps51632-regulator.c332
-rw-r--r--drivers/s390/char/con3215.c12
-rw-r--r--drivers/s390/net/qeth_core_main.c24
-rw-r--r--drivers/s390/net/qeth_l2_main.c13
-rw-r--r--drivers/scsi/isci/request.c2
-rw-r--r--drivers/scsi/scsi.c45
-rw-r--r--drivers/scsi/scsi_lib.c22
-rw-r--r--drivers/scsi/sd.c202
-rw-r--r--drivers/scsi/sd.h7
-rw-r--r--drivers/staging/android/android_alarm.h4
-rw-r--r--drivers/tty/hvc/hvc_console.c7
-rw-r--r--drivers/tty/serial/max310x.c1
-rw-r--r--drivers/usb/core/hcd.c16
-rw-r--r--drivers/usb/early/ehci-dbgp.c15
-rw-r--r--drivers/usb/host/ehci-ls1x.c2
-rw-r--r--drivers/usb/host/ohci-xls.c2
-rw-r--r--drivers/usb/musb/musb_gadget.c30
-rw-r--r--drivers/usb/musb/ux500.c2
-rw-r--r--drivers/usb/otg/Kconfig4
-rw-r--r--drivers/usb/serial/keyspan.c3
-rw-r--r--drivers/usb/serial/option.c9
-rw-r--r--drivers/usb/serial/usb_wwan.c10
-rw-r--r--drivers/usb/storage/scsiglue.c6
-rw-r--r--drivers/video/omap2/dss/dsi.c13
-rw-r--r--drivers/video/omap2/dss/dss.c18
-rw-r--r--drivers/video/omap2/dss/hdmi.c4
-rw-r--r--drivers/video/omap2/omapfb/omapfb-ioctl.c2
-rw-r--r--drivers/xen/privcmd.c18
128 files changed, 1559 insertions, 505 deletions
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index b1ae48054dc5..b7078afddb74 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -238,7 +238,7 @@ static int __devexit ahci_remove(struct platform_device *pdev)
238 return 0; 238 return 0;
239} 239}
240 240
241#ifdef CONFIG_PM 241#ifdef CONFIG_PM_SLEEP
242static int ahci_suspend(struct device *dev) 242static int ahci_suspend(struct device *dev)
243{ 243{
244 struct ahci_platform_data *pdata = dev_get_platdata(dev); 244 struct ahci_platform_data *pdata = dev_get_platdata(dev);
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index fd9ecf74e631..5b0ba3f20edc 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -1105,10 +1105,15 @@ static int ata_acpi_bind_device(struct ata_port *ap, struct scsi_device *sdev,
1105 struct acpi_device *acpi_dev; 1105 struct acpi_device *acpi_dev;
1106 struct acpi_device_power_state *states; 1106 struct acpi_device_power_state *states;
1107 1107
1108 if (ap->flags & ATA_FLAG_ACPI_SATA) 1108 if (ap->flags & ATA_FLAG_ACPI_SATA) {
1109 ata_dev = &ap->link.device[sdev->channel]; 1109 if (!sata_pmp_attached(ap))
1110 else 1110 ata_dev = &ap->link.device[sdev->id];
1111 else
1112 ata_dev = &ap->pmp_link[sdev->channel].device[sdev->id];
1113 }
1114 else {
1111 ata_dev = &ap->link.device[sdev->id]; 1115 ata_dev = &ap->link.device[sdev->id];
1116 }
1112 1117
1113 *handle = ata_dev_acpi_handle(ata_dev); 1118 *handle = ata_dev_acpi_handle(ata_dev);
1114 1119
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3cc7096cfda7..f46fbd3bd3fb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2942,6 +2942,10 @@ const struct ata_timing *ata_timing_find_mode(u8 xfer_mode)
2942 2942
2943 if (xfer_mode == t->mode) 2943 if (xfer_mode == t->mode)
2944 return t; 2944 return t;
2945
2946 WARN_ONCE(true, "%s: unable to find timing for xfer_mode 0x%x\n",
2947 __func__, xfer_mode);
2948
2945 return NULL; 2949 return NULL;
2946} 2950}
2947 2951
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e3bda074fa12..a6df6a351d6e 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1052,6 +1052,8 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev)
1052{ 1052{
1053 sdev->use_10_for_rw = 1; 1053 sdev->use_10_for_rw = 1;
1054 sdev->use_10_for_ms = 1; 1054 sdev->use_10_for_ms = 1;
1055 sdev->no_report_opcodes = 1;
1056 sdev->no_write_same = 1;
1055 1057
1056 /* Schedule policy is determined by ->qc_defer() callback and 1058 /* Schedule policy is determined by ->qc_defer() callback and
1057 * it needs to see every deferred qc. Set dev_blocked to 1 to 1059 * it needs to see every deferred qc. Set dev_blocked to 1 to
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 26201ebef3ca..371fd2c698b7 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -317,6 +317,12 @@ static int cf_init(struct arasan_cf_dev *acdev)
317 return ret; 317 return ret;
318 } 318 }
319 319
320 ret = clk_set_rate(acdev->clk, 166000000);
321 if (ret) {
322 dev_warn(acdev->host->dev, "clock set rate failed");
323 return ret;
324 }
325
320 spin_lock_irqsave(&acdev->host->lock, flags); 326 spin_lock_irqsave(&acdev->host->lock, flags);
321 /* configure CF interface clock */ 327 /* configure CF interface clock */
322 writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : 328 writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk :
@@ -908,7 +914,7 @@ static int __devexit arasan_cf_remove(struct platform_device *pdev)
908 return 0; 914 return 0;
909} 915}
910 916
911#ifdef CONFIG_PM 917#ifdef CONFIG_PM_SLEEP
912static int arasan_cf_suspend(struct device *dev) 918static int arasan_cf_suspend(struct device *dev)
913{ 919{
914 struct ata_host *host = dev_get_drvdata(dev); 920 struct ata_host *host = dev_get_drvdata(dev);
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 0d7c4c2cd26f..400bf1c3e982 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -260,7 +260,7 @@ static const struct of_device_id ahci_of_match[] = {
260}; 260};
261MODULE_DEVICE_TABLE(of, ahci_of_match); 261MODULE_DEVICE_TABLE(of, ahci_of_match);
262 262
263static int __init ahci_highbank_probe(struct platform_device *pdev) 263static int __devinit ahci_highbank_probe(struct platform_device *pdev)
264{ 264{
265 struct device *dev = &pdev->dev; 265 struct device *dev = &pdev->dev;
266 struct ahci_host_priv *hpriv; 266 struct ahci_host_priv *hpriv;
@@ -378,7 +378,7 @@ static int __devexit ahci_highbank_remove(struct platform_device *pdev)
378 return 0; 378 return 0;
379} 379}
380 380
381#ifdef CONFIG_PM 381#ifdef CONFIG_PM_SLEEP
382static int ahci_highbank_suspend(struct device *dev) 382static int ahci_highbank_suspend(struct device *dev)
383{ 383{
384 struct ata_host *host = dev_get_drvdata(dev); 384 struct ata_host *host = dev_get_drvdata(dev);
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 44a4256533e1..08608de87e4e 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -142,6 +142,39 @@ static int k2_sata_scr_write(struct ata_link *link,
142 return 0; 142 return 0;
143} 143}
144 144
145static int k2_sata_softreset(struct ata_link *link,
146 unsigned int *class, unsigned long deadline)
147{
148 u8 dmactl;
149 void __iomem *mmio = link->ap->ioaddr.bmdma_addr;
150
151 dmactl = readb(mmio + ATA_DMA_CMD);
152
153 /* Clear the start bit */
154 if (dmactl & ATA_DMA_START) {
155 dmactl &= ~ATA_DMA_START;
156 writeb(dmactl, mmio + ATA_DMA_CMD);
157 }
158
159 return ata_sff_softreset(link, class, deadline);
160}
161
162static int k2_sata_hardreset(struct ata_link *link,
163 unsigned int *class, unsigned long deadline)
164{
165 u8 dmactl;
166 void __iomem *mmio = link->ap->ioaddr.bmdma_addr;
167
168 dmactl = readb(mmio + ATA_DMA_CMD);
169
170 /* Clear the start bit */
171 if (dmactl & ATA_DMA_START) {
172 dmactl &= ~ATA_DMA_START;
173 writeb(dmactl, mmio + ATA_DMA_CMD);
174 }
175
176 return sata_sff_hardreset(link, class, deadline);
177}
145 178
146static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 179static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
147{ 180{
@@ -346,6 +379,8 @@ static struct scsi_host_template k2_sata_sht = {
346 379
347static struct ata_port_operations k2_sata_ops = { 380static struct ata_port_operations k2_sata_ops = {
348 .inherits = &ata_bmdma_port_ops, 381 .inherits = &ata_bmdma_port_ops,
382 .softreset = k2_sata_softreset,
383 .hardreset = k2_sata_hardreset,
349 .sff_tf_load = k2_sata_tf_load, 384 .sff_tf_load = k2_sata_tf_load,
350 .sff_tf_read = k2_sata_tf_read, 385 .sff_tf_read = k2_sata_tf_read,
351 .sff_check_status = k2_stat_check_status, 386 .sff_check_status = k2_stat_check_status,
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 74a67e0019a2..fbbd4ed2edf2 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -451,7 +451,7 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
451 if (ancestor) 451 if (ancestor)
452 error = dev_pm_qos_add_request(ancestor, req, value); 452 error = dev_pm_qos_add_request(ancestor, req, value);
453 453
454 if (error) 454 if (error < 0)
455 req->dev = NULL; 455 req->dev = NULL;
456 456
457 return error; 457 return error;
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 3804a0af3ef1..9fe4f1865558 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -935,7 +935,7 @@ aoe_end_request(struct aoedev *d, struct request *rq, int fastfail)
935 935
936 /* cf. http://lkml.org/lkml/2006/10/31/28 */ 936 /* cf. http://lkml.org/lkml/2006/10/31/28 */
937 if (!fastfail) 937 if (!fastfail)
938 q->request_fn(q); 938 __blk_run_queue(q);
939} 939}
940 940
941static void 941static void
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 1c49d7173966..2ddd64a9ffde 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4330,6 +4330,7 @@ out_unreg_region:
4330out_unreg_blkdev: 4330out_unreg_blkdev:
4331 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4331 unregister_blkdev(FLOPPY_MAJOR, "fd");
4332out_put_disk: 4332out_put_disk:
4333 destroy_workqueue(floppy_wq);
4333 for (drive = 0; drive < N_DRIVE; drive++) { 4334 for (drive = 0; drive < N_DRIVE; drive++) {
4334 if (!disks[drive]) 4335 if (!disks[drive])
4335 break; 4336 break;
@@ -4340,7 +4341,6 @@ out_put_disk:
4340 } 4341 }
4341 put_disk(disks[drive]); 4342 put_disk(disks[drive]);
4342 } 4343 }
4343 destroy_workqueue(floppy_wq);
4344 return err; 4344 return err;
4345} 4345}
4346 4346
@@ -4555,6 +4555,8 @@ static void __exit floppy_module_exit(void)
4555 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4555 unregister_blkdev(FLOPPY_MAJOR, "fd");
4556 platform_driver_unregister(&floppy_driver); 4556 platform_driver_unregister(&floppy_driver);
4557 4557
4558 destroy_workqueue(floppy_wq);
4559
4558 for (drive = 0; drive < N_DRIVE; drive++) { 4560 for (drive = 0; drive < N_DRIVE; drive++) {
4559 del_timer_sync(&motor_off_timer[drive]); 4561 del_timer_sync(&motor_off_timer[drive]);
4560 4562
@@ -4578,7 +4580,6 @@ static void __exit floppy_module_exit(void)
4578 4580
4579 cancel_delayed_work_sync(&fd_timeout); 4581 cancel_delayed_work_sync(&fd_timeout);
4580 cancel_delayed_work_sync(&fd_timer); 4582 cancel_delayed_work_sync(&fd_timer);
4581 destroy_workqueue(floppy_wq);
4582 4583
4583 if (atomic_read(&usage_count)) 4584 if (atomic_read(&usage_count))
4584 floppy_release_irq_and_dma(); 4585 floppy_release_irq_and_dma();
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index adc6f36564cf..9694dd99bbbc 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -559,7 +559,7 @@ static void mtip_timeout_function(unsigned long int data)
559 struct mtip_cmd *command; 559 struct mtip_cmd *command;
560 int tag, cmdto_cnt = 0; 560 int tag, cmdto_cnt = 0;
561 unsigned int bit, group; 561 unsigned int bit, group;
562 unsigned int num_command_slots = port->dd->slot_groups * 32; 562 unsigned int num_command_slots;
563 unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; 563 unsigned long to, tagaccum[SLOTBITS_IN_LONGS];
564 564
565 if (unlikely(!port)) 565 if (unlikely(!port))
@@ -572,6 +572,7 @@ static void mtip_timeout_function(unsigned long int data)
572 } 572 }
573 /* clear the tag accumulator */ 573 /* clear the tag accumulator */
574 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); 574 memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long));
575 num_command_slots = port->dd->slot_groups * 32;
575 576
576 for (tag = 0; tag < num_command_slots; tag++) { 577 for (tag = 0; tag < num_command_slots; tag++) {
577 /* 578 /*
@@ -2218,8 +2219,8 @@ static int exec_drive_taskfile(struct driver_data *dd,
2218 fis.device); 2219 fis.device);
2219 2220
2220 /* check for erase mode support during secure erase.*/ 2221 /* check for erase mode support during secure erase.*/
2221 if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) 2222 if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) && outbuf &&
2222 && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { 2223 (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
2223 erasemode = 1; 2224 erasemode = 1;
2224 } 2225 }
2225 2226
@@ -2439,7 +2440,7 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd,
2439 * return value 2440 * return value
2440 * None 2441 * None
2441 */ 2442 */
2442static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, 2443static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector,
2443 int nsect, int nents, int tag, void *callback, 2444 int nsect, int nents, int tag, void *callback,
2444 void *data, int dir) 2445 void *data, int dir)
2445{ 2446{
@@ -2447,6 +2448,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start,
2447 struct mtip_port *port = dd->port; 2448 struct mtip_port *port = dd->port;
2448 struct mtip_cmd *command = &port->commands[tag]; 2449 struct mtip_cmd *command = &port->commands[tag];
2449 int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 2450 int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
2451 u64 start = sector;
2450 2452
2451 /* Map the scatter list for DMA access */ 2453 /* Map the scatter list for DMA access */
2452 nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); 2454 nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir);
@@ -2465,8 +2467,12 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start,
2465 fis->opts = 1 << 7; 2467 fis->opts = 1 << 7;
2466 fis->command = 2468 fis->command =
2467 (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE); 2469 (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE);
2468 *((unsigned int *) &fis->lba_low) = (start & 0xFFFFFF); 2470 fis->lba_low = start & 0xFF;
2469 *((unsigned int *) &fis->lba_low_ex) = ((start >> 24) & 0xFFFFFF); 2471 fis->lba_mid = (start >> 8) & 0xFF;
2472 fis->lba_hi = (start >> 16) & 0xFF;
2473 fis->lba_low_ex = (start >> 24) & 0xFF;
2474 fis->lba_mid_ex = (start >> 32) & 0xFF;
2475 fis->lba_hi_ex = (start >> 40) & 0xFF;
2470 fis->device = 1 << 6; 2476 fis->device = 1 << 6;
2471 fis->features = nsect & 0xFF; 2477 fis->features = nsect & 0xFF;
2472 fis->features_ex = (nsect >> 8) & 0xFF; 2478 fis->features_ex = (nsect >> 8) & 0xFF;
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 5f4a917bd8bb..b1742640556a 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -34,7 +34,7 @@
34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 34#define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
35 35
36/* check for erase mode support during secure erase */ 36/* check for erase mode support during secure erase */
37#define MTIP_SEC_ERASE_MODE 0x3 37#define MTIP_SEC_ERASE_MODE 0x2
38 38
39/* # of times to retry timed out/failed IOs */ 39/* # of times to retry timed out/failed IOs */
40#define MTIP_MAX_RETRIES 2 40#define MTIP_MAX_RETRIES 2
@@ -155,14 +155,14 @@ enum {
155 MTIP_DDF_REBUILD_FAILED_BIT = 8, 155 MTIP_DDF_REBUILD_FAILED_BIT = 8,
156}; 156};
157 157
158__packed struct smart_attr{ 158struct smart_attr {
159 u8 attr_id; 159 u8 attr_id;
160 u16 flags; 160 u16 flags;
161 u8 cur; 161 u8 cur;
162 u8 worst; 162 u8 worst;
163 u32 data; 163 u32 data;
164 u8 res[3]; 164 u8 res[3];
165}; 165} __packed;
166 166
167/* Register Frame Information Structure (FIS), host to device. */ 167/* Register Frame Information Structure (FIS), host to device. */
168struct host_to_dev_fis { 168struct host_to_dev_fis {
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index fc2de5528dcc..b00000e8aef6 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -67,6 +67,7 @@ static struct usb_device_id ath3k_table[] = {
67 { USB_DEVICE(0x13d3, 0x3304) }, 67 { USB_DEVICE(0x13d3, 0x3304) },
68 { USB_DEVICE(0x0930, 0x0215) }, 68 { USB_DEVICE(0x0930, 0x0215) },
69 { USB_DEVICE(0x0489, 0xE03D) }, 69 { USB_DEVICE(0x0489, 0xE03D) },
70 { USB_DEVICE(0x0489, 0xE027) },
70 71
71 /* Atheros AR9285 Malbec with sflash firmware */ 72 /* Atheros AR9285 Malbec with sflash firmware */
72 { USB_DEVICE(0x03F0, 0x311D) }, 73 { USB_DEVICE(0x03F0, 0x311D) },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index debda27df9b0..ee82f2fb65f0 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -124,6 +124,7 @@ static struct usb_device_id blacklist_table[] = {
124 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, 124 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
125 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, 125 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
126 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, 126 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
127 { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
127 128
128 /* Atheros AR9285 Malbec with sflash firmware */ 129 /* Atheros AR9285 Malbec with sflash firmware */
129 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, 130 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
index ff63560b8467..0c48b0e05ed6 100644
--- a/drivers/bus/omap-ocp2scp.c
+++ b/drivers/bus/omap-ocp2scp.c
@@ -22,6 +22,26 @@
22#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/omap_ocp2scp.h>
26
27/**
28 * _count_resources - count for the number of resources
29 * @res: struct resource *
30 *
31 * Count and return the number of resources populated for the device that is
32 * connected to ocp2scp.
33 */
34static unsigned _count_resources(struct resource *res)
35{
36 int cnt = 0;
37
38 while (res->start != res->end) {
39 cnt++;
40 res++;
41 }
42
43 return cnt;
44}
25 45
26static int ocp2scp_remove_devices(struct device *dev, void *c) 46static int ocp2scp_remove_devices(struct device *dev, void *c)
27{ 47{
@@ -34,20 +54,62 @@ static int ocp2scp_remove_devices(struct device *dev, void *c)
34 54
35static int __devinit omap_ocp2scp_probe(struct platform_device *pdev) 55static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
36{ 56{
37 int ret; 57 int ret;
38 struct device_node *np = pdev->dev.of_node; 58 unsigned res_cnt, i;
59 struct device_node *np = pdev->dev.of_node;
60 struct platform_device *pdev_child;
61 struct omap_ocp2scp_platform_data *pdata = pdev->dev.platform_data;
62 struct omap_ocp2scp_dev *dev;
39 63
40 if (np) { 64 if (np) {
41 ret = of_platform_populate(np, NULL, NULL, &pdev->dev); 65 ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
42 if (ret) { 66 if (ret) {
43 dev_err(&pdev->dev, "failed to add resources for ocp2scp child\n"); 67 dev_err(&pdev->dev,
68 "failed to add resources for ocp2scp child\n");
44 goto err0; 69 goto err0;
45 } 70 }
71 } else if (pdata) {
72 for (i = 0, dev = *pdata->devices; i < pdata->dev_cnt; i++,
73 dev++) {
74 res_cnt = _count_resources(dev->res);
75
76 pdev_child = platform_device_alloc(dev->drv_name,
77 PLATFORM_DEVID_AUTO);
78 if (!pdev_child) {
79 dev_err(&pdev->dev,
80 "failed to allocate mem for ocp2scp child\n");
81 goto err0;
82 }
83
84 ret = platform_device_add_resources(pdev_child,
85 dev->res, res_cnt);
86 if (ret) {
87 dev_err(&pdev->dev,
88 "failed to add resources for ocp2scp child\n");
89 goto err1;
90 }
91
92 pdev_child->dev.parent = &pdev->dev;
93
94 ret = platform_device_add(pdev_child);
95 if (ret) {
96 dev_err(&pdev->dev,
97 "failed to register ocp2scp child device\n");
98 goto err1;
99 }
100 }
101 } else {
102 dev_err(&pdev->dev, "OCP2SCP initialized without plat data\n");
103 return -EINVAL;
46 } 104 }
105
47 pm_runtime_enable(&pdev->dev); 106 pm_runtime_enable(&pdev->dev);
48 107
49 return 0; 108 return 0;
50 109
110err1:
111 platform_device_put(pdev_child);
112
51err0: 113err0:
52 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); 114 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
53 115
diff --git a/drivers/clk/ux500/u8500_clk.c b/drivers/clk/ux500/u8500_clk.c
index ca4a25ed844c..e2c17d187d98 100644
--- a/drivers/clk/ux500/u8500_clk.c
+++ b/drivers/clk/ux500/u8500_clk.c
@@ -40,7 +40,7 @@ void u8500_clk_init(void)
40 CLK_IS_ROOT|CLK_IGNORE_UNUSED, 40 CLK_IS_ROOT|CLK_IGNORE_UNUSED,
41 32768); 41 32768);
42 clk_register_clkdev(clk, "clk32k", NULL); 42 clk_register_clkdev(clk, "clk32k", NULL);
43 clk_register_clkdev(clk, NULL, "rtc-pl031"); 43 clk_register_clkdev(clk, "apb_pclk", "rtc-pl031");
44 44
45 /* PRCMU clocks */ 45 /* PRCMU clocks */
46 fw_version = prcmu_get_fw_version(); 46 fw_version = prcmu_get_fw_version();
@@ -228,10 +228,17 @@ void u8500_clk_init(void)
228 228
229 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", U8500_CLKRST1_BASE, 229 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", U8500_CLKRST1_BASE,
230 BIT(2), 0); 230 BIT(2), 0);
231 clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.1");
232
231 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", U8500_CLKRST1_BASE, 233 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", U8500_CLKRST1_BASE,
232 BIT(3), 0); 234 BIT(3), 0);
235 clk_register_clkdev(clk, "apb_pclk", "msp0");
236 clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.0");
237
233 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", U8500_CLKRST1_BASE, 238 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", U8500_CLKRST1_BASE,
234 BIT(4), 0); 239 BIT(4), 0);
240 clk_register_clkdev(clk, "apb_pclk", "msp1");
241 clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.1");
235 242
236 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", U8500_CLKRST1_BASE, 243 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", U8500_CLKRST1_BASE,
237 BIT(5), 0); 244 BIT(5), 0);
@@ -239,6 +246,7 @@ void u8500_clk_init(void)
239 246
240 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", U8500_CLKRST1_BASE, 247 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", U8500_CLKRST1_BASE,
241 BIT(6), 0); 248 BIT(6), 0);
249 clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.2");
242 250
243 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", U8500_CLKRST1_BASE, 251 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", U8500_CLKRST1_BASE,
244 BIT(7), 0); 252 BIT(7), 0);
@@ -246,6 +254,7 @@ void u8500_clk_init(void)
246 254
247 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", U8500_CLKRST1_BASE, 255 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", U8500_CLKRST1_BASE,
248 BIT(8), 0); 256 BIT(8), 0);
257 clk_register_clkdev(clk, "apb_pclk", "slimbus0");
249 258
250 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", U8500_CLKRST1_BASE, 259 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", U8500_CLKRST1_BASE,
251 BIT(9), 0); 260 BIT(9), 0);
@@ -255,11 +264,16 @@ void u8500_clk_init(void)
255 264
256 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", U8500_CLKRST1_BASE, 265 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", U8500_CLKRST1_BASE,
257 BIT(10), 0); 266 BIT(10), 0);
267 clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.4");
268
258 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", U8500_CLKRST1_BASE, 269 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", U8500_CLKRST1_BASE,
259 BIT(11), 0); 270 BIT(11), 0);
271 clk_register_clkdev(clk, "apb_pclk", "msp3");
272 clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.3");
260 273
261 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", U8500_CLKRST2_BASE, 274 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", U8500_CLKRST2_BASE,
262 BIT(0), 0); 275 BIT(0), 0);
276 clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.3");
263 277
264 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", U8500_CLKRST2_BASE, 278 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", U8500_CLKRST2_BASE,
265 BIT(1), 0); 279 BIT(1), 0);
@@ -279,12 +293,13 @@ void u8500_clk_init(void)
279 293
280 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", U8500_CLKRST2_BASE, 294 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", U8500_CLKRST2_BASE,
281 BIT(5), 0); 295 BIT(5), 0);
296 clk_register_clkdev(clk, "apb_pclk", "msp2");
297 clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.2");
282 298
283 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", U8500_CLKRST2_BASE, 299 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", U8500_CLKRST2_BASE,
284 BIT(6), 0); 300 BIT(6), 0);
285 clk_register_clkdev(clk, "apb_pclk", "sdi1"); 301 clk_register_clkdev(clk, "apb_pclk", "sdi1");
286 302
287
288 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", U8500_CLKRST2_BASE, 303 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", U8500_CLKRST2_BASE,
289 BIT(7), 0); 304 BIT(7), 0);
290 clk_register_clkdev(clk, "apb_pclk", "sdi3"); 305 clk_register_clkdev(clk, "apb_pclk", "sdi3");
@@ -316,10 +331,15 @@ void u8500_clk_init(void)
316 331
317 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", U8500_CLKRST3_BASE, 332 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", U8500_CLKRST3_BASE,
318 BIT(1), 0); 333 BIT(1), 0);
334 clk_register_clkdev(clk, "apb_pclk", "ssp0");
335
319 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", U8500_CLKRST3_BASE, 336 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", U8500_CLKRST3_BASE,
320 BIT(2), 0); 337 BIT(2), 0);
338 clk_register_clkdev(clk, "apb_pclk", "ssp1");
339
321 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", U8500_CLKRST3_BASE, 340 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", U8500_CLKRST3_BASE,
322 BIT(3), 0); 341 BIT(3), 0);
342 clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.0");
323 343
324 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", U8500_CLKRST3_BASE, 344 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", U8500_CLKRST3_BASE,
325 BIT(4), 0); 345 BIT(4), 0);
@@ -401,10 +421,17 @@ void u8500_clk_init(void)
401 421
402 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk", 422 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
403 U8500_CLKRST1_BASE, BIT(2), CLK_SET_RATE_GATE); 423 U8500_CLKRST1_BASE, BIT(2), CLK_SET_RATE_GATE);
424 clk_register_clkdev(clk, NULL, "nmk-i2c.1");
425
404 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk", 426 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
405 U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE); 427 U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE);
428 clk_register_clkdev(clk, NULL, "msp0");
429 clk_register_clkdev(clk, NULL, "ux500-msp-i2s.0");
430
406 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk", 431 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
407 U8500_CLKRST1_BASE, BIT(4), CLK_SET_RATE_GATE); 432 U8500_CLKRST1_BASE, BIT(4), CLK_SET_RATE_GATE);
433 clk_register_clkdev(clk, NULL, "msp1");
434 clk_register_clkdev(clk, NULL, "ux500-msp-i2s.1");
408 435
409 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk", 436 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
410 U8500_CLKRST1_BASE, BIT(5), CLK_SET_RATE_GATE); 437 U8500_CLKRST1_BASE, BIT(5), CLK_SET_RATE_GATE);
@@ -412,17 +439,25 @@ void u8500_clk_init(void)
412 439
413 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk", 440 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
414 U8500_CLKRST1_BASE, BIT(6), CLK_SET_RATE_GATE); 441 U8500_CLKRST1_BASE, BIT(6), CLK_SET_RATE_GATE);
442 clk_register_clkdev(clk, NULL, "nmk-i2c.2");
443
415 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk", 444 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
416 U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE); 445 U8500_CLKRST1_BASE, BIT(8), CLK_SET_RATE_GATE);
417 /* FIXME: Redefinition of BIT(3). */ 446 clk_register_clkdev(clk, NULL, "slimbus0");
447
418 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk", 448 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
419 U8500_CLKRST1_BASE, BIT(9), CLK_SET_RATE_GATE); 449 U8500_CLKRST1_BASE, BIT(9), CLK_SET_RATE_GATE);
450 clk_register_clkdev(clk, NULL, "nmk-i2c.4");
451
420 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk", 452 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
421 U8500_CLKRST1_BASE, BIT(10), CLK_SET_RATE_GATE); 453 U8500_CLKRST1_BASE, BIT(10), CLK_SET_RATE_GATE);
454 clk_register_clkdev(clk, NULL, "msp3");
455 clk_register_clkdev(clk, NULL, "ux500-msp-i2s.3");
422 456
423 /* Periph2 */ 457 /* Periph2 */
424 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk", 458 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
425 U8500_CLKRST2_BASE, BIT(0), CLK_SET_RATE_GATE); 459 U8500_CLKRST2_BASE, BIT(0), CLK_SET_RATE_GATE);
460 clk_register_clkdev(clk, NULL, "nmk-i2c.3");
426 461
427 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk", 462 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
428 U8500_CLKRST2_BASE, BIT(2), CLK_SET_RATE_GATE); 463 U8500_CLKRST2_BASE, BIT(2), CLK_SET_RATE_GATE);
@@ -430,6 +465,8 @@ void u8500_clk_init(void)
430 465
431 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk", 466 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
432 U8500_CLKRST2_BASE, BIT(3), CLK_SET_RATE_GATE); 467 U8500_CLKRST2_BASE, BIT(3), CLK_SET_RATE_GATE);
468 clk_register_clkdev(clk, NULL, "msp2");
469 clk_register_clkdev(clk, NULL, "ux500-msp-i2s.2");
433 470
434 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk", 471 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
435 U8500_CLKRST2_BASE, BIT(4), CLK_SET_RATE_GATE); 472 U8500_CLKRST2_BASE, BIT(4), CLK_SET_RATE_GATE);
@@ -450,10 +487,15 @@ void u8500_clk_init(void)
450 /* Periph3 */ 487 /* Periph3 */
451 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk", 488 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
452 U8500_CLKRST3_BASE, BIT(1), CLK_SET_RATE_GATE); 489 U8500_CLKRST3_BASE, BIT(1), CLK_SET_RATE_GATE);
490 clk_register_clkdev(clk, NULL, "ssp0");
491
453 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk", 492 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
454 U8500_CLKRST3_BASE, BIT(2), CLK_SET_RATE_GATE); 493 U8500_CLKRST3_BASE, BIT(2), CLK_SET_RATE_GATE);
494 clk_register_clkdev(clk, NULL, "ssp1");
495
455 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk", 496 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
456 U8500_CLKRST3_BASE, BIT(3), CLK_SET_RATE_GATE); 497 U8500_CLKRST3_BASE, BIT(3), CLK_SET_RATE_GATE);
498 clk_register_clkdev(clk, NULL, "nmk-i2c.0");
457 499
458 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk", 500 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
459 U8500_CLKRST3_BASE, BIT(4), CLK_SET_RATE_GATE); 501 U8500_CLKRST3_BASE, BIT(4), CLK_SET_RATE_GATE);
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 8d4804732bac..8c4139647efc 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -33,7 +33,7 @@
33 * detection. The mods to Rev F required more family 33 * detection. The mods to Rev F required more family
34 * information detection. 34 * information detection.
35 * 35 *
36 * Changes/Fixes by Borislav Petkov <borislav.petkov@amd.com>: 36 * Changes/Fixes by Borislav Petkov <bp@alien8.de>:
37 * - misc fixes and code cleanups 37 * - misc fixes and code cleanups
38 * 38 *
39 * This module is based on the following documents 39 * This module is based on the following documents
diff --git a/drivers/edac/edac_stub.c b/drivers/edac/edac_stub.c
index 6c86f6e54558..351945fa2ecd 100644
--- a/drivers/edac/edac_stub.c
+++ b/drivers/edac/edac_stub.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * 2007 (c) MontaVista Software, Inc. 6 * 2007 (c) MontaVista Software, Inc.
7 * 2010 (c) Advanced Micro Devices Inc. 7 * 2010 (c) Advanced Micro Devices Inc.
8 * Borislav Petkov <borislav.petkov@amd.com> 8 * Borislav Petkov <bp@alien8.de>
9 * 9 *
10 * This file is licensed under the terms of the GNU General Public 10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any 11 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 66b5151c1080..2ae78f20cc28 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -6,7 +6,7 @@
6 * This file may be distributed under the terms of the GNU General Public 6 * This file may be distributed under the terms of the GNU General Public
7 * License version 2. 7 * License version 2.
8 * 8 *
9 * Copyright (c) 2010: Borislav Petkov <borislav.petkov@amd.com> 9 * Copyright (c) 2010: Borislav Petkov <bp@alien8.de>
10 * Advanced Micro Devices Inc. 10 * Advanced Micro Devices Inc.
11 */ 11 */
12 12
@@ -168,6 +168,6 @@ module_init(edac_init_mce_inject);
168module_exit(edac_exit_mce_inject); 168module_exit(edac_exit_mce_inject);
169 169
170MODULE_LICENSE("GPL"); 170MODULE_LICENSE("GPL");
171MODULE_AUTHOR("Borislav Petkov <borislav.petkov@amd.com>"); 171MODULE_AUTHOR("Borislav Petkov <bp@alien8.de>");
172MODULE_AUTHOR("AMD Inc."); 172MODULE_AUTHOR("AMD Inc.");
173MODULE_DESCRIPTION("MCE injection facility for testing MCE decoding"); 173MODULE_DESCRIPTION("MCE injection facility for testing MCE decoding");
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 1162d6b3bf85..bb1b392f5cda 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1546,6 +1546,8 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev)
1546 struct sbp2_logical_unit *lu = sdev->hostdata; 1546 struct sbp2_logical_unit *lu = sdev->hostdata;
1547 1547
1548 sdev->use_10_for_rw = 1; 1548 sdev->use_10_for_rw = 1;
1549 sdev->no_report_opcodes = 1;
1550 sdev->no_write_same = 1;
1549 1551
1550 if (sbp2_param_exclusive_login) 1552 if (sbp2_param_exclusive_login)
1551 sdev->manage_start_stop = 1; 1553 sdev->manage_start_stop = 1;
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index f11d8e3b4041..47150f5ded04 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -466,7 +466,7 @@ config GPIO_ADP5588_IRQ
466 466
467config GPIO_ADNP 467config GPIO_ADNP
468 tristate "Avionic Design N-bit GPIO expander" 468 tristate "Avionic Design N-bit GPIO expander"
469 depends on I2C && OF 469 depends on I2C && OF_GPIO
470 help 470 help
471 This option enables support for N GPIOs found on Avionic Design 471 This option enables support for N GPIOs found on Avionic Design
472 I2C GPIO expanders. The register space will be extended by powers 472 I2C GPIO expanders. The register space will be extended by powers
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 0f425189de11..ce1c84760076 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -77,7 +77,7 @@ struct mcp23s08_driver_data {
77 77
78/*----------------------------------------------------------------------*/ 78/*----------------------------------------------------------------------*/
79 79
80#ifdef CONFIG_I2C 80#if IS_ENABLED(CONFIG_I2C)
81 81
82static int mcp23008_read(struct mcp23s08 *mcp, unsigned reg) 82static int mcp23008_read(struct mcp23s08 *mcp, unsigned reg)
83{ 83{
@@ -399,7 +399,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
399 break; 399 break;
400#endif /* CONFIG_SPI_MASTER */ 400#endif /* CONFIG_SPI_MASTER */
401 401
402#ifdef CONFIG_I2C 402#if IS_ENABLED(CONFIG_I2C)
403 case MCP_TYPE_008: 403 case MCP_TYPE_008:
404 mcp->ops = &mcp23008_ops; 404 mcp->ops = &mcp23008_ops;
405 mcp->chip.ngpio = 8; 405 mcp->chip.ngpio = 8;
@@ -473,7 +473,7 @@ fail:
473 473
474/*----------------------------------------------------------------------*/ 474/*----------------------------------------------------------------------*/
475 475
476#ifdef CONFIG_I2C 476#if IS_ENABLED(CONFIG_I2C)
477 477
478static int __devinit mcp230xx_probe(struct i2c_client *client, 478static int __devinit mcp230xx_probe(struct i2c_client *client,
479 const struct i2c_device_id *id) 479 const struct i2c_device_id *id)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index cf7afb9eb61a..be65c0451ad5 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -92,6 +92,11 @@ static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip)
92 return mvchip->membase + GPIO_OUT_OFF; 92 return mvchip->membase + GPIO_OUT_OFF;
93} 93}
94 94
95static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip)
96{
97 return mvchip->membase + GPIO_BLINK_EN_OFF;
98}
99
95static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip) 100static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip)
96{ 101{
97 return mvchip->membase + GPIO_IO_CONF_OFF; 102 return mvchip->membase + GPIO_IO_CONF_OFF;
@@ -206,6 +211,23 @@ static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin)
206 return (u >> pin) & 1; 211 return (u >> pin) & 1;
207} 212}
208 213
214static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
215{
216 struct mvebu_gpio_chip *mvchip =
217 container_of(chip, struct mvebu_gpio_chip, chip);
218 unsigned long flags;
219 u32 u;
220
221 spin_lock_irqsave(&mvchip->lock, flags);
222 u = readl_relaxed(mvebu_gpioreg_blink(mvchip));
223 if (value)
224 u |= 1 << pin;
225 else
226 u &= ~(1 << pin);
227 writel_relaxed(u, mvebu_gpioreg_blink(mvchip));
228 spin_unlock_irqrestore(&mvchip->lock, flags);
229}
230
209static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin) 231static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
210{ 232{
211 struct mvebu_gpio_chip *mvchip = 233 struct mvebu_gpio_chip *mvchip =
@@ -244,6 +266,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
244 if (ret) 266 if (ret)
245 return ret; 267 return ret;
246 268
269 mvebu_gpio_blink(chip, pin, 0);
247 mvebu_gpio_set(chip, pin, value); 270 mvebu_gpio_set(chip, pin, value);
248 271
249 spin_lock_irqsave(&mvchip->lock, flags); 272 spin_lock_irqsave(&mvchip->lock, flags);
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index b726b478a4f5..6345878ae1e7 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -143,7 +143,7 @@ static void intel_crt_dpms(struct drm_connector *connector, int mode)
143 int old_dpms; 143 int old_dpms;
144 144
145 /* PCH platforms and VLV only support on/off. */ 145 /* PCH platforms and VLV only support on/off. */
146 if (INTEL_INFO(dev)->gen < 5 && mode != DRM_MODE_DPMS_ON) 146 if (INTEL_INFO(dev)->gen >= 5 && mode != DRM_MODE_DPMS_ON)
147 mode = DRM_MODE_DPMS_OFF; 147 mode = DRM_MODE_DPMS_OFF;
148 148
149 if (mode == connector->dpms) 149 if (mode == connector->dpms)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 461a637f1ef7..4154bcd7a070 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3841,6 +3841,17 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
3841 } 3841 }
3842 } 3842 }
3843 3843
3844 if (intel_encoder->type == INTEL_OUTPUT_EDP) {
3845 /* Use VBT settings if we have an eDP panel */
3846 unsigned int edp_bpc = dev_priv->edp.bpp / 3;
3847
3848 if (edp_bpc < display_bpc) {
3849 DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
3850 display_bpc = edp_bpc;
3851 }
3852 continue;
3853 }
3854
3844 /* 3855 /*
3845 * HDMI is either 12 or 8, so if the display lets 10bpc sneak 3856 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
3846 * through, clamp it down. (Note: >12bpc will be caught below.) 3857 * through, clamp it down. (Note: >12bpc will be caught below.)
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 79d308da29ff..c600fb06e25e 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2382,6 +2382,18 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags)
2382 return true; 2382 return true;
2383} 2383}
2384 2384
2385static void intel_sdvo_output_cleanup(struct intel_sdvo *intel_sdvo)
2386{
2387 struct drm_device *dev = intel_sdvo->base.base.dev;
2388 struct drm_connector *connector, *tmp;
2389
2390 list_for_each_entry_safe(connector, tmp,
2391 &dev->mode_config.connector_list, head) {
2392 if (intel_attached_encoder(connector) == &intel_sdvo->base)
2393 intel_sdvo_destroy(connector);
2394 }
2395}
2396
2385static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo, 2397static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
2386 struct intel_sdvo_connector *intel_sdvo_connector, 2398 struct intel_sdvo_connector *intel_sdvo_connector,
2387 int type) 2399 int type)
@@ -2705,7 +2717,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2705 intel_sdvo->caps.output_flags) != true) { 2717 intel_sdvo->caps.output_flags) != true) {
2706 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n", 2718 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
2707 SDVO_NAME(intel_sdvo)); 2719 SDVO_NAME(intel_sdvo));
2708 goto err; 2720 /* Output_setup can leave behind connectors! */
2721 goto err_output;
2709 } 2722 }
2710 2723
2711 /* Only enable the hotplug irq if we need it, to work around noisy 2724 /* Only enable the hotplug irq if we need it, to work around noisy
@@ -2718,12 +2731,12 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2718 2731
2719 /* Set the input timing to the screen. Assume always input 0. */ 2732 /* Set the input timing to the screen. Assume always input 0. */
2720 if (!intel_sdvo_set_target_input(intel_sdvo)) 2733 if (!intel_sdvo_set_target_input(intel_sdvo))
2721 goto err; 2734 goto err_output;
2722 2735
2723 if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo, 2736 if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo,
2724 &intel_sdvo->pixel_clock_min, 2737 &intel_sdvo->pixel_clock_min,
2725 &intel_sdvo->pixel_clock_max)) 2738 &intel_sdvo->pixel_clock_max))
2726 goto err; 2739 goto err_output;
2727 2740
2728 DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, " 2741 DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, "
2729 "clock range %dMHz - %dMHz, " 2742 "clock range %dMHz - %dMHz, "
@@ -2743,6 +2756,9 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2743 (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); 2756 (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N');
2744 return true; 2757 return true;
2745 2758
2759err_output:
2760 intel_sdvo_output_cleanup(intel_sdvo);
2761
2746err: 2762err:
2747 drm_encoder_cleanup(&intel_encoder->base); 2763 drm_encoder_cleanup(&intel_encoder->base);
2748 i2c_del_adapter(&intel_sdvo->ddc); 2764 i2c_del_adapter(&intel_sdvo->ddc);
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 05a909a17cee..15b182c84ce8 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -49,13 +49,7 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
49 if (chan->vblank.crtc != crtc) 49 if (chan->vblank.crtc != crtc)
50 continue; 50 continue;
51 51
52 if (nv_device(priv)->chipset == 0x50) { 52 if (nv_device(priv)->chipset >= 0xc0) {
53 nv_wr32(priv, 0x001704, chan->vblank.channel);
54 nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
55 bar->flush(bar);
56 nv_wr32(priv, 0x001570, chan->vblank.offset);
57 nv_wr32(priv, 0x001574, chan->vblank.value);
58 } else {
59 nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel); 53 nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel);
60 bar->flush(bar); 54 bar->flush(bar);
61 nv_wr32(priv, 0x06000c, 55 nv_wr32(priv, 0x06000c,
@@ -63,6 +57,17 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
63 nv_wr32(priv, 0x060010, 57 nv_wr32(priv, 0x060010,
64 lower_32_bits(chan->vblank.offset)); 58 lower_32_bits(chan->vblank.offset));
65 nv_wr32(priv, 0x060014, chan->vblank.value); 59 nv_wr32(priv, 0x060014, chan->vblank.value);
60 } else {
61 nv_wr32(priv, 0x001704, chan->vblank.channel);
62 nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
63 bar->flush(bar);
64 if (nv_device(priv)->chipset == 0x50) {
65 nv_wr32(priv, 0x001570, chan->vblank.offset);
66 nv_wr32(priv, 0x001574, chan->vblank.value);
67 } else {
68 nv_wr32(priv, 0x060010, chan->vblank.offset);
69 nv_wr32(priv, 0x060014, chan->vblank.value);
70 }
66 } 71 }
67 72
68 list_del(&chan->vblank.head); 73 list_del(&chan->vblank.head);
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
index e45035efb8ca..7bbb1e1b7a8d 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c
@@ -669,21 +669,27 @@ nv40_grctx_fill(struct nouveau_device *device, struct nouveau_gpuobj *mem)
669 }); 669 });
670} 670}
671 671
672void 672int
673nv40_grctx_init(struct nouveau_device *device, u32 *size) 673nv40_grctx_init(struct nouveau_device *device, u32 *size)
674{ 674{
675 u32 ctxprog[256], i; 675 u32 *ctxprog = kmalloc(256 * 4, GFP_KERNEL), i;
676 struct nouveau_grctx ctx = { 676 struct nouveau_grctx ctx = {
677 .device = device, 677 .device = device,
678 .mode = NOUVEAU_GRCTX_PROG, 678 .mode = NOUVEAU_GRCTX_PROG,
679 .data = ctxprog, 679 .data = ctxprog,
680 .ctxprog_max = ARRAY_SIZE(ctxprog) 680 .ctxprog_max = 256,
681 }; 681 };
682 682
683 if (!ctxprog)
684 return -ENOMEM;
685
683 nv40_grctx_generate(&ctx); 686 nv40_grctx_generate(&ctx);
684 687
685 nv_wr32(device, 0x400324, 0); 688 nv_wr32(device, 0x400324, 0);
686 for (i = 0; i < ctx.ctxprog_len; i++) 689 for (i = 0; i < ctx.ctxprog_len; i++)
687 nv_wr32(device, 0x400328, ctxprog[i]); 690 nv_wr32(device, 0x400328, ctxprog[i]);
688 *size = ctx.ctxvals_pos * 4; 691 *size = ctx.ctxvals_pos * 4;
692
693 kfree(ctxprog);
694 return 0;
689} 695}
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
index 425001204a89..cc6574eeb80e 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c
@@ -346,7 +346,9 @@ nv40_graph_init(struct nouveau_object *object)
346 return ret; 346 return ret;
347 347
348 /* generate and upload context program */ 348 /* generate and upload context program */
349 nv40_grctx_init(nv_device(priv), &priv->size); 349 ret = nv40_grctx_init(nv_device(priv), &priv->size);
350 if (ret)
351 return ret;
350 352
351 /* No context present currently */ 353 /* No context present currently */
352 nv_wr32(priv, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); 354 nv_wr32(priv, NV40_PGRAPH_CTXCTL_CUR, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h
index d2ac975afc2e..7da35a4e7970 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h
@@ -15,7 +15,7 @@ nv44_graph_class(void *priv)
15 return !(0x0baf & (1 << (device->chipset & 0x0f))); 15 return !(0x0baf & (1 << (device->chipset & 0x0f)));
16} 16}
17 17
18void nv40_grctx_init(struct nouveau_device *, u32 *size); 18int nv40_grctx_init(struct nouveau_device *, u32 *size);
19void nv40_grctx_fill(struct nouveau_device *, struct nouveau_gpuobj *); 19void nv40_grctx_fill(struct nouveau_device *, struct nouveau_gpuobj *);
20 20
21#endif 21#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/core/object.h b/drivers/gpu/drm/nouveau/core/include/core/object.h
index 818feabbf4a0..486f1a9217fd 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/object.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/object.h
@@ -175,14 +175,18 @@ nv_mo32(void *obj, u32 addr, u32 mask, u32 data)
175 return temp; 175 return temp;
176} 176}
177 177
178static inline bool 178static inline int
179nv_strncmp(void *obj, u32 addr, u32 len, const char *str) 179nv_memcmp(void *obj, u32 addr, const char *str, u32 len)
180{ 180{
181 unsigned char c1, c2;
182
181 while (len--) { 183 while (len--) {
182 if (nv_ro08(obj, addr++) != *(str++)) 184 c1 = nv_ro08(obj, addr++);
183 return false; 185 c2 = *(str++);
186 if (c1 != c2)
187 return c1 - c2;
184 } 188 }
185 return true; 189 return 0;
186} 190}
187 191
188#endif 192#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
index 39e73b91d360..41b7a6a76f19 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
@@ -54,6 +54,7 @@ int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
54 int clk, struct nouveau_pll_vals *); 54 int clk, struct nouveau_pll_vals *);
55int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1, 55int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1,
56 struct nouveau_pll_vals *); 56 struct nouveau_pll_vals *);
57 57int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
58 int clk, struct nouveau_pll_vals *);
58 59
59#endif 60#endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
index 7d750382a833..c51197157749 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c
@@ -64,7 +64,7 @@ dcb_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
64 } 64 }
65 } else 65 } else
66 if (*ver >= 0x15) { 66 if (*ver >= 0x15) {
67 if (!nv_strncmp(bios, dcb - 7, 7, "DEV_REC")) { 67 if (!nv_memcmp(bios, dcb - 7, "DEV_REC", 7)) {
68 u16 i2c = nv_ro16(bios, dcb + 2); 68 u16 i2c = nv_ro16(bios, dcb + 2);
69 *hdr = 4; 69 *hdr = 4;
70 *cnt = (i2c - dcb) / 10; 70 *cnt = (i2c - dcb) / 10;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
index cc8d7d162d7c..9068c98b96f6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c
@@ -66,6 +66,24 @@ nva3_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
66 return ret; 66 return ret;
67} 67}
68 68
69int
70nva3_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info,
71 int clk, struct nouveau_pll_vals *pv)
72{
73 int ret, N, M, P;
74
75 ret = nva3_pll_calc(clock, info, clk, &N, NULL, &M, &P);
76
77 if (ret > 0) {
78 pv->refclk = info->refclk;
79 pv->N1 = N;
80 pv->M1 = M;
81 pv->log2P = P;
82 }
83 return ret;
84}
85
86
69static int 87static int
70nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 88nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
71 struct nouveau_oclass *oclass, void *data, u32 size, 89 struct nouveau_oclass *oclass, void *data, u32 size,
@@ -80,6 +98,7 @@ nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
80 return ret; 98 return ret;
81 99
82 priv->base.pll_set = nva3_clock_pll_set; 100 priv->base.pll_set = nva3_clock_pll_set;
101 priv->base.pll_calc = nva3_clock_pll_calc;
83 return 0; 102 return 0;
84} 103}
85 104
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
index 5ccce0b17bf3..f6962c9b6c36 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
@@ -79,6 +79,7 @@ nvc0_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
79 return ret; 79 return ret;
80 80
81 priv->base.pll_set = nvc0_clock_pll_set; 81 priv->base.pll_set = nvc0_clock_pll_set;
82 priv->base.pll_calc = nva3_clock_pll_calc;
82 return 0; 83 return 0;
83} 84}
84 85
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index cc79c796afee..cbf1fc60a386 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -241,6 +241,10 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
241 241
242 if (unlikely(!abi16)) 242 if (unlikely(!abi16))
243 return -ENOMEM; 243 return -ENOMEM;
244
245 if (!drm->channel)
246 return nouveau_abi16_put(abi16, -ENODEV);
247
244 client = nv_client(abi16->client); 248 client = nv_client(abi16->client);
245 249
246 if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0) 250 if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 0910125cbbc3..8503b2ea570a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -129,7 +129,8 @@ nouveau_accel_init(struct nouveau_drm *drm)
129 129
130 /* initialise synchronisation routines */ 130 /* initialise synchronisation routines */
131 if (device->card_type < NV_10) ret = nv04_fence_create(drm); 131 if (device->card_type < NV_10) ret = nv04_fence_create(drm);
132 else if (device->chipset < 0x84) ret = nv10_fence_create(drm); 132 else if (device->card_type < NV_50) ret = nv10_fence_create(drm);
133 else if (device->chipset < 0x84) ret = nv50_fence_create(drm);
133 else if (device->card_type < NV_C0) ret = nv84_fence_create(drm); 134 else if (device->card_type < NV_C0) ret = nv84_fence_create(drm);
134 else ret = nvc0_fence_create(drm); 135 else ret = nvc0_fence_create(drm);
135 if (ret) { 136 if (ret) {
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index ba498f8e47a2..010bae19554a 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1625,7 +1625,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
1625 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0); 1625 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0);
1626 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); 1626 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
1627 /* some early dce3.2 boards have a bug in their transmitter control table */ 1627 /* some early dce3.2 boards have a bug in their transmitter control table */
1628 if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730)) 1628 if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730))
1629 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); 1629 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
1630 } 1630 }
1631 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) { 1631 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index af31f829f4a8..219942c660d7 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1330,6 +1330,8 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav
1330 break; 1330 break;
1331 udelay(1); 1331 udelay(1);
1332 } 1332 }
1333 } else {
1334 save->crtc_enabled[i] = false;
1333 } 1335 }
1334 } 1336 }
1335 1337
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c
index 10ea17a6b2a6..42433344cb1b 100644
--- a/drivers/gpu/drm/radeon/radeon_agp.c
+++ b/drivers/gpu/drm/radeon/radeon_agp.c
@@ -69,9 +69,12 @@ static struct radeon_agpmode_quirk radeon_agpmode_quirk_list[] = {
69 /* Intel 82830 830 Chipset Host Bridge / Mobility M6 LY Needs AGPMode 2 (fdo #17360)*/ 69 /* Intel 82830 830 Chipset Host Bridge / Mobility M6 LY Needs AGPMode 2 (fdo #17360)*/
70 { PCI_VENDOR_ID_INTEL, 0x3575, PCI_VENDOR_ID_ATI, 0x4c59, 70 { PCI_VENDOR_ID_INTEL, 0x3575, PCI_VENDOR_ID_ATI, 0x4c59,
71 PCI_VENDOR_ID_DELL, 0x00e3, 2}, 71 PCI_VENDOR_ID_DELL, 0x00e3, 2},
72 /* Intel 82852/82855 host bridge / Mobility FireGL 9000 R250 Needs AGPMode 1 (lp #296617) */ 72 /* Intel 82852/82855 host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 (lp #296617) */
73 { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4c66, 73 { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4c66,
74 PCI_VENDOR_ID_DELL, 0x0149, 1}, 74 PCI_VENDOR_ID_DELL, 0x0149, 1},
75 /* Intel 82855PM host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 for suspend/resume */
76 { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c66,
77 PCI_VENDOR_ID_IBM, 0x0531, 1},
75 /* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (deb #467460) */ 78 /* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (deb #467460) */
76 { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50, 79 { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50,
77 0x1025, 0x0061, 1}, 80 0x1025, 0x0061, 1},
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 860dc4813e99..bd2a3b40cd12 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -749,7 +749,10 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
749 /* clear the pages coming from the pool if requested */ 749 /* clear the pages coming from the pool if requested */
750 if (flags & TTM_PAGE_FLAG_ZERO_ALLOC) { 750 if (flags & TTM_PAGE_FLAG_ZERO_ALLOC) {
751 list_for_each_entry(p, &plist, lru) { 751 list_for_each_entry(p, &plist, lru) {
752 clear_page(page_address(p)); 752 if (PageHighMem(p))
753 clear_highpage(p);
754 else
755 clear_page(page_address(p));
753 } 756 }
754 } 757 }
755 758
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index bf8260133ea9..7d759a430294 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -308,9 +308,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
308 if (unlikely(to_page == NULL)) 308 if (unlikely(to_page == NULL))
309 goto out_err; 309 goto out_err;
310 310
311 preempt_disable();
312 copy_highpage(to_page, from_page); 311 copy_highpage(to_page, from_page);
313 preempt_enable();
314 page_cache_release(from_page); 312 page_cache_release(from_page);
315 } 313 }
316 314
@@ -358,9 +356,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
358 ret = PTR_ERR(to_page); 356 ret = PTR_ERR(to_page);
359 goto out_err; 357 goto out_err;
360 } 358 }
361 preempt_disable();
362 copy_highpage(to_page, from_page); 359 copy_highpage(to_page, from_page);
363 preempt_enable();
364 set_page_dirty(to_page); 360 set_page_dirty(to_page);
365 mark_page_accessed(to_page); 361 mark_page_accessed(to_page);
366 page_cache_release(to_page); 362 page_cache_release(to_page);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index b07ca2e4d04b..7290811f89be 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
110 memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size); 110 memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
111 111
112 ret = copy_to_user(buffer, bounce, size); 112 ret = copy_to_user(buffer, bounce, size);
113 if (ret)
114 ret = -EFAULT;
113 vfree(bounce); 115 vfree(bounce);
114 116
115 if (unlikely(ret != 0)) 117 if (unlikely(ret != 0))
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index f676c01bb471..6fcd466d0825 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -46,9 +46,9 @@ static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
46 rdesc[559] = 0x45; 46 rdesc[559] = 0x45;
47 } 47 }
48 /* the same as above (s/usage/physical/) */ 48 /* the same as above (s/usage/physical/) */
49 if ((quirks & MS_RDESC_3K) && *rsize == 106 && 49 if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
50 !memcmp((char []){ 0x19, 0x00, 0x29, 0xff }, 50 rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
51 &rdesc[94], 4)) { 51 rdesc[97] == 0xff) {
52 rdesc[94] = 0x35; 52 rdesc[94] = 0x35;
53 rdesc[96] = 0x45; 53 rdesc[96] = 0x45;
54 } 54 }
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index aa59a254be2c..c02bf208084f 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -39,6 +39,7 @@
39#define AT91_TWI_STOP 0x0002 /* Send a Stop Condition */ 39#define AT91_TWI_STOP 0x0002 /* Send a Stop Condition */
40#define AT91_TWI_MSEN 0x0004 /* Master Transfer Enable */ 40#define AT91_TWI_MSEN 0x0004 /* Master Transfer Enable */
41#define AT91_TWI_SVDIS 0x0020 /* Slave Transfer Disable */ 41#define AT91_TWI_SVDIS 0x0020 /* Slave Transfer Disable */
42#define AT91_TWI_QUICK 0x0040 /* SMBus quick command */
42#define AT91_TWI_SWRST 0x0080 /* Software Reset */ 43#define AT91_TWI_SWRST 0x0080 /* Software Reset */
43 44
44#define AT91_TWI_MMR 0x0004 /* Master Mode Register */ 45#define AT91_TWI_MMR 0x0004 /* Master Mode Register */
@@ -212,7 +213,11 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
212 213
213 INIT_COMPLETION(dev->cmd_complete); 214 INIT_COMPLETION(dev->cmd_complete);
214 dev->transfer_status = 0; 215 dev->transfer_status = 0;
215 if (dev->msg->flags & I2C_M_RD) { 216
217 if (!dev->buf_len) {
218 at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_QUICK);
219 at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP);
220 } else if (dev->msg->flags & I2C_M_RD) {
216 unsigned start_flags = AT91_TWI_START; 221 unsigned start_flags = AT91_TWI_START;
217 222
218 if (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY) { 223 if (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY) {
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 286ca1917820..0670da79ee5e 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -287,12 +287,14 @@ read_init_dma_fail:
287select_init_dma_fail: 287select_init_dma_fail:
288 dma_unmap_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE); 288 dma_unmap_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE);
289select_init_pio_fail: 289select_init_pio_fail:
290 dmaengine_terminate_all(i2c->dmach);
290 return -EINVAL; 291 return -EINVAL;
291 292
292/* Write failpath. */ 293/* Write failpath. */
293write_init_dma_fail: 294write_init_dma_fail:
294 dma_unmap_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE); 295 dma_unmap_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE);
295write_init_pio_fail: 296write_init_pio_fail:
297 dmaengine_terminate_all(i2c->dmach);
296 return -EINVAL; 298 return -EINVAL;
297} 299}
298 300
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index db31eaed6ea5..3525c9e62cb0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,7 +43,6 @@
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/i2c-omap.h> 44#include <linux/i2c-omap.h>
45#include <linux/pm_runtime.h> 45#include <linux/pm_runtime.h>
46#include <linux/pm_qos.h>
47 46
48/* I2C controller revisions */ 47/* I2C controller revisions */
49#define OMAP_I2C_OMAP1_REV_2 0x20 48#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -187,8 +186,9 @@ struct omap_i2c_dev {
187 int reg_shift; /* bit shift for I2C register addresses */ 186 int reg_shift; /* bit shift for I2C register addresses */
188 struct completion cmd_complete; 187 struct completion cmd_complete;
189 struct resource *ioarea; 188 struct resource *ioarea;
190 u32 latency; /* maximum MPU wkup latency */ 189 u32 latency; /* maximum mpu wkup latency */
191 struct pm_qos_request pm_qos_request; 190 void (*set_mpu_wkup_lat)(struct device *dev,
191 long latency);
192 u32 speed; /* Speed of bus in kHz */ 192 u32 speed; /* Speed of bus in kHz */
193 u32 dtrev; /* extra revision from DT */ 193 u32 dtrev; /* extra revision from DT */
194 u32 flags; 194 u32 flags;
@@ -494,7 +494,9 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *dev, u8 size, bool is_rx)
494 dev->b_hw = 1; /* Enable hardware fixes */ 494 dev->b_hw = 1; /* Enable hardware fixes */
495 495
496 /* calculate wakeup latency constraint for MPU */ 496 /* calculate wakeup latency constraint for MPU */
497 dev->latency = (1000000 * dev->threshold) / (1000 * dev->speed / 8); 497 if (dev->set_mpu_wkup_lat != NULL)
498 dev->latency = (1000000 * dev->threshold) /
499 (1000 * dev->speed / 8);
498} 500}
499 501
500/* 502/*
@@ -522,6 +524,9 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
522 dev->buf = msg->buf; 524 dev->buf = msg->buf;
523 dev->buf_len = msg->len; 525 dev->buf_len = msg->len;
524 526
527 /* make sure writes to dev->buf_len are ordered */
528 barrier();
529
525 omap_i2c_write_reg(dev, OMAP_I2C_CNT_REG, dev->buf_len); 530 omap_i2c_write_reg(dev, OMAP_I2C_CNT_REG, dev->buf_len);
526 531
527 /* Clear the FIFO Buffers */ 532 /* Clear the FIFO Buffers */
@@ -579,7 +584,6 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
579 */ 584 */
580 timeout = wait_for_completion_timeout(&dev->cmd_complete, 585 timeout = wait_for_completion_timeout(&dev->cmd_complete,
581 OMAP_I2C_TIMEOUT); 586 OMAP_I2C_TIMEOUT);
582 dev->buf_len = 0;
583 if (timeout == 0) { 587 if (timeout == 0) {
584 dev_err(dev->dev, "controller timed out\n"); 588 dev_err(dev->dev, "controller timed out\n");
585 omap_i2c_init(dev); 589 omap_i2c_init(dev);
@@ -629,16 +633,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
629 if (r < 0) 633 if (r < 0)
630 goto out; 634 goto out;
631 635
632 /* 636 if (dev->set_mpu_wkup_lat != NULL)
633 * When waiting for completion of a i2c transfer, we need to 637 dev->set_mpu_wkup_lat(dev->dev, dev->latency);
634 * set a wake up latency constraint for the MPU. This is to
635 * ensure quick enough wakeup from idle, when transfer
636 * completes.
637 */
638 if (dev->latency)
639 pm_qos_add_request(&dev->pm_qos_request,
640 PM_QOS_CPU_DMA_LATENCY,
641 dev->latency);
642 638
643 for (i = 0; i < num; i++) { 639 for (i = 0; i < num; i++) {
644 r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); 640 r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
@@ -646,8 +642,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
646 break; 642 break;
647 } 643 }
648 644
649 if (dev->latency) 645 if (dev->set_mpu_wkup_lat != NULL)
650 pm_qos_remove_request(&dev->pm_qos_request); 646 dev->set_mpu_wkup_lat(dev->dev, -1);
651 647
652 if (r == 0) 648 if (r == 0)
653 r = num; 649 r = num;
@@ -1104,6 +1100,7 @@ omap_i2c_probe(struct platform_device *pdev)
1104 } else if (pdata != NULL) { 1100 } else if (pdata != NULL) {
1105 dev->speed = pdata->clkrate; 1101 dev->speed = pdata->clkrate;
1106 dev->flags = pdata->flags; 1102 dev->flags = pdata->flags;
1103 dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
1107 dev->dtrev = pdata->rev; 1104 dev->dtrev = pdata->rev;
1108 } 1105 }
1109 1106
@@ -1159,8 +1156,9 @@ omap_i2c_probe(struct platform_device *pdev)
1159 dev->b_hw = 1; /* Enable hardware fixes */ 1156 dev->b_hw = 1; /* Enable hardware fixes */
1160 1157
1161 /* calculate wakeup latency constraint for MPU */ 1158 /* calculate wakeup latency constraint for MPU */
1162 dev->latency = (1000000 * dev->fifo_size) / 1159 if (dev->set_mpu_wkup_lat != NULL)
1163 (1000 * dev->speed / 8); 1160 dev->latency = (1000000 * dev->fifo_size) /
1161 (1000 * dev->speed / 8);
1164 } 1162 }
1165 1163
1166 /* reset ASAP, clearing any IRQs */ 1164 /* reset ASAP, clearing any IRQs */
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 3e0335f1fc60..9d902725bac9 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -806,6 +806,7 @@ static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c)
806 dev_err(i2c->dev, "invalid gpio[%d]: %d\n", idx, gpio); 806 dev_err(i2c->dev, "invalid gpio[%d]: %d\n", idx, gpio);
807 goto free_gpio; 807 goto free_gpio;
808 } 808 }
809 i2c->gpios[idx] = gpio;
809 810
810 ret = gpio_request(gpio, "i2c-bus"); 811 ret = gpio_request(gpio, "i2c-bus");
811 if (ret) { 812 if (ret) {
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
index 5f097f309b9f..7fa5b24b16db 100644
--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
@@ -169,7 +169,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev)
169 mux->busses = devm_kzalloc(&pdev->dev, 169 mux->busses = devm_kzalloc(&pdev->dev,
170 sizeof(mux->busses) * mux->pdata->bus_count, 170 sizeof(mux->busses) * mux->pdata->bus_count,
171 GFP_KERNEL); 171 GFP_KERNEL);
172 if (!mux->states) { 172 if (!mux->busses) {
173 dev_err(&pdev->dev, "Cannot allocate busses\n"); 173 dev_err(&pdev->dev, "Cannot allocate busses\n");
174 ret = -ENOMEM; 174 ret = -ENOMEM;
175 goto err; 175 goto err;
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index c0ec7d42c3be..1abbc170d8b7 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -26,10 +26,14 @@ static void copy_abs(struct input_dev *dev, unsigned int dst, unsigned int src)
26 * input_mt_init_slots() - initialize MT input slots 26 * input_mt_init_slots() - initialize MT input slots
27 * @dev: input device supporting MT events and finger tracking 27 * @dev: input device supporting MT events and finger tracking
28 * @num_slots: number of slots used by the device 28 * @num_slots: number of slots used by the device
29 * @flags: mt tasks to handle in core
29 * 30 *
30 * This function allocates all necessary memory for MT slot handling 31 * This function allocates all necessary memory for MT slot handling
31 * in the input device, prepares the ABS_MT_SLOT and 32 * in the input device, prepares the ABS_MT_SLOT and
32 * ABS_MT_TRACKING_ID events for use and sets up appropriate buffers. 33 * ABS_MT_TRACKING_ID events for use and sets up appropriate buffers.
34 * Depending on the flags set, it also performs pointer emulation and
35 * frame synchronization.
36 *
33 * May be called repeatedly. Returns -EINVAL if attempting to 37 * May be called repeatedly. Returns -EINVAL if attempting to
34 * reinitialize with a different number of slots. 38 * reinitialize with a different number of slots.
35 */ 39 */
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 8f02e3d0e712..4c842c320c2e 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -12,8 +12,8 @@
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 13
14#define MOUSEDEV_MINOR_BASE 32 14#define MOUSEDEV_MINOR_BASE 32
15#define MOUSEDEV_MINORS 32 15#define MOUSEDEV_MINORS 31
16#define MOUSEDEV_MIX 31 16#define MOUSEDEV_MIX 63
17 17
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028ec3db6..78e5d9ab0ba7 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -955,7 +955,8 @@ static int ads7846_resume(struct device *dev)
955 955
956static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); 956static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume);
957 957
958static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts) 958static int __devinit ads7846_setup_pendown(struct spi_device *spi,
959 struct ads7846 *ts)
959{ 960{
960 struct ads7846_platform_data *pdata = spi->dev.platform_data; 961 struct ads7846_platform_data *pdata = spi->dev.platform_data;
961 int err; 962 int err;
@@ -981,6 +982,9 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
981 982
982 ts->gpio_pendown = pdata->gpio_pendown; 983 ts->gpio_pendown = pdata->gpio_pendown;
983 984
985 if (pdata->gpio_pendown_debounce)
986 gpio_set_debounce(pdata->gpio_pendown,
987 pdata->gpio_pendown_debounce);
984 } else { 988 } else {
985 dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); 989 dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
986 return -EINVAL; 990 return -EINVAL;
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index d4a4cd445cab..0badfa48b32b 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4108,7 +4108,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
4108static int intel_iommu_add_device(struct device *dev) 4108static int intel_iommu_add_device(struct device *dev)
4109{ 4109{
4110 struct pci_dev *pdev = to_pci_dev(dev); 4110 struct pci_dev *pdev = to_pci_dev(dev);
4111 struct pci_dev *bridge, *dma_pdev; 4111 struct pci_dev *bridge, *dma_pdev = NULL;
4112 struct iommu_group *group; 4112 struct iommu_group *group;
4113 int ret; 4113 int ret;
4114 4114
@@ -4122,7 +4122,7 @@ static int intel_iommu_add_device(struct device *dev)
4122 dma_pdev = pci_get_domain_bus_and_slot( 4122 dma_pdev = pci_get_domain_bus_and_slot(
4123 pci_domain_nr(pdev->bus), 4123 pci_domain_nr(pdev->bus),
4124 bridge->subordinate->number, 0); 4124 bridge->subordinate->number, 0);
4125 else 4125 if (!dma_pdev)
4126 dma_pdev = pci_dev_get(bridge); 4126 dma_pdev = pci_dev_get(bridge);
4127 } else 4127 } else
4128 dma_pdev = pci_dev_get(pdev); 4128 dma_pdev = pci_dev_get(pdev);
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index a649f146d17b..c0f7a4266263 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1054,6 +1054,7 @@ static int smmu_debugfs_stats_show(struct seq_file *s, void *v)
1054 stats[i], val, offs); 1054 stats[i], val, offs);
1055 } 1055 }
1056 seq_printf(s, "\n"); 1056 seq_printf(s, "\n");
1057 dput(dent);
1057 1058
1058 return 0; 1059 return 0;
1059} 1060}
diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c
index dc670ccc6978..16c78f1c5ef2 100644
--- a/drivers/irqchip/irq-bcm2835.c
+++ b/drivers/irqchip/irq-bcm2835.c
@@ -168,7 +168,8 @@ static int __init armctrl_of_init(struct device_node *node,
168} 168}
169 169
170static struct of_device_id irq_of_match[] __initconst = { 170static struct of_device_id irq_of_match[] __initconst = {
171 { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init } 171 { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init },
172 { }
172}; 173};
173 174
174void __init bcm2835_init_irq(void) 175void __init bcm2835_init_irq(void)
diff --git a/drivers/leds/ledtrig-cpu.c b/drivers/leds/ledtrig-cpu.c
index b312056da14d..4239b3955ff0 100644
--- a/drivers/leds/ledtrig-cpu.c
+++ b/drivers/leds/ledtrig-cpu.c
@@ -33,8 +33,6 @@
33struct led_trigger_cpu { 33struct led_trigger_cpu {
34 char name[MAX_NAME_LEN]; 34 char name[MAX_NAME_LEN];
35 struct led_trigger *_trig; 35 struct led_trigger *_trig;
36 struct mutex lock;
37 int lock_is_inited;
38}; 36};
39 37
40static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig); 38static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);
@@ -50,12 +48,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt)
50{ 48{
51 struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig); 49 struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig);
52 50
53 /* mutex lock should be initialized before calling mutex_call() */
54 if (!trig->lock_is_inited)
55 return;
56
57 mutex_lock(&trig->lock);
58
59 /* Locate the correct CPU LED */ 51 /* Locate the correct CPU LED */
60 switch (ledevt) { 52 switch (ledevt) {
61 case CPU_LED_IDLE_END: 53 case CPU_LED_IDLE_END:
@@ -75,8 +67,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt)
75 /* Will leave the LED as it is */ 67 /* Will leave the LED as it is */
76 break; 68 break;
77 } 69 }
78
79 mutex_unlock(&trig->lock);
80} 70}
81EXPORT_SYMBOL(ledtrig_cpu); 71EXPORT_SYMBOL(ledtrig_cpu);
82 72
@@ -117,14 +107,9 @@ static int __init ledtrig_cpu_init(void)
117 for_each_possible_cpu(cpu) { 107 for_each_possible_cpu(cpu) {
118 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); 108 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
119 109
120 mutex_init(&trig->lock);
121
122 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); 110 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
123 111
124 mutex_lock(&trig->lock);
125 led_trigger_register_simple(trig->name, &trig->_trig); 112 led_trigger_register_simple(trig->name, &trig->_trig);
126 trig->lock_is_inited = 1;
127 mutex_unlock(&trig->lock);
128 } 113 }
129 114
130 register_syscore_ops(&ledtrig_cpu_syscore_ops); 115 register_syscore_ops(&ledtrig_cpu_syscore_ops);
@@ -142,15 +127,9 @@ static void __exit ledtrig_cpu_exit(void)
142 for_each_possible_cpu(cpu) { 127 for_each_possible_cpu(cpu) {
143 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); 128 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
144 129
145 mutex_lock(&trig->lock);
146
147 led_trigger_unregister_simple(trig->_trig); 130 led_trigger_unregister_simple(trig->_trig);
148 trig->_trig = NULL; 131 trig->_trig = NULL;
149 memset(trig->name, 0, MAX_NAME_LEN); 132 memset(trig->name, 0, MAX_NAME_LEN);
150 trig->lock_is_inited = 0;
151
152 mutex_unlock(&trig->lock);
153 mutex_destroy(&trig->lock);
154 } 133 }
155 134
156 unregister_syscore_ops(&ledtrig_cpu_syscore_ops); 135 unregister_syscore_ops(&ledtrig_cpu_syscore_ops);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 02db9183ca01..77e6eff41cae 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -740,8 +740,14 @@ static void rq_completed(struct mapped_device *md, int rw, int run_queue)
740 if (!md_in_flight(md)) 740 if (!md_in_flight(md))
741 wake_up(&md->wait); 741 wake_up(&md->wait);
742 742
743 /*
744 * Run this off this callpath, as drivers could invoke end_io while
745 * inside their request_fn (and holding the queue lock). Calling
746 * back into ->request_fn() could deadlock attempting to grab the
747 * queue lock again.
748 */
743 if (run_queue) 749 if (run_queue)
744 blk_run_queue(md->queue); 750 blk_run_queue_async(md->queue);
745 751
746 /* 752 /*
747 * dm_put() must be at the end of this function. See the comment above 753 * dm_put() must be at the end of this function. See the comment above
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9ab768acfb62..61200717687b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1817,10 +1817,10 @@ retry:
1817 memset(bbp, 0xff, PAGE_SIZE); 1817 memset(bbp, 0xff, PAGE_SIZE);
1818 1818
1819 for (i = 0 ; i < bb->count ; i++) { 1819 for (i = 0 ; i < bb->count ; i++) {
1820 u64 internal_bb = *p++; 1820 u64 internal_bb = p[i];
1821 u64 store_bb = ((BB_OFFSET(internal_bb) << 10) 1821 u64 store_bb = ((BB_OFFSET(internal_bb) << 10)
1822 | BB_LEN(internal_bb)); 1822 | BB_LEN(internal_bb));
1823 *bbp++ = cpu_to_le64(store_bb); 1823 bbp[i] = cpu_to_le64(store_bb);
1824 } 1824 }
1825 bb->changed = 0; 1825 bb->changed = 0;
1826 if (read_seqretry(&bb->lock, seq)) 1826 if (read_seqretry(&bb->lock, seq))
@@ -5294,7 +5294,7 @@ void md_stop_writes(struct mddev *mddev)
5294} 5294}
5295EXPORT_SYMBOL_GPL(md_stop_writes); 5295EXPORT_SYMBOL_GPL(md_stop_writes);
5296 5296
5297void md_stop(struct mddev *mddev) 5297static void __md_stop(struct mddev *mddev)
5298{ 5298{
5299 mddev->ready = 0; 5299 mddev->ready = 0;
5300 mddev->pers->stop(mddev); 5300 mddev->pers->stop(mddev);
@@ -5304,6 +5304,18 @@ void md_stop(struct mddev *mddev)
5304 mddev->pers = NULL; 5304 mddev->pers = NULL;
5305 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 5305 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
5306} 5306}
5307
5308void md_stop(struct mddev *mddev)
5309{
5310 /* stop the array and free an attached data structures.
5311 * This is called from dm-raid
5312 */
5313 __md_stop(mddev);
5314 bitmap_destroy(mddev);
5315 if (mddev->bio_set)
5316 bioset_free(mddev->bio_set);
5317}
5318
5307EXPORT_SYMBOL_GPL(md_stop); 5319EXPORT_SYMBOL_GPL(md_stop);
5308 5320
5309static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) 5321static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
@@ -5364,7 +5376,7 @@ static int do_md_stop(struct mddev * mddev, int mode,
5364 set_disk_ro(disk, 0); 5376 set_disk_ro(disk, 0);
5365 5377
5366 __md_stop_writes(mddev); 5378 __md_stop_writes(mddev);
5367 md_stop(mddev); 5379 __md_stop(mddev);
5368 mddev->queue->merge_bvec_fn = NULL; 5380 mddev->queue->merge_bvec_fn = NULL;
5369 mddev->queue->backing_dev_info.congested_fn = NULL; 5381 mddev->queue->backing_dev_info.congested_fn = NULL;
5370 5382
@@ -7936,9 +7948,9 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors,
7936 sector_t *first_bad, int *bad_sectors) 7948 sector_t *first_bad, int *bad_sectors)
7937{ 7949{
7938 int hi; 7950 int hi;
7939 int lo = 0; 7951 int lo;
7940 u64 *p = bb->page; 7952 u64 *p = bb->page;
7941 int rv = 0; 7953 int rv;
7942 sector_t target = s + sectors; 7954 sector_t target = s + sectors;
7943 unsigned seq; 7955 unsigned seq;
7944 7956
@@ -7953,7 +7965,8 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors,
7953 7965
7954retry: 7966retry:
7955 seq = read_seqbegin(&bb->lock); 7967 seq = read_seqbegin(&bb->lock);
7956 7968 lo = 0;
7969 rv = 0;
7957 hi = bb->count; 7970 hi = bb->count;
7958 7971
7959 /* Binary search between lo and hi for 'target' 7972 /* Binary search between lo and hi for 'target'
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index d1295aff4173..0d5d0ff2c0f7 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -499,7 +499,7 @@ static void raid10_end_write_request(struct bio *bio, int error)
499 */ 499 */
500 one_write_done(r10_bio); 500 one_write_done(r10_bio);
501 if (dec_rdev) 501 if (dec_rdev)
502 rdev_dec_pending(conf->mirrors[dev].rdev, conf->mddev); 502 rdev_dec_pending(rdev, conf->mddev);
503} 503}
504 504
505/* 505/*
@@ -1334,18 +1334,21 @@ retry_write:
1334 blocked_rdev = rrdev; 1334 blocked_rdev = rrdev;
1335 break; 1335 break;
1336 } 1336 }
1337 if (rdev && (test_bit(Faulty, &rdev->flags)
1338 || test_bit(Unmerged, &rdev->flags)))
1339 rdev = NULL;
1337 if (rrdev && (test_bit(Faulty, &rrdev->flags) 1340 if (rrdev && (test_bit(Faulty, &rrdev->flags)
1338 || test_bit(Unmerged, &rrdev->flags))) 1341 || test_bit(Unmerged, &rrdev->flags)))
1339 rrdev = NULL; 1342 rrdev = NULL;
1340 1343
1341 r10_bio->devs[i].bio = NULL; 1344 r10_bio->devs[i].bio = NULL;
1342 r10_bio->devs[i].repl_bio = NULL; 1345 r10_bio->devs[i].repl_bio = NULL;
1343 if (!rdev || test_bit(Faulty, &rdev->flags) || 1346
1344 test_bit(Unmerged, &rdev->flags)) { 1347 if (!rdev && !rrdev) {
1345 set_bit(R10BIO_Degraded, &r10_bio->state); 1348 set_bit(R10BIO_Degraded, &r10_bio->state);
1346 continue; 1349 continue;
1347 } 1350 }
1348 if (test_bit(WriteErrorSeen, &rdev->flags)) { 1351 if (rdev && test_bit(WriteErrorSeen, &rdev->flags)) {
1349 sector_t first_bad; 1352 sector_t first_bad;
1350 sector_t dev_sector = r10_bio->devs[i].addr; 1353 sector_t dev_sector = r10_bio->devs[i].addr;
1351 int bad_sectors; 1354 int bad_sectors;
@@ -1387,8 +1390,10 @@ retry_write:
1387 max_sectors = good_sectors; 1390 max_sectors = good_sectors;
1388 } 1391 }
1389 } 1392 }
1390 r10_bio->devs[i].bio = bio; 1393 if (rdev) {
1391 atomic_inc(&rdev->nr_pending); 1394 r10_bio->devs[i].bio = bio;
1395 atomic_inc(&rdev->nr_pending);
1396 }
1392 if (rrdev) { 1397 if (rrdev) {
1393 r10_bio->devs[i].repl_bio = bio; 1398 r10_bio->devs[i].repl_bio = bio;
1394 atomic_inc(&rrdev->nr_pending); 1399 atomic_inc(&rrdev->nr_pending);
@@ -1444,69 +1449,71 @@ retry_write:
1444 for (i = 0; i < conf->copies; i++) { 1449 for (i = 0; i < conf->copies; i++) {
1445 struct bio *mbio; 1450 struct bio *mbio;
1446 int d = r10_bio->devs[i].devnum; 1451 int d = r10_bio->devs[i].devnum;
1447 if (!r10_bio->devs[i].bio) 1452 if (r10_bio->devs[i].bio) {
1448 continue; 1453 struct md_rdev *rdev = conf->mirrors[d].rdev;
1454 mbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
1455 md_trim_bio(mbio, r10_bio->sector - bio->bi_sector,
1456 max_sectors);
1457 r10_bio->devs[i].bio = mbio;
1458
1459 mbio->bi_sector = (r10_bio->devs[i].addr+
1460 choose_data_offset(r10_bio,
1461 rdev));
1462 mbio->bi_bdev = rdev->bdev;
1463 mbio->bi_end_io = raid10_end_write_request;
1464 mbio->bi_rw = WRITE | do_sync | do_fua | do_discard;
1465 mbio->bi_private = r10_bio;
1449 1466
1450 mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); 1467 atomic_inc(&r10_bio->remaining);
1451 md_trim_bio(mbio, r10_bio->sector - bio->bi_sector,
1452 max_sectors);
1453 r10_bio->devs[i].bio = mbio;
1454 1468
1455 mbio->bi_sector = (r10_bio->devs[i].addr+ 1469 cb = blk_check_plugged(raid10_unplug, mddev,
1456 choose_data_offset(r10_bio, 1470 sizeof(*plug));
1457 conf->mirrors[d].rdev)); 1471 if (cb)
1458 mbio->bi_bdev = conf->mirrors[d].rdev->bdev; 1472 plug = container_of(cb, struct raid10_plug_cb,
1459 mbio->bi_end_io = raid10_end_write_request; 1473 cb);
1460 mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; 1474 else
1461 mbio->bi_private = r10_bio; 1475 plug = NULL;
1476 spin_lock_irqsave(&conf->device_lock, flags);
1477 if (plug) {
1478 bio_list_add(&plug->pending, mbio);
1479 plug->pending_cnt++;
1480 } else {
1481 bio_list_add(&conf->pending_bio_list, mbio);
1482 conf->pending_count++;
1483 }
1484 spin_unlock_irqrestore(&conf->device_lock, flags);
1485 if (!plug)
1486 md_wakeup_thread(mddev->thread);
1487 }
1462 1488
1463 atomic_inc(&r10_bio->remaining); 1489 if (r10_bio->devs[i].repl_bio) {
1490 struct md_rdev *rdev = conf->mirrors[d].replacement;
1491 if (rdev == NULL) {
1492 /* Replacement just got moved to main 'rdev' */
1493 smp_mb();
1494 rdev = conf->mirrors[d].rdev;
1495 }
1496 mbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
1497 md_trim_bio(mbio, r10_bio->sector - bio->bi_sector,
1498 max_sectors);
1499 r10_bio->devs[i].repl_bio = mbio;
1500
1501 mbio->bi_sector = (r10_bio->devs[i].addr +
1502 choose_data_offset(
1503 r10_bio, rdev));
1504 mbio->bi_bdev = rdev->bdev;
1505 mbio->bi_end_io = raid10_end_write_request;
1506 mbio->bi_rw = WRITE | do_sync | do_fua | do_discard;
1507 mbio->bi_private = r10_bio;
1464 1508
1465 cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug)); 1509 atomic_inc(&r10_bio->remaining);
1466 if (cb) 1510 spin_lock_irqsave(&conf->device_lock, flags);
1467 plug = container_of(cb, struct raid10_plug_cb, cb);
1468 else
1469 plug = NULL;
1470 spin_lock_irqsave(&conf->device_lock, flags);
1471 if (plug) {
1472 bio_list_add(&plug->pending, mbio);
1473 plug->pending_cnt++;
1474 } else {
1475 bio_list_add(&conf->pending_bio_list, mbio); 1511 bio_list_add(&conf->pending_bio_list, mbio);
1476 conf->pending_count++; 1512 conf->pending_count++;
1513 spin_unlock_irqrestore(&conf->device_lock, flags);
1514 if (!mddev_check_plugged(mddev))
1515 md_wakeup_thread(mddev->thread);
1477 } 1516 }
1478 spin_unlock_irqrestore(&conf->device_lock, flags);
1479 if (!plug)
1480 md_wakeup_thread(mddev->thread);
1481
1482 if (!r10_bio->devs[i].repl_bio)
1483 continue;
1484
1485 mbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
1486 md_trim_bio(mbio, r10_bio->sector - bio->bi_sector,
1487 max_sectors);
1488 r10_bio->devs[i].repl_bio = mbio;
1489
1490 /* We are actively writing to the original device
1491 * so it cannot disappear, so the replacement cannot
1492 * become NULL here
1493 */
1494 mbio->bi_sector = (r10_bio->devs[i].addr +
1495 choose_data_offset(
1496 r10_bio,
1497 conf->mirrors[d].replacement));
1498 mbio->bi_bdev = conf->mirrors[d].replacement->bdev;
1499 mbio->bi_end_io = raid10_end_write_request;
1500 mbio->bi_rw = WRITE | do_sync | do_fua | do_discard;
1501 mbio->bi_private = r10_bio;
1502
1503 atomic_inc(&r10_bio->remaining);
1504 spin_lock_irqsave(&conf->device_lock, flags);
1505 bio_list_add(&conf->pending_bio_list, mbio);
1506 conf->pending_count++;
1507 spin_unlock_irqrestore(&conf->device_lock, flags);
1508 if (!mddev_check_plugged(mddev))
1509 md_wakeup_thread(mddev->thread);
1510 } 1517 }
1511 1518
1512 /* Don't remove the bias on 'remaining' (one_write_done) until 1519 /* Don't remove the bias on 'remaining' (one_write_done) until
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index c5439dce0295..a4502686e7a8 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2774,10 +2774,12 @@ static void handle_stripe_clean_event(struct r5conf *conf,
2774 dev = &sh->dev[i]; 2774 dev = &sh->dev[i];
2775 if (!test_bit(R5_LOCKED, &dev->flags) && 2775 if (!test_bit(R5_LOCKED, &dev->flags) &&
2776 (test_bit(R5_UPTODATE, &dev->flags) || 2776 (test_bit(R5_UPTODATE, &dev->flags) ||
2777 test_and_clear_bit(R5_Discard, &dev->flags))) { 2777 test_bit(R5_Discard, &dev->flags))) {
2778 /* We can return any write requests */ 2778 /* We can return any write requests */
2779 struct bio *wbi, *wbi2; 2779 struct bio *wbi, *wbi2;
2780 pr_debug("Return write for disc %d\n", i); 2780 pr_debug("Return write for disc %d\n", i);
2781 if (test_and_clear_bit(R5_Discard, &dev->flags))
2782 clear_bit(R5_UPTODATE, &dev->flags);
2781 wbi = dev->written; 2783 wbi = dev->written;
2782 dev->written = NULL; 2784 dev->written = NULL;
2783 while (wbi && wbi->bi_sector < 2785 while (wbi && wbi->bi_sector <
@@ -2795,7 +2797,8 @@ static void handle_stripe_clean_event(struct r5conf *conf,
2795 !test_bit(STRIPE_DEGRADED, &sh->state), 2797 !test_bit(STRIPE_DEGRADED, &sh->state),
2796 0); 2798 0);
2797 } 2799 }
2798 } 2800 } else if (test_bit(R5_Discard, &sh->dev[i].flags))
2801 clear_bit(R5_Discard, &sh->dev[i].flags);
2799 2802
2800 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) 2803 if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state))
2801 if (atomic_dec_and_test(&conf->pending_full_writes)) 2804 if (atomic_dec_and_test(&conf->pending_full_writes))
@@ -3490,40 +3493,6 @@ static void handle_stripe(struct stripe_head *sh)
3490 handle_failed_sync(conf, sh, &s); 3493 handle_failed_sync(conf, sh, &s);
3491 } 3494 }
3492 3495
3493 /*
3494 * might be able to return some write requests if the parity blocks
3495 * are safe, or on a failed drive
3496 */
3497 pdev = &sh->dev[sh->pd_idx];
3498 s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx)
3499 || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx);
3500 qdev = &sh->dev[sh->qd_idx];
3501 s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx)
3502 || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx)
3503 || conf->level < 6;
3504
3505 if (s.written &&
3506 (s.p_failed || ((test_bit(R5_Insync, &pdev->flags)
3507 && !test_bit(R5_LOCKED, &pdev->flags)
3508 && (test_bit(R5_UPTODATE, &pdev->flags) ||
3509 test_bit(R5_Discard, &pdev->flags))))) &&
3510 (s.q_failed || ((test_bit(R5_Insync, &qdev->flags)
3511 && !test_bit(R5_LOCKED, &qdev->flags)
3512 && (test_bit(R5_UPTODATE, &qdev->flags) ||
3513 test_bit(R5_Discard, &qdev->flags))))))
3514 handle_stripe_clean_event(conf, sh, disks, &s.return_bi);
3515
3516 /* Now we might consider reading some blocks, either to check/generate
3517 * parity, or to satisfy requests
3518 * or to load a block that is being partially written.
3519 */
3520 if (s.to_read || s.non_overwrite
3521 || (conf->level == 6 && s.to_write && s.failed)
3522 || (s.syncing && (s.uptodate + s.compute < disks))
3523 || s.replacing
3524 || s.expanding)
3525 handle_stripe_fill(sh, &s, disks);
3526
3527 /* Now we check to see if any write operations have recently 3496 /* Now we check to see if any write operations have recently
3528 * completed 3497 * completed
3529 */ 3498 */
@@ -3561,6 +3530,40 @@ static void handle_stripe(struct stripe_head *sh)
3561 s.dec_preread_active = 1; 3530 s.dec_preread_active = 1;
3562 } 3531 }
3563 3532
3533 /*
3534 * might be able to return some write requests if the parity blocks
3535 * are safe, or on a failed drive
3536 */
3537 pdev = &sh->dev[sh->pd_idx];
3538 s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx)
3539 || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx);
3540 qdev = &sh->dev[sh->qd_idx];
3541 s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx)
3542 || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx)
3543 || conf->level < 6;
3544
3545 if (s.written &&
3546 (s.p_failed || ((test_bit(R5_Insync, &pdev->flags)
3547 && !test_bit(R5_LOCKED, &pdev->flags)
3548 && (test_bit(R5_UPTODATE, &pdev->flags) ||
3549 test_bit(R5_Discard, &pdev->flags))))) &&
3550 (s.q_failed || ((test_bit(R5_Insync, &qdev->flags)
3551 && !test_bit(R5_LOCKED, &qdev->flags)
3552 && (test_bit(R5_UPTODATE, &qdev->flags) ||
3553 test_bit(R5_Discard, &qdev->flags))))))
3554 handle_stripe_clean_event(conf, sh, disks, &s.return_bi);
3555
3556 /* Now we might consider reading some blocks, either to check/generate
3557 * parity, or to satisfy requests
3558 * or to load a block that is being partially written.
3559 */
3560 if (s.to_read || s.non_overwrite
3561 || (conf->level == 6 && s.to_write && s.failed)
3562 || (s.syncing && (s.uptodate + s.compute < disks))
3563 || s.replacing
3564 || s.expanding)
3565 handle_stripe_fill(sh, &s, disks);
3566
3564 /* Now to consider new write requests and what else, if anything 3567 /* Now to consider new write requests and what else, if anything
3565 * should be read. We do not handle new writes when: 3568 * should be read. We do not handle new writes when:
3566 * 1/ A 'write' operation (copy+xor) is already in flight. 3569 * 1/ A 'write' operation (copy+xor) is already in flight.
@@ -5529,6 +5532,10 @@ static int run(struct mddev *mddev)
5529 * discard data disk but write parity disk 5532 * discard data disk but write parity disk
5530 */ 5533 */
5531 stripe = stripe * PAGE_SIZE; 5534 stripe = stripe * PAGE_SIZE;
5535 /* Round up to power of 2, as discard handling
5536 * currently assumes that */
5537 while ((stripe-1) & stripe)
5538 stripe = (stripe | (stripe-1)) + 1;
5532 mddev->queue->limits.discard_alignment = stripe; 5539 mddev->queue->limits.discard_alignment = stripe;
5533 mddev->queue->limits.discard_granularity = stripe; 5540 mddev->queue->limits.discard_granularity = stripe;
5534 /* 5541 /*
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 8f52fc858e48..5a5cd2ace4a6 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -240,7 +240,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength)
240 240
241 if (*(szlength) != '+') { 241 if (*(szlength) != '+') {
242 devlength = simple_strtoul(szlength, &buffer, 0); 242 devlength = simple_strtoul(szlength, &buffer, 0);
243 devlength = handle_unit(devlength, buffer) - devstart; 243 devlength = handle_unit(devlength, buffer);
244 if (devlength < devstart) 244 if (devlength < devstart)
245 goto err_out; 245 goto err_out;
246 246
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ec6841d8e956..1a03b7f673ce 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2983,13 +2983,15 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
2983 /* 2983 /*
2984 * Field definitions are in the following datasheets: 2984 * Field definitions are in the following datasheets:
2985 * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32) 2985 * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
2986 * New style (6 byte ID): Samsung K9GAG08U0F (p.44) 2986 * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44)
2987 * Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22) 2987 * Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22)
2988 * 2988 *
2989 * Check for ID length, cell type, and Hynix/Samsung ID to decide what 2989 * Check for ID length, non-zero 6th byte, cell type, and Hynix/Samsung
2990 * to do. 2990 * ID to decide what to do.
2991 */ 2991 */
2992 if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG) { 2992 if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG &&
2993 (chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
2994 id_data[5] != 0x00) {
2993 /* Calc pagesize */ 2995 /* Calc pagesize */
2994 mtd->writesize = 2048 << (extid & 0x03); 2996 mtd->writesize = 2048 << (extid & 0x03);
2995 extid >>= 2; 2997 extid >>= 2;
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 64be8f0848b0..d9127e2ed808 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
121 nr_parts = plen / sizeof(part[0]); 121 nr_parts = plen / sizeof(part[0]);
122 122
123 *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL); 123 *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
124 if (!pparts) 124 if (!*pparts)
125 return -ENOMEM; 125 return -ENOMEM;
126 126
127 names = of_get_property(dp, "partition-names", &plen); 127 names = of_get_property(dp, "partition-names", &plen);
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 7153e0d27101..b3f41f200622 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -3694,7 +3694,7 @@ static int flexonenand_check_blocks_erased(struct mtd_info *mtd, int start, int
3694 * flexonenand_set_boundary - Writes the SLC boundary 3694 * flexonenand_set_boundary - Writes the SLC boundary
3695 * @param mtd - mtd info structure 3695 * @param mtd - mtd info structure
3696 */ 3696 */
3697int flexonenand_set_boundary(struct mtd_info *mtd, int die, 3697static int flexonenand_set_boundary(struct mtd_info *mtd, int die,
3698 int boundary, int lock) 3698 int boundary, int lock)
3699{ 3699{
3700 struct onenand_chip *this = mtd->priv; 3700 struct onenand_chip *this = mtd->priv;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b2530b002125..5f5b69f37d2e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1379,6 +1379,8 @@ static void bond_compute_features(struct bonding *bond)
1379 struct net_device *bond_dev = bond->dev; 1379 struct net_device *bond_dev = bond->dev;
1380 netdev_features_t vlan_features = BOND_VLAN_FEATURES; 1380 netdev_features_t vlan_features = BOND_VLAN_FEATURES;
1381 unsigned short max_hard_header_len = ETH_HLEN; 1381 unsigned short max_hard_header_len = ETH_HLEN;
1382 unsigned int gso_max_size = GSO_MAX_SIZE;
1383 u16 gso_max_segs = GSO_MAX_SEGS;
1382 int i; 1384 int i;
1383 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; 1385 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE;
1384 1386
@@ -1394,11 +1396,16 @@ static void bond_compute_features(struct bonding *bond)
1394 dst_release_flag &= slave->dev->priv_flags; 1396 dst_release_flag &= slave->dev->priv_flags;
1395 if (slave->dev->hard_header_len > max_hard_header_len) 1397 if (slave->dev->hard_header_len > max_hard_header_len)
1396 max_hard_header_len = slave->dev->hard_header_len; 1398 max_hard_header_len = slave->dev->hard_header_len;
1399
1400 gso_max_size = min(gso_max_size, slave->dev->gso_max_size);
1401 gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs);
1397 } 1402 }
1398 1403
1399done: 1404done:
1400 bond_dev->vlan_features = vlan_features; 1405 bond_dev->vlan_features = vlan_features;
1401 bond_dev->hard_header_len = max_hard_header_len; 1406 bond_dev->hard_header_len = max_hard_header_len;
1407 bond_dev->gso_max_segs = gso_max_segs;
1408 netif_set_gso_max_size(bond_dev, gso_max_size);
1402 1409
1403 flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE; 1410 flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE;
1404 bond_dev->priv_flags = flags | dst_release_flag; 1411 bond_dev->priv_flags = flags | dst_release_flag;
diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index d04911d33b64..47618e505355 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -813,6 +813,7 @@ static int __init ne_drv_probe(struct platform_device *pdev)
813 dev->irq = irq[this_dev]; 813 dev->irq = irq[this_dev];
814 dev->mem_end = bad[this_dev]; 814 dev->mem_end = bad[this_dev];
815 } 815 }
816 SET_NETDEV_DEV(dev, &pdev->dev);
816 err = do_ne_probe(dev); 817 err = do_ne_probe(dev);
817 if (err) { 818 if (err) {
818 free_netdev(dev); 819 free_netdev(dev);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index bd1fd3d87c24..01611b33a93d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9545,10 +9545,13 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp)
9545 */ 9545 */
9546static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) 9546static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)
9547{ 9547{
9548 u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); 9548 if (!CHIP_IS_E1x(bp)) {
9549 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) { 9549 u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
9550 BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing"); 9550 if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
9551 REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp)); 9551 BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
9552 REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR,
9553 1 << BP_FUNC(bp));
9554 }
9552 } 9555 }
9553} 9556}
9554 9557
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 92317e9c0f73..60ac46f4ac08 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -1860,10 +1860,14 @@ jme_open(struct net_device *netdev)
1860 jme_clear_pm(jme); 1860 jme_clear_pm(jme);
1861 JME_NAPI_ENABLE(jme); 1861 JME_NAPI_ENABLE(jme);
1862 1862
1863 tasklet_enable(&jme->linkch_task); 1863 tasklet_init(&jme->linkch_task, jme_link_change_tasklet,
1864 tasklet_enable(&jme->txclean_task); 1864 (unsigned long) jme);
1865 tasklet_hi_enable(&jme->rxclean_task); 1865 tasklet_init(&jme->txclean_task, jme_tx_clean_tasklet,
1866 tasklet_hi_enable(&jme->rxempty_task); 1866 (unsigned long) jme);
1867 tasklet_init(&jme->rxclean_task, jme_rx_clean_tasklet,
1868 (unsigned long) jme);
1869 tasklet_init(&jme->rxempty_task, jme_rx_empty_tasklet,
1870 (unsigned long) jme);
1867 1871
1868 rc = jme_request_irq(jme); 1872 rc = jme_request_irq(jme);
1869 if (rc) 1873 if (rc)
@@ -3079,22 +3083,6 @@ jme_init_one(struct pci_dev *pdev,
3079 tasklet_init(&jme->pcc_task, 3083 tasklet_init(&jme->pcc_task,
3080 jme_pcc_tasklet, 3084 jme_pcc_tasklet,
3081 (unsigned long) jme); 3085 (unsigned long) jme);
3082 tasklet_init(&jme->linkch_task,
3083 jme_link_change_tasklet,
3084 (unsigned long) jme);
3085 tasklet_init(&jme->txclean_task,
3086 jme_tx_clean_tasklet,
3087 (unsigned long) jme);
3088 tasklet_init(&jme->rxclean_task,
3089 jme_rx_clean_tasklet,
3090 (unsigned long) jme);
3091 tasklet_init(&jme->rxempty_task,
3092 jme_rx_empty_tasklet,
3093 (unsigned long) jme);
3094 tasklet_disable_nosync(&jme->linkch_task);
3095 tasklet_disable_nosync(&jme->txclean_task);
3096 tasklet_disable_nosync(&jme->rxclean_task);
3097 tasklet_disable_nosync(&jme->rxempty_task);
3098 jme->dpi.cur = PCC_P1; 3086 jme->dpi.cur = PCC_P1;
3099 3087
3100 jme->reg_ghc = 0; 3088 jme->reg_ghc = 0;
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index e558edd1cb6c..69e01977a1dd 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5459,8 +5459,10 @@ static int prepare_hardware(struct net_device *dev)
5459 rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev); 5459 rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
5460 if (rc) 5460 if (rc)
5461 return rc; 5461 return rc;
5462 tasklet_enable(&hw_priv->rx_tasklet); 5462 tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,
5463 tasklet_enable(&hw_priv->tx_tasklet); 5463 (unsigned long) hw_priv);
5464 tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,
5465 (unsigned long) hw_priv);
5464 5466
5465 hw->promiscuous = 0; 5467 hw->promiscuous = 0;
5466 hw->all_multi = 0; 5468 hw->all_multi = 0;
@@ -7033,16 +7035,6 @@ static int __devinit pcidev_init(struct pci_dev *pdev,
7033 spin_lock_init(&hw_priv->hwlock); 7035 spin_lock_init(&hw_priv->hwlock);
7034 mutex_init(&hw_priv->lock); 7036 mutex_init(&hw_priv->lock);
7035 7037
7036 /* tasklet is enabled. */
7037 tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,
7038 (unsigned long) hw_priv);
7039 tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,
7040 (unsigned long) hw_priv);
7041
7042 /* tasklet_enable will decrement the atomic counter. */
7043 tasklet_disable(&hw_priv->rx_tasklet);
7044 tasklet_disable(&hw_priv->tx_tasklet);
7045
7046 for (i = 0; i < TOTAL_PORT_NUM; i++) 7038 for (i = 0; i < TOTAL_PORT_NUM; i++)
7047 init_waitqueue_head(&hw_priv->counter[i].counter); 7039 init_waitqueue_head(&hw_priv->counter[i].counter);
7048 7040
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index 1c818254b7be..b01f83a044c4 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -979,17 +979,6 @@ static void cp_init_hw (struct cp_private *cp)
979 cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); 979 cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
980 cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4))); 980 cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
981 981
982 cpw32_f(HiTxRingAddr, 0);
983 cpw32_f(HiTxRingAddr + 4, 0);
984
985 ring_dma = cp->ring_dma;
986 cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
987 cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
988
989 ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
990 cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
991 cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
992
993 cp_start_hw(cp); 982 cp_start_hw(cp);
994 cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */ 983 cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */
995 984
@@ -1003,6 +992,17 @@ static void cp_init_hw (struct cp_private *cp)
1003 992
1004 cpw8(Config5, cpr8(Config5) & PMEStatus); 993 cpw8(Config5, cpr8(Config5) & PMEStatus);
1005 994
995 cpw32_f(HiTxRingAddr, 0);
996 cpw32_f(HiTxRingAddr + 4, 0);
997
998 ring_dma = cp->ring_dma;
999 cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
1000 cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
1001
1002 ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
1003 cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
1004 cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
1005
1006 cpw16(MultiIntr, 0); 1006 cpw16(MultiIntr, 0);
1007 1007
1008 cpw8_f(Cfg9346, Cfg9346_Lock); 1008 cpw8_f(Cfg9346, Cfg9346_Lock);
diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c
index fb9f6b38511f..edf5edb13140 100644
--- a/drivers/net/ethernet/sis/sis900.c
+++ b/drivers/net/ethernet/sis/sis900.c
@@ -2479,7 +2479,7 @@ static int sis900_resume(struct pci_dev *pci_dev)
2479 netif_start_queue(net_dev); 2479 netif_start_queue(net_dev);
2480 2480
2481 /* Workaround for EDB */ 2481 /* Workaround for EDB */
2482 sis900_set_mode(ioaddr, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); 2482 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED);
2483 2483
2484 /* Enable all known interrupts by setting the interrupt mask. */ 2484 /* Enable all known interrupts by setting the interrupt mask. */
2485 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); 2485 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE);
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 62d1baf111ea..c53c0f4e2ce3 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2110,7 +2110,7 @@ static void __devinit smsc911x_read_mac_address(struct net_device *dev)
2110static int __devinit smsc911x_init(struct net_device *dev) 2110static int __devinit smsc911x_init(struct net_device *dev)
2111{ 2111{
2112 struct smsc911x_data *pdata = netdev_priv(dev); 2112 struct smsc911x_data *pdata = netdev_priv(dev);
2113 unsigned int byte_test; 2113 unsigned int byte_test, mask;
2114 unsigned int to = 100; 2114 unsigned int to = 100;
2115 2115
2116 SMSC_TRACE(pdata, probe, "Driver Parameters:"); 2116 SMSC_TRACE(pdata, probe, "Driver Parameters:");
@@ -2130,9 +2130,22 @@ static int __devinit smsc911x_init(struct net_device *dev)
2130 /* 2130 /*
2131 * poll the READY bit in PMT_CTRL. Any other access to the device is 2131 * poll the READY bit in PMT_CTRL. Any other access to the device is
2132 * forbidden while this bit isn't set. Try for 100ms 2132 * forbidden while this bit isn't set. Try for 100ms
2133 *
2134 * Note that this test is done before the WORD_SWAP register is
2135 * programmed. So in some configurations the READY bit is at 16 before
2136 * WORD_SWAP is written to. This issue is worked around by waiting
2137 * until either bit 0 or bit 16 gets set in PMT_CTRL.
2138 *
2139 * SMSC has confirmed that checking bit 16 (marked as reserved in
2140 * the datasheet) is fine since these bits "will either never be set
2141 * or can only go high after READY does (so also indicate the device
2142 * is ready)".
2133 */ 2143 */
2134 while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to) 2144
2145 mask = PMT_CTRL_READY_ | swahw32(PMT_CTRL_READY_);
2146 while (!(smsc911x_reg_read(pdata, PMT_CTRL) & mask) && --to)
2135 udelay(1000); 2147 udelay(1000);
2148
2136 if (to == 0) { 2149 if (to == 0) {
2137 pr_err("Device not READY in 100ms aborting\n"); 2150 pr_err("Device not READY in 100ms aborting\n");
2138 return -ENODEV; 2151 return -ENODEV;
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 4e9810013850..66e025ad5df1 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev)
917 ingress_irq = rc; 917 ingress_irq = rc;
918 tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU); 918 tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
919 rc = request_irq(ingress_irq, tile_net_handle_ingress_irq, 919 rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
920 0, NULL, NULL); 920 0, "tile_net", NULL);
921 if (rc != 0) { 921 if (rc != 0) {
922 netdev_err(dev, "request_irq failed: %d\n", rc); 922 netdev_err(dev, "request_irq failed: %d\n", rc);
923 destroy_irq(ingress_irq); 923 destroy_irq(ingress_irq);
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 1d04754a6637..a788501e978e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -894,6 +894,8 @@ out:
894 return IRQ_HANDLED; 894 return IRQ_HANDLED;
895} 895}
896 896
897static void axienet_dma_err_handler(unsigned long data);
898
897/** 899/**
898 * axienet_open - Driver open routine. 900 * axienet_open - Driver open routine.
899 * @ndev: Pointer to net_device structure 901 * @ndev: Pointer to net_device structure
@@ -942,6 +944,10 @@ static int axienet_open(struct net_device *ndev)
942 phy_start(lp->phy_dev); 944 phy_start(lp->phy_dev);
943 } 945 }
944 946
947 /* Enable tasklets for Axi DMA error handling */
948 tasklet_init(&lp->dma_err_tasklet, axienet_dma_err_handler,
949 (unsigned long) lp);
950
945 /* Enable interrupts for Axi DMA Tx */ 951 /* Enable interrupts for Axi DMA Tx */
946 ret = request_irq(lp->tx_irq, axienet_tx_irq, 0, ndev->name, ndev); 952 ret = request_irq(lp->tx_irq, axienet_tx_irq, 0, ndev->name, ndev);
947 if (ret) 953 if (ret)
@@ -950,8 +956,7 @@ static int axienet_open(struct net_device *ndev)
950 ret = request_irq(lp->rx_irq, axienet_rx_irq, 0, ndev->name, ndev); 956 ret = request_irq(lp->rx_irq, axienet_rx_irq, 0, ndev->name, ndev);
951 if (ret) 957 if (ret)
952 goto err_rx_irq; 958 goto err_rx_irq;
953 /* Enable tasklets for Axi DMA error handling */ 959
954 tasklet_enable(&lp->dma_err_tasklet);
955 return 0; 960 return 0;
956 961
957err_rx_irq: 962err_rx_irq:
@@ -960,6 +965,7 @@ err_tx_irq:
960 if (lp->phy_dev) 965 if (lp->phy_dev)
961 phy_disconnect(lp->phy_dev); 966 phy_disconnect(lp->phy_dev);
962 lp->phy_dev = NULL; 967 lp->phy_dev = NULL;
968 tasklet_kill(&lp->dma_err_tasklet);
963 dev_err(lp->dev, "request_irq() failed\n"); 969 dev_err(lp->dev, "request_irq() failed\n");
964 return ret; 970 return ret;
965} 971}
@@ -1613,10 +1619,6 @@ static int __devinit axienet_of_probe(struct platform_device *op)
1613 goto err_iounmap_2; 1619 goto err_iounmap_2;
1614 } 1620 }
1615 1621
1616 tasklet_init(&lp->dma_err_tasklet, axienet_dma_err_handler,
1617 (unsigned long) lp);
1618 tasklet_disable(&lp->dma_err_tasklet);
1619
1620 return 0; 1622 return 0;
1621 1623
1622err_iounmap_2: 1624err_iounmap_2:
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 98934bdf6acf..477d6729b17f 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1102,10 +1102,12 @@ static int init_queues(struct port *port)
1102{ 1102{
1103 int i; 1103 int i;
1104 1104
1105 if (!ports_open) 1105 if (!ports_open) {
1106 if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, 1106 dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,
1107 POOL_ALLOC_SIZE, 32, 0))) 1107 POOL_ALLOC_SIZE, 32, 0);
1108 if (!dma_pool)
1108 return -ENOMEM; 1109 return -ENOMEM;
1110 }
1109 1111
1110 if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, 1112 if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
1111 &port->desc_tab_phys))) 1113 &port->desc_tab_phys)))
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 5039f08f5a5b..43e9ab4f4d7e 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -222,7 +222,7 @@ static void sirdev_config_fsm(struct work_struct *work)
222 break; 222 break;
223 223
224 case SIRDEV_STATE_DONGLE_SPEED: 224 case SIRDEV_STATE_DONGLE_SPEED:
225 if (dev->dongle_drv->reset) { 225 if (dev->dongle_drv->set_speed) {
226 ret = dev->dongle_drv->set_speed(dev, fsm->param); 226 ret = dev->dongle_drv->set_speed(dev, fsm->param);
227 if (ret < 0) { 227 if (ret < 0) {
228 fsm->result = ret; 228 fsm->result = ret;
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c
index 6428fcbbdd4b..daec9b05d168 100644
--- a/drivers/net/phy/mdio-bitbang.c
+++ b/drivers/net/phy/mdio-bitbang.c
@@ -234,7 +234,6 @@ void free_mdio_bitbang(struct mii_bus *bus)
234 struct mdiobb_ctrl *ctrl = bus->priv; 234 struct mdiobb_ctrl *ctrl = bus->priv;
235 235
236 module_put(ctrl->ops->owner); 236 module_put(ctrl->ops->owner);
237 mdiobus_unregister(bus);
238 mdiobus_free(bus); 237 mdiobus_free(bus);
239} 238}
240EXPORT_SYMBOL(free_mdio_bitbang); 239EXPORT_SYMBOL(free_mdio_bitbang);
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 899274f2f9b1..2ed1140df3e9 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -185,17 +185,20 @@ static int __devinit mdio_gpio_probe(struct platform_device *pdev)
185{ 185{
186 struct mdio_gpio_platform_data *pdata; 186 struct mdio_gpio_platform_data *pdata;
187 struct mii_bus *new_bus; 187 struct mii_bus *new_bus;
188 int ret; 188 int ret, bus_id;
189 189
190 if (pdev->dev.of_node) 190 if (pdev->dev.of_node) {
191 pdata = mdio_gpio_of_get_data(pdev); 191 pdata = mdio_gpio_of_get_data(pdev);
192 else 192 bus_id = of_alias_get_id(pdev->dev.of_node, "mdio-gpio");
193 } else {
193 pdata = pdev->dev.platform_data; 194 pdata = pdev->dev.platform_data;
195 bus_id = pdev->id;
196 }
194 197
195 if (!pdata) 198 if (!pdata)
196 return -ENODEV; 199 return -ENODEV;
197 200
198 new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id); 201 new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, bus_id);
199 if (!new_bus) 202 if (!new_bus)
200 return -ENODEV; 203 return -ENODEV;
201 204
diff --git a/drivers/net/team/team_mode_broadcast.c b/drivers/net/team/team_mode_broadcast.c
index 9db0171e9366..c5db428e73fa 100644
--- a/drivers/net/team/team_mode_broadcast.c
+++ b/drivers/net/team/team_mode_broadcast.c
@@ -29,8 +29,8 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
29 if (last) { 29 if (last) {
30 skb2 = skb_clone(skb, GFP_ATOMIC); 30 skb2 = skb_clone(skb, GFP_ATOMIC);
31 if (skb2) { 31 if (skb2) {
32 ret = team_dev_queue_xmit(team, last, 32 ret = !team_dev_queue_xmit(team, last,
33 skb2); 33 skb2);
34 if (!sum_ret) 34 if (!sum_ret)
35 sum_ret = ret; 35 sum_ret = ret;
36 } 36 }
@@ -39,7 +39,7 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb)
39 } 39 }
40 } 40 }
41 if (last) { 41 if (last) {
42 ret = team_dev_queue_xmit(team, last, skb); 42 ret = !team_dev_queue_xmit(team, last, skb);
43 if (!sum_ret) 43 if (!sum_ret)
44 sum_ret = ret; 44 sum_ret = ret;
45 } 45 }
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4cd582a4f625..74fab1a40156 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -540,10 +540,12 @@ advance:
540 (ctx->ether_desc == NULL) || (ctx->control != intf)) 540 (ctx->ether_desc == NULL) || (ctx->control != intf))
541 goto error; 541 goto error;
542 542
543 /* claim interfaces, if any */ 543 /* claim data interface, if different from control */
544 temp = usb_driver_claim_interface(driver, ctx->data, dev); 544 if (ctx->data != ctx->control) {
545 if (temp) 545 temp = usb_driver_claim_interface(driver, ctx->data, dev);
546 goto error; 546 if (temp)
547 goto error;
548 }
547 549
548 iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber; 550 iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
549 551
@@ -623,6 +625,10 @@ static void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf)
623 625
624 tasklet_kill(&ctx->bh); 626 tasklet_kill(&ctx->bh);
625 627
628 /* handle devices with combined control and data interface */
629 if (ctx->control == ctx->data)
630 ctx->data = NULL;
631
626 /* disconnect master --> disconnect slave */ 632 /* disconnect master --> disconnect slave */
627 if (intf == ctx->control && ctx->data) { 633 if (intf == ctx->control && ctx->data) {
628 usb_set_intfdata(ctx->data, NULL); 634 usb_set_intfdata(ctx->data, NULL);
@@ -1245,6 +1251,14 @@ static const struct usb_device_id cdc_devs[] = {
1245 .driver_info = (unsigned long) &wwan_info, 1251 .driver_info = (unsigned long) &wwan_info,
1246 }, 1252 },
1247 1253
1254 /* Huawei NCM devices disguised as vendor specific */
1255 { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16),
1256 .driver_info = (unsigned long)&wwan_info,
1257 },
1258 { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),
1259 .driver_info = (unsigned long)&wwan_info,
1260 },
1261
1248 /* Generic CDC-NCM devices */ 1262 /* Generic CDC-NCM devices */
1249 { USB_INTERFACE_INFO(USB_CLASS_COMM, 1263 { USB_INTERFACE_INFO(USB_CLASS_COMM,
1250 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 1264 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 3286166415b4..362cb8cfeb92 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -184,7 +184,7 @@ static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
184 /* set the address, index & direction (read from PHY) */ 184 /* set the address, index & direction (read from PHY) */
185 phy_id &= dev->mii.phy_id_mask; 185 phy_id &= dev->mii.phy_id_mask;
186 idx &= dev->mii.reg_num_mask; 186 idx &= dev->mii.reg_num_mask;
187 addr = (phy_id << 11) | (idx << 6) | MII_READ_; 187 addr = (phy_id << 11) | (idx << 6) | MII_READ_ | MII_BUSY_;
188 ret = smsc95xx_write_reg(dev, MII_ADDR, addr); 188 ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
189 check_warn_goto_done(ret, "Error writing MII_ADDR"); 189 check_warn_goto_done(ret, "Error writing MII_ADDR");
190 190
@@ -221,7 +221,7 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
221 /* set the address, index & direction (write to PHY) */ 221 /* set the address, index & direction (write to PHY) */
222 phy_id &= dev->mii.phy_id_mask; 222 phy_id &= dev->mii.phy_id_mask;
223 idx &= dev->mii.reg_num_mask; 223 idx &= dev->mii.reg_num_mask;
224 addr = (phy_id << 11) | (idx << 6) | MII_WRITE_; 224 addr = (phy_id << 11) | (idx << 6) | MII_WRITE_ | MII_BUSY_;
225 ret = smsc95xx_write_reg(dev, MII_ADDR, addr); 225 ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
226 check_warn_goto_done(ret, "Error writing MII_ADDR"); 226 check_warn_goto_done(ret, "Error writing MII_ADDR");
227 227
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 7b4adde93c01..8b5c61917076 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * VXLAN: Virtual eXtensiable Local Area Network 2 * VXLAN: Virtual eXtensible Local Area Network
3 * 3 *
4 * Copyright (c) 2012 Vyatta Inc. 4 * Copyright (c) 2012 Vyatta Inc.
5 * 5 *
@@ -50,8 +50,8 @@
50 50
51#define VXLAN_N_VID (1u << 24) 51#define VXLAN_N_VID (1u << 24)
52#define VXLAN_VID_MASK (VXLAN_N_VID - 1) 52#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
53/* VLAN + IP header + UDP + VXLAN */ 53/* IP header + UDP + VXLAN + Ethernet header */
54#define VXLAN_HEADROOM (4 + 20 + 8 + 8) 54#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
55 55
56#define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ 56#define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */
57 57
@@ -1102,6 +1102,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
1102 1102
1103 if (!tb[IFLA_MTU]) 1103 if (!tb[IFLA_MTU])
1104 dev->mtu = lowerdev->mtu - VXLAN_HEADROOM; 1104 dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
1105
1106 /* update header length based on lower device */
1107 dev->hard_header_len = lowerdev->hard_header_len +
1108 VXLAN_HEADROOM;
1105 } 1109 }
1106 1110
1107 if (data[IFLA_VXLAN_TOS]) 1111 if (data[IFLA_VXLAN_TOS])
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 3f575afd8cfc..e9a3da588e95 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -969,10 +969,12 @@ static int init_hdlc_queues(struct port *port)
969{ 969{
970 int i; 970 int i;
971 971
972 if (!ports_open) 972 if (!ports_open) {
973 if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, 973 dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,
974 POOL_ALLOC_SIZE, 32, 0))) 974 POOL_ALLOC_SIZE, 32, 0);
975 if (!dma_pool)
975 return -ENOMEM; 976 return -ENOMEM;
977 }
976 978
977 if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, 979 if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
978 &port->desc_tab_phys))) 980 &port->desc_tab_phys)))
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8e1559aba495..1829b445d0b0 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1456,7 +1456,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1456 switch (type) { 1456 switch (type) {
1457 case ATH9K_RESET_POWER_ON: 1457 case ATH9K_RESET_POWER_ON:
1458 ret = ath9k_hw_set_reset_power_on(ah); 1458 ret = ath9k_hw_set_reset_power_on(ah);
1459 if (!ret) 1459 if (ret)
1460 ah->reset_power_on = true; 1460 ah->reset_power_on = true;
1461 break; 1461 break;
1462 case ATH9K_RESET_WARM: 1462 case ATH9K_RESET_WARM:
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index a6f1e8166008..481345c23ded 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -4401,7 +4401,7 @@ static s32 brcmf_mode_to_nl80211_iftype(s32 mode)
4401 4401
4402static void brcmf_wiphy_pno_params(struct wiphy *wiphy) 4402static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
4403{ 4403{
4404#ifndef CONFIG_BRCMFISCAN 4404#ifndef CONFIG_BRCMISCAN
4405 /* scheduled scan settings */ 4405 /* scheduled scan settings */
4406 wiphy->max_sched_scan_ssids = BRCMF_PNO_MAX_PFN_COUNT; 4406 wiphy->max_sched_scan_ssids = BRCMF_PNO_MAX_PFN_COUNT;
4407 wiphy->max_match_sets = BRCMF_PNO_MAX_PFN_COUNT; 4407 wiphy->max_match_sets = BRCMF_PNO_MAX_PFN_COUNT;
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index ff8162d4c454..2d9eee93c743 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -521,7 +521,7 @@ static void iwlagn_mac_tx(struct ieee80211_hw *hw,
521 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 521 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
522 522
523 if (iwlagn_tx_skb(priv, control->sta, skb)) 523 if (iwlagn_tx_skb(priv, control->sta, skb))
524 dev_kfree_skb_any(skb); 524 ieee80211_free_txskb(hw, skb);
525} 525}
526 526
527static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw, 527static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw,
@@ -1354,6 +1354,20 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
1354 vif_priv->ctx = ctx; 1354 vif_priv->ctx = ctx;
1355 ctx->vif = vif; 1355 ctx->vif = vif;
1356 1356
1357 /*
1358 * In SNIFFER device type, the firmware reports the FCS to
1359 * the host, rather than snipping it off. Unfortunately,
1360 * mac80211 doesn't (yet) provide a per-packet flag for
1361 * this, so that we have to set the hardware flag based
1362 * on the interfaces added. As the monitor interface can
1363 * only be present by itself, and will be removed before
1364 * other interfaces are added, this is safe.
1365 */
1366 if (vif->type == NL80211_IFTYPE_MONITOR)
1367 priv->hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
1368 else
1369 priv->hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
1370
1357 err = iwl_setup_interface(priv, ctx); 1371 err = iwl_setup_interface(priv, ctx);
1358 if (!err || reset) 1372 if (!err || reset)
1359 goto out; 1373 goto out;
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index 7ff3f1430678..408132cf83c1 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -2114,7 +2114,7 @@ static void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
2114 2114
2115 info = IEEE80211_SKB_CB(skb); 2115 info = IEEE80211_SKB_CB(skb);
2116 iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); 2116 iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]);
2117 dev_kfree_skb_any(skb); 2117 ieee80211_free_txskb(priv->hw, skb);
2118} 2118}
2119 2119
2120static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) 2120static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index 17c8e5d82681..bb69f8f90b3b 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -321,6 +321,14 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority)
321 dma_map_page(trans->dev, page, 0, 321 dma_map_page(trans->dev, page, 0,
322 PAGE_SIZE << trans_pcie->rx_page_order, 322 PAGE_SIZE << trans_pcie->rx_page_order,
323 DMA_FROM_DEVICE); 323 DMA_FROM_DEVICE);
324 if (dma_mapping_error(trans->dev, rxb->page_dma)) {
325 rxb->page = NULL;
326 spin_lock_irqsave(&rxq->lock, flags);
327 list_add(&rxb->list, &rxq->rx_used);
328 spin_unlock_irqrestore(&rxq->lock, flags);
329 __free_pages(page, trans_pcie->rx_page_order);
330 return;
331 }
324 /* dma address must be no more than 36 bits */ 332 /* dma address must be no more than 36 bits */
325 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); 333 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
326 /* and also 256 byte aligned! */ 334 /* and also 256 byte aligned! */
@@ -488,8 +496,19 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
488 dma_map_page(trans->dev, rxb->page, 0, 496 dma_map_page(trans->dev, rxb->page, 0,
489 PAGE_SIZE << trans_pcie->rx_page_order, 497 PAGE_SIZE << trans_pcie->rx_page_order,
490 DMA_FROM_DEVICE); 498 DMA_FROM_DEVICE);
491 list_add_tail(&rxb->list, &rxq->rx_free); 499 if (dma_mapping_error(trans->dev, rxb->page_dma)) {
492 rxq->free_count++; 500 /*
501 * free the page(s) as well to not break
502 * the invariant that the items on the used
503 * list have no page(s)
504 */
505 __free_pages(rxb->page, trans_pcie->rx_page_order);
506 rxb->page = NULL;
507 list_add_tail(&rxb->list, &rxq->rx_used);
508 } else {
509 list_add_tail(&rxb->list, &rxq->rx_free);
510 rxq->free_count++;
511 }
493 } else 512 } else
494 list_add_tail(&rxb->list, &rxq->rx_used); 513 list_add_tail(&rxb->list, &rxq->rx_used);
495 spin_unlock_irqrestore(&rxq->lock, flags); 514 spin_unlock_irqrestore(&rxq->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 105e3af3c621..79a4ddc002d3 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -480,20 +480,12 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
480void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id) 480void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id)
481{ 481{
482 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 482 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
483 u16 rd_ptr, wr_ptr;
484 int n_bd = trans_pcie->txq[txq_id].q.n_bd;
485 483
486 if (!test_and_clear_bit(txq_id, trans_pcie->queue_used)) { 484 if (!test_and_clear_bit(txq_id, trans_pcie->queue_used)) {
487 WARN_ONCE(1, "queue %d not used", txq_id); 485 WARN_ONCE(1, "queue %d not used", txq_id);
488 return; 486 return;
489 } 487 }
490 488
491 rd_ptr = iwl_read_prph(trans, SCD_QUEUE_RDPTR(txq_id)) & (n_bd - 1);
492 wr_ptr = iwl_read_prph(trans, SCD_QUEUE_WRPTR(txq_id));
493
494 WARN_ONCE(rd_ptr != wr_ptr, "queue %d isn't empty: [%d,%d]",
495 txq_id, rd_ptr, wr_ptr);
496
497 iwl_txq_set_inactive(trans, txq_id); 489 iwl_txq_set_inactive(trans, txq_id);
498 IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id); 490 IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id);
499} 491}
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 8d465107f52b..ae9010ed58de 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -890,9 +890,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
890 return; 890 return;
891 } 891 }
892 cmd_node = adapter->curr_cmd; 892 cmd_node = adapter->curr_cmd;
893 if (cmd_node->wait_q_enabled)
894 adapter->cmd_wait_q.status = -ETIMEDOUT;
895
896 if (cmd_node) { 893 if (cmd_node) {
897 adapter->dbg.timeout_cmd_id = 894 adapter->dbg.timeout_cmd_id =
898 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; 895 adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index];
@@ -938,6 +935,14 @@ mwifiex_cmd_timeout_func(unsigned long function_context)
938 935
939 dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n", 936 dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n",
940 adapter->ps_mode, adapter->ps_state); 937 adapter->ps_mode, adapter->ps_state);
938
939 if (cmd_node->wait_q_enabled) {
940 adapter->cmd_wait_q.status = -ETIMEDOUT;
941 wake_up_interruptible(&adapter->cmd_wait_q.wait);
942 mwifiex_cancel_pending_ioctl(adapter);
943 /* reset cmd_sent flag to unblock new commands */
944 adapter->cmd_sent = false;
945 }
941 } 946 }
942 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) 947 if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
943 mwifiex_init_fw_complete(adapter); 948 mwifiex_init_fw_complete(adapter);
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index fc8a9bfa1248..82cf0fa2d9f6 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -161,7 +161,6 @@ static int mwifiex_sdio_suspend(struct device *dev)
161 struct sdio_mmc_card *card; 161 struct sdio_mmc_card *card;
162 struct mwifiex_adapter *adapter; 162 struct mwifiex_adapter *adapter;
163 mmc_pm_flag_t pm_flag = 0; 163 mmc_pm_flag_t pm_flag = 0;
164 int hs_actived = 0;
165 int i; 164 int i;
166 int ret = 0; 165 int ret = 0;
167 166
@@ -188,12 +187,14 @@ static int mwifiex_sdio_suspend(struct device *dev)
188 adapter = card->adapter; 187 adapter = card->adapter;
189 188
190 /* Enable the Host Sleep */ 189 /* Enable the Host Sleep */
191 hs_actived = mwifiex_enable_hs(adapter); 190 if (!mwifiex_enable_hs(adapter)) {
192 if (hs_actived) { 191 dev_err(adapter->dev, "cmd: failed to suspend\n");
193 pr_debug("cmd: suspend with MMC_PM_KEEP_POWER\n"); 192 return -EFAULT;
194 ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
195 } 193 }
196 194
195 dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n");
196 ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
197
197 /* Indicate device suspended */ 198 /* Indicate device suspended */
198 adapter->is_suspended = true; 199 adapter->is_suspended = true;
199 200
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 9970c2b1b199..b7e6607e6b6d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -297,6 +297,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
297 /*=== Customer ID ===*/ 297 /*=== Customer ID ===*/
298 /****** 8188CU ********/ 298 /****** 8188CU ********/
299 {RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/ 299 {RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/
300 {RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/
300 {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/ 301 {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/
301 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ 302 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
302 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ 303 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index caa011008cd0..fc24eb9b3948 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -452,29 +452,85 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev,
452 /* Grant backend access to each skb fragment page. */ 452 /* Grant backend access to each skb fragment page. */
453 for (i = 0; i < frags; i++) { 453 for (i = 0; i < frags; i++) {
454 skb_frag_t *frag = skb_shinfo(skb)->frags + i; 454 skb_frag_t *frag = skb_shinfo(skb)->frags + i;
455 struct page *page = skb_frag_page(frag);
455 456
456 tx->flags |= XEN_NETTXF_more_data; 457 len = skb_frag_size(frag);
458 offset = frag->page_offset;
457 459
458 id = get_id_from_freelist(&np->tx_skb_freelist, np->tx_skbs); 460 /* Data must not cross a page boundary. */
459 np->tx_skbs[id].skb = skb_get(skb); 461 BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));
460 tx = RING_GET_REQUEST(&np->tx, prod++);
461 tx->id = id;
462 ref = gnttab_claim_grant_reference(&np->gref_tx_head);
463 BUG_ON((signed short)ref < 0);
464 462
465 mfn = pfn_to_mfn(page_to_pfn(skb_frag_page(frag))); 463 /* Skip unused frames from start of page */
466 gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id, 464 page += offset >> PAGE_SHIFT;
467 mfn, GNTMAP_readonly); 465 offset &= ~PAGE_MASK;
468 466
469 tx->gref = np->grant_tx_ref[id] = ref; 467 while (len > 0) {
470 tx->offset = frag->page_offset; 468 unsigned long bytes;
471 tx->size = skb_frag_size(frag); 469
472 tx->flags = 0; 470 BUG_ON(offset >= PAGE_SIZE);
471
472 bytes = PAGE_SIZE - offset;
473 if (bytes > len)
474 bytes = len;
475
476 tx->flags |= XEN_NETTXF_more_data;
477
478 id = get_id_from_freelist(&np->tx_skb_freelist,
479 np->tx_skbs);
480 np->tx_skbs[id].skb = skb_get(skb);
481 tx = RING_GET_REQUEST(&np->tx, prod++);
482 tx->id = id;
483 ref = gnttab_claim_grant_reference(&np->gref_tx_head);
484 BUG_ON((signed short)ref < 0);
485
486 mfn = pfn_to_mfn(page_to_pfn(page));
487 gnttab_grant_foreign_access_ref(ref,
488 np->xbdev->otherend_id,
489 mfn, GNTMAP_readonly);
490
491 tx->gref = np->grant_tx_ref[id] = ref;
492 tx->offset = offset;
493 tx->size = bytes;
494 tx->flags = 0;
495
496 offset += bytes;
497 len -= bytes;
498
499 /* Next frame */
500 if (offset == PAGE_SIZE && len) {
501 BUG_ON(!PageCompound(page));
502 page++;
503 offset = 0;
504 }
505 }
473 } 506 }
474 507
475 np->tx.req_prod_pvt = prod; 508 np->tx.req_prod_pvt = prod;
476} 509}
477 510
511/*
512 * Count how many ring slots are required to send the frags of this
513 * skb. Each frag might be a compound page.
514 */
515static int xennet_count_skb_frag_slots(struct sk_buff *skb)
516{
517 int i, frags = skb_shinfo(skb)->nr_frags;
518 int pages = 0;
519
520 for (i = 0; i < frags; i++) {
521 skb_frag_t *frag = skb_shinfo(skb)->frags + i;
522 unsigned long size = skb_frag_size(frag);
523 unsigned long offset = frag->page_offset;
524
525 /* Skip unused frames from start of page */
526 offset &= ~PAGE_MASK;
527
528 pages += PFN_UP(offset + size);
529 }
530
531 return pages;
532}
533
478static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) 534static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
479{ 535{
480 unsigned short id; 536 unsigned short id;
@@ -487,23 +543,23 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
487 grant_ref_t ref; 543 grant_ref_t ref;
488 unsigned long mfn; 544 unsigned long mfn;
489 int notify; 545 int notify;
490 int frags = skb_shinfo(skb)->nr_frags; 546 int slots;
491 unsigned int offset = offset_in_page(data); 547 unsigned int offset = offset_in_page(data);
492 unsigned int len = skb_headlen(skb); 548 unsigned int len = skb_headlen(skb);
493 unsigned long flags; 549 unsigned long flags;
494 550
495 frags += DIV_ROUND_UP(offset + len, PAGE_SIZE); 551 slots = DIV_ROUND_UP(offset + len, PAGE_SIZE) +
496 if (unlikely(frags > MAX_SKB_FRAGS + 1)) { 552 xennet_count_skb_frag_slots(skb);
497 printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n", 553 if (unlikely(slots > MAX_SKB_FRAGS + 1)) {
498 frags); 554 net_alert_ratelimited(
499 dump_stack(); 555 "xennet: skb rides the rocket: %d slots\n", slots);
500 goto drop; 556 goto drop;
501 } 557 }
502 558
503 spin_lock_irqsave(&np->tx_lock, flags); 559 spin_lock_irqsave(&np->tx_lock, flags);
504 560
505 if (unlikely(!netif_carrier_ok(dev) || 561 if (unlikely(!netif_carrier_ok(dev) ||
506 (frags > 1 && !xennet_can_sg(dev)) || 562 (slots > 1 && !xennet_can_sg(dev)) ||
507 netif_needs_gso(skb, netif_skb_features(skb)))) { 563 netif_needs_gso(skb, netif_skb_features(skb)))) {
508 spin_unlock_irqrestore(&np->tx_lock, flags); 564 spin_unlock_irqrestore(&np->tx_lock, flags);
509 goto drop; 565 goto drop;
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 97c440a8cd61..30ae18a03a9c 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -698,13 +698,14 @@ static void pn533_wq_cmd(struct work_struct *work)
698 698
699 cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue); 699 cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue);
700 700
701 list_del(&cmd->queue);
702
701 mutex_unlock(&dev->cmd_lock); 703 mutex_unlock(&dev->cmd_lock);
702 704
703 __pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame, 705 __pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame,
704 cmd->in_frame_len, cmd->cmd_complete, 706 cmd->in_frame_len, cmd->cmd_complete,
705 cmd->arg, cmd->flags); 707 cmd->arg, cmd->flags);
706 708
707 list_del(&cmd->queue);
708 kfree(cmd); 709 kfree(cmd);
709} 710}
710 711
@@ -1678,11 +1679,14 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
1678static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, 1679static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1679 u8 *params, int params_len) 1680 u8 *params, int params_len)
1680{ 1681{
1681 struct pn533_cmd_jump_dep *cmd;
1682 struct pn533_cmd_jump_dep_response *resp; 1682 struct pn533_cmd_jump_dep_response *resp;
1683 struct nfc_target nfc_target; 1683 struct nfc_target nfc_target;
1684 u8 target_gt_len; 1684 u8 target_gt_len;
1685 int rc; 1685 int rc;
1686 struct pn533_cmd_jump_dep *cmd = (struct pn533_cmd_jump_dep *)arg;
1687 u8 active = cmd->active;
1688
1689 kfree(arg);
1686 1690
1687 if (params_len == -ENOENT) { 1691 if (params_len == -ENOENT) {
1688 nfc_dev_dbg(&dev->interface->dev, ""); 1692 nfc_dev_dbg(&dev->interface->dev, "");
@@ -1704,7 +1708,6 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1704 } 1708 }
1705 1709
1706 resp = (struct pn533_cmd_jump_dep_response *) params; 1710 resp = (struct pn533_cmd_jump_dep_response *) params;
1707 cmd = (struct pn533_cmd_jump_dep *) arg;
1708 rc = resp->status & PN533_CMD_RET_MASK; 1711 rc = resp->status & PN533_CMD_RET_MASK;
1709 if (rc != PN533_CMD_RET_SUCCESS) { 1712 if (rc != PN533_CMD_RET_SUCCESS) {
1710 nfc_dev_err(&dev->interface->dev, 1713 nfc_dev_err(&dev->interface->dev,
@@ -1734,7 +1737,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1734 if (rc == 0) 1737 if (rc == 0)
1735 rc = nfc_dep_link_is_up(dev->nfc_dev, 1738 rc = nfc_dep_link_is_up(dev->nfc_dev,
1736 dev->nfc_dev->targets[0].idx, 1739 dev->nfc_dev->targets[0].idx,
1737 !cmd->active, NFC_RF_INITIATOR); 1740 !active, NFC_RF_INITIATOR);
1738 1741
1739 return 0; 1742 return 0;
1740} 1743}
@@ -1819,12 +1822,8 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
1819 rc = pn533_send_cmd_frame_async(dev, dev->out_frame, dev->in_frame, 1822 rc = pn533_send_cmd_frame_async(dev, dev->out_frame, dev->in_frame,
1820 dev->in_maxlen, pn533_in_dep_link_up_complete, 1823 dev->in_maxlen, pn533_in_dep_link_up_complete,
1821 cmd, GFP_KERNEL); 1824 cmd, GFP_KERNEL);
1822 if (rc) 1825 if (rc < 0)
1823 goto out; 1826 kfree(cmd);
1824
1825
1826out:
1827 kfree(cmd);
1828 1827
1829 return rc; 1828 return rc;
1830} 1829}
@@ -2078,8 +2077,12 @@ error:
2078static int pn533_tm_send_complete(struct pn533 *dev, void *arg, 2077static int pn533_tm_send_complete(struct pn533 *dev, void *arg,
2079 u8 *params, int params_len) 2078 u8 *params, int params_len)
2080{ 2079{
2080 struct sk_buff *skb_out = arg;
2081
2081 nfc_dev_dbg(&dev->interface->dev, "%s", __func__); 2082 nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
2082 2083
2084 dev_kfree_skb(skb_out);
2085
2083 if (params_len < 0) { 2086 if (params_len < 0) {
2084 nfc_dev_err(&dev->interface->dev, 2087 nfc_dev_err(&dev->interface->dev,
2085 "Error %d when sending data", 2088 "Error %d when sending data",
@@ -2117,7 +2120,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
2117 2120
2118 rc = pn533_send_cmd_frame_async(dev, out_frame, dev->in_frame, 2121 rc = pn533_send_cmd_frame_async(dev, out_frame, dev->in_frame,
2119 dev->in_maxlen, pn533_tm_send_complete, 2122 dev->in_maxlen, pn533_tm_send_complete,
2120 NULL, GFP_KERNEL); 2123 skb, GFP_KERNEL);
2121 if (rc) { 2124 if (rc) {
2122 nfc_dev_err(&dev->interface->dev, 2125 nfc_dev_err(&dev->interface->dev,
2123 "Error %d when trying to send data", rc); 2126 "Error %d when trying to send data", rc);
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index d96caefd914a..aeecf0f72cad 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -178,7 +178,7 @@ config PINCTRL_COH901
178 ports of 8 GPIO pins each. 178 ports of 8 GPIO pins each.
179 179
180config PINCTRL_SAMSUNG 180config PINCTRL_SAMSUNG
181 bool "Samsung pinctrl driver" 181 bool
182 depends on OF && GPIOLIB 182 depends on OF && GPIOLIB
183 select PINMUX 183 select PINMUX
184 select PINCONF 184 select PINCONF
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index c17ae22567e0..0c6fcb461faf 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -401,7 +401,7 @@ EXPORT_SYMBOL_GPL(rio_release_inb_pwrite);
401/** 401/**
402 * rio_map_inb_region -- Map inbound memory region. 402 * rio_map_inb_region -- Map inbound memory region.
403 * @mport: Master port. 403 * @mport: Master port.
404 * @lstart: physical address of memory region to be mapped 404 * @local: physical address of memory region to be mapped
405 * @rbase: RIO base address assigned to this window 405 * @rbase: RIO base address assigned to this window
406 * @size: Size of the memory region 406 * @size: Size of the memory region
407 * @rflags: Flags for mapping. 407 * @rflags: Flags for mapping.
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index a162573d4944..10b1edc89621 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -345,6 +345,17 @@ config REGULATOR_PALMAS
345 on the muxing. This is handled automatically in the driver by 345 on the muxing. This is handled automatically in the driver by
346 reading the mux info from OTP. 346 reading the mux info from OTP.
347 347
348config REGULATOR_TPS51632
349 tristate "TI TPS51632 Power Regulator"
350 depends on I2C
351 select REGMAP_I2C
352 help
353 This driver supports TPS51632 voltage regulator chip.
354 The TPS51632 is 3-2-1 Phase D-Cap+ Step Down Driverless Controller
355 with Serial VID control and DVFS.
356 The voltage output can be configure through I2C interface or PWM
357 interface.
358
348config REGULATOR_TPS6105X 359config REGULATOR_TPS6105X
349 tristate "TI TPS6105X Power regulators" 360 tristate "TI TPS6105X Power regulators"
350 depends on TPS6105X 361 depends on TPS6105X
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 4b754e958aed..bdaca617e2f2 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
42obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o 42obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
43obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o 43obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
44obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o 44obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
45obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
45obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o 46obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
46obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o 47obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
47obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o 48obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c4829cba6a6..02a249b024b3 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1381,22 +1381,14 @@ struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
1381} 1381}
1382EXPORT_SYMBOL_GPL(regulator_get_exclusive); 1382EXPORT_SYMBOL_GPL(regulator_get_exclusive);
1383 1383
1384/** 1384/* Locks held by regulator_put() */
1385 * regulator_put - "free" the regulator source 1385static void _regulator_put(struct regulator *regulator)
1386 * @regulator: regulator source
1387 *
1388 * Note: drivers must ensure that all regulator_enable calls made on this
1389 * regulator source are balanced by regulator_disable calls prior to calling
1390 * this function.
1391 */
1392void regulator_put(struct regulator *regulator)
1393{ 1386{
1394 struct regulator_dev *rdev; 1387 struct regulator_dev *rdev;
1395 1388
1396 if (regulator == NULL || IS_ERR(regulator)) 1389 if (regulator == NULL || IS_ERR(regulator))
1397 return; 1390 return;
1398 1391
1399 mutex_lock(&regulator_list_mutex);
1400 rdev = regulator->rdev; 1392 rdev = regulator->rdev;
1401 1393
1402 debugfs_remove_recursive(regulator->debugfs); 1394 debugfs_remove_recursive(regulator->debugfs);
@@ -1412,6 +1404,20 @@ void regulator_put(struct regulator *regulator)
1412 rdev->exclusive = 0; 1404 rdev->exclusive = 0;
1413 1405
1414 module_put(rdev->owner); 1406 module_put(rdev->owner);
1407}
1408
1409/**
1410 * regulator_put - "free" the regulator source
1411 * @regulator: regulator source
1412 *
1413 * Note: drivers must ensure that all regulator_enable calls made on this
1414 * regulator source are balanced by regulator_disable calls prior to calling
1415 * this function.
1416 */
1417void regulator_put(struct regulator *regulator)
1418{
1419 mutex_lock(&regulator_list_mutex);
1420 _regulator_put(regulator);
1415 mutex_unlock(&regulator_list_mutex); 1421 mutex_unlock(&regulator_list_mutex);
1416} 1422}
1417EXPORT_SYMBOL_GPL(regulator_put); 1423EXPORT_SYMBOL_GPL(regulator_put);
@@ -1891,6 +1897,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
1891{ 1897{
1892 if (selector >= rdev->desc->n_voltages) 1898 if (selector >= rdev->desc->n_voltages)
1893 return -EINVAL; 1899 return -EINVAL;
1900 if (selector < rdev->desc->linear_min_sel)
1901 return 0;
1902
1903 selector -= rdev->desc->linear_min_sel;
1894 1904
1895 return rdev->desc->min_uV + (rdev->desc->uV_step * selector); 1905 return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
1896} 1906}
@@ -1974,7 +1984,7 @@ int regulator_is_supported_voltage(struct regulator *regulator,
1974 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { 1984 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
1975 ret = regulator_get_voltage(regulator); 1985 ret = regulator_get_voltage(regulator);
1976 if (ret >= 0) 1986 if (ret >= 0)
1977 return (min_uV >= ret && ret <= max_uV); 1987 return (min_uV <= ret && ret <= max_uV);
1978 else 1988 else
1979 return ret; 1989 return ret;
1980 } 1990 }
@@ -2114,6 +2124,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
2114 if (ret < 0) 2124 if (ret < 0)
2115 return ret; 2125 return ret;
2116 2126
2127 ret += rdev->desc->linear_min_sel;
2128
2117 /* Map back into a voltage to verify we're still in bounds */ 2129 /* Map back into a voltage to verify we're still in bounds */
2118 voltage = rdev->desc->ops->list_voltage(rdev, ret); 2130 voltage = rdev->desc->ops->list_voltage(rdev, ret);
2119 if (voltage < min_uV || voltage > max_uV) 2131 if (voltage < min_uV || voltage > max_uV)
@@ -3365,7 +3377,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
3365 if (ret != 0) { 3377 if (ret != 0) {
3366 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", 3378 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
3367 config->ena_gpio, ret); 3379 config->ena_gpio, ret);
3368 goto clean; 3380 goto wash;
3369 } 3381 }
3370 3382
3371 rdev->ena_gpio = config->ena_gpio; 3383 rdev->ena_gpio = config->ena_gpio;
@@ -3445,10 +3457,11 @@ unset_supplies:
3445 3457
3446scrub: 3458scrub:
3447 if (rdev->supply) 3459 if (rdev->supply)
3448 regulator_put(rdev->supply); 3460 _regulator_put(rdev->supply);
3449 if (rdev->ena_gpio) 3461 if (rdev->ena_gpio)
3450 gpio_free(rdev->ena_gpio); 3462 gpio_free(rdev->ena_gpio);
3451 kfree(rdev->constraints); 3463 kfree(rdev->constraints);
3464wash:
3452 device_unregister(&rdev->dev); 3465 device_unregister(&rdev->dev);
3453 /* device core frees rdev */ 3466 /* device core frees rdev */
3454 rdev = ERR_PTR(ret); 3467 rdev = ERR_PTR(ret);
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 07aee694ba92..111d76b04bb5 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -436,44 +436,14 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev)
436 return !!(reg); 436 return !!(reg);
437} 437}
438 438
439static int palmas_list_voltage_ldo(struct regulator_dev *dev,
440 unsigned selector)
441{
442 if (!selector)
443 return 0;
444
445 /* voltage is 0.85V + (selector * 0.05v) */
446 return 850000 + (selector * 50000);
447}
448
449static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
450 int min_uV, int max_uV)
451{
452 int ret, voltage;
453
454 if (min_uV == 0)
455 return 0;
456
457 if (min_uV < 900000)
458 min_uV = 900000;
459 ret = DIV_ROUND_UP(min_uV - 900000, 50000) + 1;
460
461 /* Map back into a voltage to verify we're still in bounds */
462 voltage = palmas_list_voltage_ldo(rdev, ret);
463 if (voltage < min_uV || voltage > max_uV)
464 return -EINVAL;
465
466 return ret;
467}
468
469static struct regulator_ops palmas_ops_ldo = { 439static struct regulator_ops palmas_ops_ldo = {
470 .is_enabled = palmas_is_enabled_ldo, 440 .is_enabled = palmas_is_enabled_ldo,
471 .enable = regulator_enable_regmap, 441 .enable = regulator_enable_regmap,
472 .disable = regulator_disable_regmap, 442 .disable = regulator_disable_regmap,
473 .get_voltage_sel = regulator_get_voltage_sel_regmap, 443 .get_voltage_sel = regulator_get_voltage_sel_regmap,
474 .set_voltage_sel = regulator_set_voltage_sel_regmap, 444 .set_voltage_sel = regulator_set_voltage_sel_regmap,
475 .list_voltage = palmas_list_voltage_ldo, 445 .list_voltage = regulator_list_voltage_linear,
476 .map_voltage = palmas_map_voltage_ldo, 446 .map_voltage = regulator_map_voltage_linear,
477}; 447};
478 448
479/* 449/*
@@ -821,6 +791,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
821 791
822 pmic->desc[id].type = REGULATOR_VOLTAGE; 792 pmic->desc[id].type = REGULATOR_VOLTAGE;
823 pmic->desc[id].owner = THIS_MODULE; 793 pmic->desc[id].owner = THIS_MODULE;
794 pmic->desc[id].min_uV = 900000;
795 pmic->desc[id].uV_step = 50000;
796 pmic->desc[id].linear_min_sel = 1;
824 pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, 797 pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
825 palmas_regs_info[id].vsel_addr); 798 palmas_regs_info[id].vsel_addr);
826 pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK; 799 pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK;
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
new file mode 100644
index 000000000000..34603640d6d9
--- /dev/null
+++ b/drivers/regulator/tps51632-regulator.c
@@ -0,0 +1,332 @@
1/*
2 * tps51632-regulator.c -- TI TPS51632
3 *
4 * Regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down Driverless
5 * Controller with serial VID control and DVFS.
6 *
7 * Copyright (c) 2012, NVIDIA Corporation.
8 *
9 * Author: Laxman Dewangan <ldewangan@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation version 2.
14 *
15 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
16 * whether express or implied; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 * 02111-1307, USA
24 */
25
26#include <linux/err.h>
27#include <linux/i2c.h>
28#include <linux/init.h>
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/platform_device.h>
32#include <linux/regmap.h>
33#include <linux/regulator/driver.h>
34#include <linux/regulator/machine.h>
35#include <linux/regulator/tps51632-regulator.h>
36#include <linux/slab.h>
37
38/* Register definitions */
39#define TPS51632_VOLTAGE_SELECT_REG 0x0
40#define TPS51632_VOLTAGE_BASE_REG 0x1
41#define TPS51632_OFFSET_REG 0x2
42#define TPS51632_IMON_REG 0x3
43#define TPS51632_VMAX_REG 0x4
44#define TPS51632_DVFS_CONTROL_REG 0x5
45#define TPS51632_POWER_STATE_REG 0x6
46#define TPS51632_SLEW_REGS 0x7
47#define TPS51632_FAULT_REG 0x14
48
49#define TPS51632_MAX_REG 0x15
50
51#define TPS51632_VOUT_MASK 0x7F
52#define TPS51632_VOUT_OFFSET_MASK 0x1F
53#define TPS51632_VMAX_MASK 0x7F
54#define TPS51632_VMAX_LOCK 0x80
55
56/* TPS51632_DVFS_CONTROL_REG */
57#define TPS51632_DVFS_PWMEN 0x1
58#define TPS51632_DVFS_STEP_20 0x2
59#define TPS51632_DVFS_VMAX_PG 0x4
60#define TPS51632_DVFS_PWMRST 0x8
61#define TPS51632_DVFS_OCA_EN 0x10
62#define TPS51632_DVFS_FCCM 0x20
63
64/* TPS51632_POWER_STATE_REG */
65#define TPS51632_POWER_STATE_MASK 0x03
66#define TPS51632_POWER_STATE_MULTI_PHASE_CCM 0x0
67#define TPS51632_POWER_STATE_SINGLE_PHASE_CCM 0x1
68#define TPS51632_POWER_STATE_SINGLE_PHASE_DCM 0x2
69
70#define TPS51632_MIN_VOLATGE 500000
71#define TPS51632_MAX_VOLATGE 1520000
72#define TPS51632_VOLATGE_STEP_10mV 10000
73#define TPS51632_VOLATGE_STEP_20mV 20000
74#define TPS51632_MAX_VSEL 0x7F
75#define TPS51632_MIN_VSEL 0x19
76#define TPS51632_DEFAULT_RAMP_DELAY 6000
77#define TPS51632_VOLT_VSEL(uV) \
78 (DIV_ROUND_UP(uV - TPS51632_MIN_VOLATGE, \
79 TPS51632_VOLATGE_STEP_10mV) + \
80 TPS51632_MIN_VSEL)
81
82/* TPS51632 chip information */
83struct tps51632_chip {
84 struct device *dev;
85 struct regulator_desc desc;
86 struct regulator_dev *rdev;
87 struct regmap *regmap;
88 bool enable_pwm_dvfs;
89};
90
91static int tps51632_dcdc_get_voltage_sel(struct regulator_dev *rdev)
92{
93 struct tps51632_chip *tps = rdev_get_drvdata(rdev);
94 unsigned int data;
95 int ret;
96 unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;
97 int vsel;
98
99 if (tps->enable_pwm_dvfs)
100 reg = TPS51632_VOLTAGE_BASE_REG;
101
102 ret = regmap_read(tps->regmap, reg, &data);
103 if (ret < 0) {
104 dev_err(tps->dev, "reg read failed, err %d\n", ret);
105 return ret;
106 }
107
108 vsel = data & TPS51632_VOUT_MASK;
109
110 if (vsel < TPS51632_MIN_VSEL)
111 return 0;
112 else
113 return vsel - TPS51632_MIN_VSEL;
114}
115
116static int tps51632_dcdc_set_voltage_sel(struct regulator_dev *rdev,
117 unsigned selector)
118{
119 struct tps51632_chip *tps = rdev_get_drvdata(rdev);
120 int vsel;
121 int ret;
122 unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;
123
124 if (tps->enable_pwm_dvfs)
125 reg = TPS51632_VOLTAGE_BASE_REG;
126
127 vsel = selector + TPS51632_MIN_VSEL;
128 if (vsel > TPS51632_MAX_VSEL)
129 return -EINVAL;
130
131 ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_SELECT_REG, vsel);
132 if (ret < 0)
133 dev_err(tps->dev, "reg write failed, err %d\n", ret);
134 return ret;
135}
136
137static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev,
138 int ramp_delay)
139{
140 struct tps51632_chip *tps = rdev_get_drvdata(rdev);
141 int bit = ramp_delay/6000;
142 int ret;
143
144 if (bit)
145 bit--;
146 ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
147 if (ret < 0)
148 dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
149 return ret;
150}
151
152static struct regulator_ops tps51632_dcdc_ops = {
153 .get_voltage_sel = tps51632_dcdc_get_voltage_sel,
154 .set_voltage_sel = tps51632_dcdc_set_voltage_sel,
155 .list_voltage = regulator_list_voltage_linear,
156 .set_voltage_time_sel = regulator_set_voltage_time_sel,
157 .set_ramp_delay = tps51632_dcdc_set_ramp_delay,
158};
159
160static int __devinit tps51632_init_dcdc(struct tps51632_chip *tps,
161 struct tps51632_regulator_platform_data *pdata)
162{
163 int ret;
164 uint8_t control = 0;
165 int vsel;
166
167 if (!pdata->enable_pwm_dvfs)
168 goto skip_pwm_config;
169
170 control |= TPS51632_DVFS_PWMEN;
171 tps->enable_pwm_dvfs = pdata->enable_pwm_dvfs;
172 vsel = TPS51632_VOLT_VSEL(pdata->base_voltage_uV);
173 ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_BASE_REG, vsel);
174 if (ret < 0) {
175 dev_err(tps->dev, "BASE reg write failed, err %d\n", ret);
176 return ret;
177 }
178
179 if (pdata->dvfs_step_20mV)
180 control |= TPS51632_DVFS_STEP_20;
181
182 if (pdata->max_voltage_uV) {
183 unsigned int vmax;
184 /**
185 * TPS51632 hw behavior: VMAX register can be write only
186 * once as it get locked after first write. The lock get
187 * reset only when device is power-reset.
188 * Write register only when lock bit is not enabled.
189 */
190 ret = regmap_read(tps->regmap, TPS51632_VMAX_REG, &vmax);
191 if (ret < 0) {
192 dev_err(tps->dev, "VMAX read failed, err %d\n", ret);
193 return ret;
194 }
195 if (!(vmax & TPS51632_VMAX_LOCK)) {
196 vsel = TPS51632_VOLT_VSEL(pdata->max_voltage_uV);
197 ret = regmap_write(tps->regmap, TPS51632_VMAX_REG,
198 vsel);
199 if (ret < 0) {
200 dev_err(tps->dev,
201 "VMAX write failed, err %d\n", ret);
202 return ret;
203 }
204 }
205 }
206
207skip_pwm_config:
208 ret = regmap_write(tps->regmap, TPS51632_DVFS_CONTROL_REG, control);
209 if (ret < 0)
210 dev_err(tps->dev, "DVFS reg write failed, err %d\n", ret);
211 return ret;
212}
213
214static bool rd_wr_reg(struct device *dev, unsigned int reg)
215{
216 if ((reg >= 0x8) && (reg <= 0x10))
217 return false;
218 return true;
219}
220
221static const struct regmap_config tps51632_regmap_config = {
222 .reg_bits = 8,
223 .val_bits = 8,
224 .writeable_reg = rd_wr_reg,
225 .readable_reg = rd_wr_reg,
226 .max_register = TPS51632_MAX_REG - 1,
227 .cache_type = REGCACHE_RBTREE,
228};
229
230static int __devinit tps51632_probe(struct i2c_client *client,
231 const struct i2c_device_id *id)
232{
233 struct tps51632_regulator_platform_data *pdata;
234 struct regulator_dev *rdev;
235 struct tps51632_chip *tps;
236 int ret;
237 struct regulator_config config = { };
238
239 pdata = client->dev.platform_data;
240 if (!pdata) {
241 dev_err(&client->dev, "No Platform data\n");
242 return -EINVAL;
243 }
244
245 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
246 if (!tps) {
247 dev_err(&client->dev, "Memory allocation failed\n");
248 return -ENOMEM;
249 }
250
251 tps->dev = &client->dev;
252 tps->desc.name = id->name;
253 tps->desc.id = 0;
254 tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
255 tps->desc.min_uV = TPS51632_MIN_VOLATGE;
256 tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV;
257 tps->desc.n_voltages = (TPS51632_MAX_VSEL - TPS51632_MIN_VSEL) + 1;
258 tps->desc.ops = &tps51632_dcdc_ops;
259 tps->desc.type = REGULATOR_VOLTAGE;
260 tps->desc.owner = THIS_MODULE;
261
262 tps->regmap = devm_regmap_init_i2c(client, &tps51632_regmap_config);
263 if (IS_ERR(tps->regmap)) {
264 ret = PTR_ERR(tps->regmap);
265 dev_err(&client->dev, "regmap init failed, err %d\n", ret);
266 return ret;
267 }
268 i2c_set_clientdata(client, tps);
269
270 ret = tps51632_init_dcdc(tps, pdata);
271 if (ret < 0) {
272 dev_err(tps->dev, "Init failed, err = %d\n", ret);
273 return ret;
274 }
275
276 /* Register the regulators */
277 config.dev = &client->dev;
278 config.init_data = pdata->reg_init_data;
279 config.driver_data = tps;
280 config.regmap = tps->regmap;
281 config.of_node = client->dev.of_node;
282
283 rdev = regulator_register(&tps->desc, &config);
284 if (IS_ERR(rdev)) {
285 dev_err(tps->dev, "regulator register failed\n");
286 return PTR_ERR(rdev);
287 }
288
289 tps->rdev = rdev;
290 return 0;
291}
292
293static int __devexit tps51632_remove(struct i2c_client *client)
294{
295 struct tps51632_chip *tps = i2c_get_clientdata(client);
296
297 regulator_unregister(tps->rdev);
298 return 0;
299}
300
301static const struct i2c_device_id tps51632_id[] = {
302 {.name = "tps51632",},
303 {},
304};
305
306MODULE_DEVICE_TABLE(i2c, tps51632_id);
307
308static struct i2c_driver tps51632_i2c_driver = {
309 .driver = {
310 .name = "tps51632",
311 .owner = THIS_MODULE,
312 },
313 .probe = tps51632_probe,
314 .remove = __devexit_p(tps51632_remove),
315 .id_table = tps51632_id,
316};
317
318static int __init tps51632_init(void)
319{
320 return i2c_add_driver(&tps51632_i2c_driver);
321}
322subsys_initcall(tps51632_init);
323
324static void __exit tps51632_cleanup(void)
325{
326 i2c_del_driver(&tps51632_i2c_driver);
327}
328module_exit(tps51632_cleanup);
329
330MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
331MODULE_DESCRIPTION("TPS51632 voltage regulator driver");
332MODULE_LICENSE("GPL v2");
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 9ffb6d5f17aa..4ed343e4eb41 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -44,7 +44,6 @@
44#define RAW3215_NR_CCWS 3 44#define RAW3215_NR_CCWS 3
45#define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ 45#define RAW3215_TIMEOUT HZ/10 /* time for delayed output */
46 46
47#define RAW3215_FIXED 1 /* 3215 console device is not be freed */
48#define RAW3215_WORKING 4 /* set if a request is being worked on */ 47#define RAW3215_WORKING 4 /* set if a request is being worked on */
49#define RAW3215_THROTTLED 8 /* set if reading is disabled */ 48#define RAW3215_THROTTLED 8 /* set if reading is disabled */
50#define RAW3215_STOPPED 16 /* set if writing is disabled */ 49#define RAW3215_STOPPED 16 /* set if writing is disabled */
@@ -339,8 +338,10 @@ static void raw3215_wakeup(unsigned long data)
339 struct tty_struct *tty; 338 struct tty_struct *tty;
340 339
341 tty = tty_port_tty_get(&raw->port); 340 tty = tty_port_tty_get(&raw->port);
342 tty_wakeup(tty); 341 if (tty) {
343 tty_kref_put(tty); 342 tty_wakeup(tty);
343 tty_kref_put(tty);
344 }
344} 345}
345 346
346/* 347/*
@@ -629,8 +630,7 @@ static void raw3215_shutdown(struct raw3215_info *raw)
629 DECLARE_WAITQUEUE(wait, current); 630 DECLARE_WAITQUEUE(wait, current);
630 unsigned long flags; 631 unsigned long flags;
631 632
632 if (!(raw->port.flags & ASYNC_INITIALIZED) || 633 if (!(raw->port.flags & ASYNC_INITIALIZED))
633 (raw->flags & RAW3215_FIXED))
634 return; 634 return;
635 /* Wait for outstanding requests, then free irq */ 635 /* Wait for outstanding requests, then free irq */
636 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); 636 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
@@ -926,8 +926,6 @@ static int __init con3215_init(void)
926 dev_set_drvdata(&cdev->dev, raw); 926 dev_set_drvdata(&cdev->dev, raw);
927 cdev->handler = raw3215_irq; 927 cdev->handler = raw3215_irq;
928 928
929 raw->flags |= RAW3215_FIXED;
930
931 /* Request the console irq */ 929 /* Request the console irq */
932 if (raw3215_startup(raw) != 0) { 930 if (raw3215_startup(raw) != 0) {
933 raw3215_free_info(raw); 931 raw3215_free_info(raw);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 3e25d3150456..4d6ba00d0047 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -2942,13 +2942,33 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
2942 QETH_DBF_TEXT(SETUP, 2, "qipasscb"); 2942 QETH_DBF_TEXT(SETUP, 2, "qipasscb");
2943 2943
2944 cmd = (struct qeth_ipa_cmd *) data; 2944 cmd = (struct qeth_ipa_cmd *) data;
2945
2946 switch (cmd->hdr.return_code) {
2947 case IPA_RC_NOTSUPP:
2948 case IPA_RC_L2_UNSUPPORTED_CMD:
2949 QETH_DBF_TEXT(SETUP, 2, "ipaunsup");
2950 card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS;
2951 card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS;
2952 return -0;
2953 default:
2954 if (cmd->hdr.return_code) {
2955 QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled "
2956 "rc=%d\n",
2957 dev_name(&card->gdev->dev),
2958 cmd->hdr.return_code);
2959 return 0;
2960 }
2961 }
2962
2945 if (cmd->hdr.prot_version == QETH_PROT_IPV4) { 2963 if (cmd->hdr.prot_version == QETH_PROT_IPV4) {
2946 card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported; 2964 card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported;
2947 card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled; 2965 card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled;
2948 } else { 2966 } else if (cmd->hdr.prot_version == QETH_PROT_IPV6) {
2949 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; 2967 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
2950 card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; 2968 card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
2951 } 2969 } else
2970 QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected"
2971 "\n", dev_name(&card->gdev->dev));
2952 QETH_DBF_TEXT(SETUP, 2, "suppenbl"); 2972 QETH_DBF_TEXT(SETUP, 2, "suppenbl");
2953 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_supported); 2973 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_supported);
2954 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_enabled); 2974 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_enabled);
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index e67e0258aec5..fddb62654b6a 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -626,10 +626,13 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
626 QETH_DBF_TEXT(SETUP, 2, "doL2init"); 626 QETH_DBF_TEXT(SETUP, 2, "doL2init");
627 QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card)); 627 QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card));
628 628
629 rc = qeth_query_setadapterparms(card); 629 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
630 if (rc) { 630 rc = qeth_query_setadapterparms(card);
631 QETH_DBF_MESSAGE(2, "could not query adapter parameters on " 631 if (rc) {
632 "device %s: x%x\n", CARD_BUS_ID(card), rc); 632 QETH_DBF_MESSAGE(2, "could not query adapter "
633 "parameters on device %s: x%x\n",
634 CARD_BUS_ID(card), rc);
635 }
633 } 636 }
634 637
635 if (card->info.type == QETH_CARD_TYPE_IQD || 638 if (card->info.type == QETH_CARD_TYPE_IQD ||
@@ -676,7 +679,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p)
676 return -ERESTARTSYS; 679 return -ERESTARTSYS;
677 } 680 }
678 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); 681 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]);
679 if (!rc) 682 if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND))
680 rc = qeth_l2_send_setmac(card, addr->sa_data); 683 rc = qeth_l2_send_setmac(card, addr->sa_data);
681 return rc ? -EINVAL : 0; 684 return rc ? -EINVAL : 0;
682} 685}
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index c1bafc3f3fb1..9594ab62702b 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -1972,7 +1972,7 @@ sci_io_request_frame_handler(struct isci_request *ireq,
1972 frame_index, 1972 frame_index,
1973 (void **)&frame_buffer); 1973 (void **)&frame_buffer);
1974 1974
1975 sci_controller_copy_sata_response(&ireq->stp.req, 1975 sci_controller_copy_sata_response(&ireq->stp.rsp,
1976 frame_header, 1976 frame_header,
1977 frame_buffer); 1977 frame_buffer);
1978 1978
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2936b447cae9..2c0d0ec8150b 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -55,6 +55,7 @@
55#include <linux/cpu.h> 55#include <linux/cpu.h>
56#include <linux/mutex.h> 56#include <linux/mutex.h>
57#include <linux/async.h> 57#include <linux/async.h>
58#include <asm/unaligned.h>
58 59
59#include <scsi/scsi.h> 60#include <scsi/scsi.h>
60#include <scsi/scsi_cmnd.h> 61#include <scsi/scsi_cmnd.h>
@@ -1062,6 +1063,50 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
1062EXPORT_SYMBOL_GPL(scsi_get_vpd_page); 1063EXPORT_SYMBOL_GPL(scsi_get_vpd_page);
1063 1064
1064/** 1065/**
1066 * scsi_report_opcode - Find out if a given command opcode is supported
1067 * @sdev: scsi device to query
1068 * @buffer: scratch buffer (must be at least 20 bytes long)
1069 * @len: length of buffer
1070 * @opcode: opcode for command to look up
1071 *
1072 * Uses the REPORT SUPPORTED OPERATION CODES to look up the given
1073 * opcode. Returns 0 if RSOC fails or if the command opcode is
1074 * unsupported. Returns 1 if the device claims to support the command.
1075 */
1076int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
1077 unsigned int len, unsigned char opcode)
1078{
1079 unsigned char cmd[16];
1080 struct scsi_sense_hdr sshdr;
1081 int result;
1082
1083 if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3)
1084 return 0;
1085
1086 memset(cmd, 0, 16);
1087 cmd[0] = MAINTENANCE_IN;
1088 cmd[1] = MI_REPORT_SUPPORTED_OPERATION_CODES;
1089 cmd[2] = 1; /* One command format */
1090 cmd[3] = opcode;
1091 put_unaligned_be32(len, &cmd[6]);
1092 memset(buffer, 0, len);
1093
1094 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len,
1095 &sshdr, 30 * HZ, 3, NULL);
1096
1097 if (result && scsi_sense_valid(&sshdr) &&
1098 sshdr.sense_key == ILLEGAL_REQUEST &&
1099 (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00)
1100 return 0;
1101
1102 if ((buffer[1] & 3) == 3) /* Command supported */
1103 return 1;
1104
1105 return 0;
1106}
1107EXPORT_SYMBOL(scsi_report_opcode);
1108
1109/**
1065 * scsi_device_get - get an additional reference to a scsi_device 1110 * scsi_device_get - get an additional reference to a scsi_device
1066 * @sdev: device to get a reference to 1111 * @sdev: device to get a reference to
1067 * 1112 *
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index da36a3a81a9e..9032e910bca3 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -900,11 +900,23 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
900 action = ACTION_FAIL; 900 action = ACTION_FAIL;
901 error = -EILSEQ; 901 error = -EILSEQ;
902 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */ 902 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */
903 } else if ((sshdr.asc == 0x20 || sshdr.asc == 0x24) && 903 } else if (sshdr.asc == 0x20 || sshdr.asc == 0x24) {
904 (cmd->cmnd[0] == UNMAP || 904 switch (cmd->cmnd[0]) {
905 cmd->cmnd[0] == WRITE_SAME_16 || 905 case UNMAP:
906 cmd->cmnd[0] == WRITE_SAME)) { 906 description = "Discard failure";
907 description = "Discard failure"; 907 break;
908 case WRITE_SAME:
909 case WRITE_SAME_16:
910 if (cmd->cmnd[1] & 0x8)
911 description = "Discard failure";
912 else
913 description =
914 "Write same failure";
915 break;
916 default:
917 description = "Invalid command failure";
918 break;
919 }
908 action = ACTION_FAIL; 920 action = ACTION_FAIL;
909 error = -EREMOTEIO; 921 error = -EREMOTEIO;
910 } else 922 } else
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 12f6fdfc1147..352bc77b7c88 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -99,6 +99,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
99#endif 99#endif
100 100
101static void sd_config_discard(struct scsi_disk *, unsigned int); 101static void sd_config_discard(struct scsi_disk *, unsigned int);
102static void sd_config_write_same(struct scsi_disk *);
102static int sd_revalidate_disk(struct gendisk *); 103static int sd_revalidate_disk(struct gendisk *);
103static void sd_unlock_native_capacity(struct gendisk *disk); 104static void sd_unlock_native_capacity(struct gendisk *disk);
104static int sd_probe(struct device *); 105static int sd_probe(struct device *);
@@ -395,6 +396,45 @@ sd_store_max_medium_access_timeouts(struct device *dev,
395 return err ? err : count; 396 return err ? err : count;
396} 397}
397 398
399static ssize_t
400sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr,
401 char *buf)
402{
403 struct scsi_disk *sdkp = to_scsi_disk(dev);
404
405 return snprintf(buf, 20, "%u\n", sdkp->max_ws_blocks);
406}
407
408static ssize_t
409sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr,
410 const char *buf, size_t count)
411{
412 struct scsi_disk *sdkp = to_scsi_disk(dev);
413 struct scsi_device *sdp = sdkp->device;
414 unsigned long max;
415 int err;
416
417 if (!capable(CAP_SYS_ADMIN))
418 return -EACCES;
419
420 if (sdp->type != TYPE_DISK)
421 return -EINVAL;
422
423 err = kstrtoul(buf, 10, &max);
424
425 if (err)
426 return err;
427
428 if (max == 0)
429 sdp->no_write_same = 1;
430 else if (max <= SD_MAX_WS16_BLOCKS)
431 sdkp->max_ws_blocks = max;
432
433 sd_config_write_same(sdkp);
434
435 return count;
436}
437
398static struct device_attribute sd_disk_attrs[] = { 438static struct device_attribute sd_disk_attrs[] = {
399 __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, 439 __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type,
400 sd_store_cache_type), 440 sd_store_cache_type),
@@ -410,6 +450,8 @@ static struct device_attribute sd_disk_attrs[] = {
410 __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), 450 __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL),
411 __ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode, 451 __ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode,
412 sd_store_provisioning_mode), 452 sd_store_provisioning_mode),
453 __ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR,
454 sd_show_write_same_blocks, sd_store_write_same_blocks),
413 __ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR, 455 __ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR,
414 sd_show_max_medium_access_timeouts, 456 sd_show_max_medium_access_timeouts,
415 sd_store_max_medium_access_timeouts), 457 sd_store_max_medium_access_timeouts),
@@ -561,19 +603,23 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
561 return; 603 return;
562 604
563 case SD_LBP_UNMAP: 605 case SD_LBP_UNMAP:
564 max_blocks = min_not_zero(sdkp->max_unmap_blocks, 0xffffffff); 606 max_blocks = min_not_zero(sdkp->max_unmap_blocks,
607 (u32)SD_MAX_WS16_BLOCKS);
565 break; 608 break;
566 609
567 case SD_LBP_WS16: 610 case SD_LBP_WS16:
568 max_blocks = min_not_zero(sdkp->max_ws_blocks, 0xffffffff); 611 max_blocks = min_not_zero(sdkp->max_ws_blocks,
612 (u32)SD_MAX_WS16_BLOCKS);
569 break; 613 break;
570 614
571 case SD_LBP_WS10: 615 case SD_LBP_WS10:
572 max_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)0xffff); 616 max_blocks = min_not_zero(sdkp->max_ws_blocks,
617 (u32)SD_MAX_WS10_BLOCKS);
573 break; 618 break;
574 619
575 case SD_LBP_ZERO: 620 case SD_LBP_ZERO:
576 max_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)0xffff); 621 max_blocks = min_not_zero(sdkp->max_ws_blocks,
622 (u32)SD_MAX_WS10_BLOCKS);
577 q->limits.discard_zeroes_data = 1; 623 q->limits.discard_zeroes_data = 1;
578 break; 624 break;
579 } 625 }
@@ -583,29 +629,26 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
583} 629}
584 630
585/** 631/**
586 * scsi_setup_discard_cmnd - unmap blocks on thinly provisioned device 632 * sd_setup_discard_cmnd - unmap blocks on thinly provisioned device
587 * @sdp: scsi device to operate one 633 * @sdp: scsi device to operate one
588 * @rq: Request to prepare 634 * @rq: Request to prepare
589 * 635 *
590 * Will issue either UNMAP or WRITE SAME(16) depending on preference 636 * Will issue either UNMAP or WRITE SAME(16) depending on preference
591 * indicated by target device. 637 * indicated by target device.
592 **/ 638 **/
593static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) 639static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
594{ 640{
595 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); 641 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
596 struct bio *bio = rq->bio; 642 sector_t sector = blk_rq_pos(rq);
597 sector_t sector = bio->bi_sector; 643 unsigned int nr_sectors = blk_rq_sectors(rq);
598 unsigned int nr_sectors = bio_sectors(bio); 644 unsigned int nr_bytes = blk_rq_bytes(rq);
599 unsigned int len; 645 unsigned int len;
600 int ret; 646 int ret;
601 char *buf; 647 char *buf;
602 struct page *page; 648 struct page *page;
603 649
604 if (sdkp->device->sector_size == 4096) { 650 sector >>= ilog2(sdp->sector_size) - 9;
605 sector >>= 3; 651 nr_sectors >>= ilog2(sdp->sector_size) - 9;
606 nr_sectors >>= 3;
607 }
608
609 rq->timeout = SD_TIMEOUT; 652 rq->timeout = SD_TIMEOUT;
610 653
611 memset(rq->cmd, 0, rq->cmd_len); 654 memset(rq->cmd, 0, rq->cmd_len);
@@ -660,6 +703,7 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
660 blk_add_request_payload(rq, page, len); 703 blk_add_request_payload(rq, page, len);
661 ret = scsi_setup_blk_pc_cmnd(sdp, rq); 704 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
662 rq->buffer = page_address(page); 705 rq->buffer = page_address(page);
706 rq->__data_len = nr_bytes;
663 707
664out: 708out:
665 if (ret != BLKPREP_OK) { 709 if (ret != BLKPREP_OK) {
@@ -669,6 +713,83 @@ out:
669 return ret; 713 return ret;
670} 714}
671 715
716static void sd_config_write_same(struct scsi_disk *sdkp)
717{
718 struct request_queue *q = sdkp->disk->queue;
719 unsigned int logical_block_size = sdkp->device->sector_size;
720 unsigned int blocks = 0;
721
722 if (sdkp->device->no_write_same) {
723 sdkp->max_ws_blocks = 0;
724 goto out;
725 }
726
727 /* Some devices can not handle block counts above 0xffff despite
728 * supporting WRITE SAME(16). Consequently we default to 64k
729 * blocks per I/O unless the device explicitly advertises a
730 * bigger limit.
731 */
732 if (sdkp->max_ws_blocks == 0)
733 sdkp->max_ws_blocks = SD_MAX_WS10_BLOCKS;
734
735 if (sdkp->ws16 || sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS)
736 blocks = min_not_zero(sdkp->max_ws_blocks,
737 (u32)SD_MAX_WS16_BLOCKS);
738 else
739 blocks = min_not_zero(sdkp->max_ws_blocks,
740 (u32)SD_MAX_WS10_BLOCKS);
741
742out:
743 blk_queue_max_write_same_sectors(q, blocks * (logical_block_size >> 9));
744}
745
746/**
747 * sd_setup_write_same_cmnd - write the same data to multiple blocks
748 * @sdp: scsi device to operate one
749 * @rq: Request to prepare
750 *
751 * Will issue either WRITE SAME(10) or WRITE SAME(16) depending on
752 * preference indicated by target device.
753 **/
754static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
755{
756 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
757 struct bio *bio = rq->bio;
758 sector_t sector = blk_rq_pos(rq);
759 unsigned int nr_sectors = blk_rq_sectors(rq);
760 unsigned int nr_bytes = blk_rq_bytes(rq);
761 int ret;
762
763 if (sdkp->device->no_write_same)
764 return BLKPREP_KILL;
765
766 BUG_ON(bio_offset(bio) || bio_iovec(bio)->bv_len != sdp->sector_size);
767
768 sector >>= ilog2(sdp->sector_size) - 9;
769 nr_sectors >>= ilog2(sdp->sector_size) - 9;
770
771 rq->__data_len = sdp->sector_size;
772 rq->timeout = SD_WRITE_SAME_TIMEOUT;
773 memset(rq->cmd, 0, rq->cmd_len);
774
775 if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff) {
776 rq->cmd_len = 16;
777 rq->cmd[0] = WRITE_SAME_16;
778 put_unaligned_be64(sector, &rq->cmd[2]);
779 put_unaligned_be32(nr_sectors, &rq->cmd[10]);
780 } else {
781 rq->cmd_len = 10;
782 rq->cmd[0] = WRITE_SAME;
783 put_unaligned_be32(sector, &rq->cmd[2]);
784 put_unaligned_be16(nr_sectors, &rq->cmd[7]);
785 }
786
787 ret = scsi_setup_blk_pc_cmnd(sdp, rq);
788 rq->__data_len = nr_bytes;
789
790 return ret;
791}
792
672static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) 793static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
673{ 794{
674 rq->timeout = SD_FLUSH_TIMEOUT; 795 rq->timeout = SD_FLUSH_TIMEOUT;
@@ -712,7 +833,10 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
712 * block PC requests to make life easier. 833 * block PC requests to make life easier.
713 */ 834 */
714 if (rq->cmd_flags & REQ_DISCARD) { 835 if (rq->cmd_flags & REQ_DISCARD) {
715 ret = scsi_setup_discard_cmnd(sdp, rq); 836 ret = sd_setup_discard_cmnd(sdp, rq);
837 goto out;
838 } else if (rq->cmd_flags & REQ_WRITE_SAME) {
839 ret = sd_setup_write_same_cmnd(sdp, rq);
716 goto out; 840 goto out;
717 } else if (rq->cmd_flags & REQ_FLUSH) { 841 } else if (rq->cmd_flags & REQ_FLUSH) {
718 ret = scsi_setup_flush_cmnd(sdp, rq); 842 ret = scsi_setup_flush_cmnd(sdp, rq);
@@ -1482,12 +1606,21 @@ static int sd_done(struct scsi_cmnd *SCpnt)
1482 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); 1606 unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt);
1483 struct scsi_sense_hdr sshdr; 1607 struct scsi_sense_hdr sshdr;
1484 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); 1608 struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk);
1609 struct request *req = SCpnt->request;
1485 int sense_valid = 0; 1610 int sense_valid = 0;
1486 int sense_deferred = 0; 1611 int sense_deferred = 0;
1487 unsigned char op = SCpnt->cmnd[0]; 1612 unsigned char op = SCpnt->cmnd[0];
1613 unsigned char unmap = SCpnt->cmnd[1] & 8;
1488 1614
1489 if ((SCpnt->request->cmd_flags & REQ_DISCARD) && !result) 1615 if (req->cmd_flags & REQ_DISCARD || req->cmd_flags & REQ_WRITE_SAME) {
1490 scsi_set_resid(SCpnt, 0); 1616 if (!result) {
1617 good_bytes = blk_rq_bytes(req);
1618 scsi_set_resid(SCpnt, 0);
1619 } else {
1620 good_bytes = 0;
1621 scsi_set_resid(SCpnt, blk_rq_bytes(req));
1622 }
1623 }
1491 1624
1492 if (result) { 1625 if (result) {
1493 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); 1626 sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr);
@@ -1536,9 +1669,25 @@ static int sd_done(struct scsi_cmnd *SCpnt)
1536 if (sshdr.asc == 0x10) /* DIX: Host detected corruption */ 1669 if (sshdr.asc == 0x10) /* DIX: Host detected corruption */
1537 good_bytes = sd_completed_bytes(SCpnt); 1670 good_bytes = sd_completed_bytes(SCpnt);
1538 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */ 1671 /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */
1539 if ((sshdr.asc == 0x20 || sshdr.asc == 0x24) && 1672 if (sshdr.asc == 0x20 || sshdr.asc == 0x24) {
1540 (op == UNMAP || op == WRITE_SAME_16 || op == WRITE_SAME)) 1673 switch (op) {
1541 sd_config_discard(sdkp, SD_LBP_DISABLE); 1674 case UNMAP:
1675 sd_config_discard(sdkp, SD_LBP_DISABLE);
1676 break;
1677 case WRITE_SAME_16:
1678 case WRITE_SAME:
1679 if (unmap)
1680 sd_config_discard(sdkp, SD_LBP_DISABLE);
1681 else {
1682 sdkp->device->no_write_same = 1;
1683 sd_config_write_same(sdkp);
1684
1685 good_bytes = 0;
1686 req->__data_len = blk_rq_bytes(req);
1687 req->cmd_flags |= REQ_QUIET;
1688 }
1689 }
1690 }
1542 break; 1691 break;
1543 default: 1692 default:
1544 break; 1693 break;
@@ -2374,9 +2523,7 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
2374 if (buffer[3] == 0x3c) { 2523 if (buffer[3] == 0x3c) {
2375 unsigned int lba_count, desc_count; 2524 unsigned int lba_count, desc_count;
2376 2525
2377 sdkp->max_ws_blocks = 2526 sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]);
2378 (u32) min_not_zero(get_unaligned_be64(&buffer[36]),
2379 (u64)0xffffffff);
2380 2527
2381 if (!sdkp->lbpme) 2528 if (!sdkp->lbpme)
2382 goto out; 2529 goto out;
@@ -2469,6 +2616,13 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp)
2469 kfree(buffer); 2616 kfree(buffer);
2470} 2617}
2471 2618
2619static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
2620{
2621 if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE,
2622 WRITE_SAME_16))
2623 sdkp->ws16 = 1;
2624}
2625
2472static int sd_try_extended_inquiry(struct scsi_device *sdp) 2626static int sd_try_extended_inquiry(struct scsi_device *sdp)
2473{ 2627{
2474 /* 2628 /*
@@ -2528,6 +2682,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
2528 sd_read_write_protect_flag(sdkp, buffer); 2682 sd_read_write_protect_flag(sdkp, buffer);
2529 sd_read_cache_type(sdkp, buffer); 2683 sd_read_cache_type(sdkp, buffer);
2530 sd_read_app_tag_own(sdkp, buffer); 2684 sd_read_app_tag_own(sdkp, buffer);
2685 sd_read_write_same(sdkp, buffer);
2531 } 2686 }
2532 2687
2533 sdkp->first_scan = 0; 2688 sdkp->first_scan = 0;
@@ -2545,6 +2700,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
2545 blk_queue_flush(sdkp->disk->queue, flush); 2700 blk_queue_flush(sdkp->disk->queue, flush);
2546 2701
2547 set_capacity(disk, sdkp->capacity); 2702 set_capacity(disk, sdkp->capacity);
2703 sd_config_write_same(sdkp);
2548 kfree(buffer); 2704 kfree(buffer);
2549 2705
2550 out: 2706 out:
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 47c52a6d733c..74a1e4ca5401 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -14,6 +14,7 @@
14#define SD_TIMEOUT (30 * HZ) 14#define SD_TIMEOUT (30 * HZ)
15#define SD_MOD_TIMEOUT (75 * HZ) 15#define SD_MOD_TIMEOUT (75 * HZ)
16#define SD_FLUSH_TIMEOUT (60 * HZ) 16#define SD_FLUSH_TIMEOUT (60 * HZ)
17#define SD_WRITE_SAME_TIMEOUT (120 * HZ)
17 18
18/* 19/*
19 * Number of allowed retries 20 * Number of allowed retries
@@ -39,6 +40,11 @@ enum {
39}; 40};
40 41
41enum { 42enum {
43 SD_MAX_WS10_BLOCKS = 0xffff,
44 SD_MAX_WS16_BLOCKS = 0x7fffff,
45};
46
47enum {
42 SD_LBP_FULL = 0, /* Full logical block provisioning */ 48 SD_LBP_FULL = 0, /* Full logical block provisioning */
43 SD_LBP_UNMAP, /* Use UNMAP command */ 49 SD_LBP_UNMAP, /* Use UNMAP command */
44 SD_LBP_WS16, /* Use WRITE SAME(16) with UNMAP bit */ 50 SD_LBP_WS16, /* Use WRITE SAME(16) with UNMAP bit */
@@ -77,6 +83,7 @@ struct scsi_disk {
77 unsigned lbpws : 1; 83 unsigned lbpws : 1;
78 unsigned lbpws10 : 1; 84 unsigned lbpws10 : 1;
79 unsigned lbpvpd : 1; 85 unsigned lbpvpd : 1;
86 unsigned ws16 : 1;
80}; 87};
81#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) 88#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
82 89
diff --git a/drivers/staging/android/android_alarm.h b/drivers/staging/android/android_alarm.h
index f2ffd963f1c3..d0cafd637199 100644
--- a/drivers/staging/android/android_alarm.h
+++ b/drivers/staging/android/android_alarm.h
@@ -51,12 +51,10 @@ enum android_alarm_return_flags {
51#define ANDROID_ALARM_WAIT _IO('a', 1) 51#define ANDROID_ALARM_WAIT _IO('a', 1)
52 52
53#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size) 53#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
54#define ALARM_IOR(c, type, size) _IOR('a', (c) | ((type) << 4), size)
55
56/* Set alarm */ 54/* Set alarm */
57#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec) 55#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
58#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec) 56#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
59#define ANDROID_ALARM_GET_TIME(type) ALARM_IOR(4, type, struct timespec) 57#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
60#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) 58#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
61#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0))) 59#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
62#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4) 60#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index a5dec1ca1b82..13ee53bd0bf6 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -424,7 +424,6 @@ static void hvc_hangup(struct tty_struct *tty)
424{ 424{
425 struct hvc_struct *hp = tty->driver_data; 425 struct hvc_struct *hp = tty->driver_data;
426 unsigned long flags; 426 unsigned long flags;
427 int temp_open_count;
428 427
429 if (!hp) 428 if (!hp)
430 return; 429 return;
@@ -444,7 +443,6 @@ static void hvc_hangup(struct tty_struct *tty)
444 return; 443 return;
445 } 444 }
446 445
447 temp_open_count = hp->port.count;
448 hp->port.count = 0; 446 hp->port.count = 0;
449 spin_unlock_irqrestore(&hp->port.lock, flags); 447 spin_unlock_irqrestore(&hp->port.lock, flags);
450 tty_port_tty_set(&hp->port, NULL); 448 tty_port_tty_set(&hp->port, NULL);
@@ -453,11 +451,6 @@ static void hvc_hangup(struct tty_struct *tty)
453 451
454 if (hp->ops->notifier_hangup) 452 if (hp->ops->notifier_hangup)
455 hp->ops->notifier_hangup(hp, hp->data); 453 hp->ops->notifier_hangup(hp, hp->data);
456
457 while(temp_open_count) {
458 --temp_open_count;
459 tty_port_put(&hp->port);
460 }
461} 454}
462 455
463/* 456/*
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 2bc28a59d385..1ab1d2c66de4 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1239,6 +1239,7 @@ static int __devexit max310x_remove(struct spi_device *spi)
1239static const struct spi_device_id max310x_id_table[] = { 1239static const struct spi_device_id max310x_id_table[] = {
1240 { "max3107", MAX310X_TYPE_MAX3107 }, 1240 { "max3107", MAX310X_TYPE_MAX3107 },
1241 { "max3108", MAX310X_TYPE_MAX3108 }, 1241 { "max3108", MAX310X_TYPE_MAX3108 },
1242 { }
1242}; 1243};
1243MODULE_DEVICE_TABLE(spi, max310x_id_table); 1244MODULE_DEVICE_TABLE(spi, max310x_id_table);
1244 1245
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 1e741bca0265..f034716190ff 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2151,8 +2151,15 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum);
2151irqreturn_t usb_hcd_irq (int irq, void *__hcd) 2151irqreturn_t usb_hcd_irq (int irq, void *__hcd)
2152{ 2152{
2153 struct usb_hcd *hcd = __hcd; 2153 struct usb_hcd *hcd = __hcd;
2154 unsigned long flags;
2154 irqreturn_t rc; 2155 irqreturn_t rc;
2155 2156
2157 /* IRQF_DISABLED doesn't work correctly with shared IRQs
2158 * when the first handler doesn't use it. So let's just
2159 * assume it's never used.
2160 */
2161 local_irq_save(flags);
2162
2156 if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd))) 2163 if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd)))
2157 rc = IRQ_NONE; 2164 rc = IRQ_NONE;
2158 else if (hcd->driver->irq(hcd) == IRQ_NONE) 2165 else if (hcd->driver->irq(hcd) == IRQ_NONE)
@@ -2160,6 +2167,7 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd)
2160 else 2167 else
2161 rc = IRQ_HANDLED; 2168 rc = IRQ_HANDLED;
2162 2169
2170 local_irq_restore(flags);
2163 return rc; 2171 return rc;
2164} 2172}
2165EXPORT_SYMBOL_GPL(usb_hcd_irq); 2173EXPORT_SYMBOL_GPL(usb_hcd_irq);
@@ -2347,6 +2355,14 @@ static int usb_hcd_request_irqs(struct usb_hcd *hcd,
2347 int retval; 2355 int retval;
2348 2356
2349 if (hcd->driver->irq) { 2357 if (hcd->driver->irq) {
2358
2359 /* IRQF_DISABLED doesn't work as advertised when used together
2360 * with IRQF_SHARED. As usb_hcd_irq() will always disable
2361 * interrupts we can remove it here.
2362 */
2363 if (irqflags & IRQF_SHARED)
2364 irqflags &= ~IRQF_DISABLED;
2365
2350 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", 2366 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
2351 hcd->driver->description, hcd->self.busnum); 2367 hcd->driver->description, hcd->self.busnum);
2352 retval = request_irq(irqnum, &usb_hcd_irq, irqflags, 2368 retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index e426ad626d74..4bfa78af379c 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -20,6 +20,7 @@
20#include <linux/usb/ehci_def.h> 20#include <linux/usb/ehci_def.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/kconfig.h>
23#include <linux/kgdb.h> 24#include <linux/kgdb.h>
24#include <linux/kthread.h> 25#include <linux/kthread.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -614,12 +615,6 @@ err:
614 return -ENODEV; 615 return -ENODEV;
615} 616}
616 617
617int dbgp_external_startup(struct usb_hcd *hcd)
618{
619 return xen_dbgp_external_startup(hcd) ?: _dbgp_external_startup();
620}
621EXPORT_SYMBOL_GPL(dbgp_external_startup);
622
623static int ehci_reset_port(int port) 618static int ehci_reset_port(int port)
624{ 619{
625 u32 portsc; 620 u32 portsc;
@@ -979,6 +974,7 @@ struct console early_dbgp_console = {
979 .index = -1, 974 .index = -1,
980}; 975};
981 976
977#if IS_ENABLED(CONFIG_USB_EHCI_HCD)
982int dbgp_reset_prep(struct usb_hcd *hcd) 978int dbgp_reset_prep(struct usb_hcd *hcd)
983{ 979{
984 int ret = xen_dbgp_reset_prep(hcd); 980 int ret = xen_dbgp_reset_prep(hcd);
@@ -1007,6 +1003,13 @@ int dbgp_reset_prep(struct usb_hcd *hcd)
1007} 1003}
1008EXPORT_SYMBOL_GPL(dbgp_reset_prep); 1004EXPORT_SYMBOL_GPL(dbgp_reset_prep);
1009 1005
1006int dbgp_external_startup(struct usb_hcd *hcd)
1007{
1008 return xen_dbgp_external_startup(hcd) ?: _dbgp_external_startup();
1009}
1010EXPORT_SYMBOL_GPL(dbgp_external_startup);
1011#endif /* USB_EHCI_HCD */
1012
1010#ifdef CONFIG_KGDB 1013#ifdef CONFIG_KGDB
1011 1014
1012static char kgdbdbgp_buf[DBGP_MAX_PACKET]; 1015static char kgdbdbgp_buf[DBGP_MAX_PACKET];
diff --git a/drivers/usb/host/ehci-ls1x.c b/drivers/usb/host/ehci-ls1x.c
index ca759652626b..aa0f328922df 100644
--- a/drivers/usb/host/ehci-ls1x.c
+++ b/drivers/usb/host/ehci-ls1x.c
@@ -113,7 +113,7 @@ static int ehci_hcd_ls1x_probe(struct platform_device *pdev)
113 goto err_put_hcd; 113 goto err_put_hcd;
114 } 114 }
115 115
116 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 116 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
117 if (ret) 117 if (ret)
118 goto err_put_hcd; 118 goto err_put_hcd;
119 119
diff --git a/drivers/usb/host/ohci-xls.c b/drivers/usb/host/ohci-xls.c
index 84201cd1a472..41e378f17c66 100644
--- a/drivers/usb/host/ohci-xls.c
+++ b/drivers/usb/host/ohci-xls.c
@@ -56,7 +56,7 @@ static int ohci_xls_probe_internal(const struct hc_driver *driver,
56 goto err3; 56 goto err3;
57 } 57 }
58 58
59 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); 59 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
60 if (retval != 0) 60 if (retval != 0)
61 goto err4; 61 goto err4;
62 return retval; 62 return retval;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d0b87e7b4abf..b6b84dacc791 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -707,11 +707,12 @@ static void rxstate(struct musb *musb, struct musb_request *req)
707 fifo_count = musb_readw(epio, MUSB_RXCOUNT); 707 fifo_count = musb_readw(epio, MUSB_RXCOUNT);
708 708
709 /* 709 /*
710 * use mode 1 only if we expect data of at least ep packet_sz 710 * Enable Mode 1 on RX transfers only when short_not_ok flag
711 * and have not yet received a short packet 711 * is set. Currently short_not_ok flag is set only from
712 * file_storage and f_mass_storage drivers
712 */ 713 */
713 if ((request->length - request->actual >= musb_ep->packet_sz) && 714
714 (fifo_count >= musb_ep->packet_sz)) 715 if (request->short_not_ok && fifo_count == musb_ep->packet_sz)
715 use_mode_1 = 1; 716 use_mode_1 = 1;
716 else 717 else
717 use_mode_1 = 0; 718 use_mode_1 = 0;
@@ -727,6 +728,27 @@ static void rxstate(struct musb *musb, struct musb_request *req)
727 c = musb->dma_controller; 728 c = musb->dma_controller;
728 channel = musb_ep->dma; 729 channel = musb_ep->dma;
729 730
731 /* We use DMA Req mode 0 in rx_csr, and DMA controller operates in
732 * mode 0 only. So we do not get endpoint interrupts due to DMA
733 * completion. We only get interrupts from DMA controller.
734 *
735 * We could operate in DMA mode 1 if we knew the size of the tranfer
736 * in advance. For mass storage class, request->length = what the host
737 * sends, so that'd work. But for pretty much everything else,
738 * request->length is routinely more than what the host sends. For
739 * most these gadgets, end of is signified either by a short packet,
740 * or filling the last byte of the buffer. (Sending extra data in
741 * that last pckate should trigger an overflow fault.) But in mode 1,
742 * we don't get DMA completion interrupt for short packets.
743 *
744 * Theoretically, we could enable DMAReq irq (MUSB_RXCSR_DMAMODE = 1),
745 * to get endpoint interrupt on every DMA req, but that didn't seem
746 * to work reliably.
747 *
748 * REVISIT an updated g_file_storage can set req->short_not_ok, which
749 * then becomes usable as a runtime "use mode 1" hint...
750 */
751
730 /* Experimental: Mode1 works with mass storage use cases */ 752 /* Experimental: Mode1 works with mass storage use cases */
731 if (use_mode_1) { 753 if (use_mode_1) {
732 csr |= MUSB_RXCSR_AUTOCLEAR; 754 csr |= MUSB_RXCSR_AUTOCLEAR;
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index d62a91fedc22..0e62f504410e 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -65,7 +65,7 @@ static int __devinit ux500_probe(struct platform_device *pdev)
65 struct platform_device *musb; 65 struct platform_device *musb;
66 struct ux500_glue *glue; 66 struct ux500_glue *glue;
67 struct clk *clk; 67 struct clk *clk;
68 68 int musbid;
69 int ret = -ENOMEM; 69 int ret = -ENOMEM;
70 70
71 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 71 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index d8c8a42bff3e..6223062d5d1b 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -58,7 +58,7 @@ config USB_ULPI_VIEWPORT
58 58
59config TWL4030_USB 59config TWL4030_USB
60 tristate "TWL4030 USB Transceiver Driver" 60 tristate "TWL4030 USB Transceiver Driver"
61 depends on TWL4030_CORE && REGULATOR_TWL4030 61 depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
62 select USB_OTG_UTILS 62 select USB_OTG_UTILS
63 help 63 help
64 Enable this to support the USB OTG transceiver on TWL4030 64 Enable this to support the USB OTG transceiver on TWL4030
@@ -68,7 +68,7 @@ config TWL4030_USB
68 68
69config TWL6030_USB 69config TWL6030_USB
70 tristate "TWL6030 USB Transceiver Driver" 70 tristate "TWL6030 USB Transceiver Driver"
71 depends on TWL4030_CORE && OMAP_USB2 71 depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
72 select USB_OTG_UTILS 72 select USB_OTG_UTILS
73 help 73 help
74 Enable this to support the USB OTG transceiver on TWL6030 74 Enable this to support the USB OTG transceiver on TWL6030
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 7179b0c5f814..cff8dd5b462d 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2430,7 +2430,7 @@ static void keyspan_release(struct usb_serial *serial)
2430static int keyspan_port_probe(struct usb_serial_port *port) 2430static int keyspan_port_probe(struct usb_serial_port *port)
2431{ 2431{
2432 struct usb_serial *serial = port->serial; 2432 struct usb_serial *serial = port->serial;
2433 struct keyspan_port_private *s_priv; 2433 struct keyspan_serial_private *s_priv;
2434 struct keyspan_port_private *p_priv; 2434 struct keyspan_port_private *p_priv;
2435 const struct keyspan_device_details *d_details; 2435 const struct keyspan_device_details *d_details;
2436 struct callbacks *cback; 2436 struct callbacks *cback;
@@ -2445,7 +2445,6 @@ static int keyspan_port_probe(struct usb_serial_port *port)
2445 if (!p_priv) 2445 if (!p_priv)
2446 return -ENOMEM; 2446 return -ENOMEM;
2447 2447
2448 s_priv = usb_get_serial_data(port->serial);
2449 p_priv->device_details = d_details; 2448 p_priv->device_details = d_details;
2450 2449
2451 /* Setup values for the various callback routines */ 2450 /* Setup values for the various callback routines */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 5dee7d61241e..edc64bb6f457 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -158,6 +158,7 @@ static void option_instat_callback(struct urb *urb);
158#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0x8001 158#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0x8001
159#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000 159#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000
160#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 160#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001
161#define NOVATELWIRELESS_PRODUCT_E362 0x9010
161#define NOVATELWIRELESS_PRODUCT_G1 0xA001 162#define NOVATELWIRELESS_PRODUCT_G1 0xA001
162#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 163#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002
163#define NOVATELWIRELESS_PRODUCT_G2 0xA010 164#define NOVATELWIRELESS_PRODUCT_G2 0xA010
@@ -193,6 +194,9 @@ static void option_instat_callback(struct urb *urb);
193#define DELL_PRODUCT_5730_MINICARD_TELUS 0x8181 194#define DELL_PRODUCT_5730_MINICARD_TELUS 0x8181
194#define DELL_PRODUCT_5730_MINICARD_VZW 0x8182 195#define DELL_PRODUCT_5730_MINICARD_VZW 0x8182
195 196
197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */
198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */
199
196#define KYOCERA_VENDOR_ID 0x0c88 200#define KYOCERA_VENDOR_ID 0x0c88
197#define KYOCERA_PRODUCT_KPC650 0x17da 201#define KYOCERA_PRODUCT_KPC650 0x17da
198#define KYOCERA_PRODUCT_KPC680 0x180a 202#define KYOCERA_PRODUCT_KPC680 0x180a
@@ -283,6 +287,7 @@ static void option_instat_callback(struct urb *urb);
283/* ALCATEL PRODUCTS */ 287/* ALCATEL PRODUCTS */
284#define ALCATEL_VENDOR_ID 0x1bbb 288#define ALCATEL_VENDOR_ID 0x1bbb
285#define ALCATEL_PRODUCT_X060S_X200 0x0000 289#define ALCATEL_PRODUCT_X060S_X200 0x0000
290#define ALCATEL_PRODUCT_X220_X500D 0x0017
286 291
287#define PIRELLI_VENDOR_ID 0x1266 292#define PIRELLI_VENDOR_ID 0x1266
288#define PIRELLI_PRODUCT_C100_1 0x1002 293#define PIRELLI_PRODUCT_C100_1 0x1002
@@ -706,6 +711,7 @@ static const struct usb_device_id option_ids[] = {
706 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, 711 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
707 /* Novatel Ovation MC551 a.k.a. Verizon USB551L */ 712 /* Novatel Ovation MC551 a.k.a. Verizon USB551L */
708 { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, 713 { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
714 { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) },
709 715
710 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, 716 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
711 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, 717 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
@@ -728,6 +734,8 @@ static const struct usb_device_id option_ids[] = {
728 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 734 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
729 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 735 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
730 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 736 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
737 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
738 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
731 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ 739 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
732 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 740 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
733 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, 741 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -1157,6 +1165,7 @@ static const struct usb_device_id option_ids[] = {
1157 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), 1165 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
1158 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist 1166 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
1159 }, 1167 },
1168 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) },
1160 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 1169 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
1161 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, 1170 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
1162 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), 1171 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 61a73ad1a187..a3e9c095f0d8 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -455,9 +455,6 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
455 struct usb_serial *serial = port->serial; 455 struct usb_serial *serial = port->serial;
456 struct urb *urb; 456 struct urb *urb;
457 457
458 if (endpoint == -1)
459 return NULL; /* endpoint not needed */
460
461 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ 458 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
462 if (urb == NULL) { 459 if (urb == NULL) {
463 dev_dbg(&serial->interface->dev, 460 dev_dbg(&serial->interface->dev,
@@ -489,6 +486,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
489 init_usb_anchor(&portdata->delayed); 486 init_usb_anchor(&portdata->delayed);
490 487
491 for (i = 0; i < N_IN_URB; i++) { 488 for (i = 0; i < N_IN_URB; i++) {
489 if (!port->bulk_in_size)
490 break;
491
492 buffer = (u8 *)__get_free_page(GFP_KERNEL); 492 buffer = (u8 *)__get_free_page(GFP_KERNEL);
493 if (!buffer) 493 if (!buffer)
494 goto bail_out_error; 494 goto bail_out_error;
@@ -502,8 +502,8 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
502 } 502 }
503 503
504 for (i = 0; i < N_OUT_URB; i++) { 504 for (i = 0; i < N_OUT_URB; i++) {
505 if (port->bulk_out_endpointAddress == -1) 505 if (!port->bulk_out_size)
506 continue; 506 break;
507 507
508 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); 508 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
509 if (!buffer) 509 if (!buffer)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a3d54366afcc..92f35abee92d 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -186,6 +186,12 @@ static int slave_configure(struct scsi_device *sdev)
186 /* Some devices don't handle VPD pages correctly */ 186 /* Some devices don't handle VPD pages correctly */
187 sdev->skip_vpd_pages = 1; 187 sdev->skip_vpd_pages = 1;
188 188
189 /* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
190 sdev->no_report_opcodes = 1;
191
192 /* Do not attempt to use WRITE SAME */
193 sdev->no_write_same = 1;
194
189 /* Some disks return the total number of blocks in response 195 /* Some disks return the total number of blocks in response
190 * to READ CAPACITY rather than the highest block number. 196 * to READ CAPACITY rather than the highest block number.
191 * If this device makes that mistake, tell the sd driver. */ 197 * If this device makes that mistake, tell the sd driver. */
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index d64ac3842884..bee92846cfab 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -365,11 +365,20 @@ struct platform_device *dsi_get_dsidev_from_id(int module)
365 struct omap_dss_output *out; 365 struct omap_dss_output *out;
366 enum omap_dss_output_id id; 366 enum omap_dss_output_id id;
367 367
368 id = module == 0 ? OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2; 368 switch (module) {
369 case 0:
370 id = OMAP_DSS_OUTPUT_DSI1;
371 break;
372 case 1:
373 id = OMAP_DSS_OUTPUT_DSI2;
374 break;
375 default:
376 return NULL;
377 }
369 378
370 out = omap_dss_get_output(id); 379 out = omap_dss_get_output(id);
371 380
372 return out->pdev; 381 return out ? out->pdev : NULL;
373} 382}
374 383
375static inline void dsi_write_reg(struct platform_device *dsidev, 384static inline void dsi_write_reg(struct platform_device *dsidev,
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 2ab1c3e96553..5f6eea801b06 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -697,11 +697,15 @@ static int dss_get_clocks(void)
697 697
698 dss.dss_clk = clk; 698 dss.dss_clk = clk;
699 699
700 clk = clk_get(NULL, dss.feat->clk_name); 700 if (dss.feat->clk_name) {
701 if (IS_ERR(clk)) { 701 clk = clk_get(NULL, dss.feat->clk_name);
702 DSSERR("Failed to get %s\n", dss.feat->clk_name); 702 if (IS_ERR(clk)) {
703 r = PTR_ERR(clk); 703 DSSERR("Failed to get %s\n", dss.feat->clk_name);
704 goto err; 704 r = PTR_ERR(clk);
705 goto err;
706 }
707 } else {
708 clk = NULL;
705 } 709 }
706 710
707 dss.dpll4_m4_ck = clk; 711 dss.dpll4_m4_ck = clk;
@@ -805,10 +809,10 @@ static int __init dss_init_features(struct device *dev)
805 809
806 if (cpu_is_omap24xx()) 810 if (cpu_is_omap24xx())
807 src = &omap24xx_dss_feats; 811 src = &omap24xx_dss_feats;
808 else if (cpu_is_omap34xx())
809 src = &omap34xx_dss_feats;
810 else if (cpu_is_omap3630()) 812 else if (cpu_is_omap3630())
811 src = &omap3630_dss_feats; 813 src = &omap3630_dss_feats;
814 else if (cpu_is_omap34xx())
815 src = &omap34xx_dss_feats;
812 else if (cpu_is_omap44xx()) 816 else if (cpu_is_omap44xx())
813 src = &omap44xx_dss_feats; 817 src = &omap44xx_dss_feats;
814 else if (soc_is_omap54xx()) 818 else if (soc_is_omap54xx())
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index a48a7dd75b33..8c9b8b3b7f77 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -644,8 +644,10 @@ static void hdmi_dump_regs(struct seq_file *s)
644{ 644{
645 mutex_lock(&hdmi.lock); 645 mutex_lock(&hdmi.lock);
646 646
647 if (hdmi_runtime_get()) 647 if (hdmi_runtime_get()) {
648 mutex_unlock(&hdmi.lock);
648 return; 649 return;
650 }
649 651
650 hdmi.ip_data.ops->dump_wrapper(&hdmi.ip_data, s); 652 hdmi.ip_data.ops->dump_wrapper(&hdmi.ip_data, s);
651 hdmi.ip_data.ops->dump_pll(&hdmi.ip_data, s); 653 hdmi.ip_data.ops->dump_pll(&hdmi.ip_data, s);
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 606b89f12351..d630b26a005c 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -787,7 +787,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
787 787
788 case OMAPFB_WAITFORVSYNC: 788 case OMAPFB_WAITFORVSYNC:
789 DBG("ioctl WAITFORVSYNC\n"); 789 DBG("ioctl WAITFORVSYNC\n");
790 if (!display && !display->output && !display->output->manager) { 790 if (!display || !display->output || !display->output->manager) {
791 r = -EINVAL; 791 r = -EINVAL;
792 break; 792 break;
793 } 793 }
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 8adb9cc267f9..71f5c459b088 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -361,13 +361,13 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
361 down_write(&mm->mmap_sem); 361 down_write(&mm->mmap_sem);
362 362
363 vma = find_vma(mm, m.addr); 363 vma = find_vma(mm, m.addr);
364 ret = -EINVAL;
365 if (!vma || 364 if (!vma ||
366 vma->vm_ops != &privcmd_vm_ops || 365 vma->vm_ops != &privcmd_vm_ops ||
367 (m.addr != vma->vm_start) || 366 (m.addr != vma->vm_start) ||
368 ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || 367 ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) ||
369 !privcmd_enforce_singleshot_mapping(vma)) { 368 !privcmd_enforce_singleshot_mapping(vma)) {
370 up_write(&mm->mmap_sem); 369 up_write(&mm->mmap_sem);
370 ret = -EINVAL;
371 goto out; 371 goto out;
372 } 372 }
373 373
@@ -383,12 +383,16 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
383 383
384 up_write(&mm->mmap_sem); 384 up_write(&mm->mmap_sem);
385 385
386 if (state.global_error && (version == 1)) { 386 if (version == 1) {
387 /* Write back errors in second pass. */ 387 if (state.global_error) {
388 state.user_mfn = (xen_pfn_t *)m.arr; 388 /* Write back errors in second pass. */
389 state.err = err_array; 389 state.user_mfn = (xen_pfn_t *)m.arr;
390 ret = traverse_pages(m.num, sizeof(xen_pfn_t), 390 state.err = err_array;
391 &pagelist, mmap_return_errors_v1, &state); 391 ret = traverse_pages(m.num, sizeof(xen_pfn_t),
392 &pagelist, mmap_return_errors_v1, &state);
393 } else
394 ret = 0;
395
392 } else if (version == 2) { 396 } else if (version == 2) {
393 ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); 397 ret = __copy_to_user(m.err, err_array, m.num * sizeof(int));
394 if (ret) 398 if (ret)