aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-07 20:59:07 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-07 20:59:07 -0400
commitc1a567d31b5488f4593eae7ca215264947b355ca (patch)
tree347b8226a2e92676dc2618d8109b99aa275aa31e /drivers
parent14b596c9d80bf63da3f0fcbddfd67eb62197afb4 (diff)
parentcd3de83f147601356395b57a8673e9c5ff1e59d1 (diff)
Merge 3.16-rc4 into staging-next
We want the staging tree fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/dma-contiguous.c12
-rw-r--r--drivers/block/drbd/drbd_receiver.c5
-rw-r--r--drivers/block/floppy.c2
-rw-r--r--drivers/block/rbd.c10
-rw-r--r--drivers/block/zram/zram_drv.c5
-rw-r--r--drivers/clocksource/exynos_mct.c9
-rw-r--r--drivers/firmware/efi/efi-pstore.c2
-rw-r--r--drivers/firmware/efi/efi.c6
-rw-r--r--drivers/firmware/efi/fdt.c2
-rw-r--r--drivers/gpu/drm/drm_drv.c3
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dpi.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c19
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c50
-rw-r--r--drivers/gpu/drm/exynos/regs-mixer.h1
-rw-r--r--drivers/gpu/drm/i2c/tda998x_drv.c12
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c8
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c40
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c66
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c8
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.c2
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.h1
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi_connector.c8
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c22
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h1
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c2
-rw-r--r--drivers/gpu/drm/msm/msm_fbdev.c2
-rw-r--r--drivers/gpu/drm/msm/msm_gem.c6
-rw-r--r--drivers/gpu/drm/msm/msm_iommu.c23
-rw-r--r--drivers/gpu/drm/msm/msm_mmu.h1
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c12
-rw-r--r--drivers/gpu/drm/radeon/cikd.h2
-rw-r--r--drivers/gpu/drm/radeon/cypress_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/ni_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h5
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c19
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h15
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_vm.c4
-rw-r--r--drivers/gpu/drm/radeon/trinity_dpm.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c1
-rw-r--r--drivers/hwmon/Kconfig6
-rw-r--r--drivers/hwmon/gpio-fan.c2
-rw-r--r--drivers/hwmon/ntc_thermistor.c14
-rw-r--r--drivers/hwmon/w83l786ng.c2
-rw-r--r--drivers/iio/adc/ad799x.c8
-rw-r--r--drivers/iio/inkern.c6
-rw-r--r--drivers/iommu/amd_iommu_v2.c18
-rw-r--r--drivers/iommu/intel-iommu.c9
-rw-r--r--drivers/irqchip/irq-armada-370-xp.c17
-rw-r--r--drivers/irqchip/irq-brcmstb-l2.c2
-rw-r--r--drivers/irqchip/spear-shirq.c2
-rw-r--r--drivers/isdn/hisax/Kconfig11
-rw-r--r--drivers/macintosh/smu.c3
-rw-r--r--drivers/md/md.c15
-rw-r--r--drivers/memstick/host/rtsx_pci_ms.c1
-rw-r--r--drivers/mfd/Kconfig5
-rw-r--r--drivers/mfd/ab8500-core.c2
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--drivers/net/bonding/bond_main.c9
-rw-r--r--drivers/net/can/slcan.c37
-rw-r--r--drivers/net/ethernet/allwinner/sun4i-emac.c1
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c8
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c16
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c1
-rw-r--r--drivers/net/ethernet/dec/tulip/timer.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h4
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c4
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c8
-rw-r--r--drivers/net/ethernet/marvell/skge.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c3
-rw-r--r--drivers/net/ethernet/ti/cpsw.c7
-rw-r--r--drivers/net/ethernet/tile/tilegx.c1
-rw-r--r--drivers/net/hyperv/netvsc.c2
-rw-r--r--drivers/net/ieee802154/at86rf230.c5
-rw-r--r--drivers/net/phy/at803x.c195
-rw-r--r--drivers/net/phy/phy.c3
-rw-r--r--drivers/net/slip/slip.c36
-rw-r--r--drivers/net/slip/slip.h1
-rw-r--r--drivers/net/usb/huawei_cdc_ncm.c7
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c7
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c12
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h5
-rw-r--r--drivers/net/wireless/b43/Kconfig2
-rw-r--r--drivers/net/wireless/b43/main.c1
-rw-r--r--drivers/net/wireless/b43/xmit.c10
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c4
-rw-r--r--drivers/net/wireless/mwifiex/util.h43
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c39
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c24
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h1
-rw-r--r--drivers/net/xen-netback/common.h1
-rw-r--r--drivers/net/xen-netback/interface.c49
-rw-r--r--drivers/net/xen-netback/xenbus.c28
-rw-r--r--drivers/net/xen-netfront.c109
-rw-r--r--drivers/of/fdt.c15
-rw-r--r--drivers/of/of_mdio.c8
-rw-r--r--drivers/ptp/Kconfig2
-rw-r--r--drivers/regulator/bcm590xx-regulator.c5
-rw-r--r--drivers/regulator/palmas-regulator.c12
-rw-r--r--drivers/regulator/tps65218-regulator.c3
-rw-r--r--drivers/scsi/be2iscsi/be_main.c2
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c4
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c16
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c13
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c13
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c17
-rw-r--r--drivers/scsi/qla2xxx/qla_target.h4
-rw-r--r--drivers/scsi/scsi_error.c20
-rw-r--r--drivers/scsi/scsi_transport_fc.c1
-rw-r--r--drivers/scsi/sd.c5
-rw-r--r--drivers/scsi/virtio_scsi.c26
-rw-r--r--drivers/spi/spi-pxa2xx.c8
-rw-r--r--drivers/spi/spi-qup.c44
-rw-r--r--drivers/spi/spi-sh-sci.c4
-rw-r--r--drivers/staging/iio/adc/ad7291.c4
-rw-r--r--drivers/staging/tidspbridge/core/tiomap3430.c6
-rw-r--r--drivers/target/iscsi/iscsi_target.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_auth.c14
-rw-r--r--drivers/target/iscsi/iscsi_target_login.c13
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c2
-rw-r--r--drivers/target/loopback/tcm_loop.c1
-rw-r--r--drivers/target/target_core_device.c1
-rw-r--r--drivers/tc/tc.c10
-rw-r--r--drivers/tty/serial/msm_serial.c2
-rw-r--r--drivers/usb/chipidea/udc.c7
-rw-r--r--drivers/usb/dwc3/Kconfig1
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c17
-rw-r--r--drivers/usb/dwc3/gadget.c8
-rw-r--r--drivers/usb/gadget/configfs.c37
-rw-r--r--drivers/usb/gadget/configfs.h1
-rw-r--r--drivers/usb/gadget/f_fs.c12
-rw-r--r--drivers/usb/gadget/f_rndis.c6
-rw-r--r--drivers/usb/gadget/gr_udc.c5
-rw-r--r--drivers/usb/gadget/inode.c7
-rw-r--r--drivers/usb/gadget/u_ether.c3
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/xhci-hub.c5
-rw-r--r--drivers/usb/host/xhci-ring.c9
-rw-r--r--drivers/usb/host/xhci.c10
-rw-r--r--drivers/usb/musb/musb_am335x.c23
-rw-r--r--drivers/usb/musb/musb_core.c2
-rw-r--r--drivers/usb/musb/musb_cppi41.c2
-rw-r--r--drivers/usb/musb/musb_dsps.c9
-rw-r--r--drivers/usb/musb/ux500.c1
-rw-r--r--drivers/usb/phy/phy-msm-usb.c4
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c8
-rw-r--r--drivers/usb/serial/ftdi_sio.c7
-rw-r--r--drivers/usb/serial/option.c26
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/vhost/net.c12
-rw-r--r--drivers/vhost/scsi.c12
-rw-r--r--drivers/video/fbdev/atmel_lcdfb.c2
-rw-r--r--drivers/video/fbdev/bfin_adv7393fb.c2
-rw-r--r--drivers/video/fbdev/omap2/dss/omapdss-boot-init.c8
-rw-r--r--drivers/video/fbdev/vt8500lcdfb.c2
172 files changed, 1260 insertions, 562 deletions
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 83969f8c5727..6467c919c509 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -176,14 +176,24 @@ static int __init cma_activate_area(struct cma *cma)
176 base_pfn = pfn; 176 base_pfn = pfn;
177 for (j = pageblock_nr_pages; j; --j, pfn++) { 177 for (j = pageblock_nr_pages; j; --j, pfn++) {
178 WARN_ON_ONCE(!pfn_valid(pfn)); 178 WARN_ON_ONCE(!pfn_valid(pfn));
179 /*
180 * alloc_contig_range requires the pfn range
181 * specified to be in the same zone. Make this
182 * simple by forcing the entire CMA resv range
183 * to be in the same zone.
184 */
179 if (page_zone(pfn_to_page(pfn)) != zone) 185 if (page_zone(pfn_to_page(pfn)) != zone)
180 return -EINVAL; 186 goto err;
181 } 187 }
182 init_cma_reserved_pageblock(pfn_to_page(base_pfn)); 188 init_cma_reserved_pageblock(pfn_to_page(base_pfn));
183 } while (--i); 189 } while (--i);
184 190
185 mutex_init(&cma->lock); 191 mutex_init(&cma->lock);
186 return 0; 192 return 0;
193
194err:
195 kfree(cma->bitmap);
196 return -EINVAL;
187} 197}
188 198
189static struct cma cma_areas[MAX_CMA_AREAS]; 199static struct cma cma_areas[MAX_CMA_AREAS];
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index b6c8aaf4931b..5b17ec88ea05 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1337,8 +1337,11 @@ int drbd_submit_peer_request(struct drbd_device *device,
1337 return 0; 1337 return 0;
1338 } 1338 }
1339 1339
1340 /* Discards don't have any payload.
1341 * But the scsi layer still expects a bio_vec it can use internally,
1342 * see sd_setup_discard_cmnd() and blk_add_request_payload(). */
1340 if (peer_req->flags & EE_IS_TRIM) 1343 if (peer_req->flags & EE_IS_TRIM)
1341 nr_pages = 0; /* discards don't have any payload. */ 1344 nr_pages = 1;
1342 1345
1343 /* In most cases, we will only need one bio. But in case the lower 1346 /* In most cases, we will only need one bio. But in case the lower
1344 * level restrictions happen to be different at this offset on this 1347 * level restrictions happen to be different at this offset on this
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 677db049f55a..56d46ffb08e1 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3777,7 +3777,7 @@ static void floppy_rb0_cb(struct bio *bio, int err)
3777 int drive = cbdata->drive; 3777 int drive = cbdata->drive;
3778 3778
3779 if (err) { 3779 if (err) {
3780 pr_info("floppy: error %d while reading block 0", err); 3780 pr_info("floppy: error %d while reading block 0\n", err);
3781 set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); 3781 set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
3782 } 3782 }
3783 complete(&cbdata->complete); 3783 complete(&cbdata->complete);
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index bbeb404b3a07..b2c98c1bc037 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request)
1431 return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; 1431 return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0;
1432} 1432}
1433 1433
1434static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request)
1435{
1436 struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
1437
1438 return obj_request->img_offset <
1439 round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header));
1440}
1441
1434static void rbd_obj_request_get(struct rbd_obj_request *obj_request) 1442static void rbd_obj_request_get(struct rbd_obj_request *obj_request)
1435{ 1443{
1436 dout("%s: obj %p (was %d)\n", __func__, obj_request, 1444 dout("%s: obj %p (was %d)\n", __func__, obj_request,
@@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
2748 */ 2756 */
2749 if (!img_request_write_test(img_request) || 2757 if (!img_request_write_test(img_request) ||
2750 !img_request_layered_test(img_request) || 2758 !img_request_layered_test(img_request) ||
2751 rbd_dev->parent_overlap <= obj_request->img_offset || 2759 !obj_request_overlaps_parent(obj_request) ||
2752 ((known = obj_request_known_test(obj_request)) && 2760 ((known = obj_request_known_test(obj_request)) &&
2753 obj_request_exists_test(obj_request))) { 2761 obj_request_exists_test(obj_request))) {
2754 2762
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 48eccb350180..089e72cd37be 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -622,8 +622,10 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity)
622 memset(&zram->stats, 0, sizeof(zram->stats)); 622 memset(&zram->stats, 0, sizeof(zram->stats));
623 623
624 zram->disksize = 0; 624 zram->disksize = 0;
625 if (reset_capacity) 625 if (reset_capacity) {
626 set_capacity(zram->disk, 0); 626 set_capacity(zram->disk, 0);
627 revalidate_disk(zram->disk);
628 }
627 up_write(&zram->init_lock); 629 up_write(&zram->init_lock);
628} 630}
629 631
@@ -664,6 +666,7 @@ static ssize_t disksize_store(struct device *dev,
664 zram->comp = comp; 666 zram->comp = comp;
665 zram->disksize = disksize; 667 zram->disksize = disksize;
666 set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); 668 set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
669 revalidate_disk(zram->disk);
667 up_write(&zram->init_lock); 670 up_write(&zram->init_lock);
668 return len; 671 return len;
669 672
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 8d6420013a04..f71d55f5e6e5 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -153,13 +153,10 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset)
153} 153}
154 154
155/* Clocksource handling */ 155/* Clocksource handling */
156static void exynos4_mct_frc_start(u32 hi, u32 lo) 156static void exynos4_mct_frc_start(void)
157{ 157{
158 u32 reg; 158 u32 reg;
159 159
160 exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L);
161 exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U);
162
163 reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); 160 reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON);
164 reg |= MCT_G_TCON_START; 161 reg |= MCT_G_TCON_START;
165 exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); 162 exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON);
@@ -181,7 +178,7 @@ static cycle_t exynos4_frc_read(struct clocksource *cs)
181 178
182static void exynos4_frc_resume(struct clocksource *cs) 179static void exynos4_frc_resume(struct clocksource *cs)
183{ 180{
184 exynos4_mct_frc_start(0, 0); 181 exynos4_mct_frc_start();
185} 182}
186 183
187struct clocksource mct_frc = { 184struct clocksource mct_frc = {
@@ -200,7 +197,7 @@ static u64 notrace exynos4_read_sched_clock(void)
200 197
201static void __init exynos4_clocksource_init(void) 198static void __init exynos4_clocksource_init(void)
202{ 199{
203 exynos4_mct_frc_start(0, 0); 200 exynos4_mct_frc_start();
204 201
205 if (clocksource_register_hz(&mct_frc, clk_rate)) 202 if (clocksource_register_hz(&mct_frc, clk_rate))
206 panic("%s: can't register clocksource\n", mct_frc.name); 203 panic("%s: can't register clocksource\n", mct_frc.name);
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 4b9dc836dcf9..e992abc5ef26 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -40,7 +40,7 @@ struct pstore_read_data {
40static inline u64 generic_id(unsigned long timestamp, 40static inline u64 generic_id(unsigned long timestamp,
41 unsigned int part, int count) 41 unsigned int part, int count)
42{ 42{
43 return (timestamp * 100 + part) * 1000 + count; 43 return ((u64) timestamp * 100 + part) * 1000 + count;
44} 44}
45 45
46static int efi_pstore_read_func(struct efivar_entry *entry, void *data) 46static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index cd36deb619fa..eff1a2f22f09 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -353,10 +353,10 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
353 int depth, void *data) 353 int depth, void *data)
354{ 354{
355 struct param_info *info = data; 355 struct param_info *info = data;
356 void *prop, *dest; 356 const void *prop;
357 unsigned long len; 357 void *dest;
358 u64 val; 358 u64 val;
359 int i; 359 int i, len;
360 360
361 if (depth != 1 || 361 if (depth != 1 ||
362 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) 362 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c
index 5c6a8e8a9580..82d774161cc9 100644
--- a/drivers/firmware/efi/fdt.c
+++ b/drivers/firmware/efi/fdt.c
@@ -63,7 +63,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
63 */ 63 */
64 prev = 0; 64 prev = 0;
65 for (;;) { 65 for (;;) {
66 const char *type, *name; 66 const char *type;
67 int len; 67 int len;
68 68
69 node = fdt_next_node(fdt, prev, NULL); 69 node = fdt_next_node(fdt, prev, NULL);
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 03711d00aaae..8218078b6133 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -419,8 +419,9 @@ long drm_ioctl(struct file *filp,
419 retcode = -EFAULT; 419 retcode = -EFAULT;
420 goto err_i1; 420 goto err_i1;
421 } 421 }
422 } else 422 } else if (cmd & IOC_OUT) {
423 memset(kdata, 0, usize); 423 memset(kdata, 0, usize);
424 }
424 425
425 if (ioctl->flags & DRM_UNLOCKED) 426 if (ioctl->flags & DRM_UNLOCKED)
426 retcode = func(dev, kdata, file_priv); 427 retcode = func(dev, kdata, file_priv);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 482127f633c5..9e530f205ad2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force)
40{ 40{
41 struct exynos_dpi *ctx = connector_to_dpi(connector); 41 struct exynos_dpi *ctx = connector_to_dpi(connector);
42 42
43 if (!ctx->panel->connector) 43 if (ctx->panel && !ctx->panel->connector)
44 drm_panel_attach(ctx->panel, &ctx->connector); 44 drm_panel_attach(ctx->panel, &ctx->connector);
45 45
46 return connector_status_connected; 46 return connector_status_connected;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d91f27777537..ab7d182063c3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -765,24 +765,24 @@ static int exynos_drm_init(void)
765 765
766 return 0; 766 return 0;
767 767
768err_unregister_pd:
769 platform_device_unregister(exynos_drm_pdev);
770
771err_remove_vidi: 768err_remove_vidi:
772#ifdef CONFIG_DRM_EXYNOS_VIDI 769#ifdef CONFIG_DRM_EXYNOS_VIDI
773 exynos_drm_remove_vidi(); 770 exynos_drm_remove_vidi();
771
772err_unregister_pd:
774#endif 773#endif
774 platform_device_unregister(exynos_drm_pdev);
775 775
776 return ret; 776 return ret;
777} 777}
778 778
779static void exynos_drm_exit(void) 779static void exynos_drm_exit(void)
780{ 780{
781 platform_driver_unregister(&exynos_drm_platform_driver);
781#ifdef CONFIG_DRM_EXYNOS_VIDI 782#ifdef CONFIG_DRM_EXYNOS_VIDI
782 exynos_drm_remove_vidi(); 783 exynos_drm_remove_vidi();
783#endif 784#endif
784 platform_device_unregister(exynos_drm_pdev); 785 platform_device_unregister(exynos_drm_pdev);
785 platform_driver_unregister(&exynos_drm_platform_driver);
786} 786}
787 787
788module_init(exynos_drm_init); 788module_init(exynos_drm_init);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 36535f398848..06cde4506278 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -343,7 +343,7 @@ struct exynos_drm_display * exynos_dpi_probe(struct device *dev);
343int exynos_dpi_remove(struct device *dev); 343int exynos_dpi_remove(struct device *dev);
344#else 344#else
345static inline struct exynos_drm_display * 345static inline struct exynos_drm_display *
346exynos_dpi_probe(struct device *dev) { return 0; } 346exynos_dpi_probe(struct device *dev) { return NULL; }
347static inline int exynos_dpi_remove(struct device *dev) { return 0; } 347static inline int exynos_dpi_remove(struct device *dev) { return 0; }
348#endif 348#endif
349 349
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bb45ab2e7384..33161ad38201 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -741,6 +741,8 @@ static void fimd_apply(struct exynos_drm_manager *mgr)
741 win_data = &ctx->win_data[i]; 741 win_data = &ctx->win_data[i];
742 if (win_data->enabled) 742 if (win_data->enabled)
743 fimd_win_commit(mgr, i); 743 fimd_win_commit(mgr, i);
744 else
745 fimd_win_disable(mgr, i);
744 } 746 }
745 747
746 fimd_commit(mgr); 748 fimd_commit(mgr);
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index c104d0c9b385..aa259b0a873a 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2090,6 +2090,11 @@ out:
2090 2090
2091static void hdmi_dpms(struct exynos_drm_display *display, int mode) 2091static void hdmi_dpms(struct exynos_drm_display *display, int mode)
2092{ 2092{
2093 struct hdmi_context *hdata = display->ctx;
2094 struct drm_encoder *encoder = hdata->encoder;
2095 struct drm_crtc *crtc = encoder->crtc;
2096 struct drm_crtc_helper_funcs *funcs = NULL;
2097
2093 DRM_DEBUG_KMS("mode %d\n", mode); 2098 DRM_DEBUG_KMS("mode %d\n", mode);
2094 2099
2095 switch (mode) { 2100 switch (mode) {
@@ -2099,6 +2104,20 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)
2099 case DRM_MODE_DPMS_STANDBY: 2104 case DRM_MODE_DPMS_STANDBY:
2100 case DRM_MODE_DPMS_SUSPEND: 2105 case DRM_MODE_DPMS_SUSPEND:
2101 case DRM_MODE_DPMS_OFF: 2106 case DRM_MODE_DPMS_OFF:
2107 /*
2108 * The SFRs of VP and Mixer are updated by Vertical Sync of
2109 * Timing generator which is a part of HDMI so the sequence
2110 * to disable TV Subsystem should be as following,
2111 * VP -> Mixer -> HDMI
2112 *
2113 * Below codes will try to disable Mixer and VP(if used)
2114 * prior to disabling HDMI.
2115 */
2116 if (crtc)
2117 funcs = crtc->helper_private;
2118 if (funcs && funcs->dpms)
2119 (*funcs->dpms)(crtc, mode);
2120
2102 hdmi_poweroff(display); 2121 hdmi_poweroff(display);
2103 break; 2122 break;
2104 default: 2123 default:
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 4c5aed7e54c8..7529946d0a74 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -377,6 +377,20 @@ static void mixer_run(struct mixer_context *ctx)
377 mixer_regs_dump(ctx); 377 mixer_regs_dump(ctx);
378} 378}
379 379
380static void mixer_stop(struct mixer_context *ctx)
381{
382 struct mixer_resources *res = &ctx->mixer_res;
383 int timeout = 20;
384
385 mixer_reg_writemask(res, MXR_STATUS, 0, MXR_STATUS_REG_RUN);
386
387 while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) &&
388 --timeout)
389 usleep_range(10000, 12000);
390
391 mixer_regs_dump(ctx);
392}
393
380static void vp_video_buffer(struct mixer_context *ctx, int win) 394static void vp_video_buffer(struct mixer_context *ctx, int win)
381{ 395{
382 struct mixer_resources *res = &ctx->mixer_res; 396 struct mixer_resources *res = &ctx->mixer_res;
@@ -497,13 +511,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
497static void mixer_layer_update(struct mixer_context *ctx) 511static void mixer_layer_update(struct mixer_context *ctx)
498{ 512{
499 struct mixer_resources *res = &ctx->mixer_res; 513 struct mixer_resources *res = &ctx->mixer_res;
500 u32 val;
501
502 val = mixer_reg_read(res, MXR_CFG);
503 514
504 /* allow one update per vsync only */ 515 mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
505 if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK))
506 mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
507} 516}
508 517
509static void mixer_graph_buffer(struct mixer_context *ctx, int win) 518static void mixer_graph_buffer(struct mixer_context *ctx, int win)
@@ -1010,6 +1019,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr)
1010 } 1019 }
1011 mutex_unlock(&mixer_ctx->mixer_mutex); 1020 mutex_unlock(&mixer_ctx->mixer_mutex);
1012 1021
1022 drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe);
1023
1013 atomic_set(&mixer_ctx->wait_vsync_event, 1); 1024 atomic_set(&mixer_ctx->wait_vsync_event, 1);
1014 1025
1015 /* 1026 /*
@@ -1020,6 +1031,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr)
1020 !atomic_read(&mixer_ctx->wait_vsync_event), 1031 !atomic_read(&mixer_ctx->wait_vsync_event),
1021 HZ/20)) 1032 HZ/20))
1022 DRM_DEBUG_KMS("vblank wait timed out.\n"); 1033 DRM_DEBUG_KMS("vblank wait timed out.\n");
1034
1035 drm_vblank_put(mgr->crtc->dev, mixer_ctx->pipe);
1023} 1036}
1024 1037
1025static void mixer_window_suspend(struct exynos_drm_manager *mgr) 1038static void mixer_window_suspend(struct exynos_drm_manager *mgr)
@@ -1061,7 +1074,7 @@ static void mixer_poweron(struct exynos_drm_manager *mgr)
1061 mutex_unlock(&ctx->mixer_mutex); 1074 mutex_unlock(&ctx->mixer_mutex);
1062 return; 1075 return;
1063 } 1076 }
1064 ctx->powered = true; 1077
1065 mutex_unlock(&ctx->mixer_mutex); 1078 mutex_unlock(&ctx->mixer_mutex);
1066 1079
1067 pm_runtime_get_sync(ctx->dev); 1080 pm_runtime_get_sync(ctx->dev);
@@ -1072,6 +1085,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr)
1072 clk_prepare_enable(res->sclk_mixer); 1085 clk_prepare_enable(res->sclk_mixer);
1073 } 1086 }
1074 1087
1088 mutex_lock(&ctx->mixer_mutex);
1089 ctx->powered = true;
1090 mutex_unlock(&ctx->mixer_mutex);
1091
1092 mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET);
1093
1075 mixer_reg_write(res, MXR_INT_EN, ctx->int_en); 1094 mixer_reg_write(res, MXR_INT_EN, ctx->int_en);
1076 mixer_win_reset(ctx); 1095 mixer_win_reset(ctx);
1077 1096
@@ -1084,14 +1103,21 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr)
1084 struct mixer_resources *res = &ctx->mixer_res; 1103 struct mixer_resources *res = &ctx->mixer_res;
1085 1104
1086 mutex_lock(&ctx->mixer_mutex); 1105 mutex_lock(&ctx->mixer_mutex);
1087 if (!ctx->powered) 1106 if (!ctx->powered) {
1088 goto out; 1107 mutex_unlock(&ctx->mixer_mutex);
1108 return;
1109 }
1089 mutex_unlock(&ctx->mixer_mutex); 1110 mutex_unlock(&ctx->mixer_mutex);
1090 1111
1112 mixer_stop(ctx);
1091 mixer_window_suspend(mgr); 1113 mixer_window_suspend(mgr);
1092 1114
1093 ctx->int_en = mixer_reg_read(res, MXR_INT_EN); 1115 ctx->int_en = mixer_reg_read(res, MXR_INT_EN);
1094 1116
1117 mutex_lock(&ctx->mixer_mutex);
1118 ctx->powered = false;
1119 mutex_unlock(&ctx->mixer_mutex);
1120
1095 clk_disable_unprepare(res->mixer); 1121 clk_disable_unprepare(res->mixer);
1096 if (ctx->vp_enabled) { 1122 if (ctx->vp_enabled) {
1097 clk_disable_unprepare(res->vp); 1123 clk_disable_unprepare(res->vp);
@@ -1099,12 +1125,6 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr)
1099 } 1125 }
1100 1126
1101 pm_runtime_put_sync(ctx->dev); 1127 pm_runtime_put_sync(ctx->dev);
1102
1103 mutex_lock(&ctx->mixer_mutex);
1104 ctx->powered = false;
1105
1106out:
1107 mutex_unlock(&ctx->mixer_mutex);
1108} 1128}
1109 1129
1110static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) 1130static void mixer_dpms(struct exynos_drm_manager *mgr, int mode)
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h
index 4537026bc385..5f32e1a29411 100644
--- a/drivers/gpu/drm/exynos/regs-mixer.h
+++ b/drivers/gpu/drm/exynos/regs-mixer.h
@@ -78,6 +78,7 @@
78#define MXR_STATUS_BIG_ENDIAN (1 << 3) 78#define MXR_STATUS_BIG_ENDIAN (1 << 3)
79#define MXR_STATUS_ENDIAN_MASK (1 << 3) 79#define MXR_STATUS_ENDIAN_MASK (1 << 3)
80#define MXR_STATUS_SYNC_ENABLE (1 << 2) 80#define MXR_STATUS_SYNC_ENABLE (1 << 2)
81#define MXR_STATUS_REG_IDLE (1 << 1)
81#define MXR_STATUS_REG_RUN (1 << 0) 82#define MXR_STATUS_REG_RUN (1 << 0)
82 83
83/* bits for MXR_CFG */ 84/* bits for MXR_CFG */
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 240c331405b9..ac357b02bd35 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -810,6 +810,12 @@ static int
810tda998x_encoder_mode_valid(struct drm_encoder *encoder, 810tda998x_encoder_mode_valid(struct drm_encoder *encoder,
811 struct drm_display_mode *mode) 811 struct drm_display_mode *mode)
812{ 812{
813 if (mode->clock > 150000)
814 return MODE_CLOCK_HIGH;
815 if (mode->htotal >= BIT(13))
816 return MODE_BAD_HVALUE;
817 if (mode->vtotal >= BIT(11))
818 return MODE_BAD_VVALUE;
813 return MODE_OK; 819 return MODE_OK;
814} 820}
815 821
@@ -1048,8 +1054,8 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk)
1048 return i; 1054 return i;
1049 } 1055 }
1050 } else { 1056 } else {
1051 for (i = 10; i > 0; i--) { 1057 for (i = 100; i > 0; i--) {
1052 msleep(10); 1058 msleep(1);
1053 ret = reg_read(priv, REG_INT_FLAGS_2); 1059 ret = reg_read(priv, REG_INT_FLAGS_2);
1054 if (ret < 0) 1060 if (ret < 0)
1055 return ret; 1061 return ret;
@@ -1183,7 +1189,6 @@ static void
1183tda998x_encoder_destroy(struct drm_encoder *encoder) 1189tda998x_encoder_destroy(struct drm_encoder *encoder)
1184{ 1190{
1185 struct tda998x_priv *priv = to_tda998x_priv(encoder); 1191 struct tda998x_priv *priv = to_tda998x_priv(encoder);
1186 drm_i2c_encoder_destroy(encoder);
1187 1192
1188 /* disable all IRQs and free the IRQ handler */ 1193 /* disable all IRQs and free the IRQ handler */
1189 cec_write(priv, REG_CEC_RXSHPDINTENA, 0); 1194 cec_write(priv, REG_CEC_RXSHPDINTENA, 0);
@@ -1193,6 +1198,7 @@ tda998x_encoder_destroy(struct drm_encoder *encoder)
1193 1198
1194 if (priv->cec) 1199 if (priv->cec)
1195 i2c_unregister_device(priv->cec); 1200 i2c_unregister_device(priv->cec);
1201 drm_i2c_encoder_destroy(encoder);
1196 kfree(priv); 1202 kfree(priv);
1197} 1203}
1198 1204
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 601caa88c092..b8c689202c40 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -446,7 +446,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
446 446
447 memset(&stats, 0, sizeof(stats)); 447 memset(&stats, 0, sizeof(stats));
448 stats.file_priv = file->driver_priv; 448 stats.file_priv = file->driver_priv;
449 spin_lock(&file->table_lock);
449 idr_for_each(&file->object_idr, per_file_stats, &stats); 450 idr_for_each(&file->object_idr, per_file_stats, &stats);
451 spin_unlock(&file->table_lock);
450 /* 452 /*
451 * Although we have a valid reference on file->pid, that does 453 * Although we have a valid reference on file->pid, that does
452 * not guarantee that the task_struct who called get_pid() is 454 * not guarantee that the task_struct who called get_pid() is
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 49414d30e8d4..a47fbf60b781 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -977,6 +977,8 @@ struct i915_power_well {
977 bool always_on; 977 bool always_on;
978 /* power well enable/disable usage count */ 978 /* power well enable/disable usage count */
979 int count; 979 int count;
980 /* cached hw enabled state */
981 bool hw_enabled;
980 unsigned long domains; 982 unsigned long domains;
981 unsigned long data; 983 unsigned long data;
982 const struct i915_power_well_ops *ops; 984 const struct i915_power_well_ops *ops;
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 3ffe308d5893..a5ddf3bce9c3 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring,
598 struct intel_context *from = ring->last_context; 598 struct intel_context *from = ring->last_context;
599 struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); 599 struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
600 u32 hw_flags = 0; 600 u32 hw_flags = 0;
601 bool uninitialized = false;
601 int ret, i; 602 int ret, i;
602 603
603 if (from != NULL && ring == &dev_priv->ring[RCS]) { 604 if (from != NULL && ring == &dev_priv->ring[RCS]) {
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring,
696 i915_gem_context_unreference(from); 697 i915_gem_context_unreference(from);
697 } 698 }
698 699
700 uninitialized = !to->is_initialized && from == NULL;
701 to->is_initialized = true;
702
699done: 703done:
700 i915_gem_context_reference(to); 704 i915_gem_context_reference(to);
701 ring->last_context = to; 705 ring->last_context = to;
702 to->last_ring = ring; 706 to->last_ring = ring;
703 707
704 if (ring->id == RCS && !to->is_initialized && from == NULL) { 708 if (uninitialized) {
705 ret = i915_gem_render_state_init(ring); 709 ret = i915_gem_render_state_init(ring);
706 if (ret) 710 if (ret)
707 DRM_ERROR("init render state: %d\n", ret); 711 DRM_ERROR("init render state: %d\n", ret);
708 } 712 }
709 713
710 to->is_initialized = true;
711
712 return 0; 714 return 0;
713 715
714unpin_out: 716unpin_out:
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 1ee98f121a00..827498e081df 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -315,9 +315,6 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
315 const struct bdb_lfp_backlight_data *backlight_data; 315 const struct bdb_lfp_backlight_data *backlight_data;
316 const struct bdb_lfp_backlight_data_entry *entry; 316 const struct bdb_lfp_backlight_data_entry *entry;
317 317
318 /* Err to enabling backlight if no backlight block. */
319 dev_priv->vbt.backlight.present = true;
320
321 backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); 318 backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
322 if (!backlight_data) 319 if (!backlight_data)
323 return; 320 return;
@@ -1088,6 +1085,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
1088 1085
1089 dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; 1086 dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC;
1090 1087
1088 /* Default to having backlight */
1089 dev_priv->vbt.backlight.present = true;
1090
1091 /* LFP panel data */ 1091 /* LFP panel data */
1092 dev_priv->vbt.lvds_dither = 1; 1092 dev_priv->vbt.lvds_dither = 1;
1093 dev_priv->vbt.lvds_vbt = 0; 1093 dev_priv->vbt.lvds_vbt = 0;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index efd3cf50cb0f..556c916dbf9d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2087,6 +2087,7 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
2087static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, 2087static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
2088 enum plane plane, enum pipe pipe) 2088 enum plane plane, enum pipe pipe)
2089{ 2089{
2090 struct drm_device *dev = dev_priv->dev;
2090 struct intel_crtc *intel_crtc = 2091 struct intel_crtc *intel_crtc =
2091 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); 2092 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
2092 int reg; 2093 int reg;
@@ -2106,6 +2107,14 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
2106 2107
2107 I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); 2108 I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
2108 intel_flush_primary_plane(dev_priv, plane); 2109 intel_flush_primary_plane(dev_priv, plane);
2110
2111 /*
2112 * BDW signals flip done immediately if the plane
2113 * is disabled, even if the plane enable is already
2114 * armed to occur at the next vblank :(
2115 */
2116 if (IS_BROADWELL(dev))
2117 intel_wait_for_vblank(dev, intel_crtc->pipe);
2109} 2118}
2110 2119
2111/** 2120/**
@@ -4564,7 +4573,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
4564 if (intel_crtc->active) 4573 if (intel_crtc->active)
4565 return; 4574 return;
4566 4575
4567 vlv_prepare_pll(intel_crtc); 4576 is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI);
4577
4578 if (!is_dsi && !IS_CHERRYVIEW(dev))
4579 vlv_prepare_pll(intel_crtc);
4568 4580
4569 /* Set up the display plane register */ 4581 /* Set up the display plane register */
4570 dspcntr = DISPPLANE_GAMMA_ENABLE; 4582 dspcntr = DISPPLANE_GAMMA_ENABLE;
@@ -4598,8 +4610,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
4598 if (encoder->pre_pll_enable) 4610 if (encoder->pre_pll_enable)
4599 encoder->pre_pll_enable(encoder); 4611 encoder->pre_pll_enable(encoder);
4600 4612
4601 is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI);
4602
4603 if (!is_dsi) { 4613 if (!is_dsi) {
4604 if (IS_CHERRYVIEW(dev)) 4614 if (IS_CHERRYVIEW(dev))
4605 chv_enable_pll(intel_crtc); 4615 chv_enable_pll(intel_crtc);
@@ -11087,6 +11097,22 @@ const char *intel_output_name(int output)
11087 return names[output]; 11097 return names[output];
11088} 11098}
11089 11099
11100static bool intel_crt_present(struct drm_device *dev)
11101{
11102 struct drm_i915_private *dev_priv = dev->dev_private;
11103
11104 if (IS_ULT(dev))
11105 return false;
11106
11107 if (IS_CHERRYVIEW(dev))
11108 return false;
11109
11110 if (IS_VALLEYVIEW(dev) && !dev_priv->vbt.int_crt_support)
11111 return false;
11112
11113 return true;
11114}
11115
11090static void intel_setup_outputs(struct drm_device *dev) 11116static void intel_setup_outputs(struct drm_device *dev)
11091{ 11117{
11092 struct drm_i915_private *dev_priv = dev->dev_private; 11118 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -11095,7 +11121,7 @@ static void intel_setup_outputs(struct drm_device *dev)
11095 11121
11096 intel_lvds_init(dev); 11122 intel_lvds_init(dev);
11097 11123
11098 if (!IS_ULT(dev) && !IS_CHERRYVIEW(dev) && dev_priv->vbt.int_crt_support) 11124 if (intel_crt_present(dev))
11099 intel_crt_init(dev); 11125 intel_crt_init(dev);
11100 11126
11101 if (HAS_DDI(dev)) { 11127 if (HAS_DDI(dev)) {
@@ -12411,8 +12437,8 @@ intel_display_capture_error_state(struct drm_device *dev)
12411 12437
12412 for_each_pipe(i) { 12438 for_each_pipe(i) {
12413 error->pipe[i].power_domain_on = 12439 error->pipe[i].power_domain_on =
12414 intel_display_power_enabled_sw(dev_priv, 12440 intel_display_power_enabled_unlocked(dev_priv,
12415 POWER_DOMAIN_PIPE(i)); 12441 POWER_DOMAIN_PIPE(i));
12416 if (!error->pipe[i].power_domain_on) 12442 if (!error->pipe[i].power_domain_on)
12417 continue; 12443 continue;
12418 12444
@@ -12447,7 +12473,7 @@ intel_display_capture_error_state(struct drm_device *dev)
12447 enum transcoder cpu_transcoder = transcoders[i]; 12473 enum transcoder cpu_transcoder = transcoders[i];
12448 12474
12449 error->transcoder[i].power_domain_on = 12475 error->transcoder[i].power_domain_on =
12450 intel_display_power_enabled_sw(dev_priv, 12476 intel_display_power_enabled_unlocked(dev_priv,
12451 POWER_DOMAIN_TRANSCODER(cpu_transcoder)); 12477 POWER_DOMAIN_TRANSCODER(cpu_transcoder));
12452 if (!error->transcoder[i].power_domain_on) 12478 if (!error->transcoder[i].power_domain_on)
12453 continue; 12479 continue;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index bda0ae3d80cc..eaa27ee9e367 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -950,8 +950,8 @@ int intel_power_domains_init(struct drm_i915_private *);
950void intel_power_domains_remove(struct drm_i915_private *); 950void intel_power_domains_remove(struct drm_i915_private *);
951bool intel_display_power_enabled(struct drm_i915_private *dev_priv, 951bool intel_display_power_enabled(struct drm_i915_private *dev_priv,
952 enum intel_display_power_domain domain); 952 enum intel_display_power_domain domain);
953bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, 953bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv,
954 enum intel_display_power_domain domain); 954 enum intel_display_power_domain domain);
955void intel_display_power_get(struct drm_i915_private *dev_priv, 955void intel_display_power_get(struct drm_i915_private *dev_priv,
956 enum intel_display_power_domain domain); 956 enum intel_display_power_domain domain);
957void intel_display_power_put(struct drm_i915_private *dev_priv, 957void intel_display_power_put(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 54242e4f6f4c..ee72807069e4 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3209,6 +3209,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
3209*/ 3209*/
3210static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) 3210static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
3211{ 3211{
3212 struct drm_device *dev = dev_priv->dev;
3213
3214 /* Latest VLV doesn't need to force the gfx clock */
3215 if (dev->pdev->revision >= 0xd) {
3216 valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit);
3217 return;
3218 }
3219
3212 /* 3220 /*
3213 * When we are idle. Drop to min voltage state. 3221 * When we are idle. Drop to min voltage state.
3214 */ 3222 */
@@ -5603,8 +5611,8 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv,
5603 (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); 5611 (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED);
5604} 5612}
5605 5613
5606bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, 5614bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv,
5607 enum intel_display_power_domain domain) 5615 enum intel_display_power_domain domain)
5608{ 5616{
5609 struct i915_power_domains *power_domains; 5617 struct i915_power_domains *power_domains;
5610 struct i915_power_well *power_well; 5618 struct i915_power_well *power_well;
@@ -5615,16 +5623,19 @@ bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv,
5615 return false; 5623 return false;
5616 5624
5617 power_domains = &dev_priv->power_domains; 5625 power_domains = &dev_priv->power_domains;
5626
5618 is_enabled = true; 5627 is_enabled = true;
5628
5619 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { 5629 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) {
5620 if (power_well->always_on) 5630 if (power_well->always_on)
5621 continue; 5631 continue;
5622 5632
5623 if (!power_well->count) { 5633 if (!power_well->hw_enabled) {
5624 is_enabled = false; 5634 is_enabled = false;
5625 break; 5635 break;
5626 } 5636 }
5627 } 5637 }
5638
5628 return is_enabled; 5639 return is_enabled;
5629} 5640}
5630 5641
@@ -5632,30 +5643,15 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv,
5632 enum intel_display_power_domain domain) 5643 enum intel_display_power_domain domain)
5633{ 5644{
5634 struct i915_power_domains *power_domains; 5645 struct i915_power_domains *power_domains;
5635 struct i915_power_well *power_well; 5646 bool ret;
5636 bool is_enabled;
5637 int i;
5638
5639 if (dev_priv->pm.suspended)
5640 return false;
5641 5647
5642 power_domains = &dev_priv->power_domains; 5648 power_domains = &dev_priv->power_domains;
5643 5649
5644 is_enabled = true;
5645
5646 mutex_lock(&power_domains->lock); 5650 mutex_lock(&power_domains->lock);
5647 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { 5651 ret = intel_display_power_enabled_unlocked(dev_priv, domain);
5648 if (power_well->always_on)
5649 continue;
5650
5651 if (!power_well->ops->is_enabled(dev_priv, power_well)) {
5652 is_enabled = false;
5653 break;
5654 }
5655 }
5656 mutex_unlock(&power_domains->lock); 5652 mutex_unlock(&power_domains->lock);
5657 5653
5658 return is_enabled; 5654 return ret;
5659} 5655}
5660 5656
5661/* 5657/*
@@ -5976,6 +5972,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv,
5976 if (!power_well->count++) { 5972 if (!power_well->count++) {
5977 DRM_DEBUG_KMS("enabling %s\n", power_well->name); 5973 DRM_DEBUG_KMS("enabling %s\n", power_well->name);
5978 power_well->ops->enable(dev_priv, power_well); 5974 power_well->ops->enable(dev_priv, power_well);
5975 power_well->hw_enabled = true;
5979 } 5976 }
5980 5977
5981 check_power_well_state(dev_priv, power_well); 5978 check_power_well_state(dev_priv, power_well);
@@ -6005,6 +6002,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
6005 6002
6006 if (!--power_well->count && i915.disable_power_well) { 6003 if (!--power_well->count && i915.disable_power_well) {
6007 DRM_DEBUG_KMS("disabling %s\n", power_well->name); 6004 DRM_DEBUG_KMS("disabling %s\n", power_well->name);
6005 power_well->hw_enabled = false;
6008 power_well->ops->disable(dev_priv, power_well); 6006 power_well->ops->disable(dev_priv, power_well);
6009 } 6007 }
6010 6008
@@ -6048,6 +6046,27 @@ int i915_release_power_well(void)
6048} 6046}
6049EXPORT_SYMBOL_GPL(i915_release_power_well); 6047EXPORT_SYMBOL_GPL(i915_release_power_well);
6050 6048
6049/*
6050 * Private interface for the audio driver to get CDCLK in kHz.
6051 *
6052 * Caller must request power well using i915_request_power_well() prior to
6053 * making the call.
6054 */
6055int i915_get_cdclk_freq(void)
6056{
6057 struct drm_i915_private *dev_priv;
6058
6059 if (!hsw_pwr)
6060 return -ENODEV;
6061
6062 dev_priv = container_of(hsw_pwr, struct drm_i915_private,
6063 power_domains);
6064
6065 return intel_ddi_get_cdclk_freq(dev_priv);
6066}
6067EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
6068
6069
6051#define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) 6070#define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
6052 6071
6053#define HSW_ALWAYS_ON_POWER_DOMAINS ( \ 6072#define HSW_ALWAYS_ON_POWER_DOMAINS ( \
@@ -6267,8 +6286,11 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv)
6267 int i; 6286 int i;
6268 6287
6269 mutex_lock(&power_domains->lock); 6288 mutex_lock(&power_domains->lock);
6270 for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) 6289 for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) {
6271 power_well->ops->sync_hw(dev_priv, power_well); 6290 power_well->ops->sync_hw(dev_priv, power_well);
6291 power_well->hw_enabled = power_well->ops->is_enabled(dev_priv,
6292 power_well);
6293 }
6272 mutex_unlock(&power_domains->lock); 6294 mutex_unlock(&power_domains->lock);
6273} 6295}
6274 6296
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 1b66ddcdfb33..9a17b4e92ef4 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -691,6 +691,14 @@ intel_post_enable_primary(struct drm_crtc *crtc)
691 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 691 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
692 692
693 /* 693 /*
694 * BDW signals flip done immediately if the plane
695 * is disabled, even if the plane enable is already
696 * armed to occur at the next vblank :(
697 */
698 if (IS_BROADWELL(dev))
699 intel_wait_for_vblank(dev, intel_crtc->pipe);
700
701 /*
694 * FIXME IPS should be fine as long as one plane is 702 * FIXME IPS should be fine as long as one plane is
695 * enabled, but in practice it seems to have problems 703 * enabled, but in practice it seems to have problems
696 * when going from primary only to sprite only and vice 704 * when going from primary only to sprite only and vice
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index ae750f6928c1..7f7aadef8a82 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -277,6 +277,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
277 static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; 277 static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"};
278 static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; 278 static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"};
279 static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; 279 static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"};
280 static unsigned long hpd_clk_freq[] = {0, 19200000, 0};
280 static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; 281 static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"};
281 282
282 config.phy_init = hdmi_phy_8x74_init; 283 config.phy_init = hdmi_phy_8x74_init;
@@ -286,6 +287,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
286 config.pwr_reg_names = pwr_reg_names; 287 config.pwr_reg_names = pwr_reg_names;
287 config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); 288 config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names);
288 config.hpd_clk_names = hpd_clk_names; 289 config.hpd_clk_names = hpd_clk_names;
290 config.hpd_freq = hpd_clk_freq;
289 config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); 291 config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names);
290 config.pwr_clk_names = pwr_clk_names; 292 config.pwr_clk_names = pwr_clk_names;
291 config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); 293 config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names);
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
index 9fafee6a3e43..9d7723c6528a 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
@@ -87,6 +87,7 @@ struct hdmi_platform_config {
87 87
88 /* clks that need to be on for hpd: */ 88 /* clks that need to be on for hpd: */
89 const char **hpd_clk_names; 89 const char **hpd_clk_names;
90 const long unsigned *hpd_freq;
90 int hpd_clk_cnt; 91 int hpd_clk_cnt;
91 92
92 /* clks that need to be on for screen pwr (ie pixel clk): */ 93 /* clks that need to be on for screen pwr (ie pixel clk): */
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
index e56a6196867c..28f7e3ec6c28 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c
@@ -127,6 +127,14 @@ static int hpd_enable(struct hdmi_connector *hdmi_connector)
127 } 127 }
128 128
129 for (i = 0; i < config->hpd_clk_cnt; i++) { 129 for (i = 0; i < config->hpd_clk_cnt; i++) {
130 if (config->hpd_freq && config->hpd_freq[i]) {
131 ret = clk_set_rate(hdmi->hpd_clks[i],
132 config->hpd_freq[i]);
133 if (ret)
134 dev_warn(dev->dev, "failed to set clk %s (%d)\n",
135 config->hpd_clk_names[i], ret);
136 }
137
130 ret = clk_prepare_enable(hdmi->hpd_clks[i]); 138 ret = clk_prepare_enable(hdmi->hpd_clks[i]);
131 if (ret) { 139 if (ret) {
132 dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", 140 dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n",
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 42caf7fcb0b9..71510ee26e96 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -20,6 +20,10 @@
20#include "msm_mmu.h" 20#include "msm_mmu.h"
21#include "mdp5_kms.h" 21#include "mdp5_kms.h"
22 22
23static const char *iommu_ports[] = {
24 "mdp_0",
25};
26
23static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); 27static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev);
24 28
25static int mdp5_hw_init(struct msm_kms *kms) 29static int mdp5_hw_init(struct msm_kms *kms)
@@ -104,6 +108,12 @@ static void mdp5_preclose(struct msm_kms *kms, struct drm_file *file)
104static void mdp5_destroy(struct msm_kms *kms) 108static void mdp5_destroy(struct msm_kms *kms)
105{ 109{
106 struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); 110 struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
111 struct msm_mmu *mmu = mdp5_kms->mmu;
112
113 if (mmu) {
114 mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports));
115 mmu->funcs->destroy(mmu);
116 }
107 kfree(mdp5_kms); 117 kfree(mdp5_kms);
108} 118}
109 119
@@ -216,10 +226,6 @@ fail:
216 return ret; 226 return ret;
217} 227}
218 228
219static const char *iommu_ports[] = {
220 "mdp_0",
221};
222
223static int get_clk(struct platform_device *pdev, struct clk **clkp, 229static int get_clk(struct platform_device *pdev, struct clk **clkp,
224 const char *name) 230 const char *name)
225{ 231{
@@ -317,17 +323,23 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
317 mmu = msm_iommu_new(dev, config->iommu); 323 mmu = msm_iommu_new(dev, config->iommu);
318 if (IS_ERR(mmu)) { 324 if (IS_ERR(mmu)) {
319 ret = PTR_ERR(mmu); 325 ret = PTR_ERR(mmu);
326 dev_err(dev->dev, "failed to init iommu: %d\n", ret);
320 goto fail; 327 goto fail;
321 } 328 }
329
322 ret = mmu->funcs->attach(mmu, iommu_ports, 330 ret = mmu->funcs->attach(mmu, iommu_ports,
323 ARRAY_SIZE(iommu_ports)); 331 ARRAY_SIZE(iommu_ports));
324 if (ret) 332 if (ret) {
333 dev_err(dev->dev, "failed to attach iommu: %d\n", ret);
334 mmu->funcs->destroy(mmu);
325 goto fail; 335 goto fail;
336 }
326 } else { 337 } else {
327 dev_info(dev->dev, "no iommu, fallback to phys " 338 dev_info(dev->dev, "no iommu, fallback to phys "
328 "contig buffers for scanout\n"); 339 "contig buffers for scanout\n");
329 mmu = NULL; 340 mmu = NULL;
330 } 341 }
342 mdp5_kms->mmu = mmu;
331 343
332 mdp5_kms->id = msm_register_mmu(dev, mmu); 344 mdp5_kms->id = msm_register_mmu(dev, mmu);
333 if (mdp5_kms->id < 0) { 345 if (mdp5_kms->id < 0) {
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h
index c8b1a2522c25..6e981b692d1d 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h
@@ -33,6 +33,7 @@ struct mdp5_kms {
33 33
34 /* mapper-id used to request GEM buffer mapped for scanout: */ 34 /* mapper-id used to request GEM buffer mapped for scanout: */
35 int id; 35 int id;
36 struct msm_mmu *mmu;
36 37
37 /* for tracking smp allocation amongst pipes: */ 38 /* for tracking smp allocation amongst pipes: */
38 mdp5_smp_state_t smp_state; 39 mdp5_smp_state_t smp_state;
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 0d2562fb681e..9a5d87db5c23 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -159,7 +159,7 @@ static int msm_unload(struct drm_device *dev)
159static int get_mdp_ver(struct platform_device *pdev) 159static int get_mdp_ver(struct platform_device *pdev)
160{ 160{
161#ifdef CONFIG_OF 161#ifdef CONFIG_OF
162 const static struct of_device_id match_types[] = { { 162 static const struct of_device_id match_types[] = { {
163 .compatible = "qcom,mdss_mdp", 163 .compatible = "qcom,mdss_mdp",
164 .data = (void *)5, 164 .data = (void *)5,
165 }, { 165 }, {
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index a752ab83b810..5107fc4826bc 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -59,7 +59,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
59 struct drm_framebuffer *fb = NULL; 59 struct drm_framebuffer *fb = NULL;
60 struct fb_info *fbi = NULL; 60 struct fb_info *fbi = NULL;
61 struct drm_mode_fb_cmd2 mode_cmd = {0}; 61 struct drm_mode_fb_cmd2 mode_cmd = {0};
62 dma_addr_t paddr; 62 uint32_t paddr;
63 int ret, size; 63 int ret, size;
64 64
65 sizes->surface_bpp = 32; 65 sizes->surface_bpp = 32;
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index bb8026daebc9..690d7e7b6d1e 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -278,6 +278,7 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id,
278 uint32_t *iova) 278 uint32_t *iova)
279{ 279{
280 struct msm_gem_object *msm_obj = to_msm_bo(obj); 280 struct msm_gem_object *msm_obj = to_msm_bo(obj);
281 struct drm_device *dev = obj->dev;
281 int ret = 0; 282 int ret = 0;
282 283
283 if (!msm_obj->domain[id].iova) { 284 if (!msm_obj->domain[id].iova) {
@@ -285,6 +286,11 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id,
285 struct msm_mmu *mmu = priv->mmus[id]; 286 struct msm_mmu *mmu = priv->mmus[id];
286 struct page **pages = get_pages(obj); 287 struct page **pages = get_pages(obj);
287 288
289 if (!mmu) {
290 dev_err(dev->dev, "null MMU pointer\n");
291 return -EINVAL;
292 }
293
288 if (IS_ERR(pages)) 294 if (IS_ERR(pages))
289 return PTR_ERR(pages); 295 return PTR_ERR(pages);
290 296
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 92b745986231..4b2ad9181edf 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -28,7 +28,7 @@ static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev,
28 unsigned long iova, int flags, void *arg) 28 unsigned long iova, int flags, void *arg)
29{ 29{
30 DBG("*** fault: iova=%08lx, flags=%d", iova, flags); 30 DBG("*** fault: iova=%08lx, flags=%d", iova, flags);
31 return 0; 31 return -ENOSYS;
32} 32}
33 33
34static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) 34static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
@@ -40,8 +40,10 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
40 for (i = 0; i < cnt; i++) { 40 for (i = 0; i < cnt; i++) {
41 struct device *msm_iommu_get_ctx(const char *ctx_name); 41 struct device *msm_iommu_get_ctx(const char *ctx_name);
42 struct device *ctx = msm_iommu_get_ctx(names[i]); 42 struct device *ctx = msm_iommu_get_ctx(names[i]);
43 if (IS_ERR_OR_NULL(ctx)) 43 if (IS_ERR_OR_NULL(ctx)) {
44 dev_warn(dev->dev, "couldn't get %s context", names[i]);
44 continue; 45 continue;
46 }
45 ret = iommu_attach_device(iommu->domain, ctx); 47 ret = iommu_attach_device(iommu->domain, ctx);
46 if (ret) { 48 if (ret) {
47 dev_warn(dev->dev, "could not attach iommu to %s", names[i]); 49 dev_warn(dev->dev, "could not attach iommu to %s", names[i]);
@@ -52,6 +54,20 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
52 return 0; 54 return 0;
53} 55}
54 56
57static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt)
58{
59 struct msm_iommu *iommu = to_msm_iommu(mmu);
60 int i;
61
62 for (i = 0; i < cnt; i++) {
63 struct device *msm_iommu_get_ctx(const char *ctx_name);
64 struct device *ctx = msm_iommu_get_ctx(names[i]);
65 if (IS_ERR_OR_NULL(ctx))
66 continue;
67 iommu_detach_device(iommu->domain, ctx);
68 }
69}
70
55static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, 71static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
56 struct sg_table *sgt, unsigned len, int prot) 72 struct sg_table *sgt, unsigned len, int prot)
57{ 73{
@@ -110,7 +126,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
110 126
111 VERB("unmap[%d]: %08x(%x)", i, iova, bytes); 127 VERB("unmap[%d]: %08x(%x)", i, iova, bytes);
112 128
113 BUG_ON(!IS_ALIGNED(bytes, PAGE_SIZE)); 129 BUG_ON(!PAGE_ALIGNED(bytes));
114 130
115 da += bytes; 131 da += bytes;
116 } 132 }
@@ -127,6 +143,7 @@ static void msm_iommu_destroy(struct msm_mmu *mmu)
127 143
128static const struct msm_mmu_funcs funcs = { 144static const struct msm_mmu_funcs funcs = {
129 .attach = msm_iommu_attach, 145 .attach = msm_iommu_attach,
146 .detach = msm_iommu_detach,
130 .map = msm_iommu_map, 147 .map = msm_iommu_map,
131 .unmap = msm_iommu_unmap, 148 .unmap = msm_iommu_unmap,
132 .destroy = msm_iommu_destroy, 149 .destroy = msm_iommu_destroy,
diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h
index 030324482b4a..21da6d154f71 100644
--- a/drivers/gpu/drm/msm/msm_mmu.h
+++ b/drivers/gpu/drm/msm/msm_mmu.h
@@ -22,6 +22,7 @@
22 22
23struct msm_mmu_funcs { 23struct msm_mmu_funcs {
24 int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); 24 int (*attach)(struct msm_mmu *mmu, const char **names, int cnt);
25 void (*detach)(struct msm_mmu *mmu, const char **names, int cnt);
25 int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, 26 int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt,
26 unsigned len, int prot); 27 unsigned len, int prot);
27 int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, 28 int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt,
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index c5b1f2da3954..35f4182c63b6 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -403,16 +403,18 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
403{ 403{
404 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; 404 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv;
405 u8 msg[DP_DPCD_SIZE]; 405 u8 msg[DP_DPCD_SIZE];
406 int ret, i; 406 int ret;
407
408 char dpcd_hex_dump[DP_DPCD_SIZE * 3];
407 409
408 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, 410 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
409 DP_DPCD_SIZE); 411 DP_DPCD_SIZE);
410 if (ret > 0) { 412 if (ret > 0) {
411 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); 413 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
412 DRM_DEBUG_KMS("DPCD: "); 414
413 for (i = 0; i < DP_DPCD_SIZE; i++) 415 hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd),
414 DRM_DEBUG_KMS("%02x ", msg[i]); 416 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false);
415 DRM_DEBUG_KMS("\n"); 417 DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
416 418
417 radeon_dp_probe_oui(radeon_connector); 419 radeon_dp_probe_oui(radeon_connector);
418 420
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h
index ae88660f34ea..0c6e1b55d968 100644
--- a/drivers/gpu/drm/radeon/cikd.h
+++ b/drivers/gpu/drm/radeon/cikd.h
@@ -1752,12 +1752,12 @@
1752#define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ 1752#define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */
1753#define EOP_TCL1_ACTION_EN (1 << 16) 1753#define EOP_TCL1_ACTION_EN (1 << 16)
1754#define EOP_TC_ACTION_EN (1 << 17) /* L2 */ 1754#define EOP_TC_ACTION_EN (1 << 17) /* L2 */
1755#define EOP_TCL2_VOLATILE (1 << 24)
1755#define EOP_CACHE_POLICY(x) ((x) << 25) 1756#define EOP_CACHE_POLICY(x) ((x) << 25)
1756 /* 0 - LRU 1757 /* 0 - LRU
1757 * 1 - Stream 1758 * 1 - Stream
1758 * 2 - Bypass 1759 * 2 - Bypass
1759 */ 1760 */
1760#define EOP_TCL2_VOLATILE (1 << 27)
1761#define DATA_SEL(x) ((x) << 29) 1761#define DATA_SEL(x) ((x) << 29)
1762 /* 0 - discard 1762 /* 0 - discard
1763 * 1 - send low 32bit data 1763 * 1 - send low 32bit data
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 5a9a5f4d7888..47d31e915758 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -1551,7 +1551,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev,
1551 1551
1552 table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; 1552 table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0;
1553 table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 1553 table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] =
1554 cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); 1554 cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
1555 } 1555 }
1556 1556
1557 return 0; 1557 return 0;
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 3f6e817d97ee..9ef8c38f2d66 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2726,7 +2726,7 @@ int kv_dpm_init(struct radeon_device *rdev)
2726 pi->caps_sclk_ds = true; 2726 pi->caps_sclk_ds = true;
2727 pi->enable_auto_thermal_throttling = true; 2727 pi->enable_auto_thermal_throttling = true;
2728 pi->disable_nb_ps3_in_battery = false; 2728 pi->disable_nb_ps3_in_battery = false;
2729 pi->bapm_enable = false; 2729 pi->bapm_enable = true;
2730 pi->voltage_drop_t = 0; 2730 pi->voltage_drop_t = 0;
2731 pi->caps_sclk_throttle_low_notification = false; 2731 pi->caps_sclk_throttle_low_notification = false;
2732 pi->caps_fps = false; /* true? */ 2732 pi->caps_fps = false; /* true? */
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 004c931606c4..01fc4888e6fe 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -1315,7 +1315,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev,
1315 1315
1316 table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; 1316 table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0;
1317 table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 1317 table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] =
1318 cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); 1318 cpu_to_be32(eg_pi->vddci_voltage_table.mask_low);
1319 } 1319 }
1320} 1320}
1321 1321
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 4b0bbf88d5c0..29d9cc04c04e 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -102,6 +102,7 @@ extern int radeon_runtime_pm;
102extern int radeon_hard_reset; 102extern int radeon_hard_reset;
103extern int radeon_vm_size; 103extern int radeon_vm_size;
104extern int radeon_vm_block_size; 104extern int radeon_vm_block_size;
105extern int radeon_deep_color;
105 106
106/* 107/*
107 * Copy from radeon_drv.h so we don't have to include both and have conflicting 108 * Copy from radeon_drv.h so we don't have to include both and have conflicting
@@ -749,10 +750,6 @@ union radeon_irq_stat_regs {
749 struct cik_irq_stat_regs cik; 750 struct cik_irq_stat_regs cik;
750}; 751};
751 752
752#define RADEON_MAX_HPD_PINS 7
753#define RADEON_MAX_CRTCS 6
754#define RADEON_MAX_AFMT_BLOCKS 7
755
756struct radeon_irq { 753struct radeon_irq {
757 bool installed; 754 bool installed;
758 spinlock_t lock; 755 spinlock_t lock;
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 30844814c25a..173f378428a9 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1227,11 +1227,19 @@ bool radeon_atom_get_clock_info(struct drm_device *dev)
1227 rdev->clock.default_dispclk = 1227 rdev->clock.default_dispclk =
1228 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); 1228 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq);
1229 if (rdev->clock.default_dispclk == 0) { 1229 if (rdev->clock.default_dispclk == 0) {
1230 if (ASIC_IS_DCE5(rdev)) 1230 if (ASIC_IS_DCE6(rdev))
1231 rdev->clock.default_dispclk = 60000; /* 600 Mhz */
1232 else if (ASIC_IS_DCE5(rdev))
1231 rdev->clock.default_dispclk = 54000; /* 540 Mhz */ 1233 rdev->clock.default_dispclk = 54000; /* 540 Mhz */
1232 else 1234 else
1233 rdev->clock.default_dispclk = 60000; /* 600 Mhz */ 1235 rdev->clock.default_dispclk = 60000; /* 600 Mhz */
1234 } 1236 }
1237 /* set a reasonable default for DP */
1238 if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) {
1239 DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n",
1240 rdev->clock.default_dispclk / 100);
1241 rdev->clock.default_dispclk = 60000;
1242 }
1235 rdev->clock.dp_extclk = 1243 rdev->clock.dp_extclk =
1236 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); 1244 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq);
1237 rdev->clock.current_dispclk = rdev->clock.default_dispclk; 1245 rdev->clock.current_dispclk = rdev->clock.default_dispclk;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 1b9177ed181f..44831197e82e 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -199,6 +199,9 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)
199 } 199 }
200 } 200 }
201 201
202 if ((radeon_deep_color == 0) && (bpc > 8))
203 bpc = 8;
204
202 DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", 205 DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n",
203 connector->name, connector->display_info.bpc, bpc); 206 connector->name, connector->display_info.bpc, bpc);
204 207
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 8fc362aa6a1a..13896edcf0b6 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -285,7 +285,6 @@ static void radeon_unpin_work_func(struct work_struct *__work)
285void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) 285void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)
286{ 286{
287 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; 287 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
288 struct radeon_flip_work *work;
289 unsigned long flags; 288 unsigned long flags;
290 u32 update_pending; 289 u32 update_pending;
291 int vpos, hpos; 290 int vpos, hpos;
@@ -295,8 +294,11 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)
295 return; 294 return;
296 295
297 spin_lock_irqsave(&rdev->ddev->event_lock, flags); 296 spin_lock_irqsave(&rdev->ddev->event_lock, flags);
298 work = radeon_crtc->flip_work; 297 if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) {
299 if (work == NULL) { 298 DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != "
299 "RADEON_FLIP_SUBMITTED(%d)\n",
300 radeon_crtc->flip_status,
301 RADEON_FLIP_SUBMITTED);
300 spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); 302 spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
301 return; 303 return;
302 } 304 }
@@ -344,12 +346,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
344 346
345 spin_lock_irqsave(&rdev->ddev->event_lock, flags); 347 spin_lock_irqsave(&rdev->ddev->event_lock, flags);
346 work = radeon_crtc->flip_work; 348 work = radeon_crtc->flip_work;
347 if (work == NULL) { 349 if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) {
350 DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != "
351 "RADEON_FLIP_SUBMITTED(%d)\n",
352 radeon_crtc->flip_status,
353 RADEON_FLIP_SUBMITTED);
348 spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); 354 spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);
349 return; 355 return;
350 } 356 }
351 357
352 /* Pageflip completed. Clean up. */ 358 /* Pageflip completed. Clean up. */
359 radeon_crtc->flip_status = RADEON_FLIP_NONE;
353 radeon_crtc->flip_work = NULL; 360 radeon_crtc->flip_work = NULL;
354 361
355 /* wakeup userspace */ 362 /* wakeup userspace */
@@ -476,6 +483,7 @@ static void radeon_flip_work_func(struct work_struct *__work)
476 /* do the flip (mmio) */ 483 /* do the flip (mmio) */
477 radeon_page_flip(rdev, radeon_crtc->crtc_id, base); 484 radeon_page_flip(rdev, radeon_crtc->crtc_id, base);
478 485
486 radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED;
479 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 487 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
480 up_read(&rdev->exclusive_lock); 488 up_read(&rdev->exclusive_lock);
481 489
@@ -544,7 +552,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
544 /* We borrow the event spin lock for protecting flip_work */ 552 /* We borrow the event spin lock for protecting flip_work */
545 spin_lock_irqsave(&crtc->dev->event_lock, flags); 553 spin_lock_irqsave(&crtc->dev->event_lock, flags);
546 554
547 if (radeon_crtc->flip_work) { 555 if (radeon_crtc->flip_status != RADEON_FLIP_NONE) {
548 DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); 556 DRM_DEBUG_DRIVER("flip queue: crtc already busy\n");
549 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 557 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
550 drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); 558 drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
@@ -552,6 +560,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc,
552 kfree(work); 560 kfree(work);
553 return -EBUSY; 561 return -EBUSY;
554 } 562 }
563 radeon_crtc->flip_status = RADEON_FLIP_PENDING;
555 radeon_crtc->flip_work = work; 564 radeon_crtc->flip_work = work;
556 565
557 /* update crtc fb */ 566 /* update crtc fb */
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 6e3017413386..cb1421369e3a 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -175,6 +175,7 @@ int radeon_runtime_pm = -1;
175int radeon_hard_reset = 0; 175int radeon_hard_reset = 0;
176int radeon_vm_size = 4096; 176int radeon_vm_size = 4096;
177int radeon_vm_block_size = 9; 177int radeon_vm_block_size = 9;
178int radeon_deep_color = 0;
178 179
179MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); 180MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
180module_param_named(no_wb, radeon_no_wb, int, 0444); 181module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -248,6 +249,9 @@ module_param_named(vm_size, radeon_vm_size, int, 0444);
248MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); 249MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)");
249module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); 250module_param_named(vm_block_size, radeon_vm_block_size, int, 0444);
250 251
252MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))");
253module_param_named(deep_color, radeon_deep_color, int, 0444);
254
251static struct pci_device_id pciidlist[] = { 255static struct pci_device_id pciidlist[] = {
252 radeon_PCI_IDS 256 radeon_PCI_IDS
253}; 257};
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index ad0e4b8cc7e3..0592ddb0904b 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -46,6 +46,10 @@ struct radeon_device;
46#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) 46#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base)
47#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) 47#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base)
48 48
49#define RADEON_MAX_HPD_PINS 7
50#define RADEON_MAX_CRTCS 6
51#define RADEON_MAX_AFMT_BLOCKS 7
52
49enum radeon_rmx_type { 53enum radeon_rmx_type {
50 RMX_OFF, 54 RMX_OFF,
51 RMX_FULL, 55 RMX_FULL,
@@ -233,8 +237,8 @@ struct radeon_mode_info {
233 struct card_info *atom_card_info; 237 struct card_info *atom_card_info;
234 enum radeon_connector_table connector_table; 238 enum radeon_connector_table connector_table;
235 bool mode_config_initialized; 239 bool mode_config_initialized;
236 struct radeon_crtc *crtcs[6]; 240 struct radeon_crtc *crtcs[RADEON_MAX_CRTCS];
237 struct radeon_afmt *afmt[7]; 241 struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS];
238 /* DVI-I properties */ 242 /* DVI-I properties */
239 struct drm_property *coherent_mode_property; 243 struct drm_property *coherent_mode_property;
240 /* DAC enable load detect */ 244 /* DAC enable load detect */
@@ -302,6 +306,12 @@ struct radeon_atom_ss {
302 uint16_t amount; 306 uint16_t amount;
303}; 307};
304 308
309enum radeon_flip_status {
310 RADEON_FLIP_NONE,
311 RADEON_FLIP_PENDING,
312 RADEON_FLIP_SUBMITTED
313};
314
305struct radeon_crtc { 315struct radeon_crtc {
306 struct drm_crtc base; 316 struct drm_crtc base;
307 int crtc_id; 317 int crtc_id;
@@ -327,6 +337,7 @@ struct radeon_crtc {
327 /* page flipping */ 337 /* page flipping */
328 struct workqueue_struct *flip_queue; 338 struct workqueue_struct *flip_queue;
329 struct radeon_flip_work *flip_work; 339 struct radeon_flip_work *flip_work;
340 enum radeon_flip_status flip_status;
330 /* pll sharing */ 341 /* pll sharing */
331 struct radeon_atom_ss ss; 342 struct radeon_atom_ss ss;
332 bool ss_enabled; 343 bool ss_enabled;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 12c663e86ca1..e447e390d09a 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -73,8 +73,10 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev)
73 rdev->pm.dpm.ac_power = true; 73 rdev->pm.dpm.ac_power = true;
74 else 74 else
75 rdev->pm.dpm.ac_power = false; 75 rdev->pm.dpm.ac_power = false;
76 if (rdev->asic->dpm.enable_bapm) 76 if (rdev->family == CHIP_ARUBA) {
77 radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); 77 if (rdev->asic->dpm.enable_bapm)
78 radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power);
79 }
78 mutex_unlock(&rdev->pm.mutex); 80 mutex_unlock(&rdev->pm.mutex);
79 } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { 81 } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
80 if (rdev->pm.profile == PM_PROFILE_AUTO) { 82 if (rdev->pm.profile == PM_PROFILE_AUTO) {
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index 899d9126cad6..eecff6bbd341 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -495,7 +495,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev,
495 mutex_unlock(&vm->mutex); 495 mutex_unlock(&vm->mutex);
496 496
497 r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, 497 r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8,
498 RADEON_GPU_PAGE_SIZE, false, 498 RADEON_GPU_PAGE_SIZE, true,
499 RADEON_GEM_DOMAIN_VRAM, NULL, &pt); 499 RADEON_GEM_DOMAIN_VRAM, NULL, &pt);
500 if (r) 500 if (r)
501 return r; 501 return r;
@@ -992,7 +992,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
992 return -ENOMEM; 992 return -ENOMEM;
993 } 993 }
994 994
995 r = radeon_bo_create(rdev, pd_size, align, false, 995 r = radeon_bo_create(rdev, pd_size, align, true,
996 RADEON_GEM_DOMAIN_VRAM, NULL, 996 RADEON_GEM_DOMAIN_VRAM, NULL,
997 &vm->page_directory); 997 &vm->page_directory);
998 if (r) 998 if (r)
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c
index 2a2822c03329..20da6ff183df 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -1874,7 +1874,15 @@ int trinity_dpm_init(struct radeon_device *rdev)
1874 for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) 1874 for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++)
1875 pi->at[i] = TRINITY_AT_DFLT; 1875 pi->at[i] = TRINITY_AT_DFLT;
1876 1876
1877 pi->enable_bapm = false; 1877 /* There are stability issues reported on latops with
1878 * bapm installed when switching between AC and battery
1879 * power. At the same time, some desktop boards hang
1880 * if it's not enabled and dpm is enabled.
1881 */
1882 if (rdev->flags & RADEON_IS_MOBILITY)
1883 pi->enable_bapm = false;
1884 else
1885 pi->enable_bapm = true;
1878 pi->enable_nbps_policy = true; 1886 pi->enable_nbps_policy = true;
1879 pi->enable_sclk_ds = true; 1887 pi->enable_sclk_ds = true;
1880 pi->enable_gfx_power_gating = true; 1888 pi->enable_gfx_power_gating = true;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index a89ad938eacf..b031b48dbb3c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info)
179 vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); 179 vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset);
180 vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); 180 vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres);
181 vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); 181 vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres);
182 vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length);
183 vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); 182 vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
184 } 183 }
185 184
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 08531a128f53..02d3d85829f3 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1052,7 +1052,7 @@ config SENSORS_PC87427
1052 will be called pc87427. 1052 will be called pc87427.
1053 1053
1054config SENSORS_NTC_THERMISTOR 1054config SENSORS_NTC_THERMISTOR
1055 tristate "NTC thermistor support" 1055 tristate "NTC thermistor support from Murata"
1056 depends on !OF || IIO=n || IIO 1056 depends on !OF || IIO=n || IIO
1057 help 1057 help
1058 This driver supports NTC thermistors sensor reading and its 1058 This driver supports NTC thermistors sensor reading and its
@@ -1060,7 +1060,8 @@ config SENSORS_NTC_THERMISTOR
1060 send notifications about the temperature. 1060 send notifications about the temperature.
1061 1061
1062 Currently, this driver supports 1062 Currently, this driver supports
1063 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. 1063 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333
1064 from Murata.
1064 1065
1065 This driver can also be built as a module. If so, the module 1066 This driver can also be built as a module. If so, the module
1066 will be called ntc-thermistor. 1067 will be called ntc-thermistor.
@@ -1176,6 +1177,7 @@ config SENSORS_DME1737
1176config SENSORS_EMC1403 1177config SENSORS_EMC1403
1177 tristate "SMSC EMC1403/23 thermal sensor" 1178 tristate "SMSC EMC1403/23 thermal sensor"
1178 depends on I2C 1179 depends on I2C
1180 select REGMAP_I2C
1179 help 1181 help
1180 If you say yes here you get support for the SMSC EMC1403/23 1182 If you say yes here you get support for the SMSC EMC1403/23
1181 temperature monitoring chip. 1183 temperature monitoring chip.
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index ba35e4d530b5..2566c43dd1e9 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -538,7 +538,7 @@ static int gpio_fan_probe(struct platform_device *pdev)
538 538
539 /* Make this driver part of hwmon class. */ 539 /* Make this driver part of hwmon class. */
540 fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, 540 fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev,
541 "gpio-fan", fan_data, 541 "gpio_fan", fan_data,
542 gpio_fan_groups); 542 gpio_fan_groups);
543 if (IS_ERR(fan_data->hwmon_dev)) 543 if (IS_ERR(fan_data->hwmon_dev))
544 return PTR_ERR(fan_data->hwmon_dev); 544 return PTR_ERR(fan_data->hwmon_dev);
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index e76feb86a1d4..bdfbe9114889 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -163,6 +163,18 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
163} 163}
164 164
165static const struct of_device_id ntc_match[] = { 165static const struct of_device_id ntc_match[] = {
166 { .compatible = "murata,ncp15wb473",
167 .data = &ntc_thermistor_id[0] },
168 { .compatible = "murata,ncp18wb473",
169 .data = &ntc_thermistor_id[1] },
170 { .compatible = "murata,ncp21wb473",
171 .data = &ntc_thermistor_id[2] },
172 { .compatible = "murata,ncp03wb473",
173 .data = &ntc_thermistor_id[3] },
174 { .compatible = "murata,ncp15wl333",
175 .data = &ntc_thermistor_id[4] },
176
177 /* Usage of vendor name "ntc" is deprecated */
166 { .compatible = "ntc,ncp15wb473", 178 { .compatible = "ntc,ncp15wb473",
167 .data = &ntc_thermistor_id[0] }, 179 .data = &ntc_thermistor_id[0] },
168 { .compatible = "ntc,ncp18wb473", 180 { .compatible = "ntc,ncp18wb473",
@@ -534,7 +546,7 @@ static struct platform_driver ntc_thermistor_driver = {
534 546
535module_platform_driver(ntc_thermistor_driver); 547module_platform_driver(ntc_thermistor_driver);
536 548
537MODULE_DESCRIPTION("NTC Thermistor Driver"); 549MODULE_DESCRIPTION("NTC Thermistor Driver from Murata");
538MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); 550MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
539MODULE_LICENSE("GPL"); 551MODULE_LICENSE("GPL");
540MODULE_ALIAS("platform:ntc-thermistor"); 552MODULE_ALIAS("platform:ntc-thermistor");
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c
index 6ed76ceb9270..32487c19cbfc 100644
--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -249,7 +249,7 @@ static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \
249 int nr = to_sensor_dev_attr(attr)->index; \ 249 int nr = to_sensor_dev_attr(attr)->index; \
250 struct w83l786ng_data *data = w83l786ng_update_device(dev); \ 250 struct w83l786ng_data *data = w83l786ng_update_device(dev); \
251 return sprintf(buf, "%d\n", \ 251 return sprintf(buf, "%d\n", \
252 FAN_FROM_REG(data->fan[nr], DIV_FROM_REG(data->fan_div[nr]))); \ 252 FAN_FROM_REG(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \
253} 253}
254 254
255show_fan_reg(fan); 255show_fan_reg(fan);
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 7e08c601f66e..6cf9ee18a216 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -426,9 +426,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,
426 int ret; 426 int ret;
427 struct ad799x_state *st = iio_priv(indio_dev); 427 struct ad799x_state *st = iio_priv(indio_dev);
428 428
429 if (val < 0 || val > RES_MASK(chan->scan_type.realbits))
430 return -EINVAL;
431
429 mutex_lock(&indio_dev->mlock); 432 mutex_lock(&indio_dev->mlock);
430 ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), 433 ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
431 val); 434 val << chan->scan_type.shift);
432 mutex_unlock(&indio_dev->mlock); 435 mutex_unlock(&indio_dev->mlock);
433 436
434 return ret; 437 return ret;
@@ -451,7 +454,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev,
451 mutex_unlock(&indio_dev->mlock); 454 mutex_unlock(&indio_dev->mlock);
452 if (ret < 0) 455 if (ret < 0)
453 return ret; 456 return ret;
454 *val = valin; 457 *val = (valin >> chan->scan_type.shift) &
458 RES_MASK(chan->scan_type.realbits);
455 459
456 return IIO_VAL_INT; 460 return IIO_VAL_INT;
457} 461}
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index d833d55052ea..c7497009d60a 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
183 else if (name && index >= 0) { 183 else if (name && index >= 0) {
184 pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", 184 pr_err("ERROR: could not get IIO channel %s:%s(%i)\n",
185 np->full_name, name ? name : "", index); 185 np->full_name, name ? name : "", index);
186 return chan; 186 return NULL;
187 } 187 }
188 188
189 /* 189 /*
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
193 */ 193 */
194 np = np->parent; 194 np = np->parent;
195 if (np && !of_get_property(np, "io-channel-ranges", NULL)) 195 if (np && !of_get_property(np, "io-channel-ranges", NULL))
196 break; 196 return NULL;
197 } 197 }
198
198 return chan; 199 return chan;
199} 200}
200 201
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
317 if (channel != NULL) 318 if (channel != NULL)
318 return channel; 319 return channel;
319 } 320 }
321
320 return iio_channel_get_sys(name, channel_name); 322 return iio_channel_get_sys(name, channel_name);
321} 323}
322EXPORT_SYMBOL_GPL(iio_channel_get); 324EXPORT_SYMBOL_GPL(iio_channel_get);
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index d4daa05efe60..499b4366a98d 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -45,7 +45,7 @@ struct pri_queue {
45struct pasid_state { 45struct pasid_state {
46 struct list_head list; /* For global state-list */ 46 struct list_head list; /* For global state-list */
47 atomic_t count; /* Reference count */ 47 atomic_t count; /* Reference count */
48 atomic_t mmu_notifier_count; /* Counting nested mmu_notifier 48 unsigned mmu_notifier_count; /* Counting nested mmu_notifier
49 calls */ 49 calls */
50 struct task_struct *task; /* Task bound to this PASID */ 50 struct task_struct *task; /* Task bound to this PASID */
51 struct mm_struct *mm; /* mm_struct for the faults */ 51 struct mm_struct *mm; /* mm_struct for the faults */
@@ -53,7 +53,8 @@ struct pasid_state {
53 struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ 53 struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */
54 struct device_state *device_state; /* Link to our device_state */ 54 struct device_state *device_state; /* Link to our device_state */
55 int pasid; /* PASID index */ 55 int pasid; /* PASID index */
56 spinlock_t lock; /* Protect pri_queues */ 56 spinlock_t lock; /* Protect pri_queues and
57 mmu_notifer_count */
57 wait_queue_head_t wq; /* To wait for count == 0 */ 58 wait_queue_head_t wq; /* To wait for count == 0 */
58}; 59};
59 60
@@ -431,15 +432,19 @@ static void mn_invalidate_range_start(struct mmu_notifier *mn,
431{ 432{
432 struct pasid_state *pasid_state; 433 struct pasid_state *pasid_state;
433 struct device_state *dev_state; 434 struct device_state *dev_state;
435 unsigned long flags;
434 436
435 pasid_state = mn_to_state(mn); 437 pasid_state = mn_to_state(mn);
436 dev_state = pasid_state->device_state; 438 dev_state = pasid_state->device_state;
437 439
438 if (atomic_add_return(1, &pasid_state->mmu_notifier_count) == 1) { 440 spin_lock_irqsave(&pasid_state->lock, flags);
441 if (pasid_state->mmu_notifier_count == 0) {
439 amd_iommu_domain_set_gcr3(dev_state->domain, 442 amd_iommu_domain_set_gcr3(dev_state->domain,
440 pasid_state->pasid, 443 pasid_state->pasid,
441 __pa(empty_page_table)); 444 __pa(empty_page_table));
442 } 445 }
446 pasid_state->mmu_notifier_count += 1;
447 spin_unlock_irqrestore(&pasid_state->lock, flags);
443} 448}
444 449
445static void mn_invalidate_range_end(struct mmu_notifier *mn, 450static void mn_invalidate_range_end(struct mmu_notifier *mn,
@@ -448,15 +453,19 @@ static void mn_invalidate_range_end(struct mmu_notifier *mn,
448{ 453{
449 struct pasid_state *pasid_state; 454 struct pasid_state *pasid_state;
450 struct device_state *dev_state; 455 struct device_state *dev_state;
456 unsigned long flags;
451 457
452 pasid_state = mn_to_state(mn); 458 pasid_state = mn_to_state(mn);
453 dev_state = pasid_state->device_state; 459 dev_state = pasid_state->device_state;
454 460
455 if (atomic_dec_and_test(&pasid_state->mmu_notifier_count)) { 461 spin_lock_irqsave(&pasid_state->lock, flags);
462 pasid_state->mmu_notifier_count -= 1;
463 if (pasid_state->mmu_notifier_count == 0) {
456 amd_iommu_domain_set_gcr3(dev_state->domain, 464 amd_iommu_domain_set_gcr3(dev_state->domain,
457 pasid_state->pasid, 465 pasid_state->pasid,
458 __pa(pasid_state->mm->pgd)); 466 __pa(pasid_state->mm->pgd));
459 } 467 }
468 spin_unlock_irqrestore(&pasid_state->lock, flags);
460} 469}
461 470
462static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) 471static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm)
@@ -650,7 +659,6 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
650 goto out; 659 goto out;
651 660
652 atomic_set(&pasid_state->count, 1); 661 atomic_set(&pasid_state->count, 1);
653 atomic_set(&pasid_state->mmu_notifier_count, 0);
654 init_waitqueue_head(&pasid_state->wq); 662 init_waitqueue_head(&pasid_state->wq);
655 spin_lock_init(&pasid_state->lock); 663 spin_lock_init(&pasid_state->lock);
656 664
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6bb32773c3ac..51b6b77dc3e5 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3816,14 +3816,11 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
3816 ((void *)rmrr) + rmrr->header.length, 3816 ((void *)rmrr) + rmrr->header.length,
3817 rmrr->segment, rmrru->devices, 3817 rmrr->segment, rmrru->devices,
3818 rmrru->devices_cnt); 3818 rmrru->devices_cnt);
3819 if (ret > 0) 3819 if(ret < 0)
3820 break;
3821 else if(ret < 0)
3822 return ret; 3820 return ret;
3823 } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { 3821 } else if (info->event == BUS_NOTIFY_DEL_DEVICE) {
3824 if (dmar_remove_dev_scope(info, rmrr->segment, 3822 dmar_remove_dev_scope(info, rmrr->segment,
3825 rmrru->devices, rmrru->devices_cnt)) 3823 rmrru->devices, rmrru->devices_cnt);
3826 break;
3827 } 3824 }
3828 } 3825 }
3829 3826
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index c887e6eebc41..574aba0eba4e 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -334,6 +334,15 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask,
334 334
335static void armada_xp_mpic_smp_cpu_init(void) 335static void armada_xp_mpic_smp_cpu_init(void)
336{ 336{
337 u32 control;
338 int nr_irqs, i;
339
340 control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL);
341 nr_irqs = (control >> 2) & 0x3ff;
342
343 for (i = 0; i < nr_irqs; i++)
344 writel(i, per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS);
345
337 /* Clear pending IPIs */ 346 /* Clear pending IPIs */
338 writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); 347 writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
339 348
@@ -474,7 +483,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
474 struct device_node *parent) 483 struct device_node *parent)
475{ 484{
476 struct resource main_int_res, per_cpu_int_res; 485 struct resource main_int_res, per_cpu_int_res;
477 int parent_irq; 486 int parent_irq, nr_irqs, i;
478 u32 control; 487 u32 control;
479 488
480 BUG_ON(of_address_to_resource(node, 0, &main_int_res)); 489 BUG_ON(of_address_to_resource(node, 0, &main_int_res));
@@ -496,9 +505,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
496 BUG_ON(!per_cpu_int_base); 505 BUG_ON(!per_cpu_int_base);
497 506
498 control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); 507 control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL);
508 nr_irqs = (control >> 2) & 0x3ff;
509
510 for (i = 0; i < nr_irqs; i++)
511 writel(i, main_int_base + ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
499 512
500 armada_370_xp_mpic_domain = 513 armada_370_xp_mpic_domain =
501 irq_domain_add_linear(node, (control >> 2) & 0x3ff, 514 irq_domain_add_linear(node, nr_irqs,
502 &armada_370_xp_mpic_irq_ops, NULL); 515 &armada_370_xp_mpic_irq_ops, NULL);
503 516
504 BUG_ON(!armada_370_xp_mpic_domain); 517 BUG_ON(!armada_370_xp_mpic_domain);
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c
index 8ee2a36d5840..c15c840987d2 100644
--- a/drivers/irqchip/irq-brcmstb-l2.c
+++ b/drivers/irqchip/irq-brcmstb-l2.c
@@ -150,7 +150,7 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np,
150 150
151 /* Allocate a single Generic IRQ chip for this node */ 151 /* Allocate a single Generic IRQ chip for this node */
152 ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, 152 ret = irq_alloc_domain_generic_chips(data->domain, 32, 1,
153 np->full_name, handle_level_irq, clr, 0, 0); 153 np->full_name, handle_edge_irq, clr, 0, 0);
154 if (ret) { 154 if (ret) {
155 pr_err("failed to allocate generic irq chip\n"); 155 pr_err("failed to allocate generic irq chip\n");
156 goto out_free_domain; 156 goto out_free_domain;
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c
index 3fdda3a40269..6ce6bd3441bf 100644
--- a/drivers/irqchip/spear-shirq.c
+++ b/drivers/irqchip/spear-shirq.c
@@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = {
125}; 125};
126 126
127static struct spear_shirq spear320_shirq_ras3 = { 127static struct spear_shirq spear320_shirq_ras3 = {
128 .irq_nr = 3, 128 .irq_nr = 7,
129 .irq_bit_off = 0, 129 .irq_bit_off = 0,
130 .invalid_irq = 1, 130 .invalid_irq = 1,
131 .regs = { 131 .regs = {
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index d9edcc94c2a8..97465ac5a2d5 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -16,7 +16,7 @@ config ISDN_DRV_HISAX
16 also to the configuration option of the driver for your particular 16 also to the configuration option of the driver for your particular
17 card, below. 17 card, below.
18 18
19if ISDN_DRV_HISAX!=n 19if ISDN_DRV_HISAX
20 20
21comment "D-channel protocol features" 21comment "D-channel protocol features"
22 22
@@ -348,10 +348,6 @@ config HISAX_ENTERNOW_PCI
348 This enables HiSax support for the Formula-n enter:now PCI 348 This enables HiSax support for the Formula-n enter:now PCI
349 ISDN card. 349 ISDN card.
350 350
351endif
352
353if ISDN_DRV_HISAX
354
355config HISAX_DEBUG 351config HISAX_DEBUG
356 bool "HiSax debugging" 352 bool "HiSax debugging"
357 help 353 help
@@ -420,11 +416,6 @@ config HISAX_FRITZ_PCIPNP
420 (the latter also needs you to select "ISA Plug and Play support" 416 (the latter also needs you to select "ISA Plug and Play support"
421 from the menu "Plug and Play configuration") 417 from the menu "Plug and Play configuration")
422 418
423config HISAX_AVM_A1_PCMCIA
424 bool
425 depends on HISAX_AVM_A1_CS
426 default y
427
428endif 419endif
429 420
430endmenu 421endmenu
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 23b4a3b28dbc..4eab93aa570b 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -1257,7 +1257,8 @@ static unsigned int smu_fpoll(struct file *file, poll_table *wait)
1257 if (pp->busy && pp->cmd.status != 1) 1257 if (pp->busy && pp->cmd.status != 1)
1258 mask |= POLLIN; 1258 mask |= POLLIN;
1259 spin_unlock_irqrestore(&pp->lock, flags); 1259 spin_unlock_irqrestore(&pp->lock, flags);
1260 } if (pp->mode == smu_file_events) { 1260 }
1261 if (pp->mode == smu_file_events) {
1261 /* Not yet implemented */ 1262 /* Not yet implemented */
1262 } 1263 }
1263 return mask; 1264 return mask;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 34846856dbc6..32fc19c540d4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5599,7 +5599,7 @@ static int get_array_info(struct mddev * mddev, void __user * arg)
5599 if (mddev->in_sync) 5599 if (mddev->in_sync)
5600 info.state = (1<<MD_SB_CLEAN); 5600 info.state = (1<<MD_SB_CLEAN);
5601 if (mddev->bitmap && mddev->bitmap_info.offset) 5601 if (mddev->bitmap && mddev->bitmap_info.offset)
5602 info.state = (1<<MD_SB_BITMAP_PRESENT); 5602 info.state |= (1<<MD_SB_BITMAP_PRESENT);
5603 info.active_disks = insync; 5603 info.active_disks = insync;
5604 info.working_disks = working; 5604 info.working_disks = working;
5605 info.failed_disks = failed; 5605 info.failed_disks = failed;
@@ -7501,6 +7501,19 @@ void md_do_sync(struct md_thread *thread)
7501 rdev->recovery_offset < j) 7501 rdev->recovery_offset < j)
7502 j = rdev->recovery_offset; 7502 j = rdev->recovery_offset;
7503 rcu_read_unlock(); 7503 rcu_read_unlock();
7504
7505 /* If there is a bitmap, we need to make sure all
7506 * writes that started before we added a spare
7507 * complete before we start doing a recovery.
7508 * Otherwise the write might complete and (via
7509 * bitmap_endwrite) set a bit in the bitmap after the
7510 * recovery has checked that bit and skipped that
7511 * region.
7512 */
7513 if (mddev->bitmap) {
7514 mddev->pers->quiesce(mddev, 1);
7515 mddev->pers->quiesce(mddev, 0);
7516 }
7504 } 7517 }
7505 7518
7506 printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); 7519 printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev));
diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c
index 2a635b6fdaf7..c880ba685754 100644
--- a/drivers/memstick/host/rtsx_pci_ms.c
+++ b/drivers/memstick/host/rtsx_pci_ms.c
@@ -601,6 +601,7 @@ static int rtsx_pci_ms_drv_remove(struct platform_device *pdev)
601 pcr->slots[RTSX_MS_CARD].card_event = NULL; 601 pcr->slots[RTSX_MS_CARD].card_event = NULL;
602 msh = host->msh; 602 msh = host->msh;
603 host->eject = true; 603 host->eject = true;
604 cancel_work_sync(&host->handle_req);
604 605
605 mutex_lock(&host->host_mutex); 606 mutex_lock(&host->host_mutex);
606 if (host->req) { 607 if (host->req) {
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index ee8204cc31e9..6cc4b6acc22a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -760,6 +760,7 @@ config MFD_SYSCON
760config MFD_DAVINCI_VOICECODEC 760config MFD_DAVINCI_VOICECODEC
761 tristate 761 tristate
762 select MFD_CORE 762 select MFD_CORE
763 select REGMAP_MMIO
763 764
764config MFD_TI_AM335X_TSCADC 765config MFD_TI_AM335X_TSCADC
765 tristate "TI ADC / Touch Screen chip support" 766 tristate "TI ADC / Touch Screen chip support"
@@ -1225,7 +1226,7 @@ config MFD_WM8994
1225 functionaltiy of the device other drivers must be enabled. 1226 functionaltiy of the device other drivers must be enabled.
1226 1227
1227config MFD_STW481X 1228config MFD_STW481X
1228 bool "Support for ST Microelectronics STw481x" 1229 tristate "Support for ST Microelectronics STw481x"
1229 depends on I2C && ARCH_NOMADIK 1230 depends on I2C && ARCH_NOMADIK
1230 select REGMAP_I2C 1231 select REGMAP_I2C
1231 select MFD_CORE 1232 select MFD_CORE
@@ -1248,7 +1249,7 @@ config MCP_SA11X0
1248 1249
1249# Chip drivers 1250# Chip drivers
1250config MCP_UCB1200 1251config MCP_UCB1200
1251 bool "Support for UCB1200 / UCB1300" 1252 tristate "Support for UCB1200 / UCB1300"
1252 depends on MCP_SA11X0 1253 depends on MCP_SA11X0
1253 select MCP 1254 select MCP
1254 1255
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index a8ee4a36a1d8..cf2e6a198c6b 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -591,7 +591,7 @@ static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np)
591 num_irqs = AB8500_NR_IRQS; 591 num_irqs = AB8500_NR_IRQS;
592 592
593 /* If ->irq_base is zero this will give a linear mapping */ 593 /* If ->irq_base is zero this will give a linear mapping */
594 ab8500->domain = irq_domain_add_simple(NULL, 594 ab8500->domain = irq_domain_add_simple(ab8500->dev->of_node,
595 num_irqs, 0, 595 num_irqs, 0,
596 &ab8500_irq_ops, ab8500); 596 &ab8500_irq_ops, ab8500);
597 597
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index a43d0c467274..ee9402324a23 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -54,7 +54,7 @@ config AD525X_DPOT_SPI
54config ATMEL_PWM 54config ATMEL_PWM
55 tristate "Atmel AT32/AT91 PWM support" 55 tristate "Atmel AT32/AT91 PWM support"
56 depends on HAVE_CLK 56 depends on HAVE_CLK
57 depends on AVR32 || AT91SAM9263 || AT91SAM9RL || AT91SAM9G45 57 depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45
58 help 58 help
59 This option enables device driver support for the PWM channels 59 This option enables device driver support for the PWM channels
60 on certain Atmel processors. Pulse Width Modulation is used for 60 on certain Atmel processors. Pulse Width Modulation is used for
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 04f35f960cb8..3a451b6cd3d5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1025,10 +1025,14 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
1025 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ 1025 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1026 NETIF_F_HIGHDMA | NETIF_F_LRO) 1026 NETIF_F_HIGHDMA | NETIF_F_LRO)
1027 1027
1028#define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\
1029 NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL)
1030
1028static void bond_compute_features(struct bonding *bond) 1031static void bond_compute_features(struct bonding *bond)
1029{ 1032{
1030 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; 1033 unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE;
1031 netdev_features_t vlan_features = BOND_VLAN_FEATURES; 1034 netdev_features_t vlan_features = BOND_VLAN_FEATURES;
1035 netdev_features_t enc_features = BOND_ENC_FEATURES;
1032 struct net_device *bond_dev = bond->dev; 1036 struct net_device *bond_dev = bond->dev;
1033 struct list_head *iter; 1037 struct list_head *iter;
1034 struct slave *slave; 1038 struct slave *slave;
@@ -1044,6 +1048,9 @@ static void bond_compute_features(struct bonding *bond)
1044 vlan_features = netdev_increment_features(vlan_features, 1048 vlan_features = netdev_increment_features(vlan_features,
1045 slave->dev->vlan_features, BOND_VLAN_FEATURES); 1049 slave->dev->vlan_features, BOND_VLAN_FEATURES);
1046 1050
1051 enc_features = netdev_increment_features(enc_features,
1052 slave->dev->hw_enc_features,
1053 BOND_ENC_FEATURES);
1047 dst_release_flag &= slave->dev->priv_flags; 1054 dst_release_flag &= slave->dev->priv_flags;
1048 if (slave->dev->hard_header_len > max_hard_header_len) 1055 if (slave->dev->hard_header_len > max_hard_header_len)
1049 max_hard_header_len = slave->dev->hard_header_len; 1056 max_hard_header_len = slave->dev->hard_header_len;
@@ -1054,6 +1061,7 @@ static void bond_compute_features(struct bonding *bond)
1054 1061
1055done: 1062done:
1056 bond_dev->vlan_features = vlan_features; 1063 bond_dev->vlan_features = vlan_features;
1064 bond_dev->hw_enc_features = enc_features;
1057 bond_dev->hard_header_len = max_hard_header_len; 1065 bond_dev->hard_header_len = max_hard_header_len;
1058 bond_dev->gso_max_segs = gso_max_segs; 1066 bond_dev->gso_max_segs = gso_max_segs;
1059 netif_set_gso_max_size(bond_dev, gso_max_size); 1067 netif_set_gso_max_size(bond_dev, gso_max_size);
@@ -3975,6 +3983,7 @@ void bond_setup(struct net_device *bond_dev)
3975 NETIF_F_HW_VLAN_CTAG_FILTER; 3983 NETIF_F_HW_VLAN_CTAG_FILTER;
3976 3984
3977 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); 3985 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
3986 bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
3978 bond_dev->features |= bond_dev->hw_features; 3987 bond_dev->features |= bond_dev->hw_features;
3979} 3988}
3980 3989
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index dcf9196f6316..ea4d4f1a6411 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -52,6 +52,7 @@
52#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/init.h> 53#include <linux/init.h>
54#include <linux/kernel.h> 54#include <linux/kernel.h>
55#include <linux/workqueue.h>
55#include <linux/can.h> 56#include <linux/can.h>
56#include <linux/can/skb.h> 57#include <linux/can/skb.h>
57 58
@@ -85,6 +86,7 @@ struct slcan {
85 struct tty_struct *tty; /* ptr to TTY structure */ 86 struct tty_struct *tty; /* ptr to TTY structure */
86 struct net_device *dev; /* easy for intr handling */ 87 struct net_device *dev; /* easy for intr handling */
87 spinlock_t lock; 88 spinlock_t lock;
89 struct work_struct tx_work; /* Flushes transmit buffer */
88 90
89 /* These are pointers to the malloc()ed frame buffers. */ 91 /* These are pointers to the malloc()ed frame buffers. */
90 unsigned char rbuff[SLC_MTU]; /* receiver buffer */ 92 unsigned char rbuff[SLC_MTU]; /* receiver buffer */
@@ -309,36 +311,46 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf)
309 sl->dev->stats.tx_bytes += cf->can_dlc; 311 sl->dev->stats.tx_bytes += cf->can_dlc;
310} 312}
311 313
312/* 314/* Write out any remaining transmit buffer. Scheduled when tty is writable */
313 * Called by the driver when there's room for more data. If we have 315static void slcan_transmit(struct work_struct *work)
314 * more packets to send, we send them here.
315 */
316static void slcan_write_wakeup(struct tty_struct *tty)
317{ 316{
317 struct slcan *sl = container_of(work, struct slcan, tx_work);
318 int actual; 318 int actual;
319 struct slcan *sl = (struct slcan *) tty->disc_data;
320 319
320 spin_lock_bh(&sl->lock);
321 /* First make sure we're connected. */ 321 /* First make sure we're connected. */
322 if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) 322 if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) {
323 spin_unlock_bh(&sl->lock);
323 return; 324 return;
325 }
324 326
325 spin_lock_bh(&sl->lock);
326 if (sl->xleft <= 0) { 327 if (sl->xleft <= 0) {
327 /* Now serial buffer is almost free & we can start 328 /* Now serial buffer is almost free & we can start
328 * transmission of another packet */ 329 * transmission of another packet */
329 sl->dev->stats.tx_packets++; 330 sl->dev->stats.tx_packets++;
330 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 331 clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
331 spin_unlock_bh(&sl->lock); 332 spin_unlock_bh(&sl->lock);
332 netif_wake_queue(sl->dev); 333 netif_wake_queue(sl->dev);
333 return; 334 return;
334 } 335 }
335 336
336 actual = tty->ops->write(tty, sl->xhead, sl->xleft); 337 actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
337 sl->xleft -= actual; 338 sl->xleft -= actual;
338 sl->xhead += actual; 339 sl->xhead += actual;
339 spin_unlock_bh(&sl->lock); 340 spin_unlock_bh(&sl->lock);
340} 341}
341 342
343/*
344 * Called by the driver when there's room for more data.
345 * Schedule the transmit.
346 */
347static void slcan_write_wakeup(struct tty_struct *tty)
348{
349 struct slcan *sl = tty->disc_data;
350
351 schedule_work(&sl->tx_work);
352}
353
342/* Send a can_frame to a TTY queue. */ 354/* Send a can_frame to a TTY queue. */
343static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) 355static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
344{ 356{
@@ -528,6 +540,7 @@ static struct slcan *slc_alloc(dev_t line)
528 sl->magic = SLCAN_MAGIC; 540 sl->magic = SLCAN_MAGIC;
529 sl->dev = dev; 541 sl->dev = dev;
530 spin_lock_init(&sl->lock); 542 spin_lock_init(&sl->lock);
543 INIT_WORK(&sl->tx_work, slcan_transmit);
531 slcan_devs[i] = dev; 544 slcan_devs[i] = dev;
532 545
533 return sl; 546 return sl;
@@ -626,8 +639,12 @@ static void slcan_close(struct tty_struct *tty)
626 if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) 639 if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty)
627 return; 640 return;
628 641
642 spin_lock_bh(&sl->lock);
629 tty->disc_data = NULL; 643 tty->disc_data = NULL;
630 sl->tty = NULL; 644 sl->tty = NULL;
645 spin_unlock_bh(&sl->lock);
646
647 flush_work(&sl->tx_work);
631 648
632 /* Flush network side */ 649 /* Flush network side */
633 unregister_netdev(sl->dev); 650 unregister_netdev(sl->dev);
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 28460676b8ca..d81e7167a8b5 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -736,6 +736,7 @@ static int emac_open(struct net_device *dev)
736 736
737 ret = emac_mdio_probe(dev); 737 ret = emac_mdio_probe(dev);
738 if (ret < 0) { 738 if (ret < 0) {
739 free_irq(dev->irq, dev);
739 netdev_err(dev, "cannot probe MDIO bus\n"); 740 netdev_err(dev, "cannot probe MDIO bus\n");
740 return ret; 741 return ret;
741 } 742 }
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index df2792d8383d..8afa579e7c40 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -3224,7 +3224,7 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp,
3224 return 0; 3224 return 0;
3225} 3225}
3226 3226
3227#define NVRAM_CMD_TIMEOUT 100 3227#define NVRAM_CMD_TIMEOUT 5000
3228 3228
3229static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) 3229static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd)
3230{ 3230{
@@ -3232,7 +3232,7 @@ static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd)
3232 3232
3233 tw32(NVRAM_CMD, nvram_cmd); 3233 tw32(NVRAM_CMD, nvram_cmd);
3234 for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { 3234 for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) {
3235 udelay(10); 3235 usleep_range(10, 40);
3236 if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { 3236 if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) {
3237 udelay(10); 3237 udelay(10);
3238 break; 3238 break;
@@ -7854,8 +7854,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb)
7854 netif_wake_queue(tp->dev); 7854 netif_wake_queue(tp->dev);
7855 } 7855 }
7856 7856
7857 segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); 7857 segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6));
7858 if (IS_ERR(segs)) 7858 if (IS_ERR(segs) || !segs)
7859 goto tg3_tso_bug_end; 7859 goto tg3_tso_bug_end;
7860 7860
7861 do { 7861 do {
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 2f8d6b910383..a83271cf17c3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4057,22 +4057,19 @@ int cxgb4_unregister_uld(enum cxgb4_uld type)
4057EXPORT_SYMBOL(cxgb4_unregister_uld); 4057EXPORT_SYMBOL(cxgb4_unregister_uld);
4058 4058
4059/* Check if netdev on which event is occured belongs to us or not. Return 4059/* Check if netdev on which event is occured belongs to us or not. Return
4060 * suceess (1) if it belongs otherwise failure (0). 4060 * success (true) if it belongs otherwise failure (false).
4061 * Called with rcu_read_lock() held.
4061 */ 4062 */
4062static int cxgb4_netdev(struct net_device *netdev) 4063static bool cxgb4_netdev(const struct net_device *netdev)
4063{ 4064{
4064 struct adapter *adap; 4065 struct adapter *adap;
4065 int i; 4066 int i;
4066 4067
4067 spin_lock(&adap_rcu_lock);
4068 list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) 4068 list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node)
4069 for (i = 0; i < MAX_NPORTS; i++) 4069 for (i = 0; i < MAX_NPORTS; i++)
4070 if (adap->port[i] == netdev) { 4070 if (adap->port[i] == netdev)
4071 spin_unlock(&adap_rcu_lock); 4071 return true;
4072 return 1; 4072 return false;
4073 }
4074 spin_unlock(&adap_rcu_lock);
4075 return 0;
4076} 4073}
4077 4074
4078static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, 4075static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa,
@@ -6396,6 +6393,7 @@ static void remove_one(struct pci_dev *pdev)
6396 adapter->flags &= ~DEV_ENABLED; 6393 adapter->flags &= ~DEV_ENABLED;
6397 } 6394 }
6398 pci_release_regions(pdev); 6395 pci_release_regions(pdev);
6396 synchronize_rcu();
6399 kfree(adapter); 6397 kfree(adapter);
6400 } else 6398 } else
6401 pci_release_regions(pdev); 6399 pci_release_regions(pdev);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index bba67681aeaa..931478e7bd28 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -3962,6 +3962,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
3962 p->lport = j; 3962 p->lport = j;
3963 p->rss_size = rss_size; 3963 p->rss_size = rss_size;
3964 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); 3964 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
3965 adap->port[i]->dev_port = j;
3965 3966
3966 ret = ntohl(c.u.info.lstatus_to_modtype); 3967 ret = ntohl(c.u.info.lstatus_to_modtype);
3967 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? 3968 p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ?
diff --git a/drivers/net/ethernet/dec/tulip/timer.c b/drivers/net/ethernet/dec/tulip/timer.c
index 768379b8aee9..523d9dde50a2 100644
--- a/drivers/net/ethernet/dec/tulip/timer.c
+++ b/drivers/net/ethernet/dec/tulip/timer.c
@@ -158,7 +158,7 @@ void comet_timer(unsigned long data)
158{ 158{
159 struct net_device *dev = (struct net_device *)data; 159 struct net_device *dev = (struct net_device *)data;
160 struct tulip_private *tp = netdev_priv(dev); 160 struct tulip_private *tp = netdev_priv(dev);
161 int next_tick = 60*HZ; 161 int next_tick = 2*HZ;
162 162
163 if (tulip_debug > 1) 163 if (tulip_debug > 1)
164 netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", 164 netdev_dbg(dev, "Comet link status %04x partner capability %04x\n",
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 2e7c5553955e..c2f5d2d3b932 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -557,9 +557,7 @@ static inline u16 be_max_qs(struct be_adapter *adapter)
557#define be_pvid_tagging_enabled(adapter) (adapter->pvid) 557#define be_pvid_tagging_enabled(adapter) (adapter->pvid)
558 558
559/* Is BE in QNQ multi-channel mode */ 559/* Is BE in QNQ multi-channel mode */
560#define be_is_qnq_mode(adapter) (adapter->mc_type == FLEX10 || \ 560#define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE)
561 adapter->mc_type == vNIC1 || \
562 adapter->mc_type == UFP)
563 561
564#define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ 562#define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \
565 adapter->pdev->device == OC_DEVICE_ID4) 563 adapter->pdev->device == OC_DEVICE_ID4)
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index 3e0a6b243806..59b3c056f329 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1091,7 +1091,7 @@ struct be_cmd_resp_modify_eq_delay {
1091 * based on the skew/IPL. 1091 * based on the skew/IPL.
1092 */ 1092 */
1093#define RDMA_ENABLED 0x4 1093#define RDMA_ENABLED 0x4
1094#define FLEX10_MODE 0x400 1094#define QNQ_MODE 0x400
1095#define VNIC_MODE 0x20000 1095#define VNIC_MODE 0x20000
1096#define UMC_ENABLED 0x1000000 1096#define UMC_ENABLED 0x1000000
1097struct be_cmd_req_query_fw_cfg { 1097struct be_cmd_req_query_fw_cfg {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 6822b3d76d85..34a26e42f19d 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3254,9 +3254,9 @@ err:
3254 3254
3255static u8 be_convert_mc_type(u32 function_mode) 3255static u8 be_convert_mc_type(u32 function_mode)
3256{ 3256{
3257 if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE) 3257 if (function_mode & VNIC_MODE && function_mode & QNQ_MODE)
3258 return vNIC1; 3258 return vNIC1;
3259 else if (function_mode & FLEX10_MODE) 3259 else if (function_mode & QNQ_MODE)
3260 return FLEX10; 3260 return FLEX10;
3261 else if (function_mode & VNIC_MODE) 3261 else if (function_mode & VNIC_MODE)
3262 return vNIC2; 3262 return vNIC2;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 38d9d276ab8b..77037fd377b8 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -320,6 +320,11 @@ static void *swap_buffer(void *bufaddr, int len)
320 return bufaddr; 320 return bufaddr;
321} 321}
322 322
323static inline bool is_ipv4_pkt(struct sk_buff *skb)
324{
325 return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
326}
327
323static int 328static int
324fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) 329fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)
325{ 330{
@@ -330,7 +335,8 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev)
330 if (unlikely(skb_cow_head(skb, 0))) 335 if (unlikely(skb_cow_head(skb, 0)))
331 return -1; 336 return -1;
332 337
333 ip_hdr(skb)->check = 0; 338 if (is_ipv4_pkt(skb))
339 ip_hdr(skb)->check = 0;
334 *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; 340 *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0;
335 341
336 return 0; 342 return 0;
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 7f81ae66cc89..e912b6887d40 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -4199,6 +4199,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = {
4199 DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") 4199 DMI_MATCH(DMI_BOARD_NAME, "P5NSLI")
4200 }, 4200 },
4201 }, 4201 },
4202 {
4203 .ident = "FUJITSU SIEMENS A8NE-FM",
4204 .matches = {
4205 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."),
4206 DMI_MATCH(DMI_BOARD_NAME, "A8NE-FM")
4207 },
4208 },
4202 {} 4209 {}
4203}; 4210};
4204 4211
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5f42f6d6e4c6..82ab427290c3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2439,7 +2439,8 @@ slave_start:
2439 (num_vfs_argc > 1 || probe_vfs_argc > 1)) { 2439 (num_vfs_argc > 1 || probe_vfs_argc > 1)) {
2440 mlx4_err(dev, 2440 mlx4_err(dev,
2441 "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); 2441 "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n");
2442 goto err_close; 2442 err = -EINVAL;
2443 goto err_master_mfunc;
2443 } 2444 }
2444 for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { 2445 for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) {
2445 unsigned j; 2446 unsigned j;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index ff380dac6629..b988d16cd34e 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1212,7 +1212,12 @@ static int cpsw_ndo_open(struct net_device *ndev)
1212 for_each_slave(priv, cpsw_slave_open, priv); 1212 for_each_slave(priv, cpsw_slave_open, priv);
1213 1213
1214 /* Add default VLAN */ 1214 /* Add default VLAN */
1215 cpsw_add_default_vlan(priv); 1215 if (!priv->data.dual_emac)
1216 cpsw_add_default_vlan(priv);
1217 else
1218 cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan,
1219 ALE_ALL_PORTS << priv->host_port,
1220 ALE_ALL_PORTS << priv->host_port, 0, 0);
1216 1221
1217 if (!cpsw_common_res_usage_state(priv)) { 1222 if (!cpsw_common_res_usage_state(priv)) {
1218 /* setup tx dma to fixed prio and zero offset */ 1223 /* setup tx dma to fixed prio and zero offset */
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 14389f841d43..4c70360967c2 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -2191,7 +2191,6 @@ static void tile_net_setup(struct net_device *dev)
2191static void tile_net_dev_init(const char *name, const uint8_t *mac) 2191static void tile_net_dev_init(const char *name, const uint8_t *mac)
2192{ 2192{
2193 int ret; 2193 int ret;
2194 int i;
2195 struct net_device *dev; 2194 struct net_device *dev;
2196 struct tile_net_priv *priv; 2195 struct tile_net_priv *priv;
2197 2196
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index c041f63a6d30..4ed38eaecea8 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -189,7 +189,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device)
189 "unable to teardown send buffer's gpadl\n"); 189 "unable to teardown send buffer's gpadl\n");
190 return ret; 190 return ret;
191 } 191 }
192 net_device->recv_buf_gpadl_handle = 0; 192 net_device->send_buf_gpadl_handle = 0;
193 } 193 }
194 if (net_device->send_buf) { 194 if (net_device->send_buf) {
195 /* Free up the receive buffer */ 195 /* Free up the receive buffer */
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 4517b149ed07..50899416f668 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1137,6 +1137,8 @@ static int at86rf230_probe(struct spi_device *spi)
1137 dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; 1137 dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK;
1138 1138
1139 irq_type = irq_get_trigger_type(spi->irq); 1139 irq_type = irq_get_trigger_type(spi->irq);
1140 if (!irq_type)
1141 irq_type = IRQF_TRIGGER_RISING;
1140 if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 1142 if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
1141 irq_worker = at86rf230_irqwork; 1143 irq_worker = at86rf230_irqwork;
1142 irq_handler = at86rf230_isr; 1144 irq_handler = at86rf230_isr;
@@ -1168,7 +1170,8 @@ static int at86rf230_probe(struct spi_device *spi)
1168 if (rc) 1170 if (rc)
1169 goto err_hw_init; 1171 goto err_hw_init;
1170 1172
1171 rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED, 1173 rc = devm_request_irq(&spi->dev, spi->irq, irq_handler,
1174 IRQF_SHARED | irq_type,
1172 dev_name(&spi->dev), lp); 1175 dev_name(&spi->dev), lp);
1173 if (rc) 1176 if (rc)
1174 goto err_hw_init; 1177 goto err_hw_init;
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 6c622aedbae1..fdc1b418fa6a 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -16,9 +16,13 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/of_gpio.h>
20#include <linux/gpio/consumer.h>
19 21
20#define AT803X_INTR_ENABLE 0x12 22#define AT803X_INTR_ENABLE 0x12
21#define AT803X_INTR_STATUS 0x13 23#define AT803X_INTR_STATUS 0x13
24#define AT803X_SMART_SPEED 0x14
25#define AT803X_LED_CONTROL 0x18
22#define AT803X_WOL_ENABLE 0x01 26#define AT803X_WOL_ENABLE 0x01
23#define AT803X_DEVICE_ADDR 0x03 27#define AT803X_DEVICE_ADDR 0x03
24#define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C 28#define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C
@@ -35,10 +39,52 @@
35#define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 39#define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05
36#define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) 40#define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8)
37 41
42#define ATH8030_PHY_ID 0x004dd076
43#define ATH8031_PHY_ID 0x004dd074
44#define ATH8035_PHY_ID 0x004dd072
45
38MODULE_DESCRIPTION("Atheros 803x PHY driver"); 46MODULE_DESCRIPTION("Atheros 803x PHY driver");
39MODULE_AUTHOR("Matus Ujhelyi"); 47MODULE_AUTHOR("Matus Ujhelyi");
40MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
41 49
50struct at803x_priv {
51 bool phy_reset:1;
52 struct gpio_desc *gpiod_reset;
53};
54
55struct at803x_context {
56 u16 bmcr;
57 u16 advertise;
58 u16 control1000;
59 u16 int_enable;
60 u16 smart_speed;
61 u16 led_control;
62};
63
64/* save relevant PHY registers to private copy */
65static void at803x_context_save(struct phy_device *phydev,
66 struct at803x_context *context)
67{
68 context->bmcr = phy_read(phydev, MII_BMCR);
69 context->advertise = phy_read(phydev, MII_ADVERTISE);
70 context->control1000 = phy_read(phydev, MII_CTRL1000);
71 context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE);
72 context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED);
73 context->led_control = phy_read(phydev, AT803X_LED_CONTROL);
74}
75
76/* restore relevant PHY registers from private copy */
77static void at803x_context_restore(struct phy_device *phydev,
78 const struct at803x_context *context)
79{
80 phy_write(phydev, MII_BMCR, context->bmcr);
81 phy_write(phydev, MII_ADVERTISE, context->advertise);
82 phy_write(phydev, MII_CTRL1000, context->control1000);
83 phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable);
84 phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed);
85 phy_write(phydev, AT803X_LED_CONTROL, context->led_control);
86}
87
42static int at803x_set_wol(struct phy_device *phydev, 88static int at803x_set_wol(struct phy_device *phydev,
43 struct ethtool_wolinfo *wol) 89 struct ethtool_wolinfo *wol)
44{ 90{
@@ -142,6 +188,26 @@ static int at803x_resume(struct phy_device *phydev)
142 return 0; 188 return 0;
143} 189}
144 190
191static int at803x_probe(struct phy_device *phydev)
192{
193 struct device *dev = &phydev->dev;
194 struct at803x_priv *priv;
195
196 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
197 if (!priv)
198 return -ENOMEM;
199
200 priv->gpiod_reset = devm_gpiod_get(dev, "reset");
201 if (IS_ERR(priv->gpiod_reset))
202 priv->gpiod_reset = NULL;
203 else
204 gpiod_direction_output(priv->gpiod_reset, 1);
205
206 phydev->priv = priv;
207
208 return 0;
209}
210
145static int at803x_config_init(struct phy_device *phydev) 211static int at803x_config_init(struct phy_device *phydev)
146{ 212{
147 int ret; 213 int ret;
@@ -189,58 +255,99 @@ static int at803x_config_intr(struct phy_device *phydev)
189 return err; 255 return err;
190} 256}
191 257
258static void at803x_link_change_notify(struct phy_device *phydev)
259{
260 struct at803x_priv *priv = phydev->priv;
261
262 /*
263 * Conduct a hardware reset for AT8030 every time a link loss is
264 * signalled. This is necessary to circumvent a hardware bug that
265 * occurs when the cable is unplugged while TX packets are pending
266 * in the FIFO. In such cases, the FIFO enters an error mode it
267 * cannot recover from by software.
268 */
269 if (phydev->drv->phy_id == ATH8030_PHY_ID) {
270 if (phydev->state == PHY_NOLINK) {
271 if (priv->gpiod_reset && !priv->phy_reset) {
272 struct at803x_context context;
273
274 at803x_context_save(phydev, &context);
275
276 gpiod_set_value(priv->gpiod_reset, 0);
277 msleep(1);
278 gpiod_set_value(priv->gpiod_reset, 1);
279 msleep(1);
280
281 at803x_context_restore(phydev, &context);
282
283 dev_dbg(&phydev->dev, "%s(): phy was reset\n",
284 __func__);
285 priv->phy_reset = true;
286 }
287 } else {
288 priv->phy_reset = false;
289 }
290 }
291}
292
192static struct phy_driver at803x_driver[] = { 293static struct phy_driver at803x_driver[] = {
193{ 294{
194 /* ATHEROS 8035 */ 295 /* ATHEROS 8035 */
195 .phy_id = 0x004dd072, 296 .phy_id = ATH8035_PHY_ID,
196 .name = "Atheros 8035 ethernet", 297 .name = "Atheros 8035 ethernet",
197 .phy_id_mask = 0xffffffef, 298 .phy_id_mask = 0xffffffef,
198 .config_init = at803x_config_init, 299 .probe = at803x_probe,
199 .set_wol = at803x_set_wol, 300 .config_init = at803x_config_init,
200 .get_wol = at803x_get_wol, 301 .link_change_notify = at803x_link_change_notify,
201 .suspend = at803x_suspend, 302 .set_wol = at803x_set_wol,
202 .resume = at803x_resume, 303 .get_wol = at803x_get_wol,
203 .features = PHY_GBIT_FEATURES, 304 .suspend = at803x_suspend,
204 .flags = PHY_HAS_INTERRUPT, 305 .resume = at803x_resume,
205 .config_aneg = genphy_config_aneg, 306 .features = PHY_GBIT_FEATURES,
206 .read_status = genphy_read_status, 307 .flags = PHY_HAS_INTERRUPT,
207 .driver = { 308 .config_aneg = genphy_config_aneg,
309 .read_status = genphy_read_status,
310 .driver = {
208 .owner = THIS_MODULE, 311 .owner = THIS_MODULE,
209 }, 312 },
210}, { 313}, {
211 /* ATHEROS 8030 */ 314 /* ATHEROS 8030 */
212 .phy_id = 0x004dd076, 315 .phy_id = ATH8030_PHY_ID,
213 .name = "Atheros 8030 ethernet", 316 .name = "Atheros 8030 ethernet",
214 .phy_id_mask = 0xffffffef, 317 .phy_id_mask = 0xffffffef,
215 .config_init = at803x_config_init, 318 .probe = at803x_probe,
216 .set_wol = at803x_set_wol, 319 .config_init = at803x_config_init,
217 .get_wol = at803x_get_wol, 320 .link_change_notify = at803x_link_change_notify,
218 .suspend = at803x_suspend, 321 .set_wol = at803x_set_wol,
219 .resume = at803x_resume, 322 .get_wol = at803x_get_wol,
220 .features = PHY_GBIT_FEATURES, 323 .suspend = at803x_suspend,
221 .flags = PHY_HAS_INTERRUPT, 324 .resume = at803x_resume,
222 .config_aneg = genphy_config_aneg, 325 .features = PHY_GBIT_FEATURES,
223 .read_status = genphy_read_status, 326 .flags = PHY_HAS_INTERRUPT,
224 .driver = { 327 .config_aneg = genphy_config_aneg,
328 .read_status = genphy_read_status,
329 .driver = {
225 .owner = THIS_MODULE, 330 .owner = THIS_MODULE,
226 }, 331 },
227}, { 332}, {
228 /* ATHEROS 8031 */ 333 /* ATHEROS 8031 */
229 .phy_id = 0x004dd074, 334 .phy_id = ATH8031_PHY_ID,
230 .name = "Atheros 8031 ethernet", 335 .name = "Atheros 8031 ethernet",
231 .phy_id_mask = 0xffffffef, 336 .phy_id_mask = 0xffffffef,
232 .config_init = at803x_config_init, 337 .probe = at803x_probe,
233 .set_wol = at803x_set_wol, 338 .config_init = at803x_config_init,
234 .get_wol = at803x_get_wol, 339 .link_change_notify = at803x_link_change_notify,
235 .suspend = at803x_suspend, 340 .set_wol = at803x_set_wol,
236 .resume = at803x_resume, 341 .get_wol = at803x_get_wol,
237 .features = PHY_GBIT_FEATURES, 342 .suspend = at803x_suspend,
238 .flags = PHY_HAS_INTERRUPT, 343 .resume = at803x_resume,
239 .config_aneg = genphy_config_aneg, 344 .features = PHY_GBIT_FEATURES,
240 .read_status = genphy_read_status, 345 .flags = PHY_HAS_INTERRUPT,
241 .ack_interrupt = &at803x_ack_interrupt, 346 .config_aneg = genphy_config_aneg,
242 .config_intr = &at803x_config_intr, 347 .read_status = genphy_read_status,
243 .driver = { 348 .ack_interrupt = &at803x_ack_interrupt,
349 .config_intr = &at803x_config_intr,
350 .driver = {
244 .owner = THIS_MODULE, 351 .owner = THIS_MODULE,
245 }, 352 },
246} }; 353} };
@@ -260,9 +367,9 @@ module_init(atheros_init);
260module_exit(atheros_exit); 367module_exit(atheros_exit);
261 368
262static struct mdio_device_id __maybe_unused atheros_tbl[] = { 369static struct mdio_device_id __maybe_unused atheros_tbl[] = {
263 { 0x004dd076, 0xffffffef }, 370 { ATH8030_PHY_ID, 0xffffffef },
264 { 0x004dd074, 0xffffffef }, 371 { ATH8031_PHY_ID, 0xffffffef },
265 { 0x004dd072, 0xffffffef }, 372 { ATH8035_PHY_ID, 0xffffffef },
266 { } 373 { }
267}; 374};
268 375
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3bc079a67a3d..f7c61812ea4a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -720,6 +720,9 @@ void phy_state_machine(struct work_struct *work)
720 720
721 mutex_lock(&phydev->lock); 721 mutex_lock(&phydev->lock);
722 722
723 if (phydev->drv->link_change_notify)
724 phydev->drv->link_change_notify(phydev);
725
723 switch (phydev->state) { 726 switch (phydev->state) {
724 case PHY_DOWN: 727 case PHY_DOWN:
725 case PHY_STARTING: 728 case PHY_STARTING:
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index ad4a94e9ff57..87526443841f 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -83,6 +83,7 @@
83#include <linux/delay.h> 83#include <linux/delay.h>
84#include <linux/init.h> 84#include <linux/init.h>
85#include <linux/slab.h> 85#include <linux/slab.h>
86#include <linux/workqueue.h>
86#include "slip.h" 87#include "slip.h"
87#ifdef CONFIG_INET 88#ifdef CONFIG_INET
88#include <linux/ip.h> 89#include <linux/ip.h>
@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
416#endif 417#endif
417} 418}
418 419
419/* 420/* Write out any remaining transmit buffer. Scheduled when tty is writable */
420 * Called by the driver when there's room for more data. If we have 421static void slip_transmit(struct work_struct *work)
421 * more packets to send, we send them here.
422 */
423static void slip_write_wakeup(struct tty_struct *tty)
424{ 422{
423 struct slip *sl = container_of(work, struct slip, tx_work);
425 int actual; 424 int actual;
426 struct slip *sl = tty->disc_data;
427 425
426 spin_lock_bh(&sl->lock);
428 /* First make sure we're connected. */ 427 /* First make sure we're connected. */
429 if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) 428 if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
429 spin_unlock_bh(&sl->lock);
430 return; 430 return;
431 }
431 432
432 spin_lock_bh(&sl->lock);
433 if (sl->xleft <= 0) { 433 if (sl->xleft <= 0) {
434 /* Now serial buffer is almost free & we can start 434 /* Now serial buffer is almost free & we can start
435 * transmission of another packet */ 435 * transmission of another packet */
436 sl->dev->stats.tx_packets++; 436 sl->dev->stats.tx_packets++;
437 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 437 clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
438 spin_unlock_bh(&sl->lock); 438 spin_unlock_bh(&sl->lock);
439 sl_unlock(sl); 439 sl_unlock(sl);
440 return; 440 return;
441 } 441 }
442 442
443 actual = tty->ops->write(tty, sl->xhead, sl->xleft); 443 actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
444 sl->xleft -= actual; 444 sl->xleft -= actual;
445 sl->xhead += actual; 445 sl->xhead += actual;
446 spin_unlock_bh(&sl->lock); 446 spin_unlock_bh(&sl->lock);
447} 447}
448 448
449/*
450 * Called by the driver when there's room for more data.
451 * Schedule the transmit.
452 */
453static void slip_write_wakeup(struct tty_struct *tty)
454{
455 struct slip *sl = tty->disc_data;
456
457 schedule_work(&sl->tx_work);
458}
459
449static void sl_tx_timeout(struct net_device *dev) 460static void sl_tx_timeout(struct net_device *dev)
450{ 461{
451 struct slip *sl = netdev_priv(dev); 462 struct slip *sl = netdev_priv(dev);
@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line)
749 sl->magic = SLIP_MAGIC; 760 sl->magic = SLIP_MAGIC;
750 sl->dev = dev; 761 sl->dev = dev;
751 spin_lock_init(&sl->lock); 762 spin_lock_init(&sl->lock);
763 INIT_WORK(&sl->tx_work, slip_transmit);
752 sl->mode = SL_MODE_DEFAULT; 764 sl->mode = SL_MODE_DEFAULT;
753#ifdef CONFIG_SLIP_SMART 765#ifdef CONFIG_SLIP_SMART
754 /* initialize timer_list struct */ 766 /* initialize timer_list struct */
@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty)
872 if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) 884 if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
873 return; 885 return;
874 886
887 spin_lock_bh(&sl->lock);
875 tty->disc_data = NULL; 888 tty->disc_data = NULL;
876 sl->tty = NULL; 889 sl->tty = NULL;
890 spin_unlock_bh(&sl->lock);
891
892 flush_work(&sl->tx_work);
877 893
878 /* VSV = very important to remove timers */ 894 /* VSV = very important to remove timers */
879#ifdef CONFIG_SLIP_SMART 895#ifdef CONFIG_SLIP_SMART
diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
index 67673cf1266b..cf32aadf508f 100644
--- a/drivers/net/slip/slip.h
+++ b/drivers/net/slip/slip.h
@@ -53,6 +53,7 @@ struct slip {
53 struct tty_struct *tty; /* ptr to TTY structure */ 53 struct tty_struct *tty; /* ptr to TTY structure */
54 struct net_device *dev; /* easy for intr handling */ 54 struct net_device *dev; /* easy for intr handling */
55 spinlock_t lock; 55 spinlock_t lock;
56 struct work_struct tx_work; /* Flushes transmit buffer */
56 57
57#ifdef SL_INCLUDE_CSLIP 58#ifdef SL_INCLUDE_CSLIP
58 struct slcompress *slcomp; /* for header compression */ 59 struct slcompress *slcomp; /* for header compression */
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
index f9822bc75425..5d95a13dbe2a 100644
--- a/drivers/net/usb/huawei_cdc_ncm.c
+++ b/drivers/net/usb/huawei_cdc_ncm.c
@@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
84 ctx = drvstate->ctx; 84 ctx = drvstate->ctx;
85 85
86 if (usbnet_dev->status) 86 if (usbnet_dev->status)
87 /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 87 /* The wMaxCommand buffer must be big enough to hold
88 * decimal (0x100)" 88 * any message from the modem. Experience has shown
89 * that some replies are more than 256 bytes long
89 */ 90 */
90 subdriver = usb_cdc_wdm_register(ctx->control, 91 subdriver = usb_cdc_wdm_register(ctx->control,
91 &usbnet_dev->status->desc, 92 &usbnet_dev->status->desc,
92 256, /* wMaxCommand */ 93 1024, /* wMaxCommand */
93 huawei_cdc_ncm_wdm_manage_power); 94 huawei_cdc_ncm_wdm_manage_power);
94 if (IS_ERR(subdriver)) { 95 if (IS_ERR(subdriver)) {
95 ret = PTR_ERR(subdriver); 96 ret = PTR_ERR(subdriver);
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 97394345e5dd..b76f7dcde0db 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2589,8 +2589,8 @@ vmxnet3_open(struct net_device *netdev)
2589 for (i = 0; i < adapter->num_tx_queues; i++) 2589 for (i = 0; i < adapter->num_tx_queues; i++)
2590 spin_lock_init(&adapter->tx_queue[i].tx_lock); 2590 spin_lock_init(&adapter->tx_queue[i].tx_lock);
2591 2591
2592 err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, 2592 err = vmxnet3_create_queues(adapter, adapter->tx_ring_size,
2593 VMXNET3_DEF_RX_RING_SIZE, 2593 adapter->rx_ring_size,
2594 VMXNET3_DEF_RX_RING_SIZE); 2594 VMXNET3_DEF_RX_RING_SIZE);
2595 if (err) 2595 if (err)
2596 goto queue_err; 2596 goto queue_err;
@@ -2968,6 +2968,9 @@ vmxnet3_probe_device(struct pci_dev *pdev,
2968 adapter->netdev = netdev; 2968 adapter->netdev = netdev;
2969 adapter->pdev = pdev; 2969 adapter->pdev = pdev;
2970 2970
2971 adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE;
2972 adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE;
2973
2971 spin_lock_init(&adapter->cmd_lock); 2974 spin_lock_init(&adapter->cmd_lock);
2972 adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, 2975 adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter,
2973 sizeof(struct vmxnet3_adapter), 2976 sizeof(struct vmxnet3_adapter),
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 40c1c7b0d9e0..b725fd9e7803 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -449,8 +449,8 @@ vmxnet3_get_ringparam(struct net_device *netdev,
449 param->rx_mini_max_pending = 0; 449 param->rx_mini_max_pending = 0;
450 param->rx_jumbo_max_pending = 0; 450 param->rx_jumbo_max_pending = 0;
451 451
452 param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; 452 param->rx_pending = adapter->rx_ring_size;
453 param->tx_pending = adapter->tx_queue[0].tx_ring.size; 453 param->tx_pending = adapter->tx_ring_size;
454 param->rx_mini_pending = 0; 454 param->rx_mini_pending = 0;
455 param->rx_jumbo_pending = 0; 455 param->rx_jumbo_pending = 0;
456} 456}
@@ -529,9 +529,11 @@ vmxnet3_set_ringparam(struct net_device *netdev,
529 * size */ 529 * size */
530 netdev_err(netdev, "failed to apply new sizes, " 530 netdev_err(netdev, "failed to apply new sizes, "
531 "try the default ones\n"); 531 "try the default ones\n");
532 new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE;
533 new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE;
532 err = vmxnet3_create_queues(adapter, 534 err = vmxnet3_create_queues(adapter,
533 VMXNET3_DEF_TX_RING_SIZE, 535 new_tx_ring_size,
534 VMXNET3_DEF_RX_RING_SIZE, 536 new_rx_ring_size,
535 VMXNET3_DEF_RX_RING_SIZE); 537 VMXNET3_DEF_RX_RING_SIZE);
536 if (err) { 538 if (err) {
537 netdev_err(netdev, "failed to create queues " 539 netdev_err(netdev, "failed to create queues "
@@ -545,6 +547,8 @@ vmxnet3_set_ringparam(struct net_device *netdev,
545 netdev_err(netdev, "failed to re-activate, error %d." 547 netdev_err(netdev, "failed to re-activate, error %d."
546 " Closing it\n", err); 548 " Closing it\n", err);
547 } 549 }
550 adapter->tx_ring_size = new_tx_ring_size;
551 adapter->rx_ring_size = new_rx_ring_size;
548 552
549out: 553out:
550 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); 554 clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state);
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 190569d02450..29ee77f2c97f 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -349,6 +349,11 @@ struct vmxnet3_adapter {
349 u32 link_speed; /* in mbps */ 349 u32 link_speed; /* in mbps */
350 350
351 u64 tx_timeout_count; 351 u64 tx_timeout_count;
352
353 /* Ring sizes */
354 u32 tx_ring_size;
355 u32 rx_ring_size;
356
352 struct work_struct work; 357 struct work_struct work;
353 358
354 unsigned long state; /* VMXNET3_STATE_BIT_xxx */ 359 unsigned long state; /* VMXNET3_STATE_BIT_xxx */
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index e3f67b8d3f80..40fd9b7b1426 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -36,7 +36,7 @@ config B43_SSB
36choice 36choice
37 prompt "Supported bus types" 37 prompt "Supported bus types"
38 depends on B43 38 depends on B43
39 default B43_BCMA_AND_SSB 39 default B43_BUSES_BCMA_AND_SSB
40 40
41config B43_BUSES_BCMA_AND_SSB 41config B43_BUSES_BCMA_AND_SSB
42 bool "BCMA and SSB" 42 bool "BCMA and SSB"
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 32538ac5f7e4..0d6a0bb1f876 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5221,6 +5221,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
5221 /* We don't support 5 GHz on some PHYs yet */ 5221 /* We don't support 5 GHz on some PHYs yet */
5222 switch (dev->phy.type) { 5222 switch (dev->phy.type) {
5223 case B43_PHYTYPE_A: 5223 case B43_PHYTYPE_A:
5224 case B43_PHYTYPE_G:
5224 case B43_PHYTYPE_N: 5225 case B43_PHYTYPE_N:
5225 case B43_PHYTYPE_LP: 5226 case B43_PHYTYPE_LP:
5226 case B43_PHYTYPE_HT: 5227 case B43_PHYTYPE_HT:
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 4f38f19b8e3d..6e6ef3fc2247 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
811 break; 811 break;
812 case B43_PHYTYPE_G: 812 case B43_PHYTYPE_G:
813 status.band = IEEE80211_BAND_2GHZ; 813 status.band = IEEE80211_BAND_2GHZ;
814 /* chanid is the radio channel cookie value as used 814 /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
815 * to tune the radio. */ 815 * has been modified to be compatible with N-PHY and others.
816 status.freq = chanid + 2400; 816 */
817 if (dev->fw.rev >= 508)
818 status.freq = ieee80211_channel_to_frequency(chanid, status.band);
819 else
820 status.freq = chanid + 2400;
817 break; 821 break;
818 case B43_PHYTYPE_N: 822 case B43_PHYTYPE_N:
819 case B43_PHYTYPE_LP: 823 case B43_PHYTYPE_LP:
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 574d4b597468..2cc9b6fca490 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -50,7 +50,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb,
50 return -1; 50 return -1;
51 } 51 }
52 mapping.len = size; 52 mapping.len = size;
53 memcpy(skb->cb, &mapping, sizeof(mapping)); 53 mwifiex_store_mapping(skb, &mapping);
54 return 0; 54 return 0;
55} 55}
56 56
@@ -60,7 +60,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter,
60 struct pcie_service_card *card = adapter->card; 60 struct pcie_service_card *card = adapter->card;
61 struct mwifiex_dma_mapping mapping; 61 struct mwifiex_dma_mapping mapping;
62 62
63 MWIFIEX_SKB_PACB(skb, &mapping); 63 mwifiex_get_mapping(skb, &mapping);
64 pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); 64 pci_unmap_single(card->dev, mapping.addr, mapping.len, flags);
65} 65}
66 66
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h
index ddae57021397..caadb3737b9e 100644
--- a/drivers/net/wireless/mwifiex/util.h
+++ b/drivers/net/wireless/mwifiex/util.h
@@ -20,32 +20,55 @@
20#ifndef _MWIFIEX_UTIL_H_ 20#ifndef _MWIFIEX_UTIL_H_
21#define _MWIFIEX_UTIL_H_ 21#define _MWIFIEX_UTIL_H_
22 22
23struct mwifiex_dma_mapping {
24 dma_addr_t addr;
25 size_t len;
26};
27
28struct mwifiex_cb {
29 struct mwifiex_dma_mapping dma_mapping;
30 union {
31 struct mwifiex_rxinfo rx_info;
32 struct mwifiex_txinfo tx_info;
33 };
34};
35
23static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) 36static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb)
24{ 37{
25 return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); 38 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
39
40 BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb));
41 return &cb->rx_info;
26} 42}
27 43
28static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) 44static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
29{ 45{
30 return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); 46 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
47
48 return &cb->tx_info;
31} 49}
32 50
33struct mwifiex_dma_mapping { 51static inline void mwifiex_store_mapping(struct sk_buff *skb,
34 dma_addr_t addr; 52 struct mwifiex_dma_mapping *mapping)
35 size_t len; 53{
36}; 54 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
55
56 memcpy(&cb->dma_mapping, mapping, sizeof(*mapping));
57}
37 58
38static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, 59static inline void mwifiex_get_mapping(struct sk_buff *skb,
39 struct mwifiex_dma_mapping *mapping) 60 struct mwifiex_dma_mapping *mapping)
40{ 61{
41 memcpy(mapping, skb->cb, sizeof(*mapping)); 62 struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb;
63
64 memcpy(mapping, &cb->dma_mapping, sizeof(*mapping));
42} 65}
43 66
44static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) 67static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb)
45{ 68{
46 struct mwifiex_dma_mapping mapping; 69 struct mwifiex_dma_mapping mapping;
47 70
48 MWIFIEX_SKB_PACB(skb, &mapping); 71 mwifiex_get_mapping(skb, &mapping);
49 72
50 return mapping.addr; 73 return mapping.addr;
51} 74}
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 2f1cd929c6f6..a511cccc9f01 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1681 /* 1681 /*
1682 * Detect if this device has an hardware controlled radio. 1682 * Detect if this device has an hardware controlled radio.
1683 */ 1683 */
1684 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) 1684 if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) {
1685 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); 1685 __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags);
1686 /*
1687 * On this device RFKILL initialized during probe does not work.
1688 */
1689 __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags);
1690 }
1686 1691
1687 /* 1692 /*
1688 * Check if the BBP tuning should be enabled. 1693 * Check if the BBP tuning should be enabled.
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index a49c3d73ea2c..e11dab2216c6 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer)
229/* 229/*
230 * Firmware functions 230 * Firmware functions
231 */ 231 */
232static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev)
233{
234 __le32 reg;
235 u32 fw_mode;
236
237 /* cannot use rt2x00usb_register_read here as it uses different
238 * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the
239 * magic value USB_MODE_AUTORUN (0x11) to the device, thus the
240 * returned value would be invalid.
241 */
242 rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
243 USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN,
244 &reg, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE);
245 fw_mode = le32_to_cpu(reg);
246
247 if ((fw_mode & 0x00000003) == 2)
248 return 1;
249
250 return 0;
251}
252
232static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) 253static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
233{ 254{
234 return FIRMWARE_RT2870; 255 return FIRMWARE_RT2870;
@@ -257,8 +278,13 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
257 /* 278 /*
258 * Write firmware to device. 279 * Write firmware to device.
259 */ 280 */
260 rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, 281 if (rt2800usb_autorun_detect(rt2x00dev)) {
261 data + offset, length); 282 rt2x00_info(rt2x00dev,
283 "Firmware loading not required - NIC in AutoRun mode\n");
284 } else {
285 rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
286 data + offset, length);
287 }
262 288
263 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 289 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
264 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); 290 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);
@@ -735,11 +761,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
735/* 761/*
736 * Device probe functions. 762 * Device probe functions.
737 */ 763 */
764static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev)
765{
766 if (rt2800usb_autorun_detect(rt2x00dev))
767 return 1;
768 return rt2800_efuse_detect(rt2x00dev);
769}
770
738static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) 771static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
739{ 772{
740 int retval; 773 int retval;
741 774
742 if (rt2800_efuse_detect(rt2x00dev)) 775 if (rt2800usb_efuse_detect(rt2x00dev))
743 retval = rt2800_read_eeprom_efuse(rt2x00dev); 776 retval = rt2800_read_eeprom_efuse(rt2x00dev);
744 else 777 else
745 retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, 778 retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 010b76505243..d13f25cd70d5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags {
693 REQUIRE_SW_SEQNO, 693 REQUIRE_SW_SEQNO,
694 REQUIRE_HT_TX_DESC, 694 REQUIRE_HT_TX_DESC,
695 REQUIRE_PS_AUTOWAKE, 695 REQUIRE_PS_AUTOWAKE,
696 REQUIRE_DELAYED_RFKILL,
696 697
697 /* 698 /*
698 * Capabilities 699 * Capabilities
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 2bde6729f5e6..4fa43a2eeb73 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
1126 return; 1126 return;
1127 1127
1128 /* 1128 /*
1129 * Unregister extra components. 1129 * Stop rfkill polling.
1130 */ 1130 */
1131 rt2x00rfkill_unregister(rt2x00dev); 1131 if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1132 rt2x00rfkill_unregister(rt2x00dev);
1132 1133
1133 /* 1134 /*
1134 * Allow the HW to uninitialize. 1135 * Allow the HW to uninitialize.
@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1166 1167
1167 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); 1168 set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags);
1168 1169
1170 /*
1171 * Start rfkill polling.
1172 */
1173 if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1174 rt2x00rfkill_register(rt2x00dev);
1175
1169 return 0; 1176 return 0;
1170} 1177}
1171 1178
@@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1375 rt2x00link_register(rt2x00dev); 1382 rt2x00link_register(rt2x00dev);
1376 rt2x00leds_register(rt2x00dev); 1383 rt2x00leds_register(rt2x00dev);
1377 rt2x00debug_register(rt2x00dev); 1384 rt2x00debug_register(rt2x00dev);
1378 rt2x00rfkill_register(rt2x00dev); 1385
1386 /*
1387 * Start rfkill polling.
1388 */
1389 if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1390 rt2x00rfkill_register(rt2x00dev);
1379 1391
1380 return 0; 1392 return 0;
1381 1393
@@ -1391,6 +1403,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1391 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); 1403 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
1392 1404
1393 /* 1405 /*
1406 * Stop rfkill polling.
1407 */
1408 if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
1409 rt2x00rfkill_unregister(rt2x00dev);
1410
1411 /*
1394 * Disable radio. 1412 * Disable radio.
1395 */ 1413 */
1396 rt2x00lib_disable_radio(rt2x00dev); 1414 rt2x00lib_disable_radio(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 212ac4842c16..004dff9b962d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
487 crypto.cipher = rt2x00crypto_key_to_cipher(key); 487 crypto.cipher = rt2x00crypto_key_to_cipher(key);
488 if (crypto.cipher == CIPHER_NONE) 488 if (crypto.cipher == CIPHER_NONE)
489 return -EOPNOTSUPP; 489 return -EOPNOTSUPP;
490 if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
491 return -EOPNOTSUPP;
490 492
491 crypto.cmd = cmd; 493 crypto.cmd = cmd;
492 494
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index e7bcf62347d5..831b65f93feb 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset {
93 USB_MODE_SLEEP = 7, /* RT73USB */ 93 USB_MODE_SLEEP = 7, /* RT73USB */
94 USB_MODE_FIRMWARE = 8, /* RT73USB */ 94 USB_MODE_FIRMWARE = 8, /* RT73USB */
95 USB_MODE_WAKEUP = 9, /* RT73USB */ 95 USB_MODE_WAKEUP = 9, /* RT73USB */
96 USB_MODE_AUTORUN = 17, /* RT2800USB */
96}; 97};
97 98
98/** 99/**
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 4dd7c4a1923b..2532ce85d718 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -222,6 +222,7 @@ struct xenvif {
222 222
223 /* Queues */ 223 /* Queues */
224 struct xenvif_queue *queues; 224 struct xenvif_queue *queues;
225 unsigned int num_queues; /* active queues, resource allocated */
225 226
226 /* Miscellaneous private stuff. */ 227 /* Miscellaneous private stuff. */
227 struct net_device *dev; 228 struct net_device *dev;
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 852da34b8961..9e97c7ca0ddd 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -137,32 +137,11 @@ static void xenvif_wake_queue_callback(unsigned long data)
137 } 137 }
138} 138}
139 139
140static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
141 void *accel_priv, select_queue_fallback_t fallback)
142{
143 unsigned int num_queues = dev->real_num_tx_queues;
144 u32 hash;
145 u16 queue_index;
146
147 /* First, check if there is only one queue to optimise the
148 * single-queue or old frontend scenario.
149 */
150 if (num_queues == 1) {
151 queue_index = 0;
152 } else {
153 /* Use skb_get_hash to obtain an L4 hash if available */
154 hash = skb_get_hash(skb);
155 queue_index = hash % num_queues;
156 }
157
158 return queue_index;
159}
160
161static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) 140static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
162{ 141{
163 struct xenvif *vif = netdev_priv(dev); 142 struct xenvif *vif = netdev_priv(dev);
164 struct xenvif_queue *queue = NULL; 143 struct xenvif_queue *queue = NULL;
165 unsigned int num_queues = dev->real_num_tx_queues; 144 unsigned int num_queues = vif->num_queues;
166 u16 index; 145 u16 index;
167 int min_slots_needed; 146 int min_slots_needed;
168 147
@@ -225,7 +204,7 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev)
225{ 204{
226 struct xenvif *vif = netdev_priv(dev); 205 struct xenvif *vif = netdev_priv(dev);
227 struct xenvif_queue *queue = NULL; 206 struct xenvif_queue *queue = NULL;
228 unsigned int num_queues = dev->real_num_tx_queues; 207 unsigned int num_queues = vif->num_queues;
229 unsigned long rx_bytes = 0; 208 unsigned long rx_bytes = 0;
230 unsigned long rx_packets = 0; 209 unsigned long rx_packets = 0;
231 unsigned long tx_bytes = 0; 210 unsigned long tx_bytes = 0;
@@ -256,7 +235,7 @@ out:
256static void xenvif_up(struct xenvif *vif) 235static void xenvif_up(struct xenvif *vif)
257{ 236{
258 struct xenvif_queue *queue = NULL; 237 struct xenvif_queue *queue = NULL;
259 unsigned int num_queues = vif->dev->real_num_tx_queues; 238 unsigned int num_queues = vif->num_queues;
260 unsigned int queue_index; 239 unsigned int queue_index;
261 240
262 for (queue_index = 0; queue_index < num_queues; ++queue_index) { 241 for (queue_index = 0; queue_index < num_queues; ++queue_index) {
@@ -272,7 +251,7 @@ static void xenvif_up(struct xenvif *vif)
272static void xenvif_down(struct xenvif *vif) 251static void xenvif_down(struct xenvif *vif)
273{ 252{
274 struct xenvif_queue *queue = NULL; 253 struct xenvif_queue *queue = NULL;
275 unsigned int num_queues = vif->dev->real_num_tx_queues; 254 unsigned int num_queues = vif->num_queues;
276 unsigned int queue_index; 255 unsigned int queue_index;
277 256
278 for (queue_index = 0; queue_index < num_queues; ++queue_index) { 257 for (queue_index = 0; queue_index < num_queues; ++queue_index) {
@@ -379,7 +358,7 @@ static void xenvif_get_ethtool_stats(struct net_device *dev,
379 struct ethtool_stats *stats, u64 * data) 358 struct ethtool_stats *stats, u64 * data)
380{ 359{
381 struct xenvif *vif = netdev_priv(dev); 360 struct xenvif *vif = netdev_priv(dev);
382 unsigned int num_queues = dev->real_num_tx_queues; 361 unsigned int num_queues = vif->num_queues;
383 int i; 362 int i;
384 unsigned int queue_index; 363 unsigned int queue_index;
385 struct xenvif_stats *vif_stats; 364 struct xenvif_stats *vif_stats;
@@ -424,7 +403,6 @@ static const struct net_device_ops xenvif_netdev_ops = {
424 .ndo_fix_features = xenvif_fix_features, 403 .ndo_fix_features = xenvif_fix_features,
425 .ndo_set_mac_address = eth_mac_addr, 404 .ndo_set_mac_address = eth_mac_addr,
426 .ndo_validate_addr = eth_validate_addr, 405 .ndo_validate_addr = eth_validate_addr,
427 .ndo_select_queue = xenvif_select_queue,
428}; 406};
429 407
430struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, 408struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
@@ -438,7 +416,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
438 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); 416 snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle);
439 /* Allocate a netdev with the max. supported number of queues. 417 /* Allocate a netdev with the max. supported number of queues.
440 * When the guest selects the desired number, it will be updated 418 * When the guest selects the desired number, it will be updated
441 * via netif_set_real_num_tx_queues(). 419 * via netif_set_real_num_*_queues().
442 */ 420 */
443 dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, 421 dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup,
444 xenvif_max_queues); 422 xenvif_max_queues);
@@ -458,11 +436,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
458 vif->dev = dev; 436 vif->dev = dev;
459 vif->disabled = false; 437 vif->disabled = false;
460 438
461 /* Start out with no queues. The call below does not require 439 /* Start out with no queues. */
462 * rtnl_lock() as it happens before register_netdev().
463 */
464 vif->queues = NULL; 440 vif->queues = NULL;
465 netif_set_real_num_tx_queues(dev, 0); 441 vif->num_queues = 0;
466 442
467 dev->netdev_ops = &xenvif_netdev_ops; 443 dev->netdev_ops = &xenvif_netdev_ops;
468 dev->hw_features = NETIF_F_SG | 444 dev->hw_features = NETIF_F_SG |
@@ -677,7 +653,7 @@ static void xenvif_wait_unmap_timeout(struct xenvif_queue *queue,
677void xenvif_disconnect(struct xenvif *vif) 653void xenvif_disconnect(struct xenvif *vif)
678{ 654{
679 struct xenvif_queue *queue = NULL; 655 struct xenvif_queue *queue = NULL;
680 unsigned int num_queues = vif->dev->real_num_tx_queues; 656 unsigned int num_queues = vif->num_queues;
681 unsigned int queue_index; 657 unsigned int queue_index;
682 658
683 if (netif_carrier_ok(vif->dev)) 659 if (netif_carrier_ok(vif->dev))
@@ -724,7 +700,7 @@ void xenvif_deinit_queue(struct xenvif_queue *queue)
724void xenvif_free(struct xenvif *vif) 700void xenvif_free(struct xenvif *vif)
725{ 701{
726 struct xenvif_queue *queue = NULL; 702 struct xenvif_queue *queue = NULL;
727 unsigned int num_queues = vif->dev->real_num_tx_queues; 703 unsigned int num_queues = vif->num_queues;
728 unsigned int queue_index; 704 unsigned int queue_index;
729 /* Here we want to avoid timeout messages if an skb can be legitimately 705 /* Here we want to avoid timeout messages if an skb can be legitimately
730 * stuck somewhere else. Realistically this could be an another vif's 706 * stuck somewhere else. Realistically this could be an another vif's
@@ -748,12 +724,9 @@ void xenvif_free(struct xenvif *vif)
748 xenvif_deinit_queue(queue); 724 xenvif_deinit_queue(queue);
749 } 725 }
750 726
751 /* Free the array of queues. The call below does not require
752 * rtnl_lock() because it happens after unregister_netdev().
753 */
754 netif_set_real_num_tx_queues(vif->dev, 0);
755 vfree(vif->queues); 727 vfree(vif->queues);
756 vif->queues = NULL; 728 vif->queues = NULL;
729 vif->num_queues = 0;
757 730
758 free_netdev(vif->dev); 731 free_netdev(vif->dev);
759 732
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 96c63dc2509e..3d85acd84bad 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -527,9 +527,7 @@ static void connect(struct backend_info *be)
527 /* Use the number of queues requested by the frontend */ 527 /* Use the number of queues requested by the frontend */
528 be->vif->queues = vzalloc(requested_num_queues * 528 be->vif->queues = vzalloc(requested_num_queues *
529 sizeof(struct xenvif_queue)); 529 sizeof(struct xenvif_queue));
530 rtnl_lock(); 530 be->vif->num_queues = requested_num_queues;
531 netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues);
532 rtnl_unlock();
533 531
534 for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { 532 for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) {
535 queue = &be->vif->queues[queue_index]; 533 queue = &be->vif->queues[queue_index];
@@ -546,9 +544,7 @@ static void connect(struct backend_info *be)
546 * earlier queues can be destroyed using the regular 544 * earlier queues can be destroyed using the regular
547 * disconnect logic. 545 * disconnect logic.
548 */ 546 */
549 rtnl_lock(); 547 be->vif->num_queues = queue_index;
550 netif_set_real_num_tx_queues(be->vif->dev, queue_index);
551 rtnl_unlock();
552 goto err; 548 goto err;
553 } 549 }
554 550
@@ -561,13 +557,19 @@ static void connect(struct backend_info *be)
561 * and also clean up any previously initialised queues. 557 * and also clean up any previously initialised queues.
562 */ 558 */
563 xenvif_deinit_queue(queue); 559 xenvif_deinit_queue(queue);
564 rtnl_lock(); 560 be->vif->num_queues = queue_index;
565 netif_set_real_num_tx_queues(be->vif->dev, queue_index);
566 rtnl_unlock();
567 goto err; 561 goto err;
568 } 562 }
569 } 563 }
570 564
565 /* Initialisation completed, tell core driver the number of
566 * active queues.
567 */
568 rtnl_lock();
569 netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues);
570 netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues);
571 rtnl_unlock();
572
571 xenvif_carrier_on(be->vif); 573 xenvif_carrier_on(be->vif);
572 574
573 unregister_hotplug_status_watch(be); 575 unregister_hotplug_status_watch(be);
@@ -582,13 +584,11 @@ static void connect(struct backend_info *be)
582 return; 584 return;
583 585
584err: 586err:
585 if (be->vif->dev->real_num_tx_queues > 0) 587 if (be->vif->num_queues > 0)
586 xenvif_disconnect(be->vif); /* Clean up existing queues */ 588 xenvif_disconnect(be->vif); /* Clean up existing queues */
587 vfree(be->vif->queues); 589 vfree(be->vif->queues);
588 be->vif->queues = NULL; 590 be->vif->queues = NULL;
589 rtnl_lock(); 591 be->vif->num_queues = 0;
590 netif_set_real_num_tx_queues(be->vif->dev, 0);
591 rtnl_unlock();
592 return; 592 return;
593} 593}
594 594
@@ -596,7 +596,7 @@ err:
596static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) 596static int connect_rings(struct backend_info *be, struct xenvif_queue *queue)
597{ 597{
598 struct xenbus_device *dev = be->dev; 598 struct xenbus_device *dev = be->dev;
599 unsigned int num_queues = queue->vif->dev->real_num_tx_queues; 599 unsigned int num_queues = queue->vif->num_queues;
600 unsigned long tx_ring_ref, rx_ring_ref; 600 unsigned long tx_ring_ref, rx_ring_ref;
601 unsigned int tx_evtchn, rx_evtchn; 601 unsigned int tx_evtchn, rx_evtchn;
602 int err; 602 int err;
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 5a7872ac3566..2ccb4a02368b 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1287,7 +1287,7 @@ static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id)
1287 1287
1288 if (likely(netif_carrier_ok(dev) && 1288 if (likely(netif_carrier_ok(dev) &&
1289 RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) 1289 RING_HAS_UNCONSUMED_RESPONSES(&queue->rx)))
1290 napi_schedule(&queue->napi); 1290 napi_schedule(&queue->napi);
1291 1291
1292 return IRQ_HANDLED; 1292 return IRQ_HANDLED;
1293} 1293}
@@ -1437,10 +1437,11 @@ static void xennet_end_access(int ref, void *page)
1437static void xennet_disconnect_backend(struct netfront_info *info) 1437static void xennet_disconnect_backend(struct netfront_info *info)
1438{ 1438{
1439 unsigned int i = 0; 1439 unsigned int i = 0;
1440 struct netfront_queue *queue = NULL;
1441 unsigned int num_queues = info->netdev->real_num_tx_queues; 1440 unsigned int num_queues = info->netdev->real_num_tx_queues;
1442 1441
1443 for (i = 0; i < num_queues; ++i) { 1442 for (i = 0; i < num_queues; ++i) {
1443 struct netfront_queue *queue = &info->queues[i];
1444
1444 /* Stop old i/f to prevent errors whilst we rebuild the state. */ 1445 /* Stop old i/f to prevent errors whilst we rebuild the state. */
1445 spin_lock_bh(&queue->rx_lock); 1446 spin_lock_bh(&queue->rx_lock);
1446 spin_lock_irq(&queue->tx_lock); 1447 spin_lock_irq(&queue->tx_lock);
@@ -1698,8 +1699,6 @@ static int xennet_init_queue(struct netfront_queue *queue)
1698 goto exit_free_tx; 1699 goto exit_free_tx;
1699 } 1700 }
1700 1701
1701 netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64);
1702
1703 return 0; 1702 return 0;
1704 1703
1705 exit_free_tx: 1704 exit_free_tx:
@@ -1790,6 +1789,70 @@ error:
1790 return err; 1789 return err;
1791} 1790}
1792 1791
1792static void xennet_destroy_queues(struct netfront_info *info)
1793{
1794 unsigned int i;
1795
1796 rtnl_lock();
1797
1798 for (i = 0; i < info->netdev->real_num_tx_queues; i++) {
1799 struct netfront_queue *queue = &info->queues[i];
1800
1801 if (netif_running(info->netdev))
1802 napi_disable(&queue->napi);
1803 netif_napi_del(&queue->napi);
1804 }
1805
1806 rtnl_unlock();
1807
1808 kfree(info->queues);
1809 info->queues = NULL;
1810}
1811
1812static int xennet_create_queues(struct netfront_info *info,
1813 unsigned int num_queues)
1814{
1815 unsigned int i;
1816 int ret;
1817
1818 info->queues = kcalloc(num_queues, sizeof(struct netfront_queue),
1819 GFP_KERNEL);
1820 if (!info->queues)
1821 return -ENOMEM;
1822
1823 rtnl_lock();
1824
1825 for (i = 0; i < num_queues; i++) {
1826 struct netfront_queue *queue = &info->queues[i];
1827
1828 queue->id = i;
1829 queue->info = info;
1830
1831 ret = xennet_init_queue(queue);
1832 if (ret < 0) {
1833 dev_warn(&info->netdev->dev, "only created %d queues\n",
1834 num_queues);
1835 num_queues = i;
1836 break;
1837 }
1838
1839 netif_napi_add(queue->info->netdev, &queue->napi,
1840 xennet_poll, 64);
1841 if (netif_running(info->netdev))
1842 napi_enable(&queue->napi);
1843 }
1844
1845 netif_set_real_num_tx_queues(info->netdev, num_queues);
1846
1847 rtnl_unlock();
1848
1849 if (num_queues == 0) {
1850 dev_err(&info->netdev->dev, "no queues\n");
1851 return -EINVAL;
1852 }
1853 return 0;
1854}
1855
1793/* Common code used when first setting up, and when resuming. */ 1856/* Common code used when first setting up, and when resuming. */
1794static int talk_to_netback(struct xenbus_device *dev, 1857static int talk_to_netback(struct xenbus_device *dev,
1795 struct netfront_info *info) 1858 struct netfront_info *info)
@@ -1826,42 +1889,20 @@ static int talk_to_netback(struct xenbus_device *dev,
1826 goto out; 1889 goto out;
1827 } 1890 }
1828 1891
1829 /* Allocate array of queues */ 1892 if (info->queues)
1830 info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); 1893 xennet_destroy_queues(info);
1831 if (!info->queues) { 1894
1832 err = -ENOMEM; 1895 err = xennet_create_queues(info, num_queues);
1833 goto out; 1896 if (err < 0)
1834 } 1897 goto destroy_ring;
1835 rtnl_lock();
1836 netif_set_real_num_tx_queues(info->netdev, num_queues);
1837 rtnl_unlock();
1838 1898
1839 /* Create shared ring, alloc event channel -- for each queue */ 1899 /* Create shared ring, alloc event channel -- for each queue */
1840 for (i = 0; i < num_queues; ++i) { 1900 for (i = 0; i < num_queues; ++i) {
1841 queue = &info->queues[i]; 1901 queue = &info->queues[i];
1842 queue->id = i;
1843 queue->info = info;
1844 err = xennet_init_queue(queue);
1845 if (err) {
1846 /* xennet_init_queue() cleans up after itself on failure,
1847 * but we still have to clean up any previously initialised
1848 * queues. If i > 0, set num_queues to i, then goto
1849 * destroy_ring, which calls xennet_disconnect_backend()
1850 * to tidy up.
1851 */
1852 if (i > 0) {
1853 rtnl_lock();
1854 netif_set_real_num_tx_queues(info->netdev, i);
1855 rtnl_unlock();
1856 goto destroy_ring;
1857 } else {
1858 goto out;
1859 }
1860 }
1861 err = setup_netfront(dev, queue, feature_split_evtchn); 1902 err = setup_netfront(dev, queue, feature_split_evtchn);
1862 if (err) { 1903 if (err) {
1863 /* As for xennet_init_queue(), setup_netfront() will tidy 1904 /* setup_netfront() will tidy up the current
1864 * up the current queue on error, but we need to clean up 1905 * queue on error, but we need to clean up
1865 * those already allocated. 1906 * those already allocated.
1866 */ 1907 */
1867 if (i > 0) { 1908 if (i > 0) {
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index c4cddf0cd96d..b777d8f46bd5 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -880,6 +880,21 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
880 const u64 phys_offset = __pa(PAGE_OFFSET); 880 const u64 phys_offset = __pa(PAGE_OFFSET);
881 base &= PAGE_MASK; 881 base &= PAGE_MASK;
882 size &= PAGE_MASK; 882 size &= PAGE_MASK;
883
884 if (sizeof(phys_addr_t) < sizeof(u64)) {
885 if (base > ULONG_MAX) {
886 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
887 base, base + size);
888 return;
889 }
890
891 if (base + size > ULONG_MAX) {
892 pr_warning("Ignoring memory range 0x%lx - 0x%llx\n",
893 ULONG_MAX, base + size);
894 size = ULONG_MAX - base;
895 }
896 }
897
883 if (base + size < phys_offset) { 898 if (base + size < phys_offset) {
884 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", 899 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
885 base, base + size); 900 base, base + size);
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index fb4a59830648..a3bf2122a8d5 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -323,11 +323,13 @@ int of_phy_register_fixed_link(struct device_node *np)
323 fixed_link_node = of_get_child_by_name(np, "fixed-link"); 323 fixed_link_node = of_get_child_by_name(np, "fixed-link");
324 if (fixed_link_node) { 324 if (fixed_link_node) {
325 status.link = 1; 325 status.link = 1;
326 status.duplex = of_property_read_bool(np, "full-duplex"); 326 status.duplex = of_property_read_bool(fixed_link_node,
327 "full-duplex");
327 if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) 328 if (of_property_read_u32(fixed_link_node, "speed", &status.speed))
328 return -EINVAL; 329 return -EINVAL;
329 status.pause = of_property_read_bool(np, "pause"); 330 status.pause = of_property_read_bool(fixed_link_node, "pause");
330 status.asym_pause = of_property_read_bool(np, "asym-pause"); 331 status.asym_pause = of_property_read_bool(fixed_link_node,
332 "asym-pause");
331 of_node_put(fixed_link_node); 333 of_node_put(fixed_link_node);
332 return fixed_phy_register(PHY_POLL, &status, np); 334 return fixed_phy_register(PHY_POLL, &status, np);
333 } 335 }
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index 6aea373547f6..ee3de3421f2d 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -74,7 +74,7 @@ config DP83640_PHY
74 74
75config PTP_1588_CLOCK_PCH 75config PTP_1588_CLOCK_PCH
76 tristate "Intel PCH EG20T as PTP clock" 76 tristate "Intel PCH EG20T as PTP clock"
77 depends on X86 || COMPILE_TEST 77 depends on X86_32 || COMPILE_TEST
78 depends on HAS_IOMEM && NET 78 depends on HAS_IOMEM && NET
79 select PTP_1588_CLOCK 79 select PTP_1588_CLOCK
80 help 80 help
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
index 57544e254a78..58ece59367ae 100644
--- a/drivers/regulator/bcm590xx-regulator.c
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -119,6 +119,10 @@ static const unsigned int ldo_c_table[] = {
119 2900000, 3000000, 3300000, 119 2900000, 3000000, 3300000,
120}; 120};
121 121
122static const unsigned int ldo_vbus[] = {
123 5000000,
124};
125
122/* DCDC group CSR: supported voltages in microvolts */ 126/* DCDC group CSR: supported voltages in microvolts */
123static const struct regulator_linear_range dcdc_csr_ranges[] = { 127static const struct regulator_linear_range dcdc_csr_ranges[] = {
124 REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), 128 REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000),
@@ -192,6 +196,7 @@ static struct bcm590xx_info bcm590xx_regs[] = {
192 BCM590XX_REG_TABLE(gpldo4, ldo_a_table), 196 BCM590XX_REG_TABLE(gpldo4, ldo_a_table),
193 BCM590XX_REG_TABLE(gpldo5, ldo_a_table), 197 BCM590XX_REG_TABLE(gpldo5, ldo_a_table),
194 BCM590XX_REG_TABLE(gpldo6, ldo_a_table), 198 BCM590XX_REG_TABLE(gpldo6, ldo_a_table),
199 BCM590XX_REG_TABLE(vbus, ldo_vbus),
195}; 200};
196 201
197struct bcm590xx_reg { 202struct bcm590xx_reg {
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index b982f0ff4e01..93b4ad842901 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -325,6 +325,10 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode)
325 if (rail_enable) 325 if (rail_enable)
326 palmas_smps_write(pmic->palmas, 326 palmas_smps_write(pmic->palmas,
327 palmas_regs_info[id].ctrl_addr, reg); 327 palmas_regs_info[id].ctrl_addr, reg);
328
329 /* Switch the enable value to ensure this is used for enable */
330 pmic->desc[id].enable_val = pmic->current_reg_mode[id];
331
328 return 0; 332 return 0;
329} 333}
330 334
@@ -964,6 +968,14 @@ static int palmas_regulators_probe(struct platform_device *pdev)
964 return ret; 968 return ret;
965 pmic->current_reg_mode[id] = reg & 969 pmic->current_reg_mode[id] = reg &
966 PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; 970 PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
971
972 pmic->desc[id].enable_reg =
973 PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
974 palmas_regs_info[id].ctrl_addr);
975 pmic->desc[id].enable_mask =
976 PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
977 /* set_mode overrides this value */
978 pmic->desc[id].enable_val = SMPS_CTRL_MODE_ON;
967 } 979 }
968 980
969 pmic->desc[id].type = REGULATOR_VOLTAGE; 981 pmic->desc[id].type = REGULATOR_VOLTAGE;
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 69b4b7750410..9effe48c605e 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -209,7 +209,7 @@ static const struct regulator_desc regulators[] = {
209 1, -1, -1, TPS65218_REG_ENABLE1, 209 1, -1, -1, TPS65218_REG_ENABLE1,
210 TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), 210 TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0),
211 TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, 211 TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64,
212 TPS65218_REG_CONTROL_DCDC4, 212 TPS65218_REG_CONTROL_LDO1,
213 TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, 213 TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2,
214 TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, 214 TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges,
215 2, 0), 215 2, 0),
@@ -240,6 +240,7 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
240 config.init_data = init_data; 240 config.init_data = init_data;
241 config.driver_data = tps; 241 config.driver_data = tps;
242 config.regmap = tps->regmap; 242 config.regmap = tps->regmap;
243 config.of_node = pdev->dev.of_node;
243 244
244 rdev = devm_regulator_register(&pdev->dev, &regulators[id], &config); 245 rdev = devm_regulator_register(&pdev->dev, &regulators[id], &config);
245 if (IS_ERR(rdev)) { 246 if (IS_ERR(rdev)) {
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 554349029628..56467df3d6de 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4198,6 +4198,8 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
4198 kfree(phba->ep_array); 4198 kfree(phba->ep_array);
4199 phba->ep_array = NULL; 4199 phba->ep_array = NULL;
4200 ret = -ENOMEM; 4200 ret = -ENOMEM;
4201
4202 goto free_memory;
4201 } 4203 }
4202 4204
4203 for (i = 0; i < phba->params.cxns_per_ctrl; i++) { 4205 for (i = 0; i < phba->params.cxns_per_ctrl; i++) {
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 6045aa78986a..07934b0b9ee1 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1008,10 +1008,8 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
1008 BE2_IPV6 : BE2_IPV4 ; 1008 BE2_IPV6 : BE2_IPV4 ;
1009 1009
1010 rc = mgmt_get_if_info(phba, ip_type, &if_info); 1010 rc = mgmt_get_if_info(phba, ip_type, &if_info);
1011 if (rc) { 1011 if (rc)
1012 kfree(if_info);
1013 return rc; 1012 return rc;
1014 }
1015 1013
1016 if (boot_proto == ISCSI_BOOTPROTO_DHCP) { 1014 if (boot_proto == ISCSI_BOOTPROTO_DHCP) {
1017 if (if_info->dhcp_state) { 1015 if (if_info->dhcp_state) {
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index f54843023466..785d0d71781e 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
516 skb_pull(skb, sizeof(struct fcoe_hdr)); 516 skb_pull(skb, sizeof(struct fcoe_hdr));
517 fr_len = skb->len - sizeof(struct fcoe_crc_eof); 517 fr_len = skb->len - sizeof(struct fcoe_crc_eof);
518 518
519 stats = per_cpu_ptr(lport->stats, get_cpu());
520 stats->RxFrames++;
521 stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
522
523 fp = (struct fc_frame *)skb; 519 fp = (struct fc_frame *)skb;
524 fc_frame_init(fp); 520 fc_frame_init(fp);
525 fr_dev(fp) = lport; 521 fr_dev(fp) = lport;
526 fr_sof(fp) = hp->fcoe_sof; 522 fr_sof(fp) = hp->fcoe_sof;
527 if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) { 523 if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
528 put_cpu();
529 kfree_skb(skb); 524 kfree_skb(skb);
530 return; 525 return;
531 } 526 }
532 fr_eof(fp) = crc_eof.fcoe_eof; 527 fr_eof(fp) = crc_eof.fcoe_eof;
533 fr_crc(fp) = crc_eof.fcoe_crc32; 528 fr_crc(fp) = crc_eof.fcoe_crc32;
534 if (pskb_trim(skb, fr_len)) { 529 if (pskb_trim(skb, fr_len)) {
535 put_cpu();
536 kfree_skb(skb); 530 kfree_skb(skb);
537 return; 531 return;
538 } 532 }
@@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
544 port = lport_priv(vn_port); 538 port = lport_priv(vn_port);
545 if (!ether_addr_equal(port->data_src_addr, dest_mac)) { 539 if (!ether_addr_equal(port->data_src_addr, dest_mac)) {
546 BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); 540 BNX2FC_HBA_DBG(lport, "fpma mismatch\n");
547 put_cpu();
548 kfree_skb(skb); 541 kfree_skb(skb);
549 return; 542 return;
550 } 543 }
@@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
552 if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && 545 if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA &&
553 fh->fh_type == FC_TYPE_FCP) { 546 fh->fh_type == FC_TYPE_FCP) {
554 /* Drop FCP data. We dont this in L2 path */ 547 /* Drop FCP data. We dont this in L2 path */
555 put_cpu();
556 kfree_skb(skb); 548 kfree_skb(skb);
557 return; 549 return;
558 } 550 }
@@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
562 case ELS_LOGO: 554 case ELS_LOGO:
563 if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) { 555 if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) {
564 /* drop non-FIP LOGO */ 556 /* drop non-FIP LOGO */
565 put_cpu();
566 kfree_skb(skb); 557 kfree_skb(skb);
567 return; 558 return;
568 } 559 }
@@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
572 563
573 if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) { 564 if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
574 /* Drop incoming ABTS */ 565 /* Drop incoming ABTS */
575 put_cpu();
576 kfree_skb(skb); 566 kfree_skb(skb);
577 return; 567 return;
578 } 568 }
579 569
570 stats = per_cpu_ptr(lport->stats, smp_processor_id());
571 stats->RxFrames++;
572 stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
573
580 if (le32_to_cpu(fr_crc(fp)) != 574 if (le32_to_cpu(fr_crc(fp)) !=
581 ~crc32(~0, skb->data, fr_len)) { 575 ~crc32(~0, skb->data, fr_len)) {
582 if (stats->InvalidCRCCount < 5) 576 if (stats->InvalidCRCCount < 5)
583 printk(KERN_WARNING PFX "dropping frame with " 577 printk(KERN_WARNING PFX "dropping frame with "
584 "CRC error\n"); 578 "CRC error\n");
585 stats->InvalidCRCCount++; 579 stats->InvalidCRCCount++;
586 put_cpu();
587 kfree_skb(skb); 580 kfree_skb(skb);
588 return; 581 return;
589 } 582 }
590 put_cpu();
591 fc_exch_recv(lport, fp); 583 fc_exch_recv(lport, fp);
592} 584}
593 585
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 32a5e0a2a669..7bc47fc7c686 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -282,6 +282,8 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
282 arr_sz, GFP_KERNEL); 282 arr_sz, GFP_KERNEL);
283 if (!cmgr->free_list_lock) { 283 if (!cmgr->free_list_lock) {
284 printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); 284 printk(KERN_ERR PFX "failed to alloc free_list_lock\n");
285 kfree(cmgr->free_list);
286 cmgr->free_list = NULL;
285 goto mem_err; 287 goto mem_err;
286 } 288 }
287 289
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 2ebfb2bb0f42..7b23f21f22f1 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue)
185 if (crq->valid & 0x80) { 185 if (crq->valid & 0x80) {
186 if (++queue->cur == queue->size) 186 if (++queue->cur == queue->size)
187 queue->cur = 0; 187 queue->cur = 0;
188
189 /* Ensure the read of the valid bit occurs before reading any
190 * other bits of the CRQ entry
191 */
192 rmb();
188 } else 193 } else
189 crq = NULL; 194 crq = NULL;
190 spin_unlock_irqrestore(&queue->lock, flags); 195 spin_unlock_irqrestore(&queue->lock, flags);
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata,
203{ 208{
204 struct vio_dev *vdev = to_vio_dev(hostdata->dev); 209 struct vio_dev *vdev = to_vio_dev(hostdata->dev);
205 210
211 /*
212 * Ensure the command buffer is flushed to memory before handing it
213 * over to the VIOS to prevent it from fetching any stale data.
214 */
215 mb();
206 return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); 216 return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2);
207} 217}
208 218
@@ -797,7 +807,8 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
797 evt->hostdata->dev); 807 evt->hostdata->dev);
798 if (evt->cmnd_done) 808 if (evt->cmnd_done)
799 evt->cmnd_done(evt->cmnd); 809 evt->cmnd_done(evt->cmnd);
800 } else if (evt->done) 810 } else if (evt->done && evt->crq.format != VIOSRP_MAD_FORMAT &&
811 evt->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
801 evt->done(evt); 812 evt->done(evt);
802 free_event_struct(&evt->hostdata->pool, evt); 813 free_event_struct(&evt->hostdata->pool, evt);
803 spin_lock_irqsave(hostdata->host->host_lock, flags); 814 spin_lock_irqsave(hostdata->host->host_lock, flags);
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index c4f31b21feb8..e90c89f1d480 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -677,7 +677,7 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
677 * pm8001_get_phy_settings_info : Read phy setting values. 677 * pm8001_get_phy_settings_info : Read phy setting values.
678 * @pm8001_ha : our hba. 678 * @pm8001_ha : our hba.
679 */ 679 */
680void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) 680static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
681{ 681{
682 682
683#ifdef PM8001_READ_VPD 683#ifdef PM8001_READ_VPD
@@ -691,11 +691,15 @@ void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
691 payload.offset = 0; 691 payload.offset = 0;
692 payload.length = 4096; 692 payload.length = 4096;
693 payload.func_specific = kzalloc(4096, GFP_KERNEL); 693 payload.func_specific = kzalloc(4096, GFP_KERNEL);
694 if (!payload.func_specific)
695 return -ENOMEM;
694 /* Read phy setting values from flash */ 696 /* Read phy setting values from flash */
695 PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); 697 PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
696 wait_for_completion(&completion); 698 wait_for_completion(&completion);
697 pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); 699 pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific);
700 kfree(payload.func_specific);
698#endif 701#endif
702 return 0;
699} 703}
700 704
701#ifdef PM8001_USE_MSIX 705#ifdef PM8001_USE_MSIX
@@ -879,8 +883,11 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
879 pm8001_init_sas_add(pm8001_ha); 883 pm8001_init_sas_add(pm8001_ha);
880 /* phy setting support for motherboard controller */ 884 /* phy setting support for motherboard controller */
881 if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 && 885 if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 &&
882 pdev->subsystem_vendor != 0) 886 pdev->subsystem_vendor != 0) {
883 pm8001_get_phy_settings_info(pm8001_ha); 887 rc = pm8001_get_phy_settings_info(pm8001_ha);
888 if (rc)
889 goto err_out_shost;
890 }
884 pm8001_post_sas_ha_init(shost, chip); 891 pm8001_post_sas_ha_init(shost, chip);
885 rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); 892 rc = sas_register_ha(SHOST_TO_SAS_HA(shost));
886 if (rc) 893 if (rc)
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 4b188b0164e9..e632e14180cf 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1128,7 +1128,7 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha,
1128 ctio->u.status1.flags = 1128 ctio->u.status1.flags =
1129 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | 1129 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 |
1130 CTIO7_FLAGS_TERMINATE); 1130 CTIO7_FLAGS_TERMINATE);
1131 ctio->u.status1.ox_id = entry->fcp_hdr_le.ox_id; 1131 ctio->u.status1.ox_id = cpu_to_le16(entry->fcp_hdr_le.ox_id);
1132 1132
1133 qla2x00_start_iocbs(vha, vha->req); 1133 qla2x00_start_iocbs(vha, vha->req);
1134 1134
@@ -1262,6 +1262,7 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha,
1262{ 1262{
1263 struct atio_from_isp *atio = &mcmd->orig_iocb.atio; 1263 struct atio_from_isp *atio = &mcmd->orig_iocb.atio;
1264 struct ctio7_to_24xx *ctio; 1264 struct ctio7_to_24xx *ctio;
1265 uint16_t temp;
1265 1266
1266 ql_dbg(ql_dbg_tgt, ha, 0xe008, 1267 ql_dbg(ql_dbg_tgt, ha, 0xe008,
1267 "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n", 1268 "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n",
@@ -1292,7 +1293,8 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha,
1292 ctio->u.status1.flags = (atio->u.isp24.attr << 9) | 1293 ctio->u.status1.flags = (atio->u.isp24.attr << 9) |
1293 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | 1294 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 |
1294 CTIO7_FLAGS_SEND_STATUS); 1295 CTIO7_FLAGS_SEND_STATUS);
1295 ctio->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); 1296 temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id);
1297 ctio->u.status1.ox_id = cpu_to_le16(temp);
1296 ctio->u.status1.scsi_status = 1298 ctio->u.status1.scsi_status =
1297 __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); 1299 __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID);
1298 ctio->u.status1.response_len = __constant_cpu_to_le16(8); 1300 ctio->u.status1.response_len = __constant_cpu_to_le16(8);
@@ -1513,6 +1515,7 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm,
1513 struct ctio7_to_24xx *pkt; 1515 struct ctio7_to_24xx *pkt;
1514 struct qla_hw_data *ha = vha->hw; 1516 struct qla_hw_data *ha = vha->hw;
1515 struct atio_from_isp *atio = &prm->cmd->atio; 1517 struct atio_from_isp *atio = &prm->cmd->atio;
1518 uint16_t temp;
1516 1519
1517 pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr; 1520 pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr;
1518 prm->pkt = pkt; 1521 prm->pkt = pkt;
@@ -1541,13 +1544,13 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm,
1541 pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; 1544 pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0];
1542 pkt->exchange_addr = atio->u.isp24.exchange_addr; 1545 pkt->exchange_addr = atio->u.isp24.exchange_addr;
1543 pkt->u.status0.flags |= (atio->u.isp24.attr << 9); 1546 pkt->u.status0.flags |= (atio->u.isp24.attr << 9);
1544 pkt->u.status0.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); 1547 temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id);
1548 pkt->u.status0.ox_id = cpu_to_le16(temp);
1545 pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); 1549 pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset);
1546 1550
1547 ql_dbg(ql_dbg_tgt, vha, 0xe00c, 1551 ql_dbg(ql_dbg_tgt, vha, 0xe00c,
1548 "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n", 1552 "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n",
1549 vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, 1553 vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, temp);
1550 le16_to_cpu(pkt->u.status0.ox_id));
1551 return 0; 1554 return 0;
1552} 1555}
1553 1556
@@ -2619,6 +2622,7 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha,
2619 struct qla_hw_data *ha = vha->hw; 2622 struct qla_hw_data *ha = vha->hw;
2620 request_t *pkt; 2623 request_t *pkt;
2621 int ret = 0; 2624 int ret = 0;
2625 uint16_t temp;
2622 2626
2623 ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha); 2627 ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha);
2624 2628
@@ -2655,7 +2659,8 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha,
2655 ctio24->u.status1.flags = (atio->u.isp24.attr << 9) | 2659 ctio24->u.status1.flags = (atio->u.isp24.attr << 9) |
2656 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | 2660 __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 |
2657 CTIO7_FLAGS_TERMINATE); 2661 CTIO7_FLAGS_TERMINATE);
2658 ctio24->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); 2662 temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id);
2663 ctio24->u.status1.ox_id = cpu_to_le16(temp);
2659 2664
2660 /* Most likely, it isn't needed */ 2665 /* Most likely, it isn't needed */
2661 ctio24->u.status1.residual = get_unaligned((uint32_t *) 2666 ctio24->u.status1.residual = get_unaligned((uint32_t *)
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index e0a58fd13f66..d1d24fb0160a 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -443,7 +443,7 @@ struct ctio7_to_24xx {
443 uint16_t reserved1; 443 uint16_t reserved1;
444 __le16 flags; 444 __le16 flags;
445 uint32_t residual; 445 uint32_t residual;
446 uint16_t ox_id; 446 __le16 ox_id;
447 uint16_t scsi_status; 447 uint16_t scsi_status;
448 uint32_t relative_offset; 448 uint32_t relative_offset;
449 uint32_t reserved2; 449 uint32_t reserved2;
@@ -458,7 +458,7 @@ struct ctio7_to_24xx {
458 uint16_t sense_length; 458 uint16_t sense_length;
459 uint16_t flags; 459 uint16_t flags;
460 uint32_t residual; 460 uint32_t residual;
461 uint16_t ox_id; 461 __le16 ox_id;
462 uint16_t scsi_status; 462 uint16_t scsi_status;
463 uint16_t response_len; 463 uint16_t response_len;
464 uint16_t reserved; 464 uint16_t reserved;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index cbe38e5e7955..7e957918f33f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -131,7 +131,7 @@ scmd_eh_abort_handler(struct work_struct *work)
131 "aborting command %p\n", scmd)); 131 "aborting command %p\n", scmd));
132 rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); 132 rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd);
133 if (rtn == SUCCESS) { 133 if (rtn == SUCCESS) {
134 scmd->result |= DID_TIME_OUT << 16; 134 set_host_byte(scmd, DID_TIME_OUT);
135 if (scsi_host_eh_past_deadline(sdev->host)) { 135 if (scsi_host_eh_past_deadline(sdev->host)) {
136 SCSI_LOG_ERROR_RECOVERY(3, 136 SCSI_LOG_ERROR_RECOVERY(3,
137 scmd_printk(KERN_INFO, scmd, 137 scmd_printk(KERN_INFO, scmd,
@@ -167,7 +167,7 @@ scmd_eh_abort_handler(struct work_struct *work)
167 scmd_printk(KERN_WARNING, scmd, 167 scmd_printk(KERN_WARNING, scmd,
168 "scmd %p terminate " 168 "scmd %p terminate "
169 "aborted command\n", scmd)); 169 "aborted command\n", scmd));
170 scmd->result |= DID_TIME_OUT << 16; 170 set_host_byte(scmd, DID_TIME_OUT);
171 scsi_finish_command(scmd); 171 scsi_finish_command(scmd);
172 } 172 }
173} 173}
@@ -287,15 +287,15 @@ enum blk_eh_timer_return scsi_times_out(struct request *req)
287 else if (host->hostt->eh_timed_out) 287 else if (host->hostt->eh_timed_out)
288 rtn = host->hostt->eh_timed_out(scmd); 288 rtn = host->hostt->eh_timed_out(scmd);
289 289
290 if (rtn == BLK_EH_NOT_HANDLED && !host->hostt->no_async_abort) 290 if (rtn == BLK_EH_NOT_HANDLED) {
291 if (scsi_abort_command(scmd) == SUCCESS) 291 if (!host->hostt->no_async_abort &&
292 scsi_abort_command(scmd) == SUCCESS)
292 return BLK_EH_NOT_HANDLED; 293 return BLK_EH_NOT_HANDLED;
293 294
294 scmd->result |= DID_TIME_OUT << 16; 295 set_host_byte(scmd, DID_TIME_OUT);
295 296 if (!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))
296 if (unlikely(rtn == BLK_EH_NOT_HANDLED && 297 rtn = BLK_EH_HANDLED;
297 !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) 298 }
298 rtn = BLK_EH_HANDLED;
299 299
300 return rtn; 300 return rtn;
301} 301}
@@ -1777,7 +1777,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1777 break; 1777 break;
1778 case DID_ABORT: 1778 case DID_ABORT:
1779 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { 1779 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) {
1780 scmd->result |= DID_TIME_OUT << 16; 1780 set_host_byte(scmd, DID_TIME_OUT);
1781 return SUCCESS; 1781 return SUCCESS;
1782 } 1782 }
1783 case DID_NO_CONNECT: 1783 case DID_NO_CONNECT:
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index f80908f74ca9..521f5838594b 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2549,6 +2549,7 @@ fc_rport_final_delete(struct work_struct *work)
2549 fc_flush_devloss(shost); 2549 fc_flush_devloss(shost);
2550 if (!cancel_delayed_work(&rport->dev_loss_work)) 2550 if (!cancel_delayed_work(&rport->dev_loss_work))
2551 fc_flush_devloss(shost); 2551 fc_flush_devloss(shost);
2552 cancel_work_sync(&rport->scan_work);
2552 spin_lock_irqsave(shost->host_lock, flags); 2553 spin_lock_irqsave(shost->host_lock, flags);
2553 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; 2554 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING;
2554 } 2555 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e9689d57ccb6..6825eda1114a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2441,7 +2441,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
2441 } 2441 }
2442 2442
2443 sdkp->DPOFUA = (data.device_specific & 0x10) != 0; 2443 sdkp->DPOFUA = (data.device_specific & 0x10) != 0;
2444 if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { 2444 if (sdp->broken_fua) {
2445 sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n");
2446 sdkp->DPOFUA = 0;
2447 } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) {
2445 sd_first_printk(KERN_NOTICE, sdkp, 2448 sd_first_printk(KERN_NOTICE, sdkp,
2446 "Uses READ/WRITE(6), disabling FUA\n"); 2449 "Uses READ/WRITE(6), disabling FUA\n");
2447 sdkp->DPOFUA = 0; 2450 sdkp->DPOFUA = 0;
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 89ee5929eb6d..308256b5e4cb 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -237,6 +237,16 @@ static void virtscsi_req_done(struct virtqueue *vq)
237 virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); 237 virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd);
238}; 238};
239 239
240static void virtscsi_poll_requests(struct virtio_scsi *vscsi)
241{
242 int i, num_vqs;
243
244 num_vqs = vscsi->num_queues;
245 for (i = 0; i < num_vqs; i++)
246 virtscsi_vq_done(vscsi, &vscsi->req_vqs[i],
247 virtscsi_complete_cmd);
248}
249
240static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) 250static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf)
241{ 251{
242 struct virtio_scsi_cmd *cmd = buf; 252 struct virtio_scsi_cmd *cmd = buf;
@@ -253,6 +263,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq)
253 virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); 263 virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free);
254}; 264};
255 265
266static void virtscsi_handle_event(struct work_struct *work);
267
256static int virtscsi_kick_event(struct virtio_scsi *vscsi, 268static int virtscsi_kick_event(struct virtio_scsi *vscsi,
257 struct virtio_scsi_event_node *event_node) 269 struct virtio_scsi_event_node *event_node)
258{ 270{
@@ -260,6 +272,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
260 struct scatterlist sg; 272 struct scatterlist sg;
261 unsigned long flags; 273 unsigned long flags;
262 274
275 INIT_WORK(&event_node->work, virtscsi_handle_event);
263 sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); 276 sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
264 277
265 spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); 278 spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
@@ -377,7 +390,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf)
377{ 390{
378 struct virtio_scsi_event_node *event_node = buf; 391 struct virtio_scsi_event_node *event_node = buf;
379 392
380 INIT_WORK(&event_node->work, virtscsi_handle_event);
381 schedule_work(&event_node->work); 393 schedule_work(&event_node->work);
382} 394}
383 395
@@ -589,6 +601,18 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
589 cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) 601 cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
590 ret = SUCCESS; 602 ret = SUCCESS;
591 603
604 /*
605 * The spec guarantees that all requests related to the TMF have
606 * been completed, but the callback might not have run yet if
607 * we're using independent interrupts (e.g. MSI). Poll the
608 * virtqueues once.
609 *
610 * In the abort case, sc->scsi_done will do nothing, because
611 * the block layer must have detected a timeout and as a result
612 * REQ_ATOM_COMPLETE has been set.
613 */
614 virtscsi_poll_requests(vscsi);
615
592out: 616out:
593 mempool_free(cmd, virtscsi_cmd_pool); 617 mempool_free(cmd, virtscsi_cmd_pool);
594 return ret; 618 return ret;
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index a98df7eeb42d..fe792106bdc5 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -118,6 +118,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
118 */ 118 */
119 orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); 119 orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL);
120 120
121 /* Test SPI_CS_CONTROL_SW_MODE bit enabling */
121 value = orig | SPI_CS_CONTROL_SW_MODE; 122 value = orig | SPI_CS_CONTROL_SW_MODE;
122 writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); 123 writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL);
123 value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); 124 value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL);
@@ -126,10 +127,13 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
126 goto detection_done; 127 goto detection_done;
127 } 128 }
128 129
129 value &= ~SPI_CS_CONTROL_SW_MODE; 130 orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL);
131
132 /* Test SPI_CS_CONTROL_SW_MODE bit disabling */
133 value = orig & ~SPI_CS_CONTROL_SW_MODE;
130 writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); 134 writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL);
131 value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); 135 value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL);
132 if (value != orig) { 136 if (value != (orig & ~SPI_CS_CONTROL_SW_MODE)) {
133 offset = 0x800; 137 offset = 0x800;
134 goto detection_done; 138 goto detection_done;
135 } 139 }
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index fc1de86d3c8a..c08da380cb23 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -424,31 +424,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer)
424 return 0; 424 return 0;
425} 425}
426 426
427static void spi_qup_set_cs(struct spi_device *spi, bool enable)
428{
429 struct spi_qup *controller = spi_master_get_devdata(spi->master);
430
431 u32 iocontol, mask;
432
433 iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL);
434
435 /* Disable auto CS toggle and use manual */
436 iocontol &= ~SPI_IO_C_MX_CS_MODE;
437 iocontol |= SPI_IO_C_FORCE_CS;
438
439 iocontol &= ~SPI_IO_C_CS_SELECT_MASK;
440 iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select);
441
442 mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select;
443
444 if (enable)
445 iocontol |= mask;
446 else
447 iocontol &= ~mask;
448
449 writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL);
450}
451
452static int spi_qup_transfer_one(struct spi_master *master, 427static int spi_qup_transfer_one(struct spi_master *master,
453 struct spi_device *spi, 428 struct spi_device *spi,
454 struct spi_transfer *xfer) 429 struct spi_transfer *xfer)
@@ -571,12 +546,16 @@ static int spi_qup_probe(struct platform_device *pdev)
571 return -ENOMEM; 546 return -ENOMEM;
572 } 547 }
573 548
549 /* use num-cs unless not present or out of range */
550 if (of_property_read_u16(dev->of_node, "num-cs",
551 &master->num_chipselect) ||
552 (master->num_chipselect > SPI_NUM_CHIPSELECTS))
553 master->num_chipselect = SPI_NUM_CHIPSELECTS;
554
574 master->bus_num = pdev->id; 555 master->bus_num = pdev->id;
575 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; 556 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
576 master->num_chipselect = SPI_NUM_CHIPSELECTS;
577 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); 557 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
578 master->max_speed_hz = max_freq; 558 master->max_speed_hz = max_freq;
579 master->set_cs = spi_qup_set_cs;
580 master->transfer_one = spi_qup_transfer_one; 559 master->transfer_one = spi_qup_transfer_one;
581 master->dev.of_node = pdev->dev.of_node; 560 master->dev.of_node = pdev->dev.of_node;
582 master->auto_runtime_pm = true; 561 master->auto_runtime_pm = true;
@@ -640,16 +619,19 @@ static int spi_qup_probe(struct platform_device *pdev)
640 if (ret) 619 if (ret)
641 goto error; 620 goto error;
642 621
643 ret = devm_spi_register_master(dev, master);
644 if (ret)
645 goto error;
646
647 pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); 622 pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
648 pm_runtime_use_autosuspend(dev); 623 pm_runtime_use_autosuspend(dev);
649 pm_runtime_set_active(dev); 624 pm_runtime_set_active(dev);
650 pm_runtime_enable(dev); 625 pm_runtime_enable(dev);
626
627 ret = devm_spi_register_master(dev, master);
628 if (ret)
629 goto disable_pm;
630
651 return 0; 631 return 0;
652 632
633disable_pm:
634 pm_runtime_disable(&pdev->dev);
653error: 635error:
654 clk_disable_unprepare(cclk); 636 clk_disable_unprepare(cclk);
655 clk_disable_unprepare(iclk); 637 clk_disable_unprepare(iclk);
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c
index 1f56ef651d1a..b83dd733684c 100644
--- a/drivers/spi/spi-sh-sci.c
+++ b/drivers/spi/spi-sh-sci.c
@@ -175,9 +175,9 @@ static int sh_sci_spi_remove(struct platform_device *dev)
175{ 175{
176 struct sh_sci_spi *sp = platform_get_drvdata(dev); 176 struct sh_sci_spi *sp = platform_get_drvdata(dev);
177 177
178 iounmap(sp->membase);
179 setbits(sp, PIN_INIT, 0);
180 spi_bitbang_stop(&sp->bitbang); 178 spi_bitbang_stop(&sp->bitbang);
179 setbits(sp, PIN_INIT, 0);
180 iounmap(sp->membase);
181 spi_master_put(sp->bitbang.master); 181 spi_master_put(sp->bitbang.master);
182 return 0; 182 return 0;
183} 183}
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index 357cef2a6f4c..7194bd138762 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client,
465 struct ad7291_platform_data *pdata = client->dev.platform_data; 465 struct ad7291_platform_data *pdata = client->dev.platform_data;
466 struct ad7291_chip_info *chip; 466 struct ad7291_chip_info *chip;
467 struct iio_dev *indio_dev; 467 struct iio_dev *indio_dev;
468 int ret = 0; 468 int ret;
469 469
470 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 470 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
471 if (!indio_dev) 471 if (!indio_dev)
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client,
475 if (pdata && pdata->use_external_ref) { 475 if (pdata && pdata->use_external_ref) {
476 chip->reg = devm_regulator_get(&client->dev, "vref"); 476 chip->reg = devm_regulator_get(&client->dev, "vref");
477 if (IS_ERR(chip->reg)) 477 if (IS_ERR(chip->reg))
478 return ret; 478 return PTR_ERR(chip->reg);
479 479
480 ret = regulator_enable(chip->reg); 480 ret = regulator_enable(chip->reg);
481 if (ret) 481 if (ret)
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index bf952ef7e696..f63dd8f4dde9 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt)
280 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); 280 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);
281 281
282 /* Wait until the state has moved to ON */ 282 /* Wait until the state has moved to ON */
283 while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& 283 while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD,
284 OMAP_INTRANSITION_MASK); 284 OMAP2_PM_PWSTST) &
285 OMAP_INTRANSITION_MASK)
286 ;
285 /* Disable Automatic transition */ 287 /* Disable Automatic transition */
286 (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, 288 (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO,
287 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); 289 OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL);
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 5663f4d19d02..1f4c794f5fcc 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1309,7 +1309,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
1309 if (cmd->data_direction != DMA_TO_DEVICE) { 1309 if (cmd->data_direction != DMA_TO_DEVICE) {
1310 pr_err("Command ITT: 0x%08x received DataOUT for a" 1310 pr_err("Command ITT: 0x%08x received DataOUT for a"
1311 " NON-WRITE command.\n", cmd->init_task_tag); 1311 " NON-WRITE command.\n", cmd->init_task_tag);
1312 return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); 1312 return iscsit_dump_data_payload(conn, payload_length, 1);
1313 } 1313 }
1314 se_cmd = &cmd->se_cmd; 1314 se_cmd = &cmd->se_cmd;
1315 iscsit_mod_dataout_timer(cmd); 1315 iscsit_mod_dataout_timer(cmd);
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
index 19b842c3e0b3..ab4915c0d933 100644
--- a/drivers/target/iscsi/iscsi_target_auth.c
+++ b/drivers/target/iscsi/iscsi_target_auth.c
@@ -174,7 +174,6 @@ static int chap_server_compute_md5(
174 char *nr_out_ptr, 174 char *nr_out_ptr,
175 unsigned int *nr_out_len) 175 unsigned int *nr_out_len)
176{ 176{
177 char *endptr;
178 unsigned long id; 177 unsigned long id;
179 unsigned char id_as_uchar; 178 unsigned char id_as_uchar;
180 unsigned char digest[MD5_SIGNATURE_SIZE]; 179 unsigned char digest[MD5_SIGNATURE_SIZE];
@@ -320,9 +319,14 @@ static int chap_server_compute_md5(
320 } 319 }
321 320
322 if (type == HEX) 321 if (type == HEX)
323 id = simple_strtoul(&identifier[2], &endptr, 0); 322 ret = kstrtoul(&identifier[2], 0, &id);
324 else 323 else
325 id = simple_strtoul(identifier, &endptr, 0); 324 ret = kstrtoul(identifier, 0, &id);
325
326 if (ret < 0) {
327 pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret);
328 goto out;
329 }
326 if (id > 255) { 330 if (id > 255) {
327 pr_err("chap identifier: %lu greater than 255\n", id); 331 pr_err("chap identifier: %lu greater than 255\n", id);
328 goto out; 332 goto out;
@@ -351,6 +355,10 @@ static int chap_server_compute_md5(
351 pr_err("Unable to convert incoming challenge\n"); 355 pr_err("Unable to convert incoming challenge\n");
352 goto out; 356 goto out;
353 } 357 }
358 if (challenge_len > 1024) {
359 pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n");
360 goto out;
361 }
354 /* 362 /*
355 * During mutual authentication, the CHAP_C generated by the 363 * During mutual authentication, the CHAP_C generated by the
356 * initiator must not match the original CHAP_C generated by 364 * initiator must not match the original CHAP_C generated by
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index fecb69535a15..5e71ac609418 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1216,7 +1216,7 @@ old_sess_out:
1216static int __iscsi_target_login_thread(struct iscsi_np *np) 1216static int __iscsi_target_login_thread(struct iscsi_np *np)
1217{ 1217{
1218 u8 *buffer, zero_tsih = 0; 1218 u8 *buffer, zero_tsih = 0;
1219 int ret = 0, rc, stop; 1219 int ret = 0, rc;
1220 struct iscsi_conn *conn = NULL; 1220 struct iscsi_conn *conn = NULL;
1221 struct iscsi_login *login; 1221 struct iscsi_login *login;
1222 struct iscsi_portal_group *tpg = NULL; 1222 struct iscsi_portal_group *tpg = NULL;
@@ -1230,6 +1230,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
1230 if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { 1230 if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
1231 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; 1231 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
1232 complete(&np->np_restart_comp); 1232 complete(&np->np_restart_comp);
1233 } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) {
1234 spin_unlock_bh(&np->np_thread_lock);
1235 goto exit;
1233 } else { 1236 } else {
1234 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; 1237 np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
1235 } 1238 }
@@ -1422,10 +1425,8 @@ old_sess_out:
1422 } 1425 }
1423 1426
1424out: 1427out:
1425 stop = kthread_should_stop(); 1428 return 1;
1426 /* Wait for another socket.. */ 1429
1427 if (!stop)
1428 return 1;
1429exit: 1430exit:
1430 iscsi_stop_login_thread_timer(np); 1431 iscsi_stop_login_thread_timer(np);
1431 spin_lock_bh(&np->np_thread_lock); 1432 spin_lock_bh(&np->np_thread_lock);
@@ -1442,7 +1443,7 @@ int iscsi_target_login_thread(void *arg)
1442 1443
1443 allow_signal(SIGINT); 1444 allow_signal(SIGINT);
1444 1445
1445 while (!kthread_should_stop()) { 1446 while (1) {
1446 ret = __iscsi_target_login_thread(np); 1447 ret = __iscsi_target_login_thread(np);
1447 /* 1448 /*
1448 * We break and exit here unless another sock_accept() call 1449 * We break and exit here unless another sock_accept() call
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 53e157cb8c54..fd90b28f1d94 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
1295 login->login_failed = 1; 1295 login->login_failed = 1;
1296 iscsit_collect_login_stats(conn, status_class, status_detail); 1296 iscsit_collect_login_stats(conn, status_class, status_detail);
1297 1297
1298 memset(&login->rsp[0], 0, ISCSI_HDR_LEN);
1299
1298 hdr = (struct iscsi_login_rsp *)&login->rsp[0]; 1300 hdr = (struct iscsi_login_rsp *)&login->rsp[0];
1299 hdr->opcode = ISCSI_OP_LOGIN_RSP; 1301 hdr->opcode = ISCSI_OP_LOGIN_RSP;
1300 hdr->status_class = status_class; 1302 hdr->status_class = status_class;
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 6d2f37578b29..8c64b8776a96 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -239,6 +239,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
239 return; 239 return;
240 240
241out_done: 241out_done:
242 kmem_cache_free(tcm_loop_cmd_cache, tl_cmd);
242 sc->scsi_done(sc); 243 sc->scsi_done(sc);
243 return; 244 return;
244} 245}
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 11d26fe65bfb..98da90167159 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -616,6 +616,7 @@ void core_dev_unexport(
616 dev->export_count--; 616 dev->export_count--;
617 spin_unlock(&hba->device_lock); 617 spin_unlock(&hba->device_lock);
618 618
619 lun->lun_sep = NULL;
619 lun->lun_se_dev = NULL; 620 lun->lun_se_dev = NULL;
620} 621}
621 622
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c
index a8aaf6ac2ae2..946562389ca8 100644
--- a/drivers/tc/tc.c
+++ b/drivers/tc/tc.c
@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
129 129
130 tc_device_get_irq(tdev); 130 tc_device_get_irq(tdev);
131 131
132 device_register(&tdev->dev); 132 if (device_register(&tdev->dev)) {
133 put_device(&tdev->dev);
134 goto out_err;
135 }
133 list_add_tail(&tdev->node, &tbus->devices); 136 list_add_tail(&tdev->node, &tbus->devices);
134 137
135out_err: 138out_err:
@@ -148,7 +151,10 @@ static int __init tc_init(void)
148 151
149 INIT_LIST_HEAD(&tc_bus.devices); 152 INIT_LIST_HEAD(&tc_bus.devices);
150 dev_set_name(&tc_bus.dev, "tc"); 153 dev_set_name(&tc_bus.dev, "tc");
151 device_register(&tc_bus.dev); 154 if (device_register(&tc_bus.dev)) {
155 put_device(&tc_bus.dev);
156 return 0;
157 }
152 158
153 if (tc_bus.info.slot_size) { 159 if (tc_bus.info.slot_size) {
154 unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; 160 unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000;
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index c41aca4dfc43..72000a6d5af0 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -991,7 +991,7 @@ static const struct of_device_id msm_uartdm_table[] = {
991 { } 991 { }
992}; 992};
993 993
994static int __init msm_serial_probe(struct platform_device *pdev) 994static int msm_serial_probe(struct platform_device *pdev)
995{ 995{
996 struct msm_port *msm_port; 996 struct msm_port *msm_port;
997 struct resource *resource; 997 struct resource *resource;
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 69425b3cb6b7..9d2b673f90e3 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1321,6 +1321,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
1321 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); 1321 struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep);
1322 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); 1322 struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req);
1323 unsigned long flags; 1323 unsigned long flags;
1324 struct td_node *node, *tmpnode;
1324 1325
1325 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || 1326 if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY ||
1326 hwep->ep.desc == NULL || list_empty(&hwreq->queue) || 1327 hwep->ep.desc == NULL || list_empty(&hwreq->queue) ||
@@ -1331,6 +1332,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
1331 1332
1332 hw_ep_flush(hwep->ci, hwep->num, hwep->dir); 1333 hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
1333 1334
1335 list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
1336 dma_pool_free(hwep->td_pool, node->ptr, node->dma);
1337 list_del(&node->td);
1338 kfree(node);
1339 }
1340
1334 /* pop request */ 1341 /* pop request */
1335 list_del_init(&hwreq->queue); 1342 list_del_init(&hwreq->queue);
1336 1343
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 8eb996e4f058..261c3b428220 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -45,6 +45,7 @@ comment "Platform Glue Driver Support"
45config USB_DWC3_OMAP 45config USB_DWC3_OMAP
46 tristate "Texas Instruments OMAP5 and similar Platforms" 46 tristate "Texas Instruments OMAP5 and similar Platforms"
47 depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) 47 depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST)
48 depends on OF
48 default USB_DWC3 49 default USB_DWC3
49 help 50 help
50 Some platforms from Texas Instruments like OMAP5, DRA7xxx and 51 Some platforms from Texas Instruments like OMAP5, DRA7xxx and
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 4af4c3567656..07a736acd0f2 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c)
322{ 322{
323 struct platform_device *pdev = to_platform_device(dev); 323 struct platform_device *pdev = to_platform_device(dev);
324 324
325 platform_device_unregister(pdev); 325 of_device_unregister(pdev);
326 326
327 return 0; 327 return 0;
328} 328}
@@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev)
599{ 599{
600 struct dwc3_omap *omap = dev_get_drvdata(dev); 600 struct dwc3_omap *omap = dev_get_drvdata(dev);
601 601
602 dwc3_omap_disable_irqs(omap); 602 dwc3_omap_write_irqmisc_set(omap, 0x00);
603 603
604 return 0; 604 return 0;
605} 605}
@@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev)
607static void dwc3_omap_complete(struct device *dev) 607static void dwc3_omap_complete(struct device *dev)
608{ 608{
609 struct dwc3_omap *omap = dev_get_drvdata(dev); 609 struct dwc3_omap *omap = dev_get_drvdata(dev);
610 u32 reg;
610 611
611 dwc3_omap_enable_irqs(omap); 612 reg = (USBOTGSS_IRQMISC_OEVT |
613 USBOTGSS_IRQMISC_DRVVBUS_RISE |
614 USBOTGSS_IRQMISC_CHRGVBUS_RISE |
615 USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
616 USBOTGSS_IRQMISC_IDPULLUP_RISE |
617 USBOTGSS_IRQMISC_DRVVBUS_FALL |
618 USBOTGSS_IRQMISC_CHRGVBUS_FALL |
619 USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
620 USBOTGSS_IRQMISC_IDPULLUP_FALL);
621
622 dwc3_omap_write_irqmisc_set(omap, reg);
612} 623}
613 624
614static int dwc3_omap_suspend(struct device *dev) 625static int dwc3_omap_suspend(struct device *dev)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 9d64dd02c57e..dab7927d1009 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
828 length, last ? " last" : "", 828 length, last ? " last" : "",
829 chain ? " chain" : ""); 829 chain ? " chain" : "");
830 830
831 /* Skip the LINK-TRB on ISOC */
832 if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
833 usb_endpoint_xfer_isoc(dep->endpoint.desc))
834 dep->free_slot++;
835 831
836 trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; 832 trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK];
837 833
@@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
843 } 839 }
844 840
845 dep->free_slot++; 841 dep->free_slot++;
842 /* Skip the LINK-TRB on ISOC */
843 if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) &&
844 usb_endpoint_xfer_isoc(dep->endpoint.desc))
845 dep->free_slot++;
846 846
847 trb->size = DWC3_TRB_SIZE_LENGTH(length); 847 trb->size = DWC3_TRB_SIZE_LENGTH(length);
848 trb->bpl = lower_32_bits(dma); 848 trb->bpl = lower_32_bits(dma);
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 2ddcd635ca2a..97142146eead 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = {
1145 .store_attribute = usb_os_desc_attr_store, 1145 .store_attribute = usb_os_desc_attr_store,
1146}; 1146};
1147 1147
1148static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc, 1148static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc,
1149 char *page) 1149 char *page)
1150{ 1150{
1151 memcpy(page, desc->ext_compat_id, 8); 1151 memcpy(page, desc->ext_compat_id, 8);
1152 return 8; 1152 return 8;
1153} 1153}
1154 1154
1155static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, 1155static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc,
1156 const char *page, size_t len) 1156 const char *page, size_t len)
1157{ 1157{
1158 int l; 1158 int l;
1159 1159
@@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc,
1171 return len; 1171 return len;
1172} 1172}
1173 1173
1174static struct usb_os_desc_attribute rndis_grp_attr_compatible_id = 1174static struct usb_os_desc_attribute interf_grp_attr_compatible_id =
1175 __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, 1175 __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR,
1176 rndis_grp_compatible_id_show, 1176 interf_grp_compatible_id_show,
1177 rndis_grp_compatible_id_store); 1177 interf_grp_compatible_id_store);
1178 1178
1179static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc, 1179static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc,
1180 char *page) 1180 char *page)
1181{ 1181{
1182 memcpy(page, desc->ext_compat_id + 8, 8); 1182 memcpy(page, desc->ext_compat_id + 8, 8);
1183 return 8; 1183 return 8;
1184} 1184}
1185 1185
1186static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, 1186static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc,
1187 const char *page, size_t len) 1187 const char *page, size_t len)
1188{ 1188{
1189 int l; 1189 int l;
1190 1190
@@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc,
1202 return len; 1202 return len;
1203} 1203}
1204 1204
1205static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id = 1205static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id =
1206 __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, 1206 __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR,
1207 rndis_grp_sub_compatible_id_show, 1207 interf_grp_sub_compatible_id_show,
1208 rndis_grp_sub_compatible_id_store); 1208 interf_grp_sub_compatible_id_store);
1209 1209
1210static struct configfs_attribute *interf_grp_attrs[] = { 1210static struct configfs_attribute *interf_grp_attrs[] = {
1211 &rndis_grp_attr_compatible_id.attr, 1211 &interf_grp_attr_compatible_id.attr,
1212 &rndis_grp_attr_sub_compatible_id.attr, 1212 &interf_grp_attr_sub_compatible_id.attr,
1213 NULL 1213 NULL
1214}; 1214};
1215 1215
1216int usb_os_desc_prepare_interf_dir(struct config_group *parent, 1216int usb_os_desc_prepare_interf_dir(struct config_group *parent,
1217 int n_interf, 1217 int n_interf,
1218 struct usb_os_desc **desc, 1218 struct usb_os_desc **desc,
1219 char **names,
1219 struct module *owner) 1220 struct module *owner)
1220{ 1221{
1221 struct config_group **f_default_groups, *os_desc_group, 1222 struct config_group **f_default_groups, *os_desc_group,
@@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent,
1257 d = desc[n_interf]; 1258 d = desc[n_interf];
1258 d->owner = owner; 1259 d->owner = owner;
1259 config_group_init_type_name(&d->group, "", interface_type); 1260 config_group_init_type_name(&d->group, "", interface_type);
1260 config_item_set_name(&d->group.cg_item, "interface.%d", 1261 config_item_set_name(&d->group.cg_item, "interface.%s",
1261 n_interf); 1262 names[n_interf]);
1262 interface_groups[n_interf] = &d->group; 1263 interface_groups[n_interf] = &d->group;
1263 } 1264 }
1264 1265
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
index a14ac792c698..36c468c4f5e9 100644
--- a/drivers/usb/gadget/configfs.h
+++ b/drivers/usb/gadget/configfs.h
@@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item);
8int usb_os_desc_prepare_interf_dir(struct config_group *parent, 8int usb_os_desc_prepare_interf_dir(struct config_group *parent,
9 int n_interf, 9 int n_interf,
10 struct usb_os_desc **desc, 10 struct usb_os_desc **desc,
11 char **names,
11 struct module *owner); 12 struct module *owner);
12 13
13static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) 14static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item)
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 74202d67f911..8598c27c7d43 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
1483 ffs->ep0req->context = ffs; 1483 ffs->ep0req->context = ffs;
1484 1484
1485 lang = ffs->stringtabs; 1485 lang = ffs->stringtabs;
1486 for (lang = ffs->stringtabs; *lang; ++lang) { 1486 if (lang) {
1487 struct usb_string *str = (*lang)->strings; 1487 for (; *lang; ++lang) {
1488 int id = first_id; 1488 struct usb_string *str = (*lang)->strings;
1489 for (; str->s; ++id, ++str) 1489 int id = first_id;
1490 str->id = id; 1490 for (; str->s; ++id, ++str)
1491 str->id = id;
1492 }
1491 } 1493 }
1492 1494
1493 ffs->gadget = cdev->gadget; 1495 ffs->gadget = cdev->gadget;
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index eed3ad878047..9c41e9515b8e 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
687 f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), 687 f->os_desc_table = kzalloc(sizeof(*f->os_desc_table),
688 GFP_KERNEL); 688 GFP_KERNEL);
689 if (!f->os_desc_table) 689 if (!f->os_desc_table)
690 return PTR_ERR(f->os_desc_table); 690 return -ENOMEM;
691 f->os_desc_n = 1; 691 f->os_desc_n = 1;
692 f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; 692 f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc;
693 } 693 }
@@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void)
905{ 905{
906 struct f_rndis_opts *opts; 906 struct f_rndis_opts *opts;
907 struct usb_os_desc *descs[1]; 907 struct usb_os_desc *descs[1];
908 char *names[1];
908 909
909 opts = kzalloc(sizeof(*opts), GFP_KERNEL); 910 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
910 if (!opts) 911 if (!opts)
@@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void)
922 INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); 923 INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop);
923 924
924 descs[0] = &opts->rndis_os_desc; 925 descs[0] = &opts->rndis_os_desc;
926 names[0] = "rndis";
925 usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, 927 usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs,
926 THIS_MODULE); 928 names, THIS_MODULE);
927 config_group_init_type_name(&opts->func_inst.group, "", 929 config_group_init_type_name(&opts->func_inst.group, "",
928 &rndis_func_type); 930 &rndis_func_type);
929 931
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 99a37ed03e27..c7004ee89c90 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep,
1532 "%s mode: multiple trans./microframe not valid\n", 1532 "%s mode: multiple trans./microframe not valid\n",
1533 (mode == 2 ? "Bulk" : "Control")); 1533 (mode == 2 ? "Bulk" : "Control"));
1534 return -EINVAL; 1534 return -EINVAL;
1535 } else if (nt == 0x11) { 1535 } else if (nt == 0x3) {
1536 dev_err(dev->dev, "Invalid value for trans./microframe\n"); 1536 dev_err(dev->dev,
1537 "Invalid value 0x3 for additional trans./microframe\n");
1537 return -EINVAL; 1538 return -EINVAL;
1538 } else if ((nt + 1) * max > buffer_size) { 1539 } else if ((nt + 1) * max > buffer_size) {
1539 dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", 1540 dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n",
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index ee6c16416c30..2e4ce7704908 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd)
1264 1264
1265 kfree (dev->buf); 1265 kfree (dev->buf);
1266 dev->buf = NULL; 1266 dev->buf = NULL;
1267 put_dev (dev);
1268 1267
1268 /* other endpoints were all decoupled from this device */
1269 spin_lock_irq(&dev->lock);
1270 dev->state = STATE_DEV_DISABLED;
1271 spin_unlock_irq(&dev->lock);
1272
1273 put_dev (dev);
1269 return 0; 1274 return 0;
1270} 1275}
1271 1276
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 3d78a8844e43..97b027724ee7 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link)
1120 1120
1121 DBG(dev, "%s\n", __func__); 1121 DBG(dev, "%s\n", __func__);
1122 1122
1123 netif_tx_lock(dev->net);
1123 netif_stop_queue(dev->net); 1124 netif_stop_queue(dev->net);
1125 netif_tx_unlock(dev->net);
1126
1124 netif_carrier_off(dev->net); 1127 netif_carrier_off(dev->net);
1125 1128
1126 /* disable endpoints, forcing (synchronous) completion 1129 /* disable endpoints, forcing (synchronous) completion
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 61b7817bd66b..03314f861bee 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -176,7 +176,7 @@ config USB_EHCI_HCD_AT91
176 176
177config USB_EHCI_MSM 177config USB_EHCI_MSM
178 tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" 178 tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller"
179 depends on ARCH_MSM 179 depends on ARCH_MSM || ARCH_QCOM
180 select USB_EHCI_ROOT_HUB_TT 180 select USB_EHCI_ROOT_HUB_TT
181 ---help--- 181 ---help---
182 Enables support for the USB Host controller present on the 182 Enables support for the USB Host controller present on the
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 2b998c60faf2..aa79e8749040 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -22,6 +22,7 @@
22 22
23 23
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/device.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
26 27
27#include "xhci.h" 28#include "xhci.h"
@@ -1139,7 +1140,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
1139 * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME 1140 * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME
1140 * is enabled, so also enable remote wake here. 1141 * is enabled, so also enable remote wake here.
1141 */ 1142 */
1142 if (hcd->self.root_hub->do_remote_wakeup) { 1143 if (hcd->self.root_hub->do_remote_wakeup
1144 && device_may_wakeup(hcd->self.controller)) {
1145
1143 if (t1 & PORT_CONNECT) { 1146 if (t1 & PORT_CONNECT) {
1144 t2 |= PORT_WKOC_E | PORT_WKDISC_E; 1147 t2 |= PORT_WKOC_E | PORT_WKDISC_E;
1145 t2 &= ~PORT_WKCONN_E; 1148 t2 &= ~PORT_WKCONN_E;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index d67ff71209f5..749fc68eb5c1 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1433 xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); 1433 xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code);
1434 break; 1434 break;
1435 case TRB_RESET_DEV: 1435 case TRB_RESET_DEV:
1436 WARN_ON(slot_id != TRB_TO_SLOT_ID( 1436 /* SLOT_ID field in reset device cmd completion event TRB is 0.
1437 le32_to_cpu(cmd_trb->generic.field[3]))); 1437 * Use the SLOT_ID from the command TRB instead (xhci 4.6.11)
1438 */
1439 slot_id = TRB_TO_SLOT_ID(
1440 le32_to_cpu(cmd_trb->generic.field[3]));
1438 xhci_handle_cmd_reset_dev(xhci, slot_id, event); 1441 xhci_handle_cmd_reset_dev(xhci, slot_id, event);
1439 break; 1442 break;
1440 case TRB_NEC_GET_FW: 1443 case TRB_NEC_GET_FW:
@@ -3534,7 +3537,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci,
3534 return 0; 3537 return 0;
3535 3538
3536 max_burst = urb->ep->ss_ep_comp.bMaxBurst; 3539 max_burst = urb->ep->ss_ep_comp.bMaxBurst;
3537 return roundup(total_packet_count, max_burst + 1) - 1; 3540 return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1;
3538} 3541}
3539 3542
3540/* 3543/*
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 2b8d9a24af09..7436d5f5e67a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -936,7 +936,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
936 */ 936 */
937int xhci_resume(struct xhci_hcd *xhci, bool hibernated) 937int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
938{ 938{
939 u32 command, temp = 0; 939 u32 command, temp = 0, status;
940 struct usb_hcd *hcd = xhci_to_hcd(xhci); 940 struct usb_hcd *hcd = xhci_to_hcd(xhci);
941 struct usb_hcd *secondary_hcd; 941 struct usb_hcd *secondary_hcd;
942 int retval = 0; 942 int retval = 0;
@@ -1054,8 +1054,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1054 1054
1055 done: 1055 done:
1056 if (retval == 0) { 1056 if (retval == 0) {
1057 usb_hcd_resume_root_hub(hcd); 1057 /* Resume root hubs only when have pending events. */
1058 usb_hcd_resume_root_hub(xhci->shared_hcd); 1058 status = readl(&xhci->op_regs->status);
1059 if (status & STS_EINT) {
1060 usb_hcd_resume_root_hub(hcd);
1061 usb_hcd_resume_root_hub(xhci->shared_hcd);
1062 }
1059 } 1063 }
1060 1064
1061 /* 1065 /*
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c
index d2353781bd2d..1e58ed2361cc 100644
--- a/drivers/usb/musb/musb_am335x.c
+++ b/drivers/usb/musb/musb_am335x.c
@@ -19,21 +19,6 @@ err:
19 return ret; 19 return ret;
20} 20}
21 21
22static int of_remove_populated_child(struct device *dev, void *d)
23{
24 struct platform_device *pdev = to_platform_device(dev);
25
26 of_device_unregister(pdev);
27 return 0;
28}
29
30static int am335x_child_remove(struct platform_device *pdev)
31{
32 device_for_each_child(&pdev->dev, NULL, of_remove_populated_child);
33 pm_runtime_disable(&pdev->dev);
34 return 0;
35}
36
37static const struct of_device_id am335x_child_of_match[] = { 22static const struct of_device_id am335x_child_of_match[] = {
38 { .compatible = "ti,am33xx-usb" }, 23 { .compatible = "ti,am33xx-usb" },
39 { }, 24 { },
@@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match);
42 27
43static struct platform_driver am335x_child_driver = { 28static struct platform_driver am335x_child_driver = {
44 .probe = am335x_child_probe, 29 .probe = am335x_child_probe,
45 .remove = am335x_child_remove,
46 .driver = { 30 .driver = {
47 .name = "am335x-usb-childs", 31 .name = "am335x-usb-childs",
48 .of_match_table = am335x_child_of_match, 32 .of_match_table = am335x_child_of_match,
49 }, 33 },
50}; 34};
51 35
52module_platform_driver(am335x_child_driver); 36static int __init am335x_child_init(void)
37{
38 return platform_driver_register(&am335x_child_driver);
39}
40module_init(am335x_child_init);
41
53MODULE_DESCRIPTION("AM33xx child devices"); 42MODULE_DESCRIPTION("AM33xx child devices");
54MODULE_LICENSE("GPL v2"); 43MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 61da471b7aed..eff3c5cf84f4 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -849,7 +849,7 @@ b_host:
849 } 849 }
850 850
851 /* handle babble condition */ 851 /* handle babble condition */
852 if (int_usb & MUSB_INTR_BABBLE) 852 if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb))
853 schedule_work(&musb->recover_work); 853 schedule_work(&musb->recover_work);
854 854
855#if 0 855#if 0
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 7b8bbf53127e..5341bb223b7c 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data)
318 } 318 }
319 list_add_tail(&cppi41_channel->tx_check, 319 list_add_tail(&cppi41_channel->tx_check,
320 &controller->early_tx_list); 320 &controller->early_tx_list);
321 if (!hrtimer_active(&controller->early_tx)) { 321 if (!hrtimer_is_queued(&controller->early_tx)) {
322 hrtimer_start_range_ns(&controller->early_tx, 322 hrtimer_start_range_ns(&controller->early_tx,
323 ktime_set(0, 140 * NSEC_PER_USEC), 323 ktime_set(0, 140 * NSEC_PER_USEC),
324 40 * NSEC_PER_USEC, 324 40 * NSEC_PER_USEC,
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 51beb13c7e1a..09529f94e72d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
494 struct dsps_glue *glue = dev_get_drvdata(dev->parent); 494 struct dsps_glue *glue = dev_get_drvdata(dev->parent);
495 const struct dsps_musb_wrapper *wrp = glue->wrp; 495 const struct dsps_musb_wrapper *wrp = glue->wrp;
496 void __iomem *ctrl_base = musb->ctrl_base; 496 void __iomem *ctrl_base = musb->ctrl_base;
497 void __iomem *base = musb->mregs;
498 u32 reg; 497 u32 reg;
499 498
500 reg = dsps_readl(base, wrp->mode); 499 reg = dsps_readl(ctrl_base, wrp->mode);
501 500
502 switch (mode) { 501 switch (mode) {
503 case MUSB_HOST: 502 case MUSB_HOST:
@@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
510 */ 509 */
511 reg |= (1 << wrp->iddig_mux); 510 reg |= (1 << wrp->iddig_mux);
512 511
513 dsps_writel(base, wrp->mode, reg); 512 dsps_writel(ctrl_base, wrp->mode, reg);
514 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); 513 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02);
515 break; 514 break;
516 case MUSB_PERIPHERAL: 515 case MUSB_PERIPHERAL:
@@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
523 */ 522 */
524 reg |= (1 << wrp->iddig_mux); 523 reg |= (1 << wrp->iddig_mux);
525 524
526 dsps_writel(base, wrp->mode, reg); 525 dsps_writel(ctrl_base, wrp->mode, reg);
527 break; 526 break;
528 case MUSB_OTG: 527 case MUSB_OTG:
529 dsps_writel(base, wrp->phy_utmi, 0x02); 528 dsps_writel(ctrl_base, wrp->phy_utmi, 0x02);
530 break; 529 break;
531 default: 530 default:
532 dev_err(glue->dev, "unsupported mode %d\n", mode); 531 dev_err(glue->dev, "unsupported mode %d\n", mode);
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index c2e45e632723..f202e5088461 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev)
274 musb->dev.parent = &pdev->dev; 274 musb->dev.parent = &pdev->dev;
275 musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; 275 musb->dev.dma_mask = &pdev->dev.coherent_dma_mask;
276 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; 276 musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
277 musb->dev.of_node = pdev->dev.of_node;
278 277
279 glue->dev = &pdev->dev; 278 glue->dev = &pdev->dev;
280 glue->musb = musb; 279 glue->musb = musb;
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index ced34f39bdd4..c929370cdaa6 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w)
1229 motg->chg_state = USB_CHG_STATE_UNDEFINED; 1229 motg->chg_state = USB_CHG_STATE_UNDEFINED;
1230 motg->chg_type = USB_INVALID_CHARGER; 1230 motg->chg_type = USB_INVALID_CHARGER;
1231 } 1231 }
1232 pm_runtime_put_sync(otg->phy->dev); 1232
1233 if (otg->phy->state == OTG_STATE_B_IDLE)
1234 pm_runtime_put_sync(otg->phy->dev);
1233 break; 1235 break;
1234 case OTG_STATE_B_PERIPHERAL: 1236 case OTG_STATE_B_PERIPHERAL:
1235 dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); 1237 dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index d49f9c326035..4fd36530bfa3 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -681,6 +681,14 @@ usbhs_fifo_read_end:
681 usbhs_pipe_number(pipe), 681 usbhs_pipe_number(pipe),
682 pkt->length, pkt->actual, *is_done, pkt->zero); 682 pkt->length, pkt->actual, *is_done, pkt->zero);
683 683
684 /*
685 * Transmission end
686 */
687 if (*is_done) {
688 if (usbhs_pipe_is_dcp(pipe))
689 usbhs_dcp_control_transfer_done(pipe);
690 }
691
684usbhs_fifo_read_busy: 692usbhs_fifo_read_busy:
685 usbhsf_fifo_unselect(pipe, fifo); 693 usbhsf_fifo_unselect(pipe, fifo);
686 694
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index edf3b124583c..115662c16dcc 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1566,14 +1566,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port)
1566 struct usb_device *udev = serial->dev; 1566 struct usb_device *udev = serial->dev;
1567 1567
1568 struct usb_interface *interface = serial->interface; 1568 struct usb_interface *interface = serial->interface;
1569 struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; 1569 struct usb_endpoint_descriptor *ep_desc;
1570 1570
1571 unsigned num_endpoints; 1571 unsigned num_endpoints;
1572 int i; 1572 unsigned i;
1573 1573
1574 num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; 1574 num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
1575 dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); 1575 dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
1576 1576
1577 if (!num_endpoints)
1578 return;
1579
1577 /* NOTE: some customers have programmed FT232R/FT245R devices 1580 /* NOTE: some customers have programmed FT232R/FT245R devices
1578 * with an endpoint size of 0 - not good. In this case, we 1581 * with an endpoint size of 0 - not good. In this case, we
1579 * want to override the endpoint descriptor setting and use a 1582 * want to override the endpoint descriptor setting and use a
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 59c3108cc136..ac73f49cd9f0 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb);
352/* Zoom */ 352/* Zoom */
353#define ZOOM_PRODUCT_4597 0x9607 353#define ZOOM_PRODUCT_4597 0x9607
354 354
355/* SpeedUp SU9800 usb 3g modem */
356#define SPEEDUP_PRODUCT_SU9800 0x9800
357
355/* Haier products */ 358/* Haier products */
356#define HAIER_VENDOR_ID 0x201e 359#define HAIER_VENDOR_ID 0x201e
357#define HAIER_PRODUCT_CE100 0x2009 360#define HAIER_PRODUCT_CE100 0x2009
@@ -372,8 +375,12 @@ static void option_instat_callback(struct urb *urb);
372/* Olivetti products */ 375/* Olivetti products */
373#define OLIVETTI_VENDOR_ID 0x0b3c 376#define OLIVETTI_VENDOR_ID 0x0b3c
374#define OLIVETTI_PRODUCT_OLICARD100 0xc000 377#define OLIVETTI_PRODUCT_OLICARD100 0xc000
378#define OLIVETTI_PRODUCT_OLICARD120 0xc001
379#define OLIVETTI_PRODUCT_OLICARD140 0xc002
375#define OLIVETTI_PRODUCT_OLICARD145 0xc003 380#define OLIVETTI_PRODUCT_OLICARD145 0xc003
381#define OLIVETTI_PRODUCT_OLICARD155 0xc004
376#define OLIVETTI_PRODUCT_OLICARD200 0xc005 382#define OLIVETTI_PRODUCT_OLICARD200 0xc005
383#define OLIVETTI_PRODUCT_OLICARD160 0xc00a
377#define OLIVETTI_PRODUCT_OLICARD500 0xc00b 384#define OLIVETTI_PRODUCT_OLICARD500 0xc00b
378 385
379/* Celot products */ 386/* Celot products */
@@ -1577,6 +1584,7 @@ static const struct usb_device_id option_ids[] = {
1577 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), 1584 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
1578 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist 1585 .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
1579 }, 1586 },
1587 { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
1580 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, 1588 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
1581 { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, 1589 { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
1582 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, 1590 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
@@ -1611,15 +1619,21 @@ static const struct usb_device_id option_ids[] = {
1611 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, 1619 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
1612 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ 1620 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
1613 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, 1621 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1614 1622 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
1615 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, 1623 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1624 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
1625 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1626 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140),
1627 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1616 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, 1628 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
1629 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155),
1630 .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1617 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), 1631 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
1618 .driver_info = (kernel_ulong_t)&net_intf6_blacklist 1632 .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1619 }, 1633 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160),
1634 .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1620 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), 1635 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
1621 .driver_info = (kernel_ulong_t)&net_intf4_blacklist 1636 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1622 },
1623 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ 1637 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
1624 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ 1638 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
1625 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, 1639 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 9d38ddc8da49..866b5df36ed1 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -256,6 +256,10 @@ static int slave_configure(struct scsi_device *sdev)
256 if (us->fflags & US_FL_WRITE_CACHE) 256 if (us->fflags & US_FL_WRITE_CACHE)
257 sdev->wce_default_on = 1; 257 sdev->wce_default_on = 1;
258 258
259 /* A few buggy USB-ATA bridges don't understand FUA */
260 if (us->fflags & US_FL_BROKEN_FUA)
261 sdev->broken_fua = 1;
262
259 } else { 263 } else {
260 264
261 /* Non-disk-type devices don't need to blacklist any pages 265 /* Non-disk-type devices don't need to blacklist any pages
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 174a447868cd..80a5b366255f 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201,
1936 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 1936 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1937 US_FL_IGNORE_RESIDUE ), 1937 US_FL_IGNORE_RESIDUE ),
1938 1938
1939/* Reported by Michael Büsch <m@bues.ch> */
1940UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114,
1941 "JMicron",
1942 "USB to ATA/ATAPI Bridge",
1943 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1944 US_FL_BROKEN_FUA ),
1945
1939/* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> 1946/* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
1940 * JMicron responds to USN and several other SCSI ioctls with a 1947 * JMicron responds to USN and several other SCSI ioctls with a
1941 * residue that causes subsequent I/O requests to fail. */ 1948 * residue that causes subsequent I/O requests to fail. */
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 971a760af4a1..8dae2f724a35 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work)
700 handle_rx(net); 700 handle_rx(net);
701} 701}
702 702
703static void vhost_net_free(void *addr)
704{
705 if (is_vmalloc_addr(addr))
706 vfree(addr);
707 else
708 kfree(addr);
709}
710
711static int vhost_net_open(struct inode *inode, struct file *f) 703static int vhost_net_open(struct inode *inode, struct file *f)
712{ 704{
713 struct vhost_net *n; 705 struct vhost_net *n;
@@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
723 } 715 }
724 vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); 716 vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL);
725 if (!vqs) { 717 if (!vqs) {
726 vhost_net_free(n); 718 kvfree(n);
727 return -ENOMEM; 719 return -ENOMEM;
728 } 720 }
729 721
@@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f)
840 * since jobs can re-queue themselves. */ 832 * since jobs can re-queue themselves. */
841 vhost_net_flush(n); 833 vhost_net_flush(n);
842 kfree(n->dev.vqs); 834 kfree(n->dev.vqs);
843 vhost_net_free(n); 835 kvfree(n);
844 return 0; 836 return 0;
845} 837}
846 838
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 4f4ffa4c604e..69906cacd04f 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)
1503 return 0; 1503 return 0;
1504} 1504}
1505 1505
1506static void vhost_scsi_free(struct vhost_scsi *vs)
1507{
1508 if (is_vmalloc_addr(vs))
1509 vfree(vs);
1510 else
1511 kfree(vs);
1512}
1513
1514static int vhost_scsi_open(struct inode *inode, struct file *f) 1506static int vhost_scsi_open(struct inode *inode, struct file *f)
1515{ 1507{
1516 struct vhost_scsi *vs; 1508 struct vhost_scsi *vs;
@@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
1550 return 0; 1542 return 0;
1551 1543
1552err_vqs: 1544err_vqs:
1553 vhost_scsi_free(vs); 1545 kvfree(vs);
1554err_vs: 1546err_vs:
1555 return r; 1547 return r;
1556} 1548}
@@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f)
1569 /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ 1561 /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */
1570 vhost_scsi_flush(vs); 1562 vhost_scsi_flush(vs);
1571 kfree(vs->dev.vqs); 1563 kfree(vs->dev.vqs);
1572 vhost_scsi_free(vs); 1564 kvfree(vs);
1573 return 0; 1565 return 0;
1574} 1566}
1575 1567
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index e683b6ef9594..d36e830d6fc6 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -1057,6 +1057,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1057 goto put_display_node; 1057 goto put_display_node;
1058 } 1058 }
1059 1059
1060 INIT_LIST_HEAD(&pdata->pwr_gpios);
1060 ret = -ENOMEM; 1061 ret = -ENOMEM;
1061 for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { 1062 for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
1062 gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", 1063 gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
@@ -1082,6 +1083,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
1082 dev_err(dev, "set direction output gpio %d failed\n", gpio); 1083 dev_err(dev, "set direction output gpio %d failed\n", gpio);
1083 goto put_display_node; 1084 goto put_display_node;
1084 } 1085 }
1086 list_add(&og->list, &pdata->pwr_gpios);
1085 } 1087 }
1086 1088
1087 if (is_gpio_power) 1089 if (is_gpio_power)
diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c
index a54f7f7d763b..8fe41caac38e 100644
--- a/drivers/video/fbdev/bfin_adv7393fb.c
+++ b/drivers/video/fbdev/bfin_adv7393fb.c
@@ -408,7 +408,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client,
408 /* Workaround "PPI Does Not Start Properly In Specific Mode" */ 408 /* Workaround "PPI Does Not Start Properly In Specific Mode" */
409 if (ANOMALY_05000400) { 409 if (ANOMALY_05000400) {
410 ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, 410 ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW,
411 "PPI0_FS3") 411 "PPI0_FS3");
412 if (ret) { 412 if (ret) {
413 dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); 413 dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n");
414 ret = -EBUSY; 414 ret = -EBUSY;
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
index 99af9e88b2d8..2f0822ee3ff9 100644
--- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
@@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root)
121{ 121{
122 struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), 122 struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
123 GFP_KERNEL); 123 GFP_KERNEL);
124 n->node = node; 124 if (n) {
125 n->root = root; 125 n->node = node;
126 list_add(&n->list, &dss_conv_list); 126 n->root = root;
127 list_add(&n->list, &dss_conv_list);
128 }
127} 129}
128 130
129static bool __init omapdss_list_contains(const struct device_node *node) 131static bool __init omapdss_list_contains(const struct device_node *node)
diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c
index a8f2b280f796..a1134c3f6c11 100644
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -474,8 +474,6 @@ static int vt8500lcd_remove(struct platform_device *pdev)
474 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 474 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
475 release_mem_region(res->start, resource_size(res)); 475 release_mem_region(res->start, resource_size(res));
476 476
477 kfree(fbi);
478
479 return 0; 477 return 0;
480} 478}
481 479