aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/ambassador.c1
-rw-r--r--drivers/char/hw_random/Kconfig6
-rw-r--r--drivers/char/hw_random/ixp4xx-rng.c5
-rw-r--r--drivers/crypto/Kconfig2
-rw-r--r--drivers/crypto/ixp4xx_crypto.c12
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fbdev.c3
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c1
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c11
-rw-r--r--drivers/gpu/drm/i915/intel_display.c2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c12
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c17
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c48
-rw-r--r--drivers/md/raid1.c2
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/media/dvb-frontends/stv0900_core.c6
-rw-r--r--drivers/media/i2c/adv7604.c377
-rw-r--r--drivers/media/i2c/soc_camera/mt9v022.c11
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-core.c6
-rw-r--r--drivers/media/platform/omap3isp/ispccdc.c4
-rw-r--r--drivers/media/platform/omap3isp/ispstat.c4
-rw-r--r--drivers/media/platform/omap3isp/ispstat.h4
-rw-r--r--drivers/media/platform/omap3isp/ispvideo.c2
-rw-r--r--drivers/media/platform/s5p-fimc/Kconfig1
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-capture.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-lite.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-mdevice.c41
-rw-r--r--drivers/media/platform/sh_vou.c3
-rw-r--r--drivers/media/platform/soc_camera/mx1_camera.c9
-rw-r--r--drivers/media/platform/soc_camera/mx2_camera.c13
-rw-r--r--drivers/media/platform/soc_camera/mx3_camera.c5
-rw-r--r--drivers/media/platform/soc_camera/omap1_camera.c4
-rw-r--r--drivers/media/platform/soc_camera/pxa_camera.c4
-rw-r--r--drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c13
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c11
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c4
-rw-r--r--drivers/mfd/arizona-core.c14
-rw-r--r--drivers/mfd/arizona-irq.c1
-rw-r--r--drivers/mfd/twl-core.c2
-rw-r--r--drivers/mfd/twl4030-irq.c3
-rw-r--r--drivers/mfd/wm5102-tables.c519
-rw-r--r--drivers/net/bonding/bond_main.c93
-rw-r--r--drivers/net/bonding/bond_sysfs.c36
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb.c8
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_pro.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c2
-rw-r--r--drivers/net/ethernet/realtek/8139cp.c11
-rw-r--r--drivers/net/team/team.c4
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/net/wan/ixp4xx_hss.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c12
-rw-r--r--drivers/remoteproc/remoteproc_virtio.c18
-rw-r--r--drivers/rtc/rtc-tps65910.c6
-rw-r--r--drivers/target/target_core_transport.c6
-rw-r--r--drivers/tty/vt/vt.c8
-rw-r--r--drivers/vhost/vhost.c2
58 files changed, 527 insertions, 899 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 89b30f32ba68..ff7bb8a42ed6 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1961,6 +1961,7 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
1961 res = loader_verify(lb, dev, rec); 1961 res = loader_verify(lb, dev, rec);
1962 if (res) 1962 if (res)
1963 break; 1963 break;
1964 rec = ihex_next_binrec(rec);
1964 } 1965 }
1965 release_firmware(fw); 1966 release_firmware(fw);
1966 if (!res) 1967 if (!res)
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index fbd9b2b850ef..c58ea9b80b1a 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -127,12 +127,12 @@ config HW_RANDOM_VIA
127 If unsure, say Y. 127 If unsure, say Y.
128 128
129config HW_RANDOM_IXP4XX 129config HW_RANDOM_IXP4XX
130 tristate "Intel IXP4xx NPU HW Random Number Generator support" 130 tristate "Intel IXP4xx NPU HW Pseudo-Random Number Generator support"
131 depends on HW_RANDOM && ARCH_IXP4XX 131 depends on HW_RANDOM && ARCH_IXP4XX
132 default HW_RANDOM 132 default HW_RANDOM
133 ---help--- 133 ---help---
134 This driver provides kernel-side support for the Random 134 This driver provides kernel-side support for the Pseudo-Random
135 Number Generator hardware found on the Intel IXP4xx NPU. 135 Number Generator hardware found on the Intel IXP45x/46x NPU.
136 136
137 To compile this driver as a module, choose M here: the 137 To compile this driver as a module, choose M here: the
138 module will be called ixp4xx-rng. 138 module will be called ixp4xx-rng.
diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c
index 263567f5f392..beec1627db3c 100644
--- a/drivers/char/hw_random/ixp4xx-rng.c
+++ b/drivers/char/hw_random/ixp4xx-rng.c
@@ -45,6 +45,9 @@ static int __init ixp4xx_rng_init(void)
45 void __iomem * rng_base; 45 void __iomem * rng_base;
46 int err; 46 int err;
47 47
48 if (!cpu_is_ixp46x()) /* includes IXP455 */
49 return -ENOSYS;
50
48 rng_base = ioremap(0x70002100, 4); 51 rng_base = ioremap(0x70002100, 4);
49 if (!rng_base) 52 if (!rng_base)
50 return -ENOMEM; 53 return -ENOMEM;
@@ -68,5 +71,5 @@ module_init(ixp4xx_rng_init);
68module_exit(ixp4xx_rng_exit); 71module_exit(ixp4xx_rng_exit);
69 72
70MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); 73MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
71MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for IXP4xx"); 74MODULE_DESCRIPTION("H/W Pseudo-Random Number Generator (RNG) driver for IXP45x/46x");
72MODULE_LICENSE("GPL"); 75MODULE_LICENSE("GPL");
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 308c7fb92a60..f6644f59fd9d 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -224,7 +224,7 @@ config CRYPTO_DEV_TALITOS
224 224
225config CRYPTO_DEV_IXP4XX 225config CRYPTO_DEV_IXP4XX
226 tristate "Driver for IXP4xx crypto hardware acceleration" 226 tristate "Driver for IXP4xx crypto hardware acceleration"
227 depends on ARCH_IXP4XX 227 depends on ARCH_IXP4XX && IXP4XX_QMGR && IXP4XX_NPE
228 select CRYPTO_DES 228 select CRYPTO_DES
229 select CRYPTO_ALGAPI 229 select CRYPTO_ALGAPI
230 select CRYPTO_AUTHENC 230 select CRYPTO_AUTHENC
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 8f3f74ce8c7f..21180d6cad6e 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -750,12 +750,12 @@ static int setup_cipher(struct crypto_tfm *tfm, int encrypt,
750 } 750 }
751 if (cipher_cfg & MOD_AES) { 751 if (cipher_cfg & MOD_AES) {
752 switch (key_len) { 752 switch (key_len) {
753 case 16: keylen_cfg = MOD_AES128 | KEYLEN_128; break; 753 case 16: keylen_cfg = MOD_AES128; break;
754 case 24: keylen_cfg = MOD_AES192 | KEYLEN_192; break; 754 case 24: keylen_cfg = MOD_AES192; break;
755 case 32: keylen_cfg = MOD_AES256 | KEYLEN_256; break; 755 case 32: keylen_cfg = MOD_AES256; break;
756 default: 756 default:
757 *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; 757 *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
758 return -EINVAL; 758 return -EINVAL;
759 } 759 }
760 cipher_cfg |= keylen_cfg; 760 cipher_cfg |= keylen_cfg;
761 } else if (cipher_cfg & MOD_3DES) { 761 } else if (cipher_cfg & MOD_3DES) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 241ad1eeec64..f2df06c603f7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -226,6 +226,12 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
226 * already updated or not by exynos_drm_encoder_dpms function. 226 * already updated or not by exynos_drm_encoder_dpms function.
227 */ 227 */
228 exynos_encoder->updated = true; 228 exynos_encoder->updated = true;
229
230 /*
231 * In case of setcrtc, there is no way to update encoder's dpms
232 * so update it here.
233 */
234 exynos_encoder->dpms = DRM_MODE_DPMS_ON;
229} 235}
230 236
231static void exynos_drm_encoder_disable(struct drm_encoder *encoder) 237static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
@@ -507,6 +513,6 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
507 * because the setting for disabling the overlay will be updated 513 * because the setting for disabling the overlay will be updated
508 * at vsync. 514 * at vsync.
509 */ 515 */
510 if (overlay_ops->wait_for_vblank) 516 if (overlay_ops && overlay_ops->wait_for_vblank)
511 overlay_ops->wait_for_vblank(manager->dev); 517 overlay_ops->wait_for_vblank(manager->dev);
512} 518}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 67eb6ba56edf..e7466c4414cb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -87,7 +87,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
87 87
88 dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; 88 dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr;
89 fbi->screen_base = buffer->kvaddr + offset; 89 fbi->screen_base = buffer->kvaddr + offset;
90 fbi->fix.smem_start = (unsigned long)(buffer->dma_addr + offset); 90 fbi->fix.smem_start = (unsigned long)(page_to_phys(buffer->pages[0]) +
91 offset);
91 fbi->screen_size = size; 92 fbi->screen_size = size;
92 fbi->fix.smem_len = size; 93 fbi->fix.smem_len = size;
93 94
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 130a2b510d4a..e08478f19f1a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -61,11 +61,11 @@ struct fimd_driver_data {
61 unsigned int timing_base; 61 unsigned int timing_base;
62}; 62};
63 63
64struct fimd_driver_data exynos4_fimd_driver_data = { 64static struct fimd_driver_data exynos4_fimd_driver_data = {
65 .timing_base = 0x0, 65 .timing_base = 0x0,
66}; 66};
67 67
68struct fimd_driver_data exynos5_fimd_driver_data = { 68static struct fimd_driver_data exynos5_fimd_driver_data = {
69 .timing_base = 0x20000, 69 .timing_base = 0x20000,
70}; 70};
71 71
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 60b877a388c2..862ca1eb2102 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -204,7 +204,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
204 return ret; 204 return ret;
205 205
206 plane->crtc = crtc; 206 plane->crtc = crtc;
207 plane->fb = crtc->fb;
208 207
209 exynos_plane_commit(plane); 208 exynos_plane_commit(plane);
210 exynos_plane_dpms(plane, DRM_MODE_DPMS_ON); 209 exynos_plane_dpms(plane, DRM_MODE_DPMS_ON);
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 0ed6baff4b0c..56846ed5ee55 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -499,12 +499,8 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
499 499
500 edp = find_section(bdb, BDB_EDP); 500 edp = find_section(bdb, BDB_EDP);
501 if (!edp) { 501 if (!edp) {
502 if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp.support) { 502 if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp.support)
503 DRM_DEBUG_KMS("No eDP BDB found but eDP panel " 503 DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported.\n");
504 "supported, assume %dbpp panel color "
505 "depth.\n",
506 dev_priv->edp.bpp);
507 }
508 return; 504 return;
509 } 505 }
510 506
@@ -657,9 +653,6 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
657 dev_priv->lvds_use_ssc = 1; 653 dev_priv->lvds_use_ssc = 1;
658 dev_priv->lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1); 654 dev_priv->lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1);
659 DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->lvds_ssc_freq); 655 DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->lvds_ssc_freq);
660
661 /* eDP data */
662 dev_priv->edp.bpp = 18;
663} 656}
664 657
665static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) 658static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4154bcd7a070..b426d44a2b05 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3845,7 +3845,7 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
3845 /* Use VBT settings if we have an eDP panel */ 3845 /* Use VBT settings if we have an eDP panel */
3846 unsigned int edp_bpc = dev_priv->edp.bpp / 3; 3846 unsigned int edp_bpc = dev_priv->edp.bpp / 3;
3847 3847
3848 if (edp_bpc < display_bpc) { 3848 if (edp_bpc && edp_bpc < display_bpc) {
3849 DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc); 3849 DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
3850 display_bpc = edp_bpc; 3850 display_bpc = edp_bpc;
3851 } 3851 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 72f41aaa71ff..442968f8b201 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2373,15 +2373,9 @@ int intel_enable_rc6(const struct drm_device *dev)
2373 if (i915_enable_rc6 >= 0) 2373 if (i915_enable_rc6 >= 0)
2374 return i915_enable_rc6; 2374 return i915_enable_rc6;
2375 2375
2376 if (INTEL_INFO(dev)->gen == 5) { 2376 /* Disable RC6 on Ironlake */
2377#ifdef CONFIG_INTEL_IOMMU 2377 if (INTEL_INFO(dev)->gen == 5)
2378 /* Disable rc6 on ilk if VT-d is on. */ 2378 return 0;
2379 if (intel_iommu_gfx_mapped)
2380 return false;
2381#endif
2382 DRM_DEBUG_DRIVER("Ironlake: only RC6 available\n");
2383 return INTEL_RC6_ENABLE;
2384 }
2385 2379
2386 if (IS_HASWELL(dev)) { 2380 if (IS_HASWELL(dev)) {
2387 DRM_DEBUG_DRIVER("Haswell: only RC6 available\n"); 2381 DRM_DEBUG_DRIVER("Haswell: only RC6 available\n");
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index c600fb06e25e..a6ac0b416964 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2201,7 +2201,6 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2201 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; 2201 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
2202 intel_sdvo->is_hdmi = true; 2202 intel_sdvo->is_hdmi = true;
2203 } 2203 }
2204 intel_sdvo->base.cloneable = true;
2205 2204
2206 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2205 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
2207 if (intel_sdvo->is_hdmi) 2206 if (intel_sdvo->is_hdmi)
@@ -2232,7 +2231,6 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
2232 2231
2233 intel_sdvo->is_tv = true; 2232 intel_sdvo->is_tv = true;
2234 intel_sdvo->base.needs_tv_clock = true; 2233 intel_sdvo->base.needs_tv_clock = true;
2235 intel_sdvo->base.cloneable = false;
2236 2234
2237 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2235 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
2238 2236
@@ -2275,8 +2273,6 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
2275 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1; 2273 intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1;
2276 } 2274 }
2277 2275
2278 intel_sdvo->base.cloneable = true;
2279
2280 intel_sdvo_connector_init(intel_sdvo_connector, 2276 intel_sdvo_connector_init(intel_sdvo_connector,
2281 intel_sdvo); 2277 intel_sdvo);
2282 return true; 2278 return true;
@@ -2307,9 +2303,6 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
2307 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; 2303 intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1;
2308 } 2304 }
2309 2305
2310 /* SDVO LVDS is not cloneable because the input mode gets adjusted by the encoder */
2311 intel_sdvo->base.cloneable = false;
2312
2313 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2306 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
2314 if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) 2307 if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector))
2315 goto err; 2308 goto err;
@@ -2721,6 +2714,16 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2721 goto err_output; 2714 goto err_output;
2722 } 2715 }
2723 2716
2717 /*
2718 * Cloning SDVO with anything is often impossible, since the SDVO
2719 * encoder can request a special input timing mode. And even if that's
2720 * not the case we have evidence that cloning a plain unscaled mode with
2721 * VGA doesn't really work. Furthermore the cloning flags are way too
2722 * simplistic anyway to express such constraints, so just give up on
2723 * cloning for SDVO encoders.
2724 */
2725 intel_sdvo->base.cloneable = false;
2726
2724 /* Only enable the hotplug irq if we need it, to work around noisy 2727 /* Only enable the hotplug irq if we need it, to work around noisy
2725 * hotplug lines. 2728 * hotplug lines.
2726 */ 2729 */
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 3bce0299f64a..24d932f53203 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1696,42 +1696,22 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1696 return ATOM_PPLL2; 1696 return ATOM_PPLL2;
1697 DRM_ERROR("unable to allocate a PPLL\n"); 1697 DRM_ERROR("unable to allocate a PPLL\n");
1698 return ATOM_PPLL_INVALID; 1698 return ATOM_PPLL_INVALID;
1699 } else if (ASIC_IS_AVIVO(rdev)) {
1700 /* in DP mode, the DP ref clock can come from either PPLL
1701 * depending on the asic:
1702 * DCE3: PPLL1 or PPLL2
1703 */
1704 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
1705 /* use the same PPLL for all DP monitors */
1706 pll = radeon_get_shared_dp_ppll(crtc);
1707 if (pll != ATOM_PPLL_INVALID)
1708 return pll;
1709 } else {
1710 /* use the same PPLL for all monitors with the same clock */
1711 pll = radeon_get_shared_nondp_ppll(crtc);
1712 if (pll != ATOM_PPLL_INVALID)
1713 return pll;
1714 }
1715 /* all other cases */
1716 pll_in_use = radeon_get_pll_use_mask(crtc);
1717 /* the order shouldn't matter here, but we probably
1718 * need this until we have atomic modeset
1719 */
1720 if (rdev->flags & RADEON_IS_IGP) {
1721 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1722 return ATOM_PPLL1;
1723 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1724 return ATOM_PPLL2;
1725 } else {
1726 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1727 return ATOM_PPLL2;
1728 if (!(pll_in_use & (1 << ATOM_PPLL1)))
1729 return ATOM_PPLL1;
1730 }
1731 DRM_ERROR("unable to allocate a PPLL\n");
1732 return ATOM_PPLL_INVALID;
1733 } else { 1699 } else {
1734 /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */ 1700 /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
1701 /* some atombios (observed in some DCE2/DCE3) code have a bug,
1702 * the matching btw pll and crtc is done through
1703 * PCLK_CRTC[1|2]_CNTL (0x480/0x484) but atombios code use the
1704 * pll (1 or 2) to select which register to write. ie if using
1705 * pll1 it will use PCLK_CRTC1_CNTL (0x480) and if using pll2
1706 * it will use PCLK_CRTC2_CNTL (0x484), it then use crtc id to
1707 * choose which value to write. Which is reverse order from
1708 * register logic. So only case that works is when pllid is
1709 * same as crtcid or when both pll and crtc are enabled and
1710 * both use same clock.
1711 *
1712 * So just return crtc id as if crtc and pll were hard linked
1713 * together even if they aren't
1714 */
1735 return radeon_crtc->crtc_id; 1715 return radeon_crtc->crtc_id;
1736 } 1716 }
1737} 1717}
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 636bae0405e8..a0f73092176e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -963,7 +963,7 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
963 struct r1conf *conf = mddev->private; 963 struct r1conf *conf = mddev->private;
964 struct bio *bio; 964 struct bio *bio;
965 965
966 if (from_schedule) { 966 if (from_schedule || current->bio_list) {
967 spin_lock_irq(&conf->device_lock); 967 spin_lock_irq(&conf->device_lock);
968 bio_list_merge(&conf->pending_bio_list, &plug->pending); 968 bio_list_merge(&conf->pending_bio_list, &plug->pending);
969 conf->pending_count += plug->pending_cnt; 969 conf->pending_count += plug->pending_cnt;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 0d5d0ff2c0f7..c9acbd717131 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1069,7 +1069,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
1069 struct r10conf *conf = mddev->private; 1069 struct r10conf *conf = mddev->private;
1070 struct bio *bio; 1070 struct bio *bio;
1071 1071
1072 if (from_schedule) { 1072 if (from_schedule || current->bio_list) {
1073 spin_lock_irq(&conf->device_lock); 1073 spin_lock_irq(&conf->device_lock);
1074 bio_list_merge(&conf->pending_bio_list, &plug->pending); 1074 bio_list_merge(&conf->pending_bio_list, &plug->pending);
1075 conf->pending_count += plug->pending_cnt; 1075 conf->pending_count += plug->pending_cnt;
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c
index 262dfa503c2a..b551ca350e00 100644
--- a/drivers/media/dvb-frontends/stv0900_core.c
+++ b/drivers/media/dvb-frontends/stv0900_core.c
@@ -300,15 +300,15 @@ static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32
300{ 300{
301 u32 m_div, clk_sel; 301 u32 m_div, clk_sel;
302 302
303 dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
304 intp->quartz);
305
306 if (intp == NULL) 303 if (intp == NULL)
307 return STV0900_INVALID_HANDLE; 304 return STV0900_INVALID_HANDLE;
308 305
309 if (intp->errs) 306 if (intp->errs)
310 return STV0900_I2C_ERROR; 307 return STV0900_I2C_ERROR;
311 308
309 dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
310 intp->quartz);
311
312 clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); 312 clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6);
313 m_div = ((clk_sel * mclk) / intp->quartz) - 1; 313 m_div = ((clk_sel * mclk) / intp->quartz) - 1;
314 stv0900_write_bits(intp, F0900_M_DIV, m_div); 314 stv0900_write_bits(intp, F0900_M_DIV, m_div);
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 109bc9b12e74..05f8950f6f91 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -53,8 +53,7 @@ MODULE_LICENSE("GPL");
53/* ADV7604 system clock frequency */ 53/* ADV7604 system clock frequency */
54#define ADV7604_fsc (28636360) 54#define ADV7604_fsc (28636360)
55 55
56#define DIGITAL_INPUT ((state->prim_mode == ADV7604_PRIM_MODE_HDMI_COMP) || \ 56#define DIGITAL_INPUT (state->mode == ADV7604_MODE_HDMI)
57 (state->prim_mode == ADV7604_PRIM_MODE_HDMI_GR))
58 57
59/* 58/*
60 ********************************************************************** 59 **********************************************************************
@@ -68,7 +67,7 @@ struct adv7604_state {
68 struct v4l2_subdev sd; 67 struct v4l2_subdev sd;
69 struct media_pad pad; 68 struct media_pad pad;
70 struct v4l2_ctrl_handler hdl; 69 struct v4l2_ctrl_handler hdl;
71 enum adv7604_prim_mode prim_mode; 70 enum adv7604_mode mode;
72 struct v4l2_dv_timings timings; 71 struct v4l2_dv_timings timings;
73 u8 edid[256]; 72 u8 edid[256];
74 unsigned edid_blocks; 73 unsigned edid_blocks;
@@ -77,6 +76,7 @@ struct adv7604_state {
77 struct workqueue_struct *work_queues; 76 struct workqueue_struct *work_queues;
78 struct delayed_work delayed_work_enable_hotplug; 77 struct delayed_work delayed_work_enable_hotplug;
79 bool connector_hdmi; 78 bool connector_hdmi;
79 bool restart_stdi_once;
80 80
81 /* i2c clients */ 81 /* i2c clients */
82 struct i2c_client *i2c_avlink; 82 struct i2c_client *i2c_avlink;
@@ -106,7 +106,6 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
106 V4L2_DV_BT_CEA_720X576P50, 106 V4L2_DV_BT_CEA_720X576P50,
107 V4L2_DV_BT_CEA_1280X720P24, 107 V4L2_DV_BT_CEA_1280X720P24,
108 V4L2_DV_BT_CEA_1280X720P25, 108 V4L2_DV_BT_CEA_1280X720P25,
109 V4L2_DV_BT_CEA_1280X720P30,
110 V4L2_DV_BT_CEA_1280X720P50, 109 V4L2_DV_BT_CEA_1280X720P50,
111 V4L2_DV_BT_CEA_1280X720P60, 110 V4L2_DV_BT_CEA_1280X720P60,
112 V4L2_DV_BT_CEA_1920X1080P24, 111 V4L2_DV_BT_CEA_1920X1080P24,
@@ -115,6 +114,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
115 V4L2_DV_BT_CEA_1920X1080P50, 114 V4L2_DV_BT_CEA_1920X1080P50,
116 V4L2_DV_BT_CEA_1920X1080P60, 115 V4L2_DV_BT_CEA_1920X1080P60,
117 116
117 /* sorted by DMT ID */
118 V4L2_DV_BT_DMT_640X350P85, 118 V4L2_DV_BT_DMT_640X350P85,
119 V4L2_DV_BT_DMT_640X400P85, 119 V4L2_DV_BT_DMT_640X400P85,
120 V4L2_DV_BT_DMT_720X400P85, 120 V4L2_DV_BT_DMT_720X400P85,
@@ -164,6 +164,89 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
164 { }, 164 { },
165}; 165};
166 166
167struct adv7604_video_standards {
168 struct v4l2_dv_timings timings;
169 u8 vid_std;
170 u8 v_freq;
171};
172
173/* sorted by number of lines */
174static const struct adv7604_video_standards adv7604_prim_mode_comp[] = {
175 /* { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, TODO flickering */
176 { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 },
177 { V4L2_DV_BT_CEA_1280X720P50, 0x19, 0x01 },
178 { V4L2_DV_BT_CEA_1280X720P60, 0x19, 0x00 },
179 { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 },
180 { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 },
181 { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 },
182 { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 },
183 { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 },
184 /* TODO add 1920x1080P60_RB (CVT timing) */
185 { },
186};
187
188/* sorted by number of lines */
189static const struct adv7604_video_standards adv7604_prim_mode_gr[] = {
190 { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 },
191 { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 },
192 { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 },
193 { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 },
194 { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 },
195 { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 },
196 { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 },
197 { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 },
198 { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 },
199 { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 },
200 { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 },
201 { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 },
202 { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 },
203 { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 },
204 { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 },
205 { V4L2_DV_BT_DMT_1360X768P60, 0x12, 0x00 },
206 { V4L2_DV_BT_DMT_1366X768P60, 0x13, 0x00 },
207 { V4L2_DV_BT_DMT_1400X1050P60, 0x14, 0x00 },
208 { V4L2_DV_BT_DMT_1400X1050P75, 0x15, 0x00 },
209 { V4L2_DV_BT_DMT_1600X1200P60, 0x16, 0x00 }, /* TODO not tested */
210 /* TODO add 1600X1200P60_RB (not a DMT timing) */
211 { V4L2_DV_BT_DMT_1680X1050P60, 0x18, 0x00 },
212 { V4L2_DV_BT_DMT_1920X1200P60_RB, 0x19, 0x00 }, /* TODO not tested */
213 { },
214};
215
216/* sorted by number of lines */
217static const struct adv7604_video_standards adv7604_prim_mode_hdmi_comp[] = {
218 { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 },
219 { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 },
220 { V4L2_DV_BT_CEA_1280X720P50, 0x13, 0x01 },
221 { V4L2_DV_BT_CEA_1280X720P60, 0x13, 0x00 },
222 { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 },
223 { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 },
224 { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 },
225 { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 },
226 { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 },
227 { },
228};
229
230/* sorted by number of lines */
231static const struct adv7604_video_standards adv7604_prim_mode_hdmi_gr[] = {
232 { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 },
233 { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 },
234 { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 },
235 { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 },
236 { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 },
237 { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 },
238 { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 },
239 { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 },
240 { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 },
241 { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 },
242 { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 },
243 { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 },
244 { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 },
245 { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 },
246 { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 },
247 { },
248};
249
167/* ----------------------------------------------------------------------- */ 250/* ----------------------------------------------------------------------- */
168 251
169static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) 252static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -672,64 +755,144 @@ static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd)
672 ((io_read(sd, 0x6f) & 0x10) >> 4)); 755 ((io_read(sd, 0x6f) & 0x10) >> 4));
673} 756}
674 757
675static void configure_free_run(struct v4l2_subdev *sd, const struct v4l2_bt_timings *timings) 758static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd,
759 u8 prim_mode,
760 const struct adv7604_video_standards *predef_vid_timings,
761 const struct v4l2_dv_timings *timings)
762{
763 struct adv7604_state *state = to_state(sd);
764 int i;
765
766 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) {
767 if (!v4l_match_dv_timings(timings, &predef_vid_timings[i].timings,
768 DIGITAL_INPUT ? 250000 : 1000000))
769 continue;
770 io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */
771 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) +
772 prim_mode); /* v_freq and prim mode */
773 return 0;
774 }
775
776 return -1;
777}
778
779static int configure_predefined_video_timings(struct v4l2_subdev *sd,
780 struct v4l2_dv_timings *timings)
676{ 781{
782 struct adv7604_state *state = to_state(sd);
783 int err;
784
785 v4l2_dbg(1, debug, sd, "%s", __func__);
786
787 /* reset to default values */
788 io_write(sd, 0x16, 0x43);
789 io_write(sd, 0x17, 0x5a);
790 /* disable embedded syncs for auto graphics mode */
791 cp_write_and_or(sd, 0x81, 0xef, 0x00);
792 cp_write(sd, 0x8f, 0x00);
793 cp_write(sd, 0x90, 0x00);
794 cp_write(sd, 0xa2, 0x00);
795 cp_write(sd, 0xa3, 0x00);
796 cp_write(sd, 0xa4, 0x00);
797 cp_write(sd, 0xa5, 0x00);
798 cp_write(sd, 0xa6, 0x00);
799 cp_write(sd, 0xa7, 0x00);
800 cp_write(sd, 0xab, 0x00);
801 cp_write(sd, 0xac, 0x00);
802
803 switch (state->mode) {
804 case ADV7604_MODE_COMP:
805 case ADV7604_MODE_GR:
806 err = find_and_set_predefined_video_timings(sd,
807 0x01, adv7604_prim_mode_comp, timings);
808 if (err)
809 err = find_and_set_predefined_video_timings(sd,
810 0x02, adv7604_prim_mode_gr, timings);
811 break;
812 case ADV7604_MODE_HDMI:
813 err = find_and_set_predefined_video_timings(sd,
814 0x05, adv7604_prim_mode_hdmi_comp, timings);
815 if (err)
816 err = find_and_set_predefined_video_timings(sd,
817 0x06, adv7604_prim_mode_hdmi_gr, timings);
818 break;
819 default:
820 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
821 __func__, state->mode);
822 err = -1;
823 break;
824 }
825
826
827 return err;
828}
829
830static void configure_custom_video_timings(struct v4l2_subdev *sd,
831 const struct v4l2_bt_timings *bt)
832{
833 struct adv7604_state *state = to_state(sd);
677 struct i2c_client *client = v4l2_get_subdevdata(sd); 834 struct i2c_client *client = v4l2_get_subdevdata(sd);
678 u32 width = htotal(timings); 835 u32 width = htotal(bt);
679 u32 height = vtotal(timings); 836 u32 height = vtotal(bt);
680 u16 ch1_fr_ll = (((u32)timings->pixelclock / 100) > 0) ? 837 u16 cp_start_sav = bt->hsync + bt->hbackporch - 4;
681 ((width * (ADV7604_fsc / 100)) / ((u32)timings->pixelclock / 100)) : 0; 838 u16 cp_start_eav = width - bt->hfrontporch;
839 u16 cp_start_vbi = height - bt->vfrontporch;
840 u16 cp_end_vbi = bt->vsync + bt->vbackporch;
841 u16 ch1_fr_ll = (((u32)bt->pixelclock / 100) > 0) ?
842 ((width * (ADV7604_fsc / 100)) / ((u32)bt->pixelclock / 100)) : 0;
843 const u8 pll[2] = {
844 0xc0 | ((width >> 8) & 0x1f),
845 width & 0xff
846 };
682 847
683 v4l2_dbg(2, debug, sd, "%s\n", __func__); 848 v4l2_dbg(2, debug, sd, "%s\n", __func__);
684 849
685 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); /* CH1_FR_LL */ 850 switch (state->mode) {
686 cp_write(sd, 0x90, ch1_fr_ll & 0xff); /* CH1_FR_LL */ 851 case ADV7604_MODE_COMP:
687 cp_write(sd, 0xab, (height >> 4) & 0xff); /* CP_LCOUNT_MAX */ 852 case ADV7604_MODE_GR:
688 cp_write(sd, 0xac, (height & 0x0f) << 4); /* CP_LCOUNT_MAX */ 853 /* auto graphics */
689 /* TODO support interlaced */ 854 io_write(sd, 0x00, 0x07); /* video std */
690 cp_write(sd, 0x91, 0x10); /* INTERLACED */ 855 io_write(sd, 0x01, 0x02); /* prim mode */
691 856 /* enable embedded syncs for auto graphics mode */
692 /* Should only be set in auto-graphics mode [REF_02 p. 91-92] */ 857 cp_write_and_or(sd, 0x81, 0xef, 0x10);
693 if ((io_read(sd, 0x00) == 0x07) && (io_read(sd, 0x01) == 0x02)) {
694 u16 cp_start_sav, cp_start_eav, cp_start_vbi, cp_end_vbi;
695 const u8 pll[2] = {
696 (0xc0 | ((width >> 8) & 0x1f)),
697 (width & 0xff)
698 };
699 858
859 /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */
700 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ 860 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */
701 /* IO-map reg. 0x16 and 0x17 should be written in sequence */ 861 /* IO-map reg. 0x16 and 0x17 should be written in sequence */
702 if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { 862 if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) {
703 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); 863 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n");
704 return; 864 break;
705 } 865 }
706 866
707 /* active video - horizontal timing */ 867 /* active video - horizontal timing */
708 cp_start_sav = timings->hsync + timings->hbackporch - 4;
709 cp_start_eav = width - timings->hfrontporch;
710 cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); 868 cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff);
711 cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | ((cp_start_eav >> 8) & 0x0f)); 869 cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) |
870 ((cp_start_eav >> 8) & 0x0f));
712 cp_write(sd, 0xa4, cp_start_eav & 0xff); 871 cp_write(sd, 0xa4, cp_start_eav & 0xff);
713 872
714 /* active video - vertical timing */ 873 /* active video - vertical timing */
715 cp_start_vbi = height - timings->vfrontporch;
716 cp_end_vbi = timings->vsync + timings->vbackporch;
717 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); 874 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff);
718 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | ((cp_end_vbi >> 8) & 0xf)); 875 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) |
876 ((cp_end_vbi >> 8) & 0xf));
719 cp_write(sd, 0xa7, cp_end_vbi & 0xff); 877 cp_write(sd, 0xa7, cp_end_vbi & 0xff);
720 } else { 878 break;
721 /* reset to default values */ 879 case ADV7604_MODE_HDMI:
722 io_write(sd, 0x16, 0x43); 880 /* set default prim_mode/vid_std for HDMI
723 io_write(sd, 0x17, 0x5a); 881 accoring to [REF_03, c. 4.2] */
724 cp_write(sd, 0xa2, 0x00); 882 io_write(sd, 0x00, 0x02); /* video std */
725 cp_write(sd, 0xa3, 0x00); 883 io_write(sd, 0x01, 0x06); /* prim mode */
726 cp_write(sd, 0xa4, 0x00); 884 break;
727 cp_write(sd, 0xa5, 0x00); 885 default:
728 cp_write(sd, 0xa6, 0x00); 886 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
729 cp_write(sd, 0xa7, 0x00); 887 __func__, state->mode);
888 break;
730 } 889 }
731}
732 890
891 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7);
892 cp_write(sd, 0x90, ch1_fr_ll & 0xff);
893 cp_write(sd, 0xab, (height >> 4) & 0xff);
894 cp_write(sd, 0xac, (height & 0x0f) << 4);
895}
733 896
734static void set_rgb_quantization_range(struct v4l2_subdev *sd) 897static void set_rgb_quantization_range(struct v4l2_subdev *sd)
735{ 898{
@@ -738,12 +901,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
738 switch (state->rgb_quantization_range) { 901 switch (state->rgb_quantization_range) {
739 case V4L2_DV_RGB_RANGE_AUTO: 902 case V4L2_DV_RGB_RANGE_AUTO:
740 /* automatic */ 903 /* automatic */
741 if ((hdmi_read(sd, 0x05) & 0x80) || 904 if (DIGITAL_INPUT && !(hdmi_read(sd, 0x05) & 0x80)) {
742 (state->prim_mode == ADV7604_PRIM_MODE_COMP) ||
743 (state->prim_mode == ADV7604_PRIM_MODE_RGB)) {
744 /* receiving HDMI or analog signal */
745 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
746 } else {
747 /* receiving DVI-D signal */ 905 /* receiving DVI-D signal */
748 906
749 /* ADV7604 selects RGB limited range regardless of 907 /* ADV7604 selects RGB limited range regardless of
@@ -756,6 +914,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
756 /* RGB full range (0-255) */ 914 /* RGB full range (0-255) */
757 io_write_and_or(sd, 0x02, 0x0f, 0x10); 915 io_write_and_or(sd, 0x02, 0x0f, 0x10);
758 } 916 }
917 } else {
918 /* receiving HDMI or analog signal, set automode */
919 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
759 } 920 }
760 break; 921 break;
761 case V4L2_DV_RGB_RANGE_LIMITED: 922 case V4L2_DV_RGB_RANGE_LIMITED:
@@ -967,8 +1128,10 @@ static int stdi2dv_timings(struct v4l2_subdev *sd,
967 state->aspect_ratio, timings)) 1128 state->aspect_ratio, timings))
968 return 0; 1129 return 0;
969 1130
970 v4l2_dbg(2, debug, sd, "%s: No format candidate found for lcf=%d, bl = %d\n", 1131 v4l2_dbg(2, debug, sd,
971 __func__, stdi->lcf, stdi->bl); 1132 "%s: No format candidate found for lcvs = %d, lcf=%d, bl = %d, %chsync, %cvsync\n",
1133 __func__, stdi->lcvs, stdi->lcf, stdi->bl,
1134 stdi->hs_pol, stdi->vs_pol);
972 return -1; 1135 return -1;
973} 1136}
974 1137
@@ -1123,7 +1286,7 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd,
1123 adv7604_fill_optional_dv_timings_fields(sd, timings); 1286 adv7604_fill_optional_dv_timings_fields(sd, timings);
1124 } else { 1287 } else {
1125 /* find format 1288 /* find format
1126 * Since LCVS values are inaccurate (REF_03, page 275-276), 1289 * Since LCVS values are inaccurate [REF_03, p. 275-276],
1127 * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. 1290 * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails.
1128 */ 1291 */
1129 if (!stdi2dv_timings(sd, &stdi, timings)) 1292 if (!stdi2dv_timings(sd, &stdi, timings))
@@ -1135,9 +1298,31 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd,
1135 stdi.lcvs -= 2; 1298 stdi.lcvs -= 2;
1136 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); 1299 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs);
1137 if (stdi2dv_timings(sd, &stdi, timings)) { 1300 if (stdi2dv_timings(sd, &stdi, timings)) {
1301 /*
1302 * The STDI block may measure wrong values, especially
1303 * for lcvs and lcf. If the driver can not find any
1304 * valid timing, the STDI block is restarted to measure
1305 * the video timings again. The function will return an
1306 * error, but the restart of STDI will generate a new
1307 * STDI interrupt and the format detection process will
1308 * restart.
1309 */
1310 if (state->restart_stdi_once) {
1311 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__);
1312 /* TODO restart STDI for Sync Channel 2 */
1313 /* enter one-shot mode */
1314 cp_write_and_or(sd, 0x86, 0xf9, 0x00);
1315 /* trigger STDI restart */
1316 cp_write_and_or(sd, 0x86, 0xf9, 0x04);
1317 /* reset to continuous mode */
1318 cp_write_and_or(sd, 0x86, 0xf9, 0x02);
1319 state->restart_stdi_once = false;
1320 return -ENOLINK;
1321 }
1138 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); 1322 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__);
1139 return -ERANGE; 1323 return -ERANGE;
1140 } 1324 }
1325 state->restart_stdi_once = true;
1141 } 1326 }
1142found: 1327found:
1143 1328
@@ -1166,6 +1351,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd,
1166{ 1351{
1167 struct adv7604_state *state = to_state(sd); 1352 struct adv7604_state *state = to_state(sd);
1168 struct v4l2_bt_timings *bt; 1353 struct v4l2_bt_timings *bt;
1354 int err;
1169 1355
1170 if (!timings) 1356 if (!timings)
1171 return -EINVAL; 1357 return -EINVAL;
@@ -1178,12 +1364,20 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd,
1178 __func__, (u32)bt->pixelclock); 1364 __func__, (u32)bt->pixelclock);
1179 return -ERANGE; 1365 return -ERANGE;
1180 } 1366 }
1367
1181 adv7604_fill_optional_dv_timings_fields(sd, timings); 1368 adv7604_fill_optional_dv_timings_fields(sd, timings);
1182 1369
1183 state->timings = *timings; 1370 state->timings = *timings;
1184 1371
1185 /* freerun */ 1372 cp_write(sd, 0x91, bt->interlaced ? 0x50 : 0x10);
1186 configure_free_run(sd, bt); 1373
1374 /* Use prim_mode and vid_std when available */
1375 err = configure_predefined_video_timings(sd, timings);
1376 if (err) {
1377 /* custom settings when the video format
1378 does not have prim_mode/vid_std */
1379 configure_custom_video_timings(sd, bt);
1380 }
1187 1381
1188 set_rgb_quantization_range(sd); 1382 set_rgb_quantization_range(sd);
1189 1383
@@ -1203,24 +1397,25 @@ static int adv7604_g_dv_timings(struct v4l2_subdev *sd,
1203 return 0; 1397 return 0;
1204} 1398}
1205 1399
1206static void enable_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) 1400static void enable_input(struct v4l2_subdev *sd)
1207{ 1401{
1208 switch (prim_mode) { 1402 struct adv7604_state *state = to_state(sd);
1209 case ADV7604_PRIM_MODE_COMP: 1403
1210 case ADV7604_PRIM_MODE_RGB: 1404 switch (state->mode) {
1405 case ADV7604_MODE_COMP:
1406 case ADV7604_MODE_GR:
1211 /* enable */ 1407 /* enable */
1212 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ 1408 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */
1213 break; 1409 break;
1214 case ADV7604_PRIM_MODE_HDMI_COMP: 1410 case ADV7604_MODE_HDMI:
1215 case ADV7604_PRIM_MODE_HDMI_GR:
1216 /* enable */ 1411 /* enable */
1217 hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ 1412 hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */
1218 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ 1413 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */
1219 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ 1414 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */
1220 break; 1415 break;
1221 default: 1416 default:
1222 v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", 1417 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
1223 __func__, prim_mode); 1418 __func__, state->mode);
1224 break; 1419 break;
1225 } 1420 }
1226} 1421}
@@ -1233,17 +1428,13 @@ static void disable_input(struct v4l2_subdev *sd)
1233 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ 1428 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */
1234} 1429}
1235 1430
1236static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) 1431static void select_input(struct v4l2_subdev *sd)
1237{ 1432{
1238 switch (prim_mode) { 1433 struct adv7604_state *state = to_state(sd);
1239 case ADV7604_PRIM_MODE_COMP:
1240 case ADV7604_PRIM_MODE_RGB:
1241 /* set mode and select free run resolution */
1242 io_write(sd, 0x00, 0x07); /* video std */
1243 io_write(sd, 0x01, 0x02); /* prim mode */
1244 /* enable embedded syncs for auto graphics mode */
1245 cp_write_and_or(sd, 0x81, 0xef, 0x10);
1246 1434
1435 switch (state->mode) {
1436 case ADV7604_MODE_COMP:
1437 case ADV7604_MODE_GR:
1247 /* reset ADI recommended settings for HDMI: */ 1438 /* reset ADI recommended settings for HDMI: */
1248 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ 1439 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */
1249 hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ 1440 hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */
@@ -1271,16 +1462,7 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod
1271 cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ 1462 cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */
1272 break; 1463 break;
1273 1464
1274 case ADV7604_PRIM_MODE_HDMI_COMP: 1465 case ADV7604_MODE_HDMI:
1275 case ADV7604_PRIM_MODE_HDMI_GR:
1276 /* set mode and select free run resolution */
1277 /* video std */
1278 io_write(sd, 0x00,
1279 (prim_mode == ADV7604_PRIM_MODE_HDMI_GR) ? 0x02 : 0x1e);
1280 io_write(sd, 0x01, prim_mode); /* prim mode */
1281 /* disable embedded syncs for auto graphics mode */
1282 cp_write_and_or(sd, 0x81, 0xef, 0x00);
1283
1284 /* set ADI recommended settings for HDMI: */ 1466 /* set ADI recommended settings for HDMI: */
1285 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ 1467 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */
1286 hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ 1468 hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */
@@ -1309,7 +1491,8 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod
1309 1491
1310 break; 1492 break;
1311 default: 1493 default:
1312 v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", __func__, prim_mode); 1494 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
1495 __func__, state->mode);
1313 break; 1496 break;
1314 } 1497 }
1315} 1498}
@@ -1321,26 +1504,13 @@ static int adv7604_s_routing(struct v4l2_subdev *sd,
1321 1504
1322 v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); 1505 v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input);
1323 1506
1324 switch (input) { 1507 state->mode = input;
1325 case 0:
1326 /* TODO select HDMI_COMP or HDMI_GR */
1327 state->prim_mode = ADV7604_PRIM_MODE_HDMI_COMP;
1328 break;
1329 case 1:
1330 state->prim_mode = ADV7604_PRIM_MODE_RGB;
1331 break;
1332 case 2:
1333 state->prim_mode = ADV7604_PRIM_MODE_COMP;
1334 break;
1335 default:
1336 return -EINVAL;
1337 }
1338 1508
1339 disable_input(sd); 1509 disable_input(sd);
1340 1510
1341 select_input(sd, state->prim_mode); 1511 select_input(sd);
1342 1512
1343 enable_input(sd, state->prim_mode); 1513 enable_input(sd);
1344 1514
1345 return 0; 1515 return 0;
1346} 1516}
@@ -1549,8 +1719,9 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
1549 v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); 1719 v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true");
1550 v4l2_info(sd, "CP free run: %s\n", 1720 v4l2_info(sd, "CP free run: %s\n",
1551 (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); 1721 (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off"));
1552 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", 1722 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n",
1553 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); 1723 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f,
1724 (io_read(sd, 0x01) & 0x70) >> 4);
1554 1725
1555 v4l2_info(sd, "-----Video Timings-----\n"); 1726 v4l2_info(sd, "-----Video Timings-----\n");
1556 if (read_stdi(sd, &stdi)) 1727 if (read_stdi(sd, &stdi))
@@ -1712,9 +1883,9 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
1712 cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ 1883 cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */
1713 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ 1884 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */
1714 cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - 1885 cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold -
1715 ADI recommended setting [REF_01 c. 2.3.3] */ 1886 ADI recommended setting [REF_01, c. 2.3.3] */
1716 cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - 1887 cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold -
1717 ADI recommended setting [REF_01 c. 2.3.3] */ 1888 ADI recommended setting [REF_01, c. 2.3.3] */
1718 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution 1889 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution
1719 for digital formats */ 1890 for digital formats */
1720 1891
@@ -1724,11 +1895,6 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
1724 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ 1895 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */
1725 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); 1896 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4);
1726 1897
1727 state->prim_mode = pdata->prim_mode;
1728 select_input(sd, pdata->prim_mode);
1729
1730 enable_input(sd, pdata->prim_mode);
1731
1732 /* interrupts */ 1898 /* interrupts */
1733 io_write(sd, 0x40, 0xc2); /* Configure INT1 */ 1899 io_write(sd, 0x40, 0xc2); /* Configure INT1 */
1734 io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ 1900 io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */
@@ -1883,6 +2049,7 @@ static int adv7604_probe(struct i2c_client *client,
1883 v4l2_err(sd, "failed to create all i2c clients\n"); 2049 v4l2_err(sd, "failed to create all i2c clients\n");
1884 goto err_i2c; 2050 goto err_i2c;
1885 } 2051 }
2052 state->restart_stdi_once = true;
1886 2053
1887 /* work queues */ 2054 /* work queues */
1888 state->work_queues = create_singlethread_workqueue(client->name); 2055 state->work_queues = create_singlethread_workqueue(client->name);
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
index 13057b966ee9..333ef178d6fb 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -263,9 +263,14 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
263 if (ret & 1) /* Autoexposure */ 263 if (ret & 1) /* Autoexposure */
264 ret = reg_write(client, mt9v022->reg->max_total_shutter_width, 264 ret = reg_write(client, mt9v022->reg->max_total_shutter_width,
265 rect.height + mt9v022->y_skip_top + 43); 265 rect.height + mt9v022->y_skip_top + 43);
266 else 266 /*
267 ret = reg_write(client, MT9V022_TOTAL_SHUTTER_WIDTH, 267 * If autoexposure is off, there is no need to set
268 rect.height + mt9v022->y_skip_top + 43); 268 * MT9V022_TOTAL_SHUTTER_WIDTH here. Autoexposure can be off
269 * only if the user has set exposure manually, using the
270 * V4L2_CID_EXPOSURE_AUTO with the value V4L2_EXPOSURE_MANUAL.
271 * In this case the register MT9V022_TOTAL_SHUTTER_WIDTH
272 * already contains the correct value.
273 */
269 } 274 }
270 /* Setup frame format: defaults apart from width and height */ 275 /* Setup frame format: defaults apart from width and height */
271 if (!ret) 276 if (!ret)
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index bfec9e65aefb..19cbb12a12a2 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -965,8 +965,10 @@ static struct platform_device_id gsc_driver_ids[] = {
965MODULE_DEVICE_TABLE(platform, gsc_driver_ids); 965MODULE_DEVICE_TABLE(platform, gsc_driver_ids);
966 966
967static const struct of_device_id exynos_gsc_match[] = { 967static const struct of_device_id exynos_gsc_match[] = {
968 { .compatible = "samsung,exynos5250-gsc", 968 {
969 .data = &gsc_v_100_drvdata, }, 969 .compatible = "samsung,exynos5-gsc",
970 .data = &gsc_v_100_drvdata,
971 },
970 {}, 972 {},
971}; 973};
972MODULE_DEVICE_TABLE(of, exynos_gsc_match); 974MODULE_DEVICE_TABLE(of, exynos_gsc_match);
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 60181ab96063..aa9df9d71a7b 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -1706,7 +1706,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
1706} 1706}
1707 1707
1708static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, 1708static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1709 const struct v4l2_event_subscription *sub) 1709 struct v4l2_event_subscription *sub)
1710{ 1710{
1711 if (sub->type != V4L2_EVENT_FRAME_SYNC) 1711 if (sub->type != V4L2_EVENT_FRAME_SYNC)
1712 return -EINVAL; 1712 return -EINVAL;
@@ -1719,7 +1719,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1719} 1719}
1720 1720
1721static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, 1721static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1722 const struct v4l2_event_subscription *sub) 1722 struct v4l2_event_subscription *sub)
1723{ 1723{
1724 return v4l2_event_unsubscribe(fh, sub); 1724 return v4l2_event_unsubscribe(fh, sub);
1725} 1725}
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index d7ac76b5c2ae..b8640be692f1 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -1025,7 +1025,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat)
1025 1025
1026int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, 1026int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
1027 struct v4l2_fh *fh, 1027 struct v4l2_fh *fh,
1028 const struct v4l2_event_subscription *sub) 1028 struct v4l2_event_subscription *sub)
1029{ 1029{
1030 struct ispstat *stat = v4l2_get_subdevdata(subdev); 1030 struct ispstat *stat = v4l2_get_subdevdata(subdev);
1031 1031
@@ -1037,7 +1037,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
1037 1037
1038int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, 1038int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
1039 struct v4l2_fh *fh, 1039 struct v4l2_fh *fh,
1040 const struct v4l2_event_subscription *sub) 1040 struct v4l2_event_subscription *sub)
1041{ 1041{
1042 return v4l2_event_unsubscribe(fh, sub); 1042 return v4l2_event_unsubscribe(fh, sub);
1043} 1043}
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h
index a6fe653eb237..9b7c8654dc8a 100644
--- a/drivers/media/platform/omap3isp/ispstat.h
+++ b/drivers/media/platform/omap3isp/ispstat.h
@@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name,
147void omap3isp_stat_cleanup(struct ispstat *stat); 147void omap3isp_stat_cleanup(struct ispstat *stat);
148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, 148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
149 struct v4l2_fh *fh, 149 struct v4l2_fh *fh,
150 const struct v4l2_event_subscription *sub); 150 struct v4l2_event_subscription *sub);
151int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, 151int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
152 struct v4l2_fh *fh, 152 struct v4l2_fh *fh,
153 const struct v4l2_event_subscription *sub); 153 struct v4l2_event_subscription *sub);
154int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); 154int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
155 155
156int omap3isp_stat_busy(struct ispstat *stat); 156int omap3isp_stat_busy(struct ispstat *stat);
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index a0b737fecf13..75cd309035f9 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -792,7 +792,7 @@ isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop)
792} 792}
793 793
794static int 794static int
795isp_video_set_crop(struct file *file, void *fh, struct v4l2_crop *crop) 795isp_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop)
796{ 796{
797 struct isp_video *video = video_drvdata(file); 797 struct isp_video *video = video_drvdata(file);
798 struct v4l2_subdev *subdev; 798 struct v4l2_subdev *subdev;
diff --git a/drivers/media/platform/s5p-fimc/Kconfig b/drivers/media/platform/s5p-fimc/Kconfig
index 8f090a8f270e..c16b20d86ed2 100644
--- a/drivers/media/platform/s5p-fimc/Kconfig
+++ b/drivers/media/platform/s5p-fimc/Kconfig
@@ -24,6 +24,7 @@ config VIDEO_S5P_FIMC
24config VIDEO_S5P_MIPI_CSIS 24config VIDEO_S5P_MIPI_CSIS
25 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" 25 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver"
26 depends on REGULATOR 26 depends on REGULATOR
27 select S5P_SETUP_MIPIPHY
27 help 28 help
28 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 29 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
29 receiver (MIPI-CSIS) devices. 30 receiver (MIPI-CSIS) devices.
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c
index 367efd164d0f..3d39d97abaa5 100644
--- a/drivers/media/platform/s5p-fimc/fimc-capture.c
+++ b/drivers/media/platform/s5p-fimc/fimc-capture.c
@@ -1736,7 +1736,9 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
1736 q->mem_ops = &vb2_dma_contig_memops; 1736 q->mem_ops = &vb2_dma_contig_memops;
1737 q->buf_struct_size = sizeof(struct fimc_vid_buffer); 1737 q->buf_struct_size = sizeof(struct fimc_vid_buffer);
1738 1738
1739 vb2_queue_init(q); 1739 ret = vb2_queue_init(q);
1740 if (ret)
1741 goto err_ent;
1740 1742
1741 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; 1743 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK;
1742 ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); 1744 ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0);
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 70bcf39de879..9db246bed841 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -1253,7 +1253,9 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
1253 q->buf_struct_size = sizeof(struct flite_buffer); 1253 q->buf_struct_size = sizeof(struct flite_buffer);
1254 q->drv_priv = fimc; 1254 q->drv_priv = fimc;
1255 1255
1256 vb2_queue_init(q); 1256 ret = vb2_queue_init(q);
1257 if (ret < 0)
1258 return ret;
1257 1259
1258 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; 1260 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK;
1259 ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); 1261 ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0);
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 80ada5882f62..38ea4d143a49 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -343,53 +343,50 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
343static int fimc_register_callback(struct device *dev, void *p) 343static int fimc_register_callback(struct device *dev, void *p)
344{ 344{
345 struct fimc_dev *fimc = dev_get_drvdata(dev); 345 struct fimc_dev *fimc = dev_get_drvdata(dev);
346 struct v4l2_subdev *sd = &fimc->vid_cap.subdev; 346 struct v4l2_subdev *sd;
347 struct fimc_md *fmd = p; 347 struct fimc_md *fmd = p;
348 int ret = 0; 348 int ret;
349
350 if (!fimc || !fimc->pdev)
351 return 0;
352 349
353 if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) 350 if (fimc == NULL || fimc->id >= FIMC_MAX_DEVS)
354 return 0; 351 return 0;
355 352
356 fimc->pipeline_ops = &fimc_pipeline_ops; 353 sd = &fimc->vid_cap.subdev;
357 fmd->fimc[fimc->pdev->id] = fimc;
358 sd->grp_id = FIMC_GROUP_ID; 354 sd->grp_id = FIMC_GROUP_ID;
359 355
360 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); 356 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
361 if (ret) { 357 if (ret) {
362 v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", 358 v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n",
363 fimc->id, ret); 359 fimc->id, ret);
360 return ret;
364 } 361 }
365 362
366 return ret; 363 fimc->pipeline_ops = &fimc_pipeline_ops;
364 fmd->fimc[fimc->id] = fimc;
365 return 0;
367} 366}
368 367
369static int fimc_lite_register_callback(struct device *dev, void *p) 368static int fimc_lite_register_callback(struct device *dev, void *p)
370{ 369{
371 struct fimc_lite *fimc = dev_get_drvdata(dev); 370 struct fimc_lite *fimc = dev_get_drvdata(dev);
372 struct v4l2_subdev *sd = &fimc->subdev;
373 struct fimc_md *fmd = p; 371 struct fimc_md *fmd = p;
374 int ret; 372 int ret;
375 373
376 if (fimc == NULL) 374 if (fimc == NULL || fimc->index >= FIMC_LITE_MAX_DEVS)
377 return 0; 375 return 0;
378 376
379 if (fimc->index >= FIMC_LITE_MAX_DEVS) 377 fimc->subdev.grp_id = FLITE_GROUP_ID;
380 return 0;
381 378
382 fimc->pipeline_ops = &fimc_pipeline_ops; 379 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev);
383 fmd->fimc_lite[fimc->index] = fimc;
384 sd->grp_id = FLITE_GROUP_ID;
385
386 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
387 if (ret) { 380 if (ret) {
388 v4l2_err(&fmd->v4l2_dev, 381 v4l2_err(&fmd->v4l2_dev,
389 "Failed to register FIMC-LITE.%d (%d)\n", 382 "Failed to register FIMC-LITE.%d (%d)\n",
390 fimc->index, ret); 383 fimc->index, ret);
384 return ret;
391 } 385 }
392 return ret; 386
387 fimc->pipeline_ops = &fimc_pipeline_ops;
388 fmd->fimc_lite[fimc->index] = fimc;
389 return 0;
393} 390}
394 391
395static int csis_register_callback(struct device *dev, void *p) 392static int csis_register_callback(struct device *dev, void *p)
@@ -407,10 +404,12 @@ static int csis_register_callback(struct device *dev, void *p)
407 v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); 404 v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name);
408 405
409 id = pdev->id < 0 ? 0 : pdev->id; 406 id = pdev->id < 0 ? 0 : pdev->id;
410 fmd->csis[id].sd = sd;
411 sd->grp_id = CSIS_GROUP_ID; 407 sd->grp_id = CSIS_GROUP_ID;
408
412 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); 409 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
413 if (ret) 410 if (!ret)
411 fmd->csis[id].sd = sd;
412 else
414 v4l2_err(&fmd->v4l2_dev, 413 v4l2_err(&fmd->v4l2_dev,
415 "Failed to register CSIS subdevice: %d\n", ret); 414 "Failed to register CSIS subdevice: %d\n", ret);
416 return ret; 415 return ret;
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index 85fd312f0a82..a1c87f0ceaab 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -935,9 +935,10 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a)
935/* Assume a dull encoder, do all the work ourselves. */ 935/* Assume a dull encoder, do all the work ourselves. */
936static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) 936static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a)
937{ 937{
938 struct v4l2_crop a_writable = *a;
938 struct video_device *vdev = video_devdata(file); 939 struct video_device *vdev = video_devdata(file);
939 struct sh_vou_device *vou_dev = video_get_drvdata(vdev); 940 struct sh_vou_device *vou_dev = video_get_drvdata(vdev);
940 struct v4l2_rect *rect = &a->c; 941 struct v4l2_rect *rect = &a_writable.c;
941 struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; 942 struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT};
942 struct v4l2_pix_format *pix = &vou_dev->pix; 943 struct v4l2_pix_format *pix = &vou_dev->pix;
943 struct sh_vou_geometry geo; 944 struct sh_vou_geometry geo;
diff --git a/drivers/media/platform/soc_camera/mx1_camera.c b/drivers/media/platform/soc_camera/mx1_camera.c
index bbe70991d30b..032b8c9097f9 100644
--- a/drivers/media/platform/soc_camera/mx1_camera.c
+++ b/drivers/media/platform/soc_camera/mx1_camera.c
@@ -470,14 +470,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
470 pcdev->icd = NULL; 470 pcdev->icd = NULL;
471} 471}
472 472
473static int mx1_camera_set_crop(struct soc_camera_device *icd,
474 struct v4l2_crop *a)
475{
476 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
477
478 return v4l2_subdev_call(sd, video, s_crop, a);
479}
480
481static int mx1_camera_set_bus_param(struct soc_camera_device *icd) 473static int mx1_camera_set_bus_param(struct soc_camera_device *icd)
482{ 474{
483 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 475 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
@@ -689,7 +681,6 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = {
689 .add = mx1_camera_add_device, 681 .add = mx1_camera_add_device,
690 .remove = mx1_camera_remove_device, 682 .remove = mx1_camera_remove_device,
691 .set_bus_param = mx1_camera_set_bus_param, 683 .set_bus_param = mx1_camera_set_bus_param,
692 .set_crop = mx1_camera_set_crop,
693 .set_fmt = mx1_camera_set_fmt, 684 .set_fmt = mx1_camera_set_fmt,
694 .try_fmt = mx1_camera_try_fmt, 685 .try_fmt = mx1_camera_try_fmt,
695 .init_videobuf = mx1_camera_init_videobuf, 686 .init_videobuf = mx1_camera_init_videobuf,
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 9fd9d1c5b218..9a55f4c4c7f4 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -864,8 +864,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
864 864
865 bytesperline = soc_mbus_bytes_per_line(icd->user_width, 865 bytesperline = soc_mbus_bytes_per_line(icd->user_width,
866 icd->current_fmt->host_fmt); 866 icd->current_fmt->host_fmt);
867 if (bytesperline < 0) 867 if (bytesperline < 0) {
868 spin_unlock_irqrestore(&pcdev->lock, flags);
868 return bytesperline; 869 return bytesperline;
870 }
869 871
870 /* 872 /*
871 * I didn't manage to properly enable/disable the prp 873 * I didn't manage to properly enable/disable the prp
@@ -878,8 +880,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
878 pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, 880 pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev,
879 pcdev->discard_size, &pcdev->discard_buffer_dma, 881 pcdev->discard_size, &pcdev->discard_buffer_dma,
880 GFP_KERNEL); 882 GFP_KERNEL);
881 if (!pcdev->discard_buffer) 883 if (!pcdev->discard_buffer) {
884 spin_unlock_irqrestore(&pcdev->lock, flags);
882 return -ENOMEM; 885 return -ENOMEM;
886 }
883 887
884 pcdev->buf_discard[0].discard = true; 888 pcdev->buf_discard[0].discard = true;
885 list_add_tail(&pcdev->buf_discard[0].queue, 889 list_add_tail(&pcdev->buf_discard[0].queue,
@@ -1099,9 +1103,10 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1099} 1103}
1100 1104
1101static int mx2_camera_set_crop(struct soc_camera_device *icd, 1105static int mx2_camera_set_crop(struct soc_camera_device *icd,
1102 struct v4l2_crop *a) 1106 const struct v4l2_crop *a)
1103{ 1107{
1104 struct v4l2_rect *rect = &a->c; 1108 struct v4l2_crop a_writable = *a;
1109 struct v4l2_rect *rect = &a_writable.c;
1105 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1110 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1106 struct v4l2_mbus_framefmt mf; 1111 struct v4l2_mbus_framefmt mf;
1107 int ret; 1112 int ret;
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 3557ac97e430..261f6e9e1b17 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -799,9 +799,10 @@ static inline void stride_align(__u32 *width)
799 * default g_crop and cropcap from soc_camera.c 799 * default g_crop and cropcap from soc_camera.c
800 */ 800 */
801static int mx3_camera_set_crop(struct soc_camera_device *icd, 801static int mx3_camera_set_crop(struct soc_camera_device *icd,
802 struct v4l2_crop *a) 802 const struct v4l2_crop *a)
803{ 803{
804 struct v4l2_rect *rect = &a->c; 804 struct v4l2_crop a_writable = *a;
805 struct v4l2_rect *rect = &a_writable.c;
805 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 806 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
806 struct mx3_camera_dev *mx3_cam = ici->priv; 807 struct mx3_camera_dev *mx3_cam = ici->priv;
807 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 808 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c
index fa08c7695ccb..13636a585106 100644
--- a/drivers/media/platform/soc_camera/omap1_camera.c
+++ b/drivers/media/platform/soc_camera/omap1_camera.c
@@ -1215,9 +1215,9 @@ static int set_mbus_format(struct omap1_cam_dev *pcdev, struct device *dev,
1215} 1215}
1216 1216
1217static int omap1_cam_set_crop(struct soc_camera_device *icd, 1217static int omap1_cam_set_crop(struct soc_camera_device *icd,
1218 struct v4l2_crop *crop) 1218 const struct v4l2_crop *crop)
1219{ 1219{
1220 struct v4l2_rect *rect = &crop->c; 1220 const struct v4l2_rect *rect = &crop->c;
1221 const struct soc_camera_format_xlate *xlate = icd->current_fmt; 1221 const struct soc_camera_format_xlate *xlate = icd->current_fmt;
1222 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1222 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1223 struct device *dev = icd->parent; 1223 struct device *dev = icd->parent;
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c
index 1e3776d08dac..3434ffe79c6e 100644
--- a/drivers/media/platform/soc_camera/pxa_camera.c
+++ b/drivers/media/platform/soc_camera/pxa_camera.c
@@ -1337,9 +1337,9 @@ static int pxa_camera_check_frame(u32 width, u32 height)
1337} 1337}
1338 1338
1339static int pxa_camera_set_crop(struct soc_camera_device *icd, 1339static int pxa_camera_set_crop(struct soc_camera_device *icd,
1340 struct v4l2_crop *a) 1340 const struct v4l2_crop *a)
1341{ 1341{
1342 struct v4l2_rect *rect = &a->c; 1342 const struct v4l2_rect *rect = &a->c;
1343 struct device *dev = icd->parent; 1343 struct device *dev = icd->parent;
1344 struct soc_camera_host *ici = to_soc_camera_host(dev); 1344 struct soc_camera_host *ici = to_soc_camera_host(dev);
1345 struct pxa_camera_dev *pcdev = ici->priv; 1345 struct pxa_camera_dev *pcdev = ici->priv;
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
index 0a24253dcda2..2d8861c0e8f2 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
@@ -1182,13 +1182,13 @@ static void sh_mobile_ceu_put_formats(struct soc_camera_device *icd)
1182} 1182}
1183 1183
1184/* Check if any dimension of r1 is smaller than respective one of r2 */ 1184/* Check if any dimension of r1 is smaller than respective one of r2 */
1185static bool is_smaller(struct v4l2_rect *r1, struct v4l2_rect *r2) 1185static bool is_smaller(const struct v4l2_rect *r1, const struct v4l2_rect *r2)
1186{ 1186{
1187 return r1->width < r2->width || r1->height < r2->height; 1187 return r1->width < r2->width || r1->height < r2->height;
1188} 1188}
1189 1189
1190/* Check if r1 fails to cover r2 */ 1190/* Check if r1 fails to cover r2 */
1191static bool is_inside(struct v4l2_rect *r1, struct v4l2_rect *r2) 1191static bool is_inside(const struct v4l2_rect *r1, const struct v4l2_rect *r2)
1192{ 1192{
1193 return r1->left > r2->left || r1->top > r2->top || 1193 return r1->left > r2->left || r1->top > r2->top ||
1194 r1->left + r1->width < r2->left + r2->width || 1194 r1->left + r1->width < r2->left + r2->width ||
@@ -1263,7 +1263,7 @@ static void update_subrect(struct sh_mobile_ceu_cam *cam)
1263 * 3. if (2) failed, try to request the maximum image 1263 * 3. if (2) failed, try to request the maximum image
1264 */ 1264 */
1265static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, 1265static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop,
1266 const struct v4l2_crop *cam_crop) 1266 struct v4l2_crop *cam_crop)
1267{ 1267{
1268 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1268 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1269 struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; 1269 struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c;
@@ -1519,7 +1519,8 @@ static int client_scale(struct soc_camera_device *icd,
1519static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, 1519static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1520 const struct v4l2_crop *a) 1520 const struct v4l2_crop *a)
1521{ 1521{
1522 struct v4l2_rect *rect = &a->c; 1522 struct v4l2_crop a_writable = *a;
1523 const struct v4l2_rect *rect = &a_writable.c;
1523 struct device *dev = icd->parent; 1524 struct device *dev = icd->parent;
1524 struct soc_camera_host *ici = to_soc_camera_host(dev); 1525 struct soc_camera_host *ici = to_soc_camera_host(dev);
1525 struct sh_mobile_ceu_dev *pcdev = ici->priv; 1526 struct sh_mobile_ceu_dev *pcdev = ici->priv;
@@ -1545,7 +1546,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1545 * 1. - 2. Apply iterative camera S_CROP for new input window, read back 1546 * 1. - 2. Apply iterative camera S_CROP for new input window, read back
1546 * actual camera rectangle. 1547 * actual camera rectangle.
1547 */ 1548 */
1548 ret = client_s_crop(icd, a, &cam_crop); 1549 ret = client_s_crop(icd, &a_writable, &cam_crop);
1549 if (ret < 0) 1550 if (ret < 0)
1550 return ret; 1551 return ret;
1551 1552
@@ -1946,7 +1947,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1946} 1947}
1947 1948
1948static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, 1949static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd,
1949 struct v4l2_crop *a) 1950 const struct v4l2_crop *a)
1950{ 1951{
1951 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1952 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1952 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 1953 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index 9859d2a2449b..ba51f65204de 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -283,14 +283,13 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
283 283
284 /* activate the pid on the device pid filter */ 284 /* activate the pid on the device pid filter */
285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && 285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
286 adap->pid_filtering && 286 adap->pid_filtering && adap->props->pid_filter) {
287 adap->props->pid_filter)
288 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, 287 ret = adap->props->pid_filter(adap, dvbdmxfeed->index,
289 dvbdmxfeed->pid, (count == 1) ? 1 : 0); 288 dvbdmxfeed->pid, (count == 1) ? 1 : 0);
290 if (ret < 0) 289 if (ret < 0)
291 dev_err(&d->udev->dev, "%s: pid_filter() " \ 290 dev_err(&d->udev->dev, "%s: pid_filter() failed=%d\n",
292 "failed=%d\n", KBUILD_MODNAME, 291 KBUILD_MODNAME, ret);
293 ret); 292 }
294 293
295 /* start feeding if it is first pid */ 294 /* start feeding if it is first pid */
296 if (adap->feed_count == 1 && count == 1) { 295 if (adap->feed_count == 1 && count == 1) {
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
index 0431beed0ef4..5716662b4834 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
@@ -32,9 +32,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
32 return -EINVAL; 32 return -EINVAL;
33 } 33 }
34 34
35 ret = mutex_lock_interruptible(&d->usb_mutex); 35 mutex_lock(&d->usb_mutex);
36 if (ret < 0)
37 return ret;
38 36
39 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); 37 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf);
40 38
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index adabba8d28bc..093f1acce403 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1346,6 +1346,10 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
1346 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, 1346 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1347 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, 1347 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1348 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, 1348 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1349 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1350 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1351 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1352 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1349 { } 1353 { }
1350}; 1354};
1351MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); 1355MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 1b48f2094806..f4f9bf84bc7b 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -98,9 +98,9 @@ static irqreturn_t arizona_underclocked(int irq, void *data)
98 98
99 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS) 99 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS)
100 dev_err(arizona->dev, "AIF3 underclocked\n"); 100 dev_err(arizona->dev, "AIF3 underclocked\n");
101 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS)
102 dev_err(arizona->dev, "AIF3 underclocked\n");
103 if (val & ARIZONA_AIF2_UNDERCLOCKED_STS) 101 if (val & ARIZONA_AIF2_UNDERCLOCKED_STS)
102 dev_err(arizona->dev, "AIF2 underclocked\n");
103 if (val & ARIZONA_AIF1_UNDERCLOCKED_STS)
104 dev_err(arizona->dev, "AIF1 underclocked\n"); 104 dev_err(arizona->dev, "AIF1 underclocked\n");
105 if (val & ARIZONA_ISRC2_UNDERCLOCKED_STS) 105 if (val & ARIZONA_ISRC2_UNDERCLOCKED_STS)
106 dev_err(arizona->dev, "ISRC2 underclocked\n"); 106 dev_err(arizona->dev, "ISRC2 underclocked\n");
@@ -415,11 +415,19 @@ int __devinit arizona_dev_init(struct arizona *arizona)
415 415
416 /* If we have a /RESET GPIO we'll already be reset */ 416 /* If we have a /RESET GPIO we'll already be reset */
417 if (!arizona->pdata.reset) { 417 if (!arizona->pdata.reset) {
418 regcache_mark_dirty(arizona->regmap);
419
418 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0); 420 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0);
419 if (ret != 0) { 421 if (ret != 0) {
420 dev_err(dev, "Failed to reset device: %d\n", ret); 422 dev_err(dev, "Failed to reset device: %d\n", ret);
421 goto err_reset; 423 goto err_reset;
422 } 424 }
425
426 ret = regcache_sync(arizona->regmap);
427 if (ret != 0) {
428 dev_err(dev, "Failed to sync device: %d\n", ret);
429 goto err_reset;
430 }
423 } 431 }
424 432
425 ret = arizona_wait_for_boot(arizona); 433 ret = arizona_wait_for_boot(arizona);
@@ -520,7 +528,7 @@ int __devinit arizona_dev_init(struct arizona *arizona)
520 break; 528 break;
521 case WM5110: 529 case WM5110:
522 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, 530 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs,
523 ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 531 ARRAY_SIZE(wm5110_devs), NULL, 0, NULL);
524 break; 532 break;
525 } 533 }
526 534
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index ef0f2d001df2..b1b009177405 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -178,6 +178,7 @@ int arizona_irq_init(struct arizona *arizona)
178 178
179 switch (arizona->rev) { 179 switch (arizona->rev) {
180 case 0: 180 case 0:
181 case 1:
181 ctrlif_error = false; 182 ctrlif_error = false;
182 break; 183 break;
183 default: 184 default:
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 4ae642320205..a071a8643a47 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -671,7 +671,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
671 } 671 }
672 672
673 if (IS_ENABLED(CONFIG_PWM_TWL6030) && twl_class_is_6030()) { 673 if (IS_ENABLED(CONFIG_PWM_TWL6030) && twl_class_is_6030()) {
674 child = add_child(TWL6030_MODULE_ID1, "twl6030-pwm", NULL, 0, 674 child = add_child(SUB_CHIP_ID1, "twl6030-pwm", NULL, 0,
675 false, 0, 0); 675 false, 0, 0);
676 if (IS_ERR(child)) 676 if (IS_ERR(child))
677 return PTR_ERR(child); 677 return PTR_ERR(child);
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index ad733d76207a..cdd1173ed4e9 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -672,7 +672,8 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)
672 irq = sih_mod + twl4030_irq_base; 672 irq = sih_mod + twl4030_irq_base;
673 irq_set_handler_data(irq, agent); 673 irq_set_handler_data(irq, agent);
674 agent->irq_name = kasprintf(GFP_KERNEL, "twl4030_%s", sih->name); 674 agent->irq_name = kasprintf(GFP_KERNEL, "twl4030_%s", sih->name);
675 status = request_threaded_irq(irq, NULL, handle_twl4030_sih, 0, 675 status = request_threaded_irq(irq, NULL, handle_twl4030_sih,
676 IRQF_EARLY_RESUME,
676 agent->irq_name ?: sih->name, NULL); 677 agent->irq_name ?: sih->name, NULL);
677 678
678 dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", sih->name, 679 dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", sih->name,
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index 01b9255ed631..14490cc785d2 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -43,6 +43,7 @@ static const struct reg_default wm5102_reva_patch[] = {
43 { 0x479, 0x0A30 }, 43 { 0x479, 0x0A30 },
44 { 0x47B, 0x0810 }, 44 { 0x47B, 0x0810 },
45 { 0x47D, 0x0510 }, 45 { 0x47D, 0x0510 },
46 { 0x4D1, 0x017F },
46 { 0x500, 0x000D }, 47 { 0x500, 0x000D },
47 { 0x507, 0x1820 }, 48 { 0x507, 0x1820 },
48 { 0x508, 0x1820 }, 49 { 0x508, 0x1820 },
@@ -52,524 +53,6 @@ static const struct reg_default wm5102_reva_patch[] = {
52 { 0x580, 0x000D }, 53 { 0x580, 0x000D },
53 { 0x587, 0x1820 }, 54 { 0x587, 0x1820 },
54 { 0x588, 0x1820 }, 55 { 0x588, 0x1820 },
55 { 0x101, 0x8140 },
56 { 0x3000, 0x2225 },
57 { 0x3001, 0x3a03 },
58 { 0x3002, 0x0225 },
59 { 0x3003, 0x0801 },
60 { 0x3004, 0x6249 },
61 { 0x3005, 0x0c04 },
62 { 0x3006, 0x0225 },
63 { 0x3007, 0x5901 },
64 { 0x3008, 0xe249 },
65 { 0x3009, 0x030d },
66 { 0x300a, 0x0249 },
67 { 0x300b, 0x2c01 },
68 { 0x300c, 0xe249 },
69 { 0x300d, 0x4342 },
70 { 0x300e, 0xe249 },
71 { 0x300f, 0x73c0 },
72 { 0x3010, 0x4249 },
73 { 0x3011, 0x0c00 },
74 { 0x3012, 0x0225 },
75 { 0x3013, 0x1f01 },
76 { 0x3014, 0x0225 },
77 { 0x3015, 0x1e01 },
78 { 0x3016, 0x0225 },
79 { 0x3017, 0xfa00 },
80 { 0x3018, 0x0000 },
81 { 0x3019, 0xf000 },
82 { 0x301a, 0x0000 },
83 { 0x301b, 0xf000 },
84 { 0x301c, 0x0000 },
85 { 0x301d, 0xf000 },
86 { 0x301e, 0x0000 },
87 { 0x301f, 0xf000 },
88 { 0x3020, 0x0000 },
89 { 0x3021, 0xf000 },
90 { 0x3022, 0x0000 },
91 { 0x3023, 0xf000 },
92 { 0x3024, 0x0000 },
93 { 0x3025, 0xf000 },
94 { 0x3026, 0x0000 },
95 { 0x3027, 0xf000 },
96 { 0x3028, 0x0000 },
97 { 0x3029, 0xf000 },
98 { 0x302a, 0x0000 },
99 { 0x302b, 0xf000 },
100 { 0x302c, 0x0000 },
101 { 0x302d, 0xf000 },
102 { 0x302e, 0x0000 },
103 { 0x302f, 0xf000 },
104 { 0x3030, 0x0225 },
105 { 0x3031, 0x1a01 },
106 { 0x3032, 0x0225 },
107 { 0x3033, 0x1e00 },
108 { 0x3034, 0x0225 },
109 { 0x3035, 0x1f00 },
110 { 0x3036, 0x6225 },
111 { 0x3037, 0xf800 },
112 { 0x3038, 0x0000 },
113 { 0x3039, 0xf000 },
114 { 0x303a, 0x0000 },
115 { 0x303b, 0xf000 },
116 { 0x303c, 0x0000 },
117 { 0x303d, 0xf000 },
118 { 0x303e, 0x0000 },
119 { 0x303f, 0xf000 },
120 { 0x3040, 0x2226 },
121 { 0x3041, 0x3a03 },
122 { 0x3042, 0x0226 },
123 { 0x3043, 0x0801 },
124 { 0x3044, 0x6249 },
125 { 0x3045, 0x0c06 },
126 { 0x3046, 0x0226 },
127 { 0x3047, 0x5901 },
128 { 0x3048, 0xe249 },
129 { 0x3049, 0x030d },
130 { 0x304a, 0x0249 },
131 { 0x304b, 0x2c01 },
132 { 0x304c, 0xe249 },
133 { 0x304d, 0x4342 },
134 { 0x304e, 0xe249 },
135 { 0x304f, 0x73c0 },
136 { 0x3050, 0x4249 },
137 { 0x3051, 0x0c00 },
138 { 0x3052, 0x0226 },
139 { 0x3053, 0x1f01 },
140 { 0x3054, 0x0226 },
141 { 0x3055, 0x1e01 },
142 { 0x3056, 0x0226 },
143 { 0x3057, 0xfa00 },
144 { 0x3058, 0x0000 },
145 { 0x3059, 0xf000 },
146 { 0x305a, 0x0000 },
147 { 0x305b, 0xf000 },
148 { 0x305c, 0x0000 },
149 { 0x305d, 0xf000 },
150 { 0x305e, 0x0000 },
151 { 0x305f, 0xf000 },
152 { 0x3060, 0x0000 },
153 { 0x3061, 0xf000 },
154 { 0x3062, 0x0000 },
155 { 0x3063, 0xf000 },
156 { 0x3064, 0x0000 },
157 { 0x3065, 0xf000 },
158 { 0x3066, 0x0000 },
159 { 0x3067, 0xf000 },
160 { 0x3068, 0x0000 },
161 { 0x3069, 0xf000 },
162 { 0x306a, 0x0000 },
163 { 0x306b, 0xf000 },
164 { 0x306c, 0x0000 },
165 { 0x306d, 0xf000 },
166 { 0x306e, 0x0000 },
167 { 0x306f, 0xf000 },
168 { 0x3070, 0x0226 },
169 { 0x3071, 0x1a01 },
170 { 0x3072, 0x0226 },
171 { 0x3073, 0x1e00 },
172 { 0x3074, 0x0226 },
173 { 0x3075, 0x1f00 },
174 { 0x3076, 0x6226 },
175 { 0x3077, 0xf800 },
176 { 0x3078, 0x0000 },
177 { 0x3079, 0xf000 },
178 { 0x307a, 0x0000 },
179 { 0x307b, 0xf000 },
180 { 0x307c, 0x0000 },
181 { 0x307d, 0xf000 },
182 { 0x307e, 0x0000 },
183 { 0x307f, 0xf000 },
184 { 0x3080, 0x2227 },
185 { 0x3081, 0x3a03 },
186 { 0x3082, 0x0227 },
187 { 0x3083, 0x0801 },
188 { 0x3084, 0x6255 },
189 { 0x3085, 0x0c04 },
190 { 0x3086, 0x0227 },
191 { 0x3087, 0x5901 },
192 { 0x3088, 0xe255 },
193 { 0x3089, 0x030d },
194 { 0x308a, 0x0255 },
195 { 0x308b, 0x2c01 },
196 { 0x308c, 0xe255 },
197 { 0x308d, 0x4342 },
198 { 0x308e, 0xe255 },
199 { 0x308f, 0x73c0 },
200 { 0x3090, 0x4255 },
201 { 0x3091, 0x0c00 },
202 { 0x3092, 0x0227 },
203 { 0x3093, 0x1f01 },
204 { 0x3094, 0x0227 },
205 { 0x3095, 0x1e01 },
206 { 0x3096, 0x0227 },
207 { 0x3097, 0xfa00 },
208 { 0x3098, 0x0000 },
209 { 0x3099, 0xf000 },
210 { 0x309a, 0x0000 },
211 { 0x309b, 0xf000 },
212 { 0x309c, 0x0000 },
213 { 0x309d, 0xf000 },
214 { 0x309e, 0x0000 },
215 { 0x309f, 0xf000 },
216 { 0x30a0, 0x0000 },
217 { 0x30a1, 0xf000 },
218 { 0x30a2, 0x0000 },
219 { 0x30a3, 0xf000 },
220 { 0x30a4, 0x0000 },
221 { 0x30a5, 0xf000 },
222 { 0x30a6, 0x0000 },
223 { 0x30a7, 0xf000 },
224 { 0x30a8, 0x0000 },
225 { 0x30a9, 0xf000 },
226 { 0x30aa, 0x0000 },
227 { 0x30ab, 0xf000 },
228 { 0x30ac, 0x0000 },
229 { 0x30ad, 0xf000 },
230 { 0x30ae, 0x0000 },
231 { 0x30af, 0xf000 },
232 { 0x30b0, 0x0227 },
233 { 0x30b1, 0x1a01 },
234 { 0x30b2, 0x0227 },
235 { 0x30b3, 0x1e00 },
236 { 0x30b4, 0x0227 },
237 { 0x30b5, 0x1f00 },
238 { 0x30b6, 0x6227 },
239 { 0x30b7, 0xf800 },
240 { 0x30b8, 0x0000 },
241 { 0x30b9, 0xf000 },
242 { 0x30ba, 0x0000 },
243 { 0x30bb, 0xf000 },
244 { 0x30bc, 0x0000 },
245 { 0x30bd, 0xf000 },
246 { 0x30be, 0x0000 },
247 { 0x30bf, 0xf000 },
248 { 0x30c0, 0x2228 },
249 { 0x30c1, 0x3a03 },
250 { 0x30c2, 0x0228 },
251 { 0x30c3, 0x0801 },
252 { 0x30c4, 0x6255 },
253 { 0x30c5, 0x0c06 },
254 { 0x30c6, 0x0228 },
255 { 0x30c7, 0x5901 },
256 { 0x30c8, 0xe255 },
257 { 0x30c9, 0x030d },
258 { 0x30ca, 0x0255 },
259 { 0x30cb, 0x2c01 },
260 { 0x30cc, 0xe255 },
261 { 0x30cd, 0x4342 },
262 { 0x30ce, 0xe255 },
263 { 0x30cf, 0x73c0 },
264 { 0x30d0, 0x4255 },
265 { 0x30d1, 0x0c00 },
266 { 0x30d2, 0x0228 },
267 { 0x30d3, 0x1f01 },
268 { 0x30d4, 0x0228 },
269 { 0x30d5, 0x1e01 },
270 { 0x30d6, 0x0228 },
271 { 0x30d7, 0xfa00 },
272 { 0x30d8, 0x0000 },
273 { 0x30d9, 0xf000 },
274 { 0x30da, 0x0000 },
275 { 0x30db, 0xf000 },
276 { 0x30dc, 0x0000 },
277 { 0x30dd, 0xf000 },
278 { 0x30de, 0x0000 },
279 { 0x30df, 0xf000 },
280 { 0x30e0, 0x0000 },
281 { 0x30e1, 0xf000 },
282 { 0x30e2, 0x0000 },
283 { 0x30e3, 0xf000 },
284 { 0x30e4, 0x0000 },
285 { 0x30e5, 0xf000 },
286 { 0x30e6, 0x0000 },
287 { 0x30e7, 0xf000 },
288 { 0x30e8, 0x0000 },
289 { 0x30e9, 0xf000 },
290 { 0x30ea, 0x0000 },
291 { 0x30eb, 0xf000 },
292 { 0x30ec, 0x0000 },
293 { 0x30ed, 0xf000 },
294 { 0x30ee, 0x0000 },
295 { 0x30ef, 0xf000 },
296 { 0x30f0, 0x0228 },
297 { 0x30f1, 0x1a01 },
298 { 0x30f2, 0x0228 },
299 { 0x30f3, 0x1e00 },
300 { 0x30f4, 0x0228 },
301 { 0x30f5, 0x1f00 },
302 { 0x30f6, 0x6228 },
303 { 0x30f7, 0xf800 },
304 { 0x30f8, 0x0000 },
305 { 0x30f9, 0xf000 },
306 { 0x30fa, 0x0000 },
307 { 0x30fb, 0xf000 },
308 { 0x30fc, 0x0000 },
309 { 0x30fd, 0xf000 },
310 { 0x30fe, 0x0000 },
311 { 0x30ff, 0xf000 },
312 { 0x3100, 0x222b },
313 { 0x3101, 0x3a03 },
314 { 0x3102, 0x222b },
315 { 0x3103, 0x5803 },
316 { 0x3104, 0xe26f },
317 { 0x3105, 0x030d },
318 { 0x3106, 0x626f },
319 { 0x3107, 0x2c01 },
320 { 0x3108, 0xe26f },
321 { 0x3109, 0x4342 },
322 { 0x310a, 0xe26f },
323 { 0x310b, 0x73c0 },
324 { 0x310c, 0x026f },
325 { 0x310d, 0x0c00 },
326 { 0x310e, 0x022b },
327 { 0x310f, 0x1f01 },
328 { 0x3110, 0x022b },
329 { 0x3111, 0x1e01 },
330 { 0x3112, 0x022b },
331 { 0x3113, 0xfa00 },
332 { 0x3114, 0x0000 },
333 { 0x3115, 0xf000 },
334 { 0x3116, 0x0000 },
335 { 0x3117, 0xf000 },
336 { 0x3118, 0x0000 },
337 { 0x3119, 0xf000 },
338 { 0x311a, 0x0000 },
339 { 0x311b, 0xf000 },
340 { 0x311c, 0x0000 },
341 { 0x311d, 0xf000 },
342 { 0x311e, 0x0000 },
343 { 0x311f, 0xf000 },
344 { 0x3120, 0x022b },
345 { 0x3121, 0x0a01 },
346 { 0x3122, 0x022b },
347 { 0x3123, 0x1e00 },
348 { 0x3124, 0x022b },
349 { 0x3125, 0x1f00 },
350 { 0x3126, 0x622b },
351 { 0x3127, 0xf800 },
352 { 0x3128, 0x0000 },
353 { 0x3129, 0xf000 },
354 { 0x312a, 0x0000 },
355 { 0x312b, 0xf000 },
356 { 0x312c, 0x0000 },
357 { 0x312d, 0xf000 },
358 { 0x312e, 0x0000 },
359 { 0x312f, 0xf000 },
360 { 0x3130, 0x0000 },
361 { 0x3131, 0xf000 },
362 { 0x3132, 0x0000 },
363 { 0x3133, 0xf000 },
364 { 0x3134, 0x0000 },
365 { 0x3135, 0xf000 },
366 { 0x3136, 0x0000 },
367 { 0x3137, 0xf000 },
368 { 0x3138, 0x0000 },
369 { 0x3139, 0xf000 },
370 { 0x313a, 0x0000 },
371 { 0x313b, 0xf000 },
372 { 0x313c, 0x0000 },
373 { 0x313d, 0xf000 },
374 { 0x313e, 0x0000 },
375 { 0x313f, 0xf000 },
376 { 0x3140, 0x0000 },
377 { 0x3141, 0xf000 },
378 { 0x3142, 0x0000 },
379 { 0x3143, 0xf000 },
380 { 0x3144, 0x0000 },
381 { 0x3145, 0xf000 },
382 { 0x3146, 0x0000 },
383 { 0x3147, 0xf000 },
384 { 0x3148, 0x0000 },
385 { 0x3149, 0xf000 },
386 { 0x314a, 0x0000 },
387 { 0x314b, 0xf000 },
388 { 0x314c, 0x0000 },
389 { 0x314d, 0xf000 },
390 { 0x314e, 0x0000 },
391 { 0x314f, 0xf000 },
392 { 0x3150, 0x0000 },
393 { 0x3151, 0xf000 },
394 { 0x3152, 0x0000 },
395 { 0x3153, 0xf000 },
396 { 0x3154, 0x0000 },
397 { 0x3155, 0xf000 },
398 { 0x3156, 0x0000 },
399 { 0x3157, 0xf000 },
400 { 0x3158, 0x0000 },
401 { 0x3159, 0xf000 },
402 { 0x315a, 0x0000 },
403 { 0x315b, 0xf000 },
404 { 0x315c, 0x0000 },
405 { 0x315d, 0xf000 },
406 { 0x315e, 0x0000 },
407 { 0x315f, 0xf000 },
408 { 0x3160, 0x0000 },
409 { 0x3161, 0xf000 },
410 { 0x3162, 0x0000 },
411 { 0x3163, 0xf000 },
412 { 0x3164, 0x0000 },
413 { 0x3165, 0xf000 },
414 { 0x3166, 0x0000 },
415 { 0x3167, 0xf000 },
416 { 0x3168, 0x0000 },
417 { 0x3169, 0xf000 },
418 { 0x316a, 0x0000 },
419 { 0x316b, 0xf000 },
420 { 0x316c, 0x0000 },
421 { 0x316d, 0xf000 },
422 { 0x316e, 0x0000 },
423 { 0x316f, 0xf000 },
424 { 0x3170, 0x0000 },
425 { 0x3171, 0xf000 },
426 { 0x3172, 0x0000 },
427 { 0x3173, 0xf000 },
428 { 0x3174, 0x0000 },
429 { 0x3175, 0xf000 },
430 { 0x3176, 0x0000 },
431 { 0x3177, 0xf000 },
432 { 0x3178, 0x0000 },
433 { 0x3179, 0xf000 },
434 { 0x317a, 0x0000 },
435 { 0x317b, 0xf000 },
436 { 0x317c, 0x0000 },
437 { 0x317d, 0xf000 },
438 { 0x317e, 0x0000 },
439 { 0x317f, 0xf000 },
440 { 0x3180, 0x2001 },
441 { 0x3181, 0xf101 },
442 { 0x3182, 0x0000 },
443 { 0x3183, 0xf000 },
444 { 0x3184, 0x0000 },
445 { 0x3185, 0xf000 },
446 { 0x3186, 0x0000 },
447 { 0x3187, 0xf000 },
448 { 0x3188, 0x0000 },
449 { 0x3189, 0xf000 },
450 { 0x318a, 0x0000 },
451 { 0x318b, 0xf000 },
452 { 0x318c, 0x0000 },
453 { 0x318d, 0xf000 },
454 { 0x318e, 0x0000 },
455 { 0x318f, 0xf000 },
456 { 0x3190, 0x0000 },
457 { 0x3191, 0xf000 },
458 { 0x3192, 0x0000 },
459 { 0x3193, 0xf000 },
460 { 0x3194, 0x0000 },
461 { 0x3195, 0xf000 },
462 { 0x3196, 0x0000 },
463 { 0x3197, 0xf000 },
464 { 0x3198, 0x0000 },
465 { 0x3199, 0xf000 },
466 { 0x319a, 0x0000 },
467 { 0x319b, 0xf000 },
468 { 0x319c, 0x0000 },
469 { 0x319d, 0xf000 },
470 { 0x319e, 0x0000 },
471 { 0x319f, 0xf000 },
472 { 0x31a0, 0x0000 },
473 { 0x31a1, 0xf000 },
474 { 0x31a2, 0x0000 },
475 { 0x31a3, 0xf000 },
476 { 0x31a4, 0x0000 },
477 { 0x31a5, 0xf000 },
478 { 0x31a6, 0x0000 },
479 { 0x31a7, 0xf000 },
480 { 0x31a8, 0x0000 },
481 { 0x31a9, 0xf000 },
482 { 0x31aa, 0x0000 },
483 { 0x31ab, 0xf000 },
484 { 0x31ac, 0x0000 },
485 { 0x31ad, 0xf000 },
486 { 0x31ae, 0x0000 },
487 { 0x31af, 0xf000 },
488 { 0x31b0, 0x0000 },
489 { 0x31b1, 0xf000 },
490 { 0x31b2, 0x0000 },
491 { 0x31b3, 0xf000 },
492 { 0x31b4, 0x0000 },
493 { 0x31b5, 0xf000 },
494 { 0x31b6, 0x0000 },
495 { 0x31b7, 0xf000 },
496 { 0x31b8, 0x0000 },
497 { 0x31b9, 0xf000 },
498 { 0x31ba, 0x0000 },
499 { 0x31bb, 0xf000 },
500 { 0x31bc, 0x0000 },
501 { 0x31bd, 0xf000 },
502 { 0x31be, 0x0000 },
503 { 0x31bf, 0xf000 },
504 { 0x31c0, 0x0000 },
505 { 0x31c1, 0xf000 },
506 { 0x31c2, 0x0000 },
507 { 0x31c3, 0xf000 },
508 { 0x31c4, 0x0000 },
509 { 0x31c5, 0xf000 },
510 { 0x31c6, 0x0000 },
511 { 0x31c7, 0xf000 },
512 { 0x31c8, 0x0000 },
513 { 0x31c9, 0xf000 },
514 { 0x31ca, 0x0000 },
515 { 0x31cb, 0xf000 },
516 { 0x31cc, 0x0000 },
517 { 0x31cd, 0xf000 },
518 { 0x31ce, 0x0000 },
519 { 0x31cf, 0xf000 },
520 { 0x31d0, 0x0000 },
521 { 0x31d1, 0xf000 },
522 { 0x31d2, 0x0000 },
523 { 0x31d3, 0xf000 },
524 { 0x31d4, 0x0000 },
525 { 0x31d5, 0xf000 },
526 { 0x31d6, 0x0000 },
527 { 0x31d7, 0xf000 },
528 { 0x31d8, 0x0000 },
529 { 0x31d9, 0xf000 },
530 { 0x31da, 0x0000 },
531 { 0x31db, 0xf000 },
532 { 0x31dc, 0x0000 },
533 { 0x31dd, 0xf000 },
534 { 0x31de, 0x0000 },
535 { 0x31df, 0xf000 },
536 { 0x31e0, 0x0000 },
537 { 0x31e1, 0xf000 },
538 { 0x31e2, 0x0000 },
539 { 0x31e3, 0xf000 },
540 { 0x31e4, 0x0000 },
541 { 0x31e5, 0xf000 },
542 { 0x31e6, 0x0000 },
543 { 0x31e7, 0xf000 },
544 { 0x31e8, 0x0000 },
545 { 0x31e9, 0xf000 },
546 { 0x31ea, 0x0000 },
547 { 0x31eb, 0xf000 },
548 { 0x31ec, 0x0000 },
549 { 0x31ed, 0xf000 },
550 { 0x31ee, 0x0000 },
551 { 0x31ef, 0xf000 },
552 { 0x31f0, 0x0000 },
553 { 0x31f1, 0xf000 },
554 { 0x31f2, 0x0000 },
555 { 0x31f3, 0xf000 },
556 { 0x31f4, 0x0000 },
557 { 0x31f5, 0xf000 },
558 { 0x31f6, 0x0000 },
559 { 0x31f7, 0xf000 },
560 { 0x31f8, 0x0000 },
561 { 0x31f9, 0xf000 },
562 { 0x31fa, 0x0000 },
563 { 0x31fb, 0xf000 },
564 { 0x31fc, 0x0000 },
565 { 0x31fd, 0xf000 },
566 { 0x31fe, 0x0000 },
567 { 0x31ff, 0xf000 },
568 { 0x024d, 0xff50 },
569 { 0x0252, 0xff50 },
570 { 0x0259, 0x0112 },
571 { 0x025e, 0x0112 },
572 { 0x101, 0x0304 },
573 { 0x80, 0x0000 }, 56 { 0x80, 0x0000 },
574}; 57};
575 58
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5f5b69f37d2e..a7d47350ea4b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3459,6 +3459,28 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
3459 3459
3460/*-------------------------- Device entry points ----------------------------*/ 3460/*-------------------------- Device entry points ----------------------------*/
3461 3461
3462static void bond_work_init_all(struct bonding *bond)
3463{
3464 INIT_DELAYED_WORK(&bond->mcast_work,
3465 bond_resend_igmp_join_requests_delayed);
3466 INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor);
3467 INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor);
3468 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP)
3469 INIT_DELAYED_WORK(&bond->arp_work, bond_activebackup_arp_mon);
3470 else
3471 INIT_DELAYED_WORK(&bond->arp_work, bond_loadbalance_arp_mon);
3472 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
3473}
3474
3475static void bond_work_cancel_all(struct bonding *bond)
3476{
3477 cancel_delayed_work_sync(&bond->mii_work);
3478 cancel_delayed_work_sync(&bond->arp_work);
3479 cancel_delayed_work_sync(&bond->alb_work);
3480 cancel_delayed_work_sync(&bond->ad_work);
3481 cancel_delayed_work_sync(&bond->mcast_work);
3482}
3483
3462static int bond_open(struct net_device *bond_dev) 3484static int bond_open(struct net_device *bond_dev)
3463{ 3485{
3464 struct bonding *bond = netdev_priv(bond_dev); 3486 struct bonding *bond = netdev_priv(bond_dev);
@@ -3481,41 +3503,27 @@ static int bond_open(struct net_device *bond_dev)
3481 } 3503 }
3482 read_unlock(&bond->lock); 3504 read_unlock(&bond->lock);
3483 3505
3484 INIT_DELAYED_WORK(&bond->mcast_work, bond_resend_igmp_join_requests_delayed); 3506 bond_work_init_all(bond);
3485 3507
3486 if (bond_is_lb(bond)) { 3508 if (bond_is_lb(bond)) {
3487 /* bond_alb_initialize must be called before the timer 3509 /* bond_alb_initialize must be called before the timer
3488 * is started. 3510 * is started.
3489 */ 3511 */
3490 if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB))) { 3512 if (bond_alb_initialize(bond, (bond->params.mode == BOND_MODE_ALB)))
3491 /* something went wrong - fail the open operation */
3492 return -ENOMEM; 3513 return -ENOMEM;
3493 }
3494
3495 INIT_DELAYED_WORK(&bond->alb_work, bond_alb_monitor);
3496 queue_delayed_work(bond->wq, &bond->alb_work, 0); 3514 queue_delayed_work(bond->wq, &bond->alb_work, 0);
3497 } 3515 }
3498 3516
3499 if (bond->params.miimon) { /* link check interval, in milliseconds. */ 3517 if (bond->params.miimon) /* link check interval, in milliseconds. */
3500 INIT_DELAYED_WORK(&bond->mii_work, bond_mii_monitor);
3501 queue_delayed_work(bond->wq, &bond->mii_work, 0); 3518 queue_delayed_work(bond->wq, &bond->mii_work, 0);
3502 }
3503 3519
3504 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */ 3520 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */
3505 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP)
3506 INIT_DELAYED_WORK(&bond->arp_work,
3507 bond_activebackup_arp_mon);
3508 else
3509 INIT_DELAYED_WORK(&bond->arp_work,
3510 bond_loadbalance_arp_mon);
3511
3512 queue_delayed_work(bond->wq, &bond->arp_work, 0); 3521 queue_delayed_work(bond->wq, &bond->arp_work, 0);
3513 if (bond->params.arp_validate) 3522 if (bond->params.arp_validate)
3514 bond->recv_probe = bond_arp_rcv; 3523 bond->recv_probe = bond_arp_rcv;
3515 } 3524 }
3516 3525
3517 if (bond->params.mode == BOND_MODE_8023AD) { 3526 if (bond->params.mode == BOND_MODE_8023AD) {
3518 INIT_DELAYED_WORK(&bond->ad_work, bond_3ad_state_machine_handler);
3519 queue_delayed_work(bond->wq, &bond->ad_work, 0); 3527 queue_delayed_work(bond->wq, &bond->ad_work, 0);
3520 /* register to receive LACPDUs */ 3528 /* register to receive LACPDUs */
3521 bond->recv_probe = bond_3ad_lacpdu_recv; 3529 bond->recv_probe = bond_3ad_lacpdu_recv;
@@ -3530,34 +3538,10 @@ static int bond_close(struct net_device *bond_dev)
3530 struct bonding *bond = netdev_priv(bond_dev); 3538 struct bonding *bond = netdev_priv(bond_dev);
3531 3539
3532 write_lock_bh(&bond->lock); 3540 write_lock_bh(&bond->lock);
3533
3534 bond->send_peer_notif = 0; 3541 bond->send_peer_notif = 0;
3535
3536 write_unlock_bh(&bond->lock); 3542 write_unlock_bh(&bond->lock);
3537 3543
3538 if (bond->params.miimon) { /* link check interval, in milliseconds. */ 3544 bond_work_cancel_all(bond);
3539 cancel_delayed_work_sync(&bond->mii_work);
3540 }
3541
3542 if (bond->params.arp_interval) { /* arp interval, in milliseconds. */
3543 cancel_delayed_work_sync(&bond->arp_work);
3544 }
3545
3546 switch (bond->params.mode) {
3547 case BOND_MODE_8023AD:
3548 cancel_delayed_work_sync(&bond->ad_work);
3549 break;
3550 case BOND_MODE_TLB:
3551 case BOND_MODE_ALB:
3552 cancel_delayed_work_sync(&bond->alb_work);
3553 break;
3554 default:
3555 break;
3556 }
3557
3558 if (delayed_work_pending(&bond->mcast_work))
3559 cancel_delayed_work_sync(&bond->mcast_work);
3560
3561 if (bond_is_lb(bond)) { 3545 if (bond_is_lb(bond)) {
3562 /* Must be called only after all 3546 /* Must be called only after all
3563 * slaves have been released 3547 * slaves have been released
@@ -4436,26 +4420,6 @@ static void bond_setup(struct net_device *bond_dev)
4436 bond_dev->features |= bond_dev->hw_features; 4420 bond_dev->features |= bond_dev->hw_features;
4437} 4421}
4438 4422
4439static void bond_work_cancel_all(struct bonding *bond)
4440{
4441 if (bond->params.miimon && delayed_work_pending(&bond->mii_work))
4442 cancel_delayed_work_sync(&bond->mii_work);
4443
4444 if (bond->params.arp_interval && delayed_work_pending(&bond->arp_work))
4445 cancel_delayed_work_sync(&bond->arp_work);
4446
4447 if (bond->params.mode == BOND_MODE_ALB &&
4448 delayed_work_pending(&bond->alb_work))
4449 cancel_delayed_work_sync(&bond->alb_work);
4450
4451 if (bond->params.mode == BOND_MODE_8023AD &&
4452 delayed_work_pending(&bond->ad_work))
4453 cancel_delayed_work_sync(&bond->ad_work);
4454
4455 if (delayed_work_pending(&bond->mcast_work))
4456 cancel_delayed_work_sync(&bond->mcast_work);
4457}
4458
4459/* 4423/*
4460* Destroy a bonding device. 4424* Destroy a bonding device.
4461* Must be under rtnl_lock when this function is called. 4425* Must be under rtnl_lock when this function is called.
@@ -4706,12 +4670,13 @@ static int bond_check_params(struct bond_params *params)
4706 arp_ip_count++) { 4670 arp_ip_count++) {
4707 /* not complete check, but should be good enough to 4671 /* not complete check, but should be good enough to
4708 catch mistakes */ 4672 catch mistakes */
4709 if (!isdigit(arp_ip_target[arp_ip_count][0])) { 4673 __be32 ip = in_aton(arp_ip_target[arp_ip_count]);
4674 if (!isdigit(arp_ip_target[arp_ip_count][0]) ||
4675 ip == 0 || ip == htonl(INADDR_BROADCAST)) {
4710 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", 4676 pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4711 arp_ip_target[arp_ip_count]); 4677 arp_ip_target[arp_ip_count]);
4712 arp_interval = 0; 4678 arp_interval = 0;
4713 } else { 4679 } else {
4714 __be32 ip = in_aton(arp_ip_target[arp_ip_count]);
4715 arp_target[arp_ip_count] = ip; 4680 arp_target[arp_ip_count] = ip;
4716 } 4681 }
4717 } 4682 }
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ef8d2a080d17..1877ed7ca086 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -513,6 +513,8 @@ static ssize_t bonding_store_arp_interval(struct device *d,
513 int new_value, ret = count; 513 int new_value, ret = count;
514 struct bonding *bond = to_bond(d); 514 struct bonding *bond = to_bond(d);
515 515
516 if (!rtnl_trylock())
517 return restart_syscall();
516 if (sscanf(buf, "%d", &new_value) != 1) { 518 if (sscanf(buf, "%d", &new_value) != 1) {
517 pr_err("%s: no arp_interval value specified.\n", 519 pr_err("%s: no arp_interval value specified.\n",
518 bond->dev->name); 520 bond->dev->name);
@@ -539,10 +541,6 @@ static ssize_t bonding_store_arp_interval(struct device *d,
539 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", 541 pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n",
540 bond->dev->name, bond->dev->name); 542 bond->dev->name, bond->dev->name);
541 bond->params.miimon = 0; 543 bond->params.miimon = 0;
542 if (delayed_work_pending(&bond->mii_work)) {
543 cancel_delayed_work(&bond->mii_work);
544 flush_workqueue(bond->wq);
545 }
546 } 544 }
547 if (!bond->params.arp_targets[0]) { 545 if (!bond->params.arp_targets[0]) {
548 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", 546 pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n",
@@ -554,19 +552,12 @@ static ssize_t bonding_store_arp_interval(struct device *d,
554 * timer will get fired off when the open function 552 * timer will get fired off when the open function
555 * is called. 553 * is called.
556 */ 554 */
557 if (!delayed_work_pending(&bond->arp_work)) { 555 cancel_delayed_work_sync(&bond->mii_work);
558 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) 556 queue_delayed_work(bond->wq, &bond->arp_work, 0);
559 INIT_DELAYED_WORK(&bond->arp_work,
560 bond_activebackup_arp_mon);
561 else
562 INIT_DELAYED_WORK(&bond->arp_work,
563 bond_loadbalance_arp_mon);
564
565 queue_delayed_work(bond->wq, &bond->arp_work, 0);
566 }
567 } 557 }
568 558
569out: 559out:
560 rtnl_unlock();
570 return ret; 561 return ret;
571} 562}
572static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR, 563static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR,
@@ -962,6 +953,8 @@ static ssize_t bonding_store_miimon(struct device *d,
962 int new_value, ret = count; 953 int new_value, ret = count;
963 struct bonding *bond = to_bond(d); 954 struct bonding *bond = to_bond(d);
964 955
956 if (!rtnl_trylock())
957 return restart_syscall();
965 if (sscanf(buf, "%d", &new_value) != 1) { 958 if (sscanf(buf, "%d", &new_value) != 1) {
966 pr_err("%s: no miimon value specified.\n", 959 pr_err("%s: no miimon value specified.\n",
967 bond->dev->name); 960 bond->dev->name);
@@ -993,10 +986,6 @@ static ssize_t bonding_store_miimon(struct device *d,
993 bond->params.arp_validate = 986 bond->params.arp_validate =
994 BOND_ARP_VALIDATE_NONE; 987 BOND_ARP_VALIDATE_NONE;
995 } 988 }
996 if (delayed_work_pending(&bond->arp_work)) {
997 cancel_delayed_work(&bond->arp_work);
998 flush_workqueue(bond->wq);
999 }
1000 } 989 }
1001 990
1002 if (bond->dev->flags & IFF_UP) { 991 if (bond->dev->flags & IFF_UP) {
@@ -1005,15 +994,12 @@ static ssize_t bonding_store_miimon(struct device *d,
1005 * timer will get fired off when the open function 994 * timer will get fired off when the open function
1006 * is called. 995 * is called.
1007 */ 996 */
1008 if (!delayed_work_pending(&bond->mii_work)) { 997 cancel_delayed_work_sync(&bond->arp_work);
1009 INIT_DELAYED_WORK(&bond->mii_work, 998 queue_delayed_work(bond->wq, &bond->mii_work, 0);
1010 bond_mii_monitor);
1011 queue_delayed_work(bond->wq,
1012 &bond->mii_work, 0);
1013 }
1014 } 999 }
1015 } 1000 }
1016out: 1001out:
1002 rtnl_unlock();
1017 return ret; 1003 return ret;
1018} 1004}
1019static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR, 1005static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR,
@@ -1582,6 +1568,7 @@ static ssize_t bonding_store_slaves_active(struct device *d,
1582 goto out; 1568 goto out;
1583 } 1569 }
1584 1570
1571 read_lock(&bond->lock);
1585 bond_for_each_slave(bond, slave, i) { 1572 bond_for_each_slave(bond, slave, i) {
1586 if (!bond_is_active_slave(slave)) { 1573 if (!bond_is_active_slave(slave)) {
1587 if (new_value) 1574 if (new_value)
@@ -1590,6 +1577,7 @@ static ssize_t bonding_store_slaves_active(struct device *d,
1590 slave->inactive = 1; 1577 slave->inactive = 1;
1591 } 1578 }
1592 } 1579 }
1580 read_unlock(&bond->lock);
1593out: 1581out:
1594 return ret; 1582 return ret;
1595} 1583}
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 86f26a1ede4c..25723d8ee201 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -519,8 +519,10 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
519 mc->pdev->dev.can.state = new_state; 519 mc->pdev->dev.can.state = new_state;
520 520
521 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) { 521 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {
522 struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
523
522 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv); 524 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
523 skb->tstamp = timeval_to_ktime(tv); 525 hwts->hwtstamp = timeval_to_ktime(tv);
524 } 526 }
525 527
526 netif_rx(skb); 528 netif_rx(skb);
@@ -605,6 +607,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
605 struct sk_buff *skb; 607 struct sk_buff *skb;
606 struct can_frame *cf; 608 struct can_frame *cf;
607 struct timeval tv; 609 struct timeval tv;
610 struct skb_shared_hwtstamps *hwts;
608 611
609 skb = alloc_can_skb(mc->netdev, &cf); 612 skb = alloc_can_skb(mc->netdev, &cf);
610 if (!skb) 613 if (!skb)
@@ -652,7 +655,8 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
652 655
653 /* convert timestamp into kernel time */ 656 /* convert timestamp into kernel time */
654 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv); 657 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
655 skb->tstamp = timeval_to_ktime(tv); 658 hwts = skb_hwtstamps(skb);
659 hwts->hwtstamp = timeval_to_ktime(tv);
656 660
657 /* push the skb */ 661 /* push the skb */
658 netif_rx(skb); 662 netif_rx(skb);
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index e1626d92511a..30d79bfa5b10 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -532,6 +532,7 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
532 struct can_frame *can_frame; 532 struct can_frame *can_frame;
533 struct sk_buff *skb; 533 struct sk_buff *skb;
534 struct timeval tv; 534 struct timeval tv;
535 struct skb_shared_hwtstamps *hwts;
535 536
536 skb = alloc_can_skb(netdev, &can_frame); 537 skb = alloc_can_skb(netdev, &can_frame);
537 if (!skb) 538 if (!skb)
@@ -549,7 +550,8 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
549 memcpy(can_frame->data, rx->data, can_frame->can_dlc); 550 memcpy(can_frame->data, rx->data, can_frame->can_dlc);
550 551
551 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(rx->ts32), &tv); 552 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(rx->ts32), &tv);
552 skb->tstamp = timeval_to_ktime(tv); 553 hwts = skb_hwtstamps(skb);
554 hwts->hwtstamp = timeval_to_ktime(tv);
553 555
554 netif_rx(skb); 556 netif_rx(skb);
555 netdev->stats.rx_packets++; 557 netdev->stats.rx_packets++;
@@ -570,6 +572,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
570 u8 err_mask = 0; 572 u8 err_mask = 0;
571 struct sk_buff *skb; 573 struct sk_buff *skb;
572 struct timeval tv; 574 struct timeval tv;
575 struct skb_shared_hwtstamps *hwts;
573 576
574 /* nothing should be sent while in BUS_OFF state */ 577 /* nothing should be sent while in BUS_OFF state */
575 if (dev->can.state == CAN_STATE_BUS_OFF) 578 if (dev->can.state == CAN_STATE_BUS_OFF)
@@ -664,7 +667,8 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
664 dev->can.state = new_state; 667 dev->can.state = new_state;
665 668
666 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv); 669 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv);
667 skb->tstamp = timeval_to_ktime(tv); 670 hwts = skb_hwtstamps(skb);
671 hwts->hwtstamp = timeval_to_ktime(tv);
668 netif_rx(skb); 672 netif_rx(skb);
669 netdev->stats.rx_packets++; 673 netdev->stats.rx_packets++;
670 netdev->stats.rx_bytes += can_frame->can_dlc; 674 netdev->stats.rx_bytes += can_frame->can_dlc;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 5d36795877cb..b799ab12a291 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -237,7 +237,7 @@ static int mlx4_en_dcbnl_ieee_setmaxrate(struct net_device *dev,
237 if (err) 237 if (err)
238 return err; 238 return err;
239 239
240 memcpy(priv->maxrate, tmp, sizeof(*priv->maxrate)); 240 memcpy(priv->maxrate, tmp, sizeof(priv->maxrate));
241 241
242 return 0; 242 return 0;
243} 243}
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index b01f83a044c4..609125a249d9 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -1060,17 +1060,22 @@ static int cp_init_rings (struct cp_private *cp)
1060 1060
1061static int cp_alloc_rings (struct cp_private *cp) 1061static int cp_alloc_rings (struct cp_private *cp)
1062{ 1062{
1063 struct device *d = &cp->pdev->dev;
1063 void *mem; 1064 void *mem;
1065 int rc;
1064 1066
1065 mem = dma_alloc_coherent(&cp->pdev->dev, CP_RING_BYTES, 1067 mem = dma_alloc_coherent(d, CP_RING_BYTES, &cp->ring_dma, GFP_KERNEL);
1066 &cp->ring_dma, GFP_KERNEL);
1067 if (!mem) 1068 if (!mem)
1068 return -ENOMEM; 1069 return -ENOMEM;
1069 1070
1070 cp->rx_ring = mem; 1071 cp->rx_ring = mem;
1071 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE]; 1072 cp->tx_ring = &cp->rx_ring[CP_RX_RING_SIZE];
1072 1073
1073 return cp_init_rings(cp); 1074 rc = cp_init_rings(cp);
1075 if (rc < 0)
1076 dma_free_coherent(d, CP_RING_BYTES, cp->rx_ring, cp->ring_dma);
1077
1078 return rc;
1074} 1079}
1075 1080
1076static void cp_clean_rings (struct cp_private *cp) 1081static void cp_clean_rings (struct cp_private *cp)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index d44cca327588..ad86660fb8f9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1794,10 +1794,12 @@ static void team_setup(struct net_device *dev)
1794 1794
1795 dev->features |= NETIF_F_LLTX; 1795 dev->features |= NETIF_F_LLTX;
1796 dev->features |= NETIF_F_GRO; 1796 dev->features |= NETIF_F_GRO;
1797 dev->hw_features = NETIF_F_HW_VLAN_TX | 1797 dev->hw_features = TEAM_VLAN_FEATURES |
1798 NETIF_F_HW_VLAN_TX |
1798 NETIF_F_HW_VLAN_RX | 1799 NETIF_F_HW_VLAN_RX |
1799 NETIF_F_HW_VLAN_FILTER; 1800 NETIF_F_HW_VLAN_FILTER;
1800 1801
1802 dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
1801 dev->features |= dev->hw_features; 1803 dev->features |= dev->hw_features;
1802} 1804}
1803 1805
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 3b566fa0f8e6..1ea91f4237f0 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -385,6 +385,7 @@ static const struct usb_device_id products[] = {
385 }, 385 },
386 386
387 /* 3. Combined interface devices matching on interface number */ 387 /* 3. Combined interface devices matching on interface number */
388 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
388 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, 389 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
389 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, 390 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
390 {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, 391 {QMI_FIXED_INTF(0x19d2, 0x0017, 3)},
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index e9a3da588e95..760776b3d66c 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -1365,7 +1365,7 @@ static int __devinit hss_init_one(struct platform_device *pdev)
1365 1365
1366 platform_set_drvdata(pdev, port); 1366 platform_set_drvdata(pdev, port);
1367 1367
1368 netdev_info(dev, "HSS-%i\n", port->id); 1368 netdev_info(dev, "initialized\n");
1369 return 0; 1369 return 0;
1370 1370
1371err_free_netdev: 1371err_free_netdev:
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 10896393e5a0..2830ea290502 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -1012,12 +1012,12 @@ static void iwl_calc_basic_rates(struct iwl_priv *priv,
1012 * As a consequence, it's not as complicated as it sounds, just add 1012 * As a consequence, it's not as complicated as it sounds, just add
1013 * any lower rates to the ACK rate bitmap. 1013 * any lower rates to the ACK rate bitmap.
1014 */ 1014 */
1015 if (IWL_RATE_11M_INDEX < lowest_present_ofdm) 1015 if (IWL_RATE_11M_INDEX < lowest_present_cck)
1016 ofdm |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE; 1016 cck |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE;
1017 if (IWL_RATE_5M_INDEX < lowest_present_ofdm) 1017 if (IWL_RATE_5M_INDEX < lowest_present_cck)
1018 ofdm |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE; 1018 cck |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE;
1019 if (IWL_RATE_2M_INDEX < lowest_present_ofdm) 1019 if (IWL_RATE_2M_INDEX < lowest_present_cck)
1020 ofdm |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE; 1020 cck |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE;
1021 /* 1M already there or needed so always add */ 1021 /* 1M already there or needed so always add */
1022 cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE; 1022 cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE;
1023 1023
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index e7a4780e93db..9e198e590675 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -120,15 +120,11 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
120 return vq; 120 return vq;
121} 121}
122 122
123static void rproc_virtio_del_vqs(struct virtio_device *vdev) 123static void __rproc_virtio_del_vqs(struct virtio_device *vdev)
124{ 124{
125 struct virtqueue *vq, *n; 125 struct virtqueue *vq, *n;
126 struct rproc *rproc = vdev_to_rproc(vdev);
127 struct rproc_vring *rvring; 126 struct rproc_vring *rvring;
128 127
129 /* power down the remote processor before deleting vqs */
130 rproc_shutdown(rproc);
131
132 list_for_each_entry_safe(vq, n, &vdev->vqs, list) { 128 list_for_each_entry_safe(vq, n, &vdev->vqs, list) {
133 rvring = vq->priv; 129 rvring = vq->priv;
134 rvring->vq = NULL; 130 rvring->vq = NULL;
@@ -137,6 +133,16 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev)
137 } 133 }
138} 134}
139 135
136static void rproc_virtio_del_vqs(struct virtio_device *vdev)
137{
138 struct rproc *rproc = vdev_to_rproc(vdev);
139
140 /* power down the remote processor before deleting vqs */
141 rproc_shutdown(rproc);
142
143 __rproc_virtio_del_vqs(vdev);
144}
145
140static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, 146static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
141 struct virtqueue *vqs[], 147 struct virtqueue *vqs[],
142 vq_callback_t *callbacks[], 148 vq_callback_t *callbacks[],
@@ -163,7 +169,7 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
163 return 0; 169 return 0;
164 170
165error: 171error:
166 rproc_virtio_del_vqs(vdev); 172 __rproc_virtio_del_vqs(vdev);
167 return ret; 173 return ret;
168} 174}
169 175
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 7a82337e4dee..073108dcf9e7 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -288,11 +288,11 @@ static int __devinit tps65910_rtc_probe(struct platform_device *pdev)
288static int __devexit tps65910_rtc_remove(struct platform_device *pdev) 288static int __devexit tps65910_rtc_remove(struct platform_device *pdev)
289{ 289{
290 /* leave rtc running, but disable irqs */ 290 /* leave rtc running, but disable irqs */
291 struct rtc_device *rtc = platform_get_drvdata(pdev); 291 struct tps65910_rtc *tps_rtc = platform_get_drvdata(pdev);
292 292
293 tps65910_rtc_alarm_irq_enable(&rtc->dev, 0); 293 tps65910_rtc_alarm_irq_enable(&pdev->dev, 0);
294 294
295 rtc_device_unregister(rtc); 295 rtc_device_unregister(tps_rtc->rtc);
296 return 0; 296 return 0;
297} 297}
298 298
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 9097155e9ebe..dcecbfb17243 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1819,8 +1819,10 @@ void target_execute_cmd(struct se_cmd *cmd)
1819 /* 1819 /*
1820 * If the received CDB has aleady been aborted stop processing it here. 1820 * If the received CDB has aleady been aborted stop processing it here.
1821 */ 1821 */
1822 if (transport_check_aborted_status(cmd, 1)) 1822 if (transport_check_aborted_status(cmd, 1)) {
1823 complete(&cmd->t_transport_stop_comp);
1823 return; 1824 return;
1825 }
1824 1826
1825 /* 1827 /*
1826 * Determine if IOCTL context caller in requesting the stopping of this 1828 * Determine if IOCTL context caller in requesting the stopping of this
@@ -3067,7 +3069,7 @@ void transport_send_task_abort(struct se_cmd *cmd)
3067 unsigned long flags; 3069 unsigned long flags;
3068 3070
3069 spin_lock_irqsave(&cmd->t_state_lock, flags); 3071 spin_lock_irqsave(&cmd->t_state_lock, flags);
3070 if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { 3072 if (cmd->se_cmd_flags & (SCF_SENT_CHECK_CONDITION | SCF_SENT_DELAYED_TAS)) {
3071 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 3073 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
3072 return; 3074 return;
3073 } 3075 }
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index f87d7e8964bf..4e0d0c3734b3 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -539,25 +539,25 @@ static void insert_char(struct vc_data *vc, unsigned int nr)
539{ 539{
540 unsigned short *p = (unsigned short *) vc->vc_pos; 540 unsigned short *p = (unsigned short *) vc->vc_pos;
541 541
542 scr_memmovew(p + nr, p, vc->vc_cols - vc->vc_x); 542 scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x) * 2);
543 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); 543 scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
544 vc->vc_need_wrap = 0; 544 vc->vc_need_wrap = 0;
545 if (DO_UPDATE(vc)) 545 if (DO_UPDATE(vc))
546 do_update_region(vc, (unsigned long) p, 546 do_update_region(vc, (unsigned long) p,
547 (vc->vc_cols - vc->vc_x) / 2 + 1); 547 vc->vc_cols - vc->vc_x);
548} 548}
549 549
550static void delete_char(struct vc_data *vc, unsigned int nr) 550static void delete_char(struct vc_data *vc, unsigned int nr)
551{ 551{
552 unsigned short *p = (unsigned short *) vc->vc_pos; 552 unsigned short *p = (unsigned short *) vc->vc_pos;
553 553
554 scr_memcpyw(p, p + nr, vc->vc_cols - vc->vc_x - nr); 554 scr_memcpyw(p, p + nr, (vc->vc_cols - vc->vc_x - nr) * 2);
555 scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, 555 scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char,
556 nr * 2); 556 nr * 2);
557 vc->vc_need_wrap = 0; 557 vc->vc_need_wrap = 0;
558 if (DO_UPDATE(vc)) 558 if (DO_UPDATE(vc))
559 do_update_region(vc, (unsigned long) p, 559 do_update_region(vc, (unsigned long) p,
560 (vc->vc_cols - vc->vc_x) / 2); 560 vc->vc_cols - vc->vc_x);
561} 561}
562 562
563static int softcursor_original; 563static int softcursor_original;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 99ac2cb08b43..dedaf81d8f36 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1076,7 +1076,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
1076 } 1076 }
1077 _iov = iov + ret; 1077 _iov = iov + ret;
1078 size = reg->memory_size - addr + reg->guest_phys_addr; 1078 size = reg->memory_size - addr + reg->guest_phys_addr;
1079 _iov->iov_len = min((u64)len, size); 1079 _iov->iov_len = min((u64)len - s, size);
1080 _iov->iov_base = (void __user *)(unsigned long) 1080 _iov->iov_base = (void __user *)(unsigned long)
1081 (reg->userspace_addr + addr - reg->guest_phys_addr); 1081 (reg->userspace_addr + addr - reg->guest_phys_addr);
1082 s += size; 1082 s += size;