aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atm/solos-pci.c2
-rw-r--r--drivers/clk/mvebu/clk-gating-ctrl.c2
-rw-r--r--drivers/dma/mv_xor.c9
-rw-r--r--drivers/gpu/drm/drm_mm.c41
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h8
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c77
-rw-r--r--drivers/gpu/drm/i915/i915_gem_dmabuf.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c12
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c23
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c160
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c76
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h17
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h147
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc13
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h157
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c11
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h8
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/gpio.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c128
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c65
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/device/nve0.c28
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/base.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mxm/base.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c30
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c29
-rw-r--r--drivers/gpu/drm/radeon/radeon.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c49
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c15
-rw-r--r--drivers/gpu/drm/tegra/dc.c11
-rw-r--r--drivers/gpu/drm/tegra/drm.h18
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c25
-rw-r--r--drivers/gpu/drm/tegra/host1x.c2
-rw-r--r--drivers/hwmon/emc6w201.c2
-rw-r--r--drivers/hwmon/lm73.c16
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c8
-rw-r--r--drivers/i2c/busses/i2c-ali1563.c10
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c8
-rw-r--r--drivers/i2c/busses/i2c-amd756.c7
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c7
-rw-r--r--drivers/i2c/busses/i2c-at91.c14
-rw-r--r--drivers/i2c/busses/i2c-au1550.c6
-rw-r--r--drivers/i2c/busses/i2c-cpm.c8
-rw-r--r--drivers/i2c/busses/i2c-designware-pcidrv.c6
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c6
-rw-r--r--drivers/i2c/busses/i2c-eg20t.c6
-rw-r--r--drivers/i2c/busses/i2c-elektor.c8
-rw-r--r--drivers/i2c/busses/i2c-gpio.c8
-rw-r--r--drivers/i2c/busses/i2c-highlander.c6
-rw-r--r--drivers/i2c/busses/i2c-hydra.c6
-rw-r--r--drivers/i2c/busses/i2c-i801.c28
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c8
-rw-r--r--drivers/i2c/busses/i2c-intel-mid.c6
-rw-r--r--drivers/i2c/busses/i2c-isch.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c38
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c18
-rw-r--r--drivers/i2c/busses/i2c-mxs.c6
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c12
-rw-r--r--drivers/i2c/busses/i2c-nuc900.c6
-rw-r--r--drivers/i2c/busses/i2c-ocores.c6
-rw-r--r--drivers/i2c/busses/i2c-octeon.c10
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c6
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c6
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c8
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c6
-rw-r--r--drivers/i2c/busses/i2c-piix4.c32
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c6
-rw-r--r--drivers/i2c/busses/i2c-pnx.c6
-rw-r--r--drivers/i2c/busses/i2c-powermac.c16
-rw-r--r--drivers/i2c/busses/i2c-puv3.c6
-rw-r--r--drivers/i2c/busses/i2c-pxa-pci.c6
-rw-r--r--drivers/i2c/busses/i2c-rcar.c6
-rw-r--r--drivers/i2c/busses/i2c-s6000.c8
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c8
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c2
-rw-r--r--drivers/i2c/busses/i2c-sirf.c8
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c4
-rw-r--r--drivers/i2c/busses/i2c-sis630.c8
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c6
-rw-r--r--drivers/i2c/busses/i2c-tegra.c8
-rw-r--r--drivers/i2c/busses/i2c-via.c6
-rw-r--r--drivers/i2c/busses/i2c-viapro.c4
-rw-r--r--drivers/i2c/busses/i2c-viperboard.c6
-rw-r--r--drivers/i2c/busses/i2c-xiic.c8
-rw-r--r--drivers/i2c/busses/i2c-xlr.c6
-rw-r--r--drivers/i2c/busses/scx200_acb.c16
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c14
-rw-r--r--drivers/i2c/muxes/i2c-mux-pinctrl.c8
-rw-r--r--drivers/leds/leds-gpio.c5
-rw-r--r--drivers/media/platform/omap3isp/isp.c2
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c19
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c12
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
-rw-r--r--drivers/net/ethernet/ti/cpts.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h1
-rw-r--r--drivers/net/tun.c24
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c2
-rw-r--r--drivers/pci/pci-sysfs.c85
-rw-r--r--drivers/pci/pcie/portdrv_pci.c20
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-dove.c7
-rw-r--r--drivers/power/avs/smartreflex.c2
-rw-r--r--drivers/power/reset/gpio-poweroff.c33
-rw-r--r--drivers/watchdog/da9055_wdt.c17
-rw-r--r--drivers/watchdog/omap_wdt.c1
-rw-r--r--drivers/watchdog/twl4030_wdt.c11
123 files changed, 1240 insertions, 803 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d70abe77f737..d47db401027f 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr
538 } else { 538 } else {
539 count = -EINVAL; 539 count = -EINVAL;
540 } 540 }
541 spin_lock_irq(&card->param_queue_lock); 541 spin_unlock_irq(&card->param_queue_lock);
542 return count; 542 return count;
543} 543}
544 544
diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c
index c6d3c263b070..8fa5408b6c7d 100644
--- a/drivers/clk/mvebu/clk-gating-ctrl.c
+++ b/drivers/clk/mvebu/clk-gating-ctrl.c
@@ -32,7 +32,7 @@ struct mvebu_soc_descr {
32 32
33#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) 33#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
34 34
35static struct clk __init *mvebu_clk_gating_get_src( 35static struct clk *mvebu_clk_gating_get_src(
36 struct of_phandle_args *clkspec, void *data) 36 struct of_phandle_args *clkspec, void *data)
37{ 37{
38 struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; 38 struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index ac71f555dd72..e17fad03cb80 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev)
1361err_channel_add: 1361err_channel_add:
1362 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) 1362 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
1363 if (xordev->channels[i]) { 1363 if (xordev->channels[i]) {
1364 mv_xor_channel_remove(xordev->channels[i]);
1364 if (pdev->dev.of_node) 1365 if (pdev->dev.of_node)
1365 irq_dispose_mapping(xordev->channels[i]->irq); 1366 irq_dispose_mapping(xordev->channels[i]->irq);
1366 mv_xor_channel_remove(xordev->channels[i]);
1367 } 1367 }
1368 1368
1369 clk_disable_unprepare(xordev->clk); 1369 if (!IS_ERR(xordev->clk)) {
1370 clk_put(xordev->clk); 1370 clk_disable_unprepare(xordev->clk);
1371 clk_put(xordev->clk);
1372 }
1373
1371 return ret; 1374 return ret;
1372} 1375}
1373 1376
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 0761a03cdbb2..2bf9670ba29b 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -184,19 +184,27 @@ EXPORT_SYMBOL(drm_mm_get_block_generic);
184 * -ENOSPC if no suitable free area is available. The preallocated memory node 184 * -ENOSPC if no suitable free area is available. The preallocated memory node
185 * must be cleared. 185 * must be cleared.
186 */ 186 */
187int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 187int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
188 unsigned long size, unsigned alignment) 188 unsigned long size, unsigned alignment,
189 unsigned long color)
189{ 190{
190 struct drm_mm_node *hole_node; 191 struct drm_mm_node *hole_node;
191 192
192 hole_node = drm_mm_search_free(mm, size, alignment, false); 193 hole_node = drm_mm_search_free_generic(mm, size, alignment,
194 color, 0);
193 if (!hole_node) 195 if (!hole_node)
194 return -ENOSPC; 196 return -ENOSPC;
195 197
196 drm_mm_insert_helper(hole_node, node, size, alignment, 0); 198 drm_mm_insert_helper(hole_node, node, size, alignment, color);
197
198 return 0; 199 return 0;
199} 200}
201EXPORT_SYMBOL(drm_mm_insert_node_generic);
202
203int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node,
204 unsigned long size, unsigned alignment)
205{
206 return drm_mm_insert_node_generic(mm, node, size, alignment, 0);
207}
200EXPORT_SYMBOL(drm_mm_insert_node); 208EXPORT_SYMBOL(drm_mm_insert_node);
201 209
202static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, 210static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
@@ -275,22 +283,31 @@ EXPORT_SYMBOL(drm_mm_get_block_range_generic);
275 * -ENOSPC if no suitable free area is available. This is for range 283 * -ENOSPC if no suitable free area is available. This is for range
276 * restricted allocations. The preallocated memory node must be cleared. 284 * restricted allocations. The preallocated memory node must be cleared.
277 */ 285 */
278int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, 286int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node,
279 unsigned long size, unsigned alignment, 287 unsigned long size, unsigned alignment, unsigned long color,
280 unsigned long start, unsigned long end) 288 unsigned long start, unsigned long end)
281{ 289{
282 struct drm_mm_node *hole_node; 290 struct drm_mm_node *hole_node;
283 291
284 hole_node = drm_mm_search_free_in_range(mm, size, alignment, 292 hole_node = drm_mm_search_free_in_range_generic(mm,
285 start, end, false); 293 size, alignment, color,
294 start, end, 0);
286 if (!hole_node) 295 if (!hole_node)
287 return -ENOSPC; 296 return -ENOSPC;
288 297
289 drm_mm_insert_helper_range(hole_node, node, size, alignment, 0, 298 drm_mm_insert_helper_range(hole_node, node,
299 size, alignment, color,
290 start, end); 300 start, end);
291
292 return 0; 301 return 0;
293} 302}
303EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic);
304
305int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node,
306 unsigned long size, unsigned alignment,
307 unsigned long start, unsigned long end)
308{
309 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 0, start, end);
310}
294EXPORT_SYMBOL(drm_mm_insert_node_in_range); 311EXPORT_SYMBOL(drm_mm_insert_node_in_range);
295 312
296/** 313/**
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8f63cd5de4b4..99daa896105d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -989,6 +989,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
989 case I915_PARAM_HAS_SECURE_BATCHES: 989 case I915_PARAM_HAS_SECURE_BATCHES:
990 value = capable(CAP_SYS_ADMIN); 990 value = capable(CAP_SYS_ADMIN);
991 break; 991 break;
992 case I915_PARAM_HAS_PINNED_BATCHES:
993 value = 1;
994 break;
992 default: 995 default:
993 DRM_DEBUG_DRIVER("Unknown parameter %d\n", 996 DRM_DEBUG_DRIVER("Unknown parameter %d\n",
994 param->param); 997 param->param);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 557843dd4b2e..ed3059575576 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -780,6 +780,7 @@ typedef struct drm_i915_private {
780 struct i915_hw_ppgtt *aliasing_ppgtt; 780 struct i915_hw_ppgtt *aliasing_ppgtt;
781 781
782 struct shrinker inactive_shrinker; 782 struct shrinker inactive_shrinker;
783 bool shrinker_no_lock_stealing;
783 784
784 /** 785 /**
785 * List of objects currently involved in rendering. 786 * List of objects currently involved in rendering.
@@ -1100,6 +1101,7 @@ struct drm_i915_gem_object {
1100 */ 1101 */
1101 atomic_t pending_flip; 1102 atomic_t pending_flip;
1102}; 1103};
1104#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)
1103 1105
1104#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) 1106#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
1105 1107
@@ -1166,6 +1168,9 @@ struct drm_i915_file_private {
1166#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \ 1168#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \
1167 (dev)->pci_device == 0x0152 || \ 1169 (dev)->pci_device == 0x0152 || \
1168 (dev)->pci_device == 0x015a) 1170 (dev)->pci_device == 0x015a)
1171#define IS_SNB_GT1(dev) ((dev)->pci_device == 0x0102 || \
1172 (dev)->pci_device == 0x0106 || \
1173 (dev)->pci_device == 0x010A)
1169#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) 1174#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
1170#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell) 1175#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
1171#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) 1176#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
@@ -1196,6 +1201,9 @@ struct drm_i915_file_private {
1196#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) 1201#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
1197#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical) 1202#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical)
1198 1203
1204/* Early gen2 have a totally busted CS tlb and require pinned batches. */
1205#define HAS_BROKEN_CS_TLB(dev) (IS_I830(dev) || IS_845G(dev))
1206
1199/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1207/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1200 * rows, which changed the alignment requirements and fence programming. 1208 * rows, which changed the alignment requirements and fence programming.
1201 */ 1209 */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 742206e45103..da3c82e301b1 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1517,9 +1517,11 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1517 if (obj->base.map_list.map) 1517 if (obj->base.map_list.map)
1518 return 0; 1518 return 0;
1519 1519
1520 dev_priv->mm.shrinker_no_lock_stealing = true;
1521
1520 ret = drm_gem_create_mmap_offset(&obj->base); 1522 ret = drm_gem_create_mmap_offset(&obj->base);
1521 if (ret != -ENOSPC) 1523 if (ret != -ENOSPC)
1522 return ret; 1524 goto out;
1523 1525
1524 /* Badly fragmented mmap space? The only way we can recover 1526 /* Badly fragmented mmap space? The only way we can recover
1525 * space is by destroying unwanted objects. We can't randomly release 1527 * space is by destroying unwanted objects. We can't randomly release
@@ -1531,10 +1533,14 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1531 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT); 1533 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT);
1532 ret = drm_gem_create_mmap_offset(&obj->base); 1534 ret = drm_gem_create_mmap_offset(&obj->base);
1533 if (ret != -ENOSPC) 1535 if (ret != -ENOSPC)
1534 return ret; 1536 goto out;
1535 1537
1536 i915_gem_shrink_all(dev_priv); 1538 i915_gem_shrink_all(dev_priv);
1537 return drm_gem_create_mmap_offset(&obj->base); 1539 ret = drm_gem_create_mmap_offset(&obj->base);
1540out:
1541 dev_priv->mm.shrinker_no_lock_stealing = false;
1542
1543 return ret;
1538} 1544}
1539 1545
1540static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj) 1546static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj)
@@ -2890,7 +2896,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2890{ 2896{
2891 struct drm_device *dev = obj->base.dev; 2897 struct drm_device *dev = obj->base.dev;
2892 drm_i915_private_t *dev_priv = dev->dev_private; 2898 drm_i915_private_t *dev_priv = dev->dev_private;
2893 struct drm_mm_node *free_space; 2899 struct drm_mm_node *node;
2894 u32 size, fence_size, fence_alignment, unfenced_alignment; 2900 u32 size, fence_size, fence_alignment, unfenced_alignment;
2895 bool mappable, fenceable; 2901 bool mappable, fenceable;
2896 int ret; 2902 int ret;
@@ -2936,66 +2942,54 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2936 2942
2937 i915_gem_object_pin_pages(obj); 2943 i915_gem_object_pin_pages(obj);
2938 2944
2945 node = kzalloc(sizeof(*node), GFP_KERNEL);
2946 if (node == NULL) {
2947 i915_gem_object_unpin_pages(obj);
2948 return -ENOMEM;
2949 }
2950
2939 search_free: 2951 search_free:
2940 if (map_and_fenceable) 2952 if (map_and_fenceable)
2941 free_space = drm_mm_search_free_in_range_color(&dev_priv->mm.gtt_space, 2953 ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node,
2942 size, alignment, obj->cache_level, 2954 size, alignment, obj->cache_level,
2943 0, dev_priv->mm.gtt_mappable_end, 2955 0, dev_priv->mm.gtt_mappable_end);
2944 false);
2945 else 2956 else
2946 free_space = drm_mm_search_free_color(&dev_priv->mm.gtt_space, 2957 ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node,
2947 size, alignment, obj->cache_level, 2958 size, alignment, obj->cache_level);
2948 false); 2959 if (ret) {
2949
2950 if (free_space != NULL) {
2951 if (map_and_fenceable)
2952 free_space =
2953 drm_mm_get_block_range_generic(free_space,
2954 size, alignment, obj->cache_level,
2955 0, dev_priv->mm.gtt_mappable_end,
2956 false);
2957 else
2958 free_space =
2959 drm_mm_get_block_generic(free_space,
2960 size, alignment, obj->cache_level,
2961 false);
2962 }
2963 if (free_space == NULL) {
2964 ret = i915_gem_evict_something(dev, size, alignment, 2960 ret = i915_gem_evict_something(dev, size, alignment,
2965 obj->cache_level, 2961 obj->cache_level,
2966 map_and_fenceable, 2962 map_and_fenceable,
2967 nonblocking); 2963 nonblocking);
2968 if (ret) { 2964 if (ret == 0)
2969 i915_gem_object_unpin_pages(obj); 2965 goto search_free;
2970 return ret;
2971 }
2972 2966
2973 goto search_free; 2967 i915_gem_object_unpin_pages(obj);
2968 kfree(node);
2969 return ret;
2974 } 2970 }
2975 if (WARN_ON(!i915_gem_valid_gtt_space(dev, 2971 if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
2976 free_space,
2977 obj->cache_level))) {
2978 i915_gem_object_unpin_pages(obj); 2972 i915_gem_object_unpin_pages(obj);
2979 drm_mm_put_block(free_space); 2973 drm_mm_put_block(node);
2980 return -EINVAL; 2974 return -EINVAL;
2981 } 2975 }
2982 2976
2983 ret = i915_gem_gtt_prepare_object(obj); 2977 ret = i915_gem_gtt_prepare_object(obj);
2984 if (ret) { 2978 if (ret) {
2985 i915_gem_object_unpin_pages(obj); 2979 i915_gem_object_unpin_pages(obj);
2986 drm_mm_put_block(free_space); 2980 drm_mm_put_block(node);
2987 return ret; 2981 return ret;
2988 } 2982 }
2989 2983
2990 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list); 2984 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list);
2991 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list); 2985 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
2992 2986
2993 obj->gtt_space = free_space; 2987 obj->gtt_space = node;
2994 obj->gtt_offset = free_space->start; 2988 obj->gtt_offset = node->start;
2995 2989
2996 fenceable = 2990 fenceable =
2997 free_space->size == fence_size && 2991 node->size == fence_size &&
2998 (free_space->start & (fence_alignment - 1)) == 0; 2992 (node->start & (fence_alignment - 1)) == 0;
2999 2993
3000 mappable = 2994 mappable =
3001 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end; 2995 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end;
@@ -4392,6 +4386,9 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4392 if (!mutex_is_locked_by(&dev->struct_mutex, current)) 4386 if (!mutex_is_locked_by(&dev->struct_mutex, current))
4393 return 0; 4387 return 0;
4394 4388
4389 if (dev_priv->mm.shrinker_no_lock_stealing)
4390 return 0;
4391
4395 unlock = false; 4392 unlock = false;
4396 } 4393 }
4397 4394
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 773ef77b6c22..7be4241e8242 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -226,7 +226,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
226{ 226{
227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); 227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
228 228
229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, 0600); 229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, flags);
230} 230}
231 231
232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) 232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index ee8f97f0539e..d6a994a07393 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -808,6 +808,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
808 808
809 flags |= I915_DISPATCH_SECURE; 809 flags |= I915_DISPATCH_SECURE;
810 } 810 }
811 if (args->flags & I915_EXEC_IS_PINNED)
812 flags |= I915_DISPATCH_PINNED;
811 813
812 switch (args->flags & I915_EXEC_RING_MASK) { 814 switch (args->flags & I915_EXEC_RING_MASK) {
813 case I915_EXEC_DEFAULT: 815 case I915_EXEC_DEFAULT:
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a4dc97f8b9f0..2220dec3e5d9 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1087,6 +1087,18 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
1087 if (!ring->get_seqno) 1087 if (!ring->get_seqno)
1088 return NULL; 1088 return NULL;
1089 1089
1090 if (HAS_BROKEN_CS_TLB(dev_priv->dev)) {
1091 u32 acthd = I915_READ(ACTHD);
1092
1093 if (WARN_ON(ring->id != RCS))
1094 return NULL;
1095
1096 obj = ring->private;
1097 if (acthd >= obj->gtt_offset &&
1098 acthd < obj->gtt_offset + obj->base.size)
1099 return i915_error_object_create(dev_priv, obj);
1100 }
1101
1090 seqno = ring->get_seqno(ring, false); 1102 seqno = ring->get_seqno(ring, false);
1091 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) { 1103 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {
1092 if (obj->ring != ring) 1104 if (obj->ring != ring)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3f75cfaf1c3f..186ee5c85b51 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -517,6 +517,7 @@
517 * the enables for writing to the corresponding low bit. 517 * the enables for writing to the corresponding low bit.
518 */ 518 */
519#define _3D_CHICKEN 0x02084 519#define _3D_CHICKEN 0x02084
520#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
520#define _3D_CHICKEN2 0x0208c 521#define _3D_CHICKEN2 0x0208c
521/* Disables pipelining of read flushes past the SF-WIZ interface. 522/* Disables pipelining of read flushes past the SF-WIZ interface.
522 * Required on all Ironlake steppings according to the B-Spec, but the 523 * Required on all Ironlake steppings according to the B-Spec, but the
@@ -532,7 +533,8 @@
532# define MI_FLUSH_ENABLE (1 << 12) 533# define MI_FLUSH_ENABLE (1 << 12)
533 534
534#define GEN6_GT_MODE 0x20d0 535#define GEN6_GT_MODE 0x20d0
535#define GEN6_GT_MODE_HI (1 << 9) 536#define GEN6_GT_MODE_HI (1 << 9)
537#define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
536 538
537#define GFX_MODE 0x02520 539#define GFX_MODE 0x02520
538#define GFX_MODE_GEN7 0x0229c 540#define GFX_MODE_GEN7 0x0229c
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5d127e068950..a9fb046b94a1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8144,10 +8144,6 @@ intel_modeset_stage_output_state(struct drm_device *dev,
8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n"); 8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n");
8145 config->mode_changed = true; 8145 config->mode_changed = true;
8146 } 8146 }
8147
8148 /* Disable all disconnected encoders. */
8149 if (connector->base.status == connector_status_disconnected)
8150 connector->new_encoder = NULL;
8151 } 8147 }
8152 /* connector->new_encoder is now updated for all connectors. */ 8148 /* connector->new_encoder is now updated for all connectors. */
8153 8149
@@ -9167,6 +9163,23 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
9167 * the crtc fixup. */ 9163 * the crtc fixup. */
9168} 9164}
9169 9165
9166static void i915_redisable_vga(struct drm_device *dev)
9167{
9168 struct drm_i915_private *dev_priv = dev->dev_private;
9169 u32 vga_reg;
9170
9171 if (HAS_PCH_SPLIT(dev))
9172 vga_reg = CPU_VGACNTRL;
9173 else
9174 vga_reg = VGACNTRL;
9175
9176 if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
9177 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
9178 I915_WRITE(vga_reg, VGA_DISP_DISABLE);
9179 POSTING_READ(vga_reg);
9180 }
9181}
9182
9170/* Scan out the current hw modeset state, sanitizes it and maps it into the drm 9183/* Scan out the current hw modeset state, sanitizes it and maps it into the drm
9171 * and i915 state tracking structures. */ 9184 * and i915 state tracking structures. */
9172void intel_modeset_setup_hw_state(struct drm_device *dev, 9185void intel_modeset_setup_hw_state(struct drm_device *dev,
@@ -9275,6 +9288,8 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
9275 intel_set_mode(&crtc->base, &crtc->base.mode, 9288 intel_set_mode(&crtc->base, &crtc->base.mode,
9276 crtc->base.x, crtc->base.y, crtc->base.fb); 9289 crtc->base.x, crtc->base.y, crtc->base.fb);
9277 } 9290 }
9291
9292 i915_redisable_vga(dev);
9278 } else { 9293 } else {
9279 intel_modeset_update_staged_output_state(dev); 9294 intel_modeset_update_staged_output_state(dev);
9280 } 9295 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 496caa73eb70..e6f54ffab3ba 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -405,7 +405,7 @@ void intel_update_fbc(struct drm_device *dev)
405 * - going to an unsupported config (interlace, pixel multiply, etc.) 405 * - going to an unsupported config (interlace, pixel multiply, etc.)
406 */ 406 */
407 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { 407 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
408 if (tmp_crtc->enabled && 408 if (to_intel_crtc(tmp_crtc)->active &&
409 !to_intel_crtc(tmp_crtc)->primary_disabled && 409 !to_intel_crtc(tmp_crtc)->primary_disabled &&
410 tmp_crtc->fb) { 410 tmp_crtc->fb) {
411 if (crtc) { 411 if (crtc) {
@@ -992,7 +992,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev)
992 struct drm_crtc *crtc, *enabled = NULL; 992 struct drm_crtc *crtc, *enabled = NULL;
993 993
994 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 994 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
995 if (crtc->enabled && crtc->fb) { 995 if (to_intel_crtc(crtc)->active && crtc->fb) {
996 if (enabled) 996 if (enabled)
997 return NULL; 997 return NULL;
998 enabled = crtc; 998 enabled = crtc;
@@ -1086,7 +1086,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
1086 int entries, tlb_miss; 1086 int entries, tlb_miss;
1087 1087
1088 crtc = intel_get_crtc_for_plane(dev, plane); 1088 crtc = intel_get_crtc_for_plane(dev, plane);
1089 if (crtc->fb == NULL || !crtc->enabled) { 1089 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
1090 *cursor_wm = cursor->guard_size; 1090 *cursor_wm = cursor->guard_size;
1091 *plane_wm = display->guard_size; 1091 *plane_wm = display->guard_size;
1092 return false; 1092 return false;
@@ -1215,7 +1215,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,
1215 int entries; 1215 int entries;
1216 1216
1217 crtc = intel_get_crtc_for_plane(dev, plane); 1217 crtc = intel_get_crtc_for_plane(dev, plane);
1218 if (crtc->fb == NULL || !crtc->enabled) 1218 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active)
1219 return false; 1219 return false;
1220 1220
1221 clock = crtc->mode.clock; /* VESA DOT Clock */ 1221 clock = crtc->mode.clock; /* VESA DOT Clock */
@@ -1286,6 +1286,7 @@ static void valleyview_update_wm(struct drm_device *dev)
1286 struct drm_i915_private *dev_priv = dev->dev_private; 1286 struct drm_i915_private *dev_priv = dev->dev_private;
1287 int planea_wm, planeb_wm, cursora_wm, cursorb_wm; 1287 int planea_wm, planeb_wm, cursora_wm, cursorb_wm;
1288 int plane_sr, cursor_sr; 1288 int plane_sr, cursor_sr;
1289 int ignore_plane_sr, ignore_cursor_sr;
1289 unsigned int enabled = 0; 1290 unsigned int enabled = 0;
1290 1291
1291 vlv_update_drain_latency(dev); 1292 vlv_update_drain_latency(dev);
@@ -1302,17 +1303,23 @@ static void valleyview_update_wm(struct drm_device *dev)
1302 &planeb_wm, &cursorb_wm)) 1303 &planeb_wm, &cursorb_wm))
1303 enabled |= 2; 1304 enabled |= 2;
1304 1305
1305 plane_sr = cursor_sr = 0;
1306 if (single_plane_enabled(enabled) && 1306 if (single_plane_enabled(enabled) &&
1307 g4x_compute_srwm(dev, ffs(enabled) - 1, 1307 g4x_compute_srwm(dev, ffs(enabled) - 1,
1308 sr_latency_ns, 1308 sr_latency_ns,
1309 &valleyview_wm_info, 1309 &valleyview_wm_info,
1310 &valleyview_cursor_wm_info, 1310 &valleyview_cursor_wm_info,
1311 &plane_sr, &cursor_sr)) 1311 &plane_sr, &ignore_cursor_sr) &&
1312 g4x_compute_srwm(dev, ffs(enabled) - 1,
1313 2*sr_latency_ns,
1314 &valleyview_wm_info,
1315 &valleyview_cursor_wm_info,
1316 &ignore_plane_sr, &cursor_sr)) {
1312 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN); 1317 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN);
1313 else 1318 } else {
1314 I915_WRITE(FW_BLC_SELF_VLV, 1319 I915_WRITE(FW_BLC_SELF_VLV,
1315 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN); 1320 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN);
1321 plane_sr = cursor_sr = 0;
1322 }
1316 1323
1317 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1324 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1318 planea_wm, cursora_wm, 1325 planea_wm, cursora_wm,
@@ -1352,17 +1359,18 @@ static void g4x_update_wm(struct drm_device *dev)
1352 &planeb_wm, &cursorb_wm)) 1359 &planeb_wm, &cursorb_wm))
1353 enabled |= 2; 1360 enabled |= 2;
1354 1361
1355 plane_sr = cursor_sr = 0;
1356 if (single_plane_enabled(enabled) && 1362 if (single_plane_enabled(enabled) &&
1357 g4x_compute_srwm(dev, ffs(enabled) - 1, 1363 g4x_compute_srwm(dev, ffs(enabled) - 1,
1358 sr_latency_ns, 1364 sr_latency_ns,
1359 &g4x_wm_info, 1365 &g4x_wm_info,
1360 &g4x_cursor_wm_info, 1366 &g4x_cursor_wm_info,
1361 &plane_sr, &cursor_sr)) 1367 &plane_sr, &cursor_sr)) {
1362 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 1368 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
1363 else 1369 } else {
1364 I915_WRITE(FW_BLC_SELF, 1370 I915_WRITE(FW_BLC_SELF,
1365 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN); 1371 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN);
1372 plane_sr = cursor_sr = 0;
1373 }
1366 1374
1367 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1375 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1368 planea_wm, cursora_wm, 1376 planea_wm, cursora_wm,
@@ -1468,7 +1476,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1468 1476
1469 fifo_size = dev_priv->display.get_fifo_size(dev, 0); 1477 fifo_size = dev_priv->display.get_fifo_size(dev, 0);
1470 crtc = intel_get_crtc_for_plane(dev, 0); 1478 crtc = intel_get_crtc_for_plane(dev, 0);
1471 if (crtc->enabled && crtc->fb) { 1479 if (to_intel_crtc(crtc)->active && crtc->fb) {
1472 int cpp = crtc->fb->bits_per_pixel / 8; 1480 int cpp = crtc->fb->bits_per_pixel / 8;
1473 if (IS_GEN2(dev)) 1481 if (IS_GEN2(dev))
1474 cpp = 4; 1482 cpp = 4;
@@ -1482,7 +1490,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1482 1490
1483 fifo_size = dev_priv->display.get_fifo_size(dev, 1); 1491 fifo_size = dev_priv->display.get_fifo_size(dev, 1);
1484 crtc = intel_get_crtc_for_plane(dev, 1); 1492 crtc = intel_get_crtc_for_plane(dev, 1);
1485 if (crtc->enabled && crtc->fb) { 1493 if (to_intel_crtc(crtc)->active && crtc->fb) {
1486 int cpp = crtc->fb->bits_per_pixel / 8; 1494 int cpp = crtc->fb->bits_per_pixel / 8;
1487 if (IS_GEN2(dev)) 1495 if (IS_GEN2(dev))
1488 cpp = 4; 1496 cpp = 4;
@@ -1811,8 +1819,110 @@ static void sandybridge_update_wm(struct drm_device *dev)
1811 enabled |= 2; 1819 enabled |= 2;
1812 } 1820 }
1813 1821
1814 if ((dev_priv->num_pipe == 3) && 1822 /*
1815 g4x_compute_wm0(dev, 2, 1823 * Calculate and update the self-refresh watermark only when one
1824 * display plane is used.
1825 *
1826 * SNB support 3 levels of watermark.
1827 *
1828 * WM1/WM2/WM2 watermarks have to be enabled in the ascending order,
1829 * and disabled in the descending order
1830 *
1831 */
1832 I915_WRITE(WM3_LP_ILK, 0);
1833 I915_WRITE(WM2_LP_ILK, 0);
1834 I915_WRITE(WM1_LP_ILK, 0);
1835
1836 if (!single_plane_enabled(enabled) ||
1837 dev_priv->sprite_scaling_enabled)
1838 return;
1839 enabled = ffs(enabled) - 1;
1840
1841 /* WM1 */
1842 if (!ironlake_compute_srwm(dev, 1, enabled,
1843 SNB_READ_WM1_LATENCY() * 500,
1844 &sandybridge_display_srwm_info,
1845 &sandybridge_cursor_srwm_info,
1846 &fbc_wm, &plane_wm, &cursor_wm))
1847 return;
1848
1849 I915_WRITE(WM1_LP_ILK,
1850 WM1_LP_SR_EN |
1851 (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1852 (fbc_wm << WM1_LP_FBC_SHIFT) |
1853 (plane_wm << WM1_LP_SR_SHIFT) |
1854 cursor_wm);
1855
1856 /* WM2 */
1857 if (!ironlake_compute_srwm(dev, 2, enabled,
1858 SNB_READ_WM2_LATENCY() * 500,
1859 &sandybridge_display_srwm_info,
1860 &sandybridge_cursor_srwm_info,
1861 &fbc_wm, &plane_wm, &cursor_wm))
1862 return;
1863
1864 I915_WRITE(WM2_LP_ILK,
1865 WM2_LP_EN |
1866 (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1867 (fbc_wm << WM1_LP_FBC_SHIFT) |
1868 (plane_wm << WM1_LP_SR_SHIFT) |
1869 cursor_wm);
1870
1871 /* WM3 */
1872 if (!ironlake_compute_srwm(dev, 3, enabled,
1873 SNB_READ_WM3_LATENCY() * 500,
1874 &sandybridge_display_srwm_info,
1875 &sandybridge_cursor_srwm_info,
1876 &fbc_wm, &plane_wm, &cursor_wm))
1877 return;
1878
1879 I915_WRITE(WM3_LP_ILK,
1880 WM3_LP_EN |
1881 (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1882 (fbc_wm << WM1_LP_FBC_SHIFT) |
1883 (plane_wm << WM1_LP_SR_SHIFT) |
1884 cursor_wm);
1885}
1886
1887static void ivybridge_update_wm(struct drm_device *dev)
1888{
1889 struct drm_i915_private *dev_priv = dev->dev_private;
1890 int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */
1891 u32 val;
1892 int fbc_wm, plane_wm, cursor_wm;
1893 int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm;
1894 unsigned int enabled;
1895
1896 enabled = 0;
1897 if (g4x_compute_wm0(dev, 0,
1898 &sandybridge_display_wm_info, latency,
1899 &sandybridge_cursor_wm_info, latency,
1900 &plane_wm, &cursor_wm)) {
1901 val = I915_READ(WM0_PIPEA_ILK);
1902 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1903 I915_WRITE(WM0_PIPEA_ILK, val |
1904 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1905 DRM_DEBUG_KMS("FIFO watermarks For pipe A -"
1906 " plane %d, " "cursor: %d\n",
1907 plane_wm, cursor_wm);
1908 enabled |= 1;
1909 }
1910
1911 if (g4x_compute_wm0(dev, 1,
1912 &sandybridge_display_wm_info, latency,
1913 &sandybridge_cursor_wm_info, latency,
1914 &plane_wm, &cursor_wm)) {
1915 val = I915_READ(WM0_PIPEB_ILK);
1916 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1917 I915_WRITE(WM0_PIPEB_ILK, val |
1918 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1919 DRM_DEBUG_KMS("FIFO watermarks For pipe B -"
1920 " plane %d, cursor: %d\n",
1921 plane_wm, cursor_wm);
1922 enabled |= 2;
1923 }
1924
1925 if (g4x_compute_wm0(dev, 2,
1816 &sandybridge_display_wm_info, latency, 1926 &sandybridge_display_wm_info, latency,
1817 &sandybridge_cursor_wm_info, latency, 1927 &sandybridge_cursor_wm_info, latency,
1818 &plane_wm, &cursor_wm)) { 1928 &plane_wm, &cursor_wm)) {
@@ -1875,12 +1985,17 @@ static void sandybridge_update_wm(struct drm_device *dev)
1875 (plane_wm << WM1_LP_SR_SHIFT) | 1985 (plane_wm << WM1_LP_SR_SHIFT) |
1876 cursor_wm); 1986 cursor_wm);
1877 1987
1878 /* WM3 */ 1988 /* WM3, note we have to correct the cursor latency */
1879 if (!ironlake_compute_srwm(dev, 3, enabled, 1989 if (!ironlake_compute_srwm(dev, 3, enabled,
1880 SNB_READ_WM3_LATENCY() * 500, 1990 SNB_READ_WM3_LATENCY() * 500,
1881 &sandybridge_display_srwm_info, 1991 &sandybridge_display_srwm_info,
1882 &sandybridge_cursor_srwm_info, 1992 &sandybridge_cursor_srwm_info,
1883 &fbc_wm, &plane_wm, &cursor_wm)) 1993 &fbc_wm, &plane_wm, &ignore_cursor_wm) ||
1994 !ironlake_compute_srwm(dev, 3, enabled,
1995 2 * SNB_READ_WM3_LATENCY() * 500,
1996 &sandybridge_display_srwm_info,
1997 &sandybridge_cursor_srwm_info,
1998 &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm))
1884 return; 1999 return;
1885 2000
1886 I915_WRITE(WM3_LP_ILK, 2001 I915_WRITE(WM3_LP_ILK,
@@ -1929,7 +2044,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
1929 int entries, tlb_miss; 2044 int entries, tlb_miss;
1930 2045
1931 crtc = intel_get_crtc_for_plane(dev, plane); 2046 crtc = intel_get_crtc_for_plane(dev, plane);
1932 if (crtc->fb == NULL || !crtc->enabled) { 2047 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
1933 *sprite_wm = display->guard_size; 2048 *sprite_wm = display->guard_size;
1934 return false; 2049 return false;
1935 } 2050 }
@@ -3471,6 +3586,15 @@ static void gen6_init_clock_gating(struct drm_device *dev)
3471 I915_READ(ILK_DISPLAY_CHICKEN2) | 3586 I915_READ(ILK_DISPLAY_CHICKEN2) |
3472 ILK_ELPIN_409_SELECT); 3587 ILK_ELPIN_409_SELECT);
3473 3588
3589 /* WaDisableHiZPlanesWhenMSAAEnabled */
3590 I915_WRITE(_3D_CHICKEN,
3591 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB));
3592
3593 /* WaSetupGtModeTdRowDispatch */
3594 if (IS_SNB_GT1(dev))
3595 I915_WRITE(GEN6_GT_MODE,
3596 _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE));
3597
3474 I915_WRITE(WM3_LP_ILK, 0); 3598 I915_WRITE(WM3_LP_ILK, 0);
3475 I915_WRITE(WM2_LP_ILK, 0); 3599 I915_WRITE(WM2_LP_ILK, 0);
3476 I915_WRITE(WM1_LP_ILK, 0); 3600 I915_WRITE(WM1_LP_ILK, 0);
@@ -3999,7 +4123,7 @@ void intel_init_pm(struct drm_device *dev)
3999 } else if (IS_IVYBRIDGE(dev)) { 4123 } else if (IS_IVYBRIDGE(dev)) {
4000 /* FIXME: detect B0+ stepping and use auto training */ 4124 /* FIXME: detect B0+ stepping and use auto training */
4001 if (SNB_READ_WM0_LATENCY()) { 4125 if (SNB_READ_WM0_LATENCY()) {
4002 dev_priv->display.update_wm = sandybridge_update_wm; 4126 dev_priv->display.update_wm = ivybridge_update_wm;
4003 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; 4127 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
4004 } else { 4128 } else {
4005 DRM_DEBUG_KMS("Failed to read display plane latency. " 4129 DRM_DEBUG_KMS("Failed to read display plane latency. "
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2346b920bd86..ae253e04c391 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -547,9 +547,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)
547 547
548static void render_ring_cleanup(struct intel_ring_buffer *ring) 548static void render_ring_cleanup(struct intel_ring_buffer *ring)
549{ 549{
550 struct drm_device *dev = ring->dev;
551
550 if (!ring->private) 552 if (!ring->private)
551 return; 553 return;
552 554
555 if (HAS_BROKEN_CS_TLB(dev))
556 drm_gem_object_unreference(to_gem_object(ring->private));
557
553 cleanup_pipe_control(ring); 558 cleanup_pipe_control(ring);
554} 559}
555 560
@@ -969,6 +974,8 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring,
969 return 0; 974 return 0;
970} 975}
971 976
977/* Just userspace ABI convention to limit the wa batch bo to a resonable size */
978#define I830_BATCH_LIMIT (256*1024)
972static int 979static int
973i830_dispatch_execbuffer(struct intel_ring_buffer *ring, 980i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
974 u32 offset, u32 len, 981 u32 offset, u32 len,
@@ -976,15 +983,47 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
976{ 983{
977 int ret; 984 int ret;
978 985
979 ret = intel_ring_begin(ring, 4); 986 if (flags & I915_DISPATCH_PINNED) {
980 if (ret) 987 ret = intel_ring_begin(ring, 4);
981 return ret; 988 if (ret)
989 return ret;
982 990
983 intel_ring_emit(ring, MI_BATCH_BUFFER); 991 intel_ring_emit(ring, MI_BATCH_BUFFER);
984 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); 992 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
985 intel_ring_emit(ring, offset + len - 8); 993 intel_ring_emit(ring, offset + len - 8);
986 intel_ring_emit(ring, 0); 994 intel_ring_emit(ring, MI_NOOP);
987 intel_ring_advance(ring); 995 intel_ring_advance(ring);
996 } else {
997 struct drm_i915_gem_object *obj = ring->private;
998 u32 cs_offset = obj->gtt_offset;
999
1000 if (len > I830_BATCH_LIMIT)
1001 return -ENOSPC;
1002
1003 ret = intel_ring_begin(ring, 9+3);
1004 if (ret)
1005 return ret;
1006 /* Blit the batch (which has now all relocs applied) to the stable batch
1007 * scratch bo area (so that the CS never stumbles over its tlb
1008 * invalidation bug) ... */
1009 intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD |
1010 XY_SRC_COPY_BLT_WRITE_ALPHA |
1011 XY_SRC_COPY_BLT_WRITE_RGB);
1012 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096);
1013 intel_ring_emit(ring, 0);
1014 intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024);
1015 intel_ring_emit(ring, cs_offset);
1016 intel_ring_emit(ring, 0);
1017 intel_ring_emit(ring, 4096);
1018 intel_ring_emit(ring, offset);
1019 intel_ring_emit(ring, MI_FLUSH);
1020
1021 /* ... and execute it. */
1022 intel_ring_emit(ring, MI_BATCH_BUFFER);
1023 intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
1024 intel_ring_emit(ring, cs_offset + len - 8);
1025 intel_ring_advance(ring);
1026 }
988 1027
989 return 0; 1028 return 0;
990} 1029}
@@ -1596,6 +1635,27 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
1596 ring->init = init_render_ring; 1635 ring->init = init_render_ring;
1597 ring->cleanup = render_ring_cleanup; 1636 ring->cleanup = render_ring_cleanup;
1598 1637
1638 /* Workaround batchbuffer to combat CS tlb bug. */
1639 if (HAS_BROKEN_CS_TLB(dev)) {
1640 struct drm_i915_gem_object *obj;
1641 int ret;
1642
1643 obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT);
1644 if (obj == NULL) {
1645 DRM_ERROR("Failed to allocate batch bo\n");
1646 return -ENOMEM;
1647 }
1648
1649 ret = i915_gem_object_pin(obj, 0, true, false);
1650 if (ret != 0) {
1651 drm_gem_object_unreference(&obj->base);
1652 DRM_ERROR("Failed to ping batch bo\n");
1653 return ret;
1654 }
1655
1656 ring->private = obj;
1657 }
1658
1599 return intel_init_ring_buffer(dev, ring); 1659 return intel_init_ring_buffer(dev, ring);
1600} 1660}
1601 1661
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 526182ed0c6d..6af87cd05725 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -94,6 +94,7 @@ struct intel_ring_buffer {
94 u32 offset, u32 length, 94 u32 offset, u32 length,
95 unsigned flags); 95 unsigned flags);
96#define I915_DISPATCH_SECURE 0x1 96#define I915_DISPATCH_SECURE 0x1
97#define I915_DISPATCH_PINNED 0x2
97 void (*cleanup)(struct intel_ring_buffer *ring); 98 void (*cleanup)(struct intel_ring_buffer *ring);
98 int (*sync_to)(struct intel_ring_buffer *ring, 99 int (*sync_to)(struct intel_ring_buffer *ring,
99 struct intel_ring_buffer *to, 100 struct intel_ring_buffer *to,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
index 7b715fda2763..62ab231cd6b6 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
@@ -57,6 +57,11 @@ chipsets:
57.b16 #nve4_gpc_mmio_tail 57.b16 #nve4_gpc_mmio_tail
58.b16 #nve4_tpc_mmio_head 58.b16 #nve4_tpc_mmio_head
59.b16 #nve4_tpc_mmio_tail 59.b16 #nve4_tpc_mmio_tail
60.b8 0xe6 0 0 0
61.b16 #nve4_gpc_mmio_head
62.b16 #nve4_gpc_mmio_tail
63.b16 #nve4_tpc_mmio_head
64.b16 #nve4_tpc_mmio_tail
60.b8 0 0 0 0 65.b8 0 0 0 0
61 66
62// GPC mmio lists 67// GPC mmio lists
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
index 26c2165bad0f..09ee4702c8b2 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
@@ -34,13 +34,16 @@ uint32_t nve0_grgpc_data[] = {
34 0x00000000, 34 0x00000000,
35/* 0x0064: chipsets */ 35/* 0x0064: chipsets */
36 0x000000e4, 36 0x000000e4,
37 0x01040080, 37 0x0110008c,
38 0x014c0104, 38 0x01580110,
39 0x000000e7, 39 0x000000e7,
40 0x01040080, 40 0x0110008c,
41 0x014c0104, 41 0x01580110,
42 0x000000e6,
43 0x0110008c,
44 0x01580110,
42 0x00000000, 45 0x00000000,
43/* 0x0080: nve4_gpc_mmio_head */ 46/* 0x008c: nve4_gpc_mmio_head */
44 0x00000380, 47 0x00000380,
45 0x04000400, 48 0x04000400,
46 0x0800040c, 49 0x0800040c,
@@ -74,8 +77,8 @@ uint32_t nve0_grgpc_data[] = {
74 0x14003100, 77 0x14003100,
75 0x000031d0, 78 0x000031d0,
76 0x040031e0, 79 0x040031e0,
77/* 0x0104: nve4_gpc_mmio_tail */ 80/* 0x0110: nve4_gpc_mmio_tail */
78/* 0x0104: nve4_tpc_mmio_head */ 81/* 0x0110: nve4_tpc_mmio_head */
79 0x00000048, 82 0x00000048,
80 0x00000064, 83 0x00000064,
81 0x00000088, 84 0x00000088,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
index acfc457654bd..0bcfa4d447e5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
@@ -754,6 +754,16 @@ ctx_mmio_exec:
754// on load it means: "a save preceeded this load" 754// on load it means: "a save preceeded this load"
755// 755//
756ctx_xfer: 756ctx_xfer:
757 // according to mwk, some kind of wait for idle
758 mov $r15 0xc00
759 shl b32 $r15 6
760 mov $r14 4
761 iowr I[$r15 + 0x200] $r14
762 ctx_xfer_idle:
763 iord $r14 I[$r15 + 0x000]
764 and $r14 0x2000
765 bra ne #ctx_xfer_idle
766
757 bra not $p1 #ctx_xfer_pre 767 bra not $p1 #ctx_xfer_pre
758 bra $p2 #ctx_xfer_pre_load 768 bra $p2 #ctx_xfer_pre_load
759 ctx_xfer_pre: 769 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
index 85a8d556f484..bb03d2a1d57b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
@@ -799,79 +799,80 @@ uint32_t nvc0_grhub_code[] = {
799 0x01fa0613, 799 0x01fa0613,
800 0xf803f806, 800 0xf803f806,
801/* 0x0829: ctx_xfer */ 801/* 0x0829: ctx_xfer */
802 0x0611f400, 802 0x00f7f100,
803/* 0x082f: ctx_xfer_pre */ 803 0x06f4b60c,
804 0xf01102f4, 804 0xd004e7f0,
805 0x21f510f7, 805/* 0x0836: ctx_xfer_idle */
806 0x21f50698, 806 0xfecf80fe,
807 0x11f40631, 807 0x00e4f100,
808/* 0x083d: ctx_xfer_pre_load */ 808 0xf91bf420,
809 0x02f7f01c, 809 0xf40611f4,
810 0x065721f5, 810/* 0x0846: ctx_xfer_pre */
811 0x066621f5, 811 0xf7f01102,
812 0x067821f5, 812 0x9821f510,
813 0x21f5f4bd, 813 0x3121f506,
814 0x21f50657, 814 0x1c11f406,
815/* 0x0856: ctx_xfer_exec */ 815/* 0x0854: ctx_xfer_pre_load */
816 0x019806b8, 816 0xf502f7f0,
817 0x1427f116, 817 0xf5065721,
818 0x0624b604, 818 0xf5066621,
819 0xf10020d0, 819 0xbd067821,
820 0xf0a500e7, 820 0x5721f5f4,
821 0x1fb941e3, 821 0xb821f506,
822 0x8d21f402, 822/* 0x086d: ctx_xfer_exec */
823 0xf004e0b6, 823 0x16019806,
824 0x2cf001fc, 824 0x041427f1,
825 0x0124b602, 825 0xd00624b6,
826 0xf405f2fd, 826 0xe7f10020,
827 0x17f18d21, 827 0xe3f0a500,
828 0x13f04afc, 828 0x021fb941,
829 0x0c27f002, 829 0xb68d21f4,
830 0xf50012d0, 830 0xfcf004e0,
831 0xf1020721, 831 0x022cf001,
832 0xf047fc27, 832 0xfd0124b6,
833 0x20d00223, 833 0x21f405f2,
834 0x012cf000, 834 0xfc17f18d,
835 0xd00320b6, 835 0x0213f04a,
836 0xacf00012, 836 0xd00c27f0,
837 0x06a5f001, 837 0x21f50012,
838 0x9800b7f0, 838 0x27f10207,
839 0x0d98140c, 839 0x23f047fc,
840 0x00e7f015, 840 0x0020d002,
841 0x015c21f5, 841 0xb6012cf0,
842 0xf508a7f0, 842 0x12d00320,
843 0xf5010321, 843 0x01acf000,
844 0xf4020721, 844 0xf006a5f0,
845 0xa7f02201, 845 0x0c9800b7,
846 0xc921f40c, 846 0x150d9814,
847 0x0a1017f1, 847 0xf500e7f0,
848 0xf00614b6, 848 0xf0015c21,
849 0x12d00527, 849 0x21f508a7,
850/* 0x08dd: ctx_xfer_post_save_wait */ 850 0x21f50103,
851 0x0012cf00, 851 0x01f40207,
852 0xf40522fd, 852 0x0ca7f022,
853 0x02f4fa1b, 853 0xf1c921f4,
854/* 0x08e9: ctx_xfer_post */ 854 0xb60a1017,
855 0x02f7f032, 855 0x27f00614,
856 0x065721f5, 856 0x0012d005,
857 0x21f5f4bd, 857/* 0x08f4: ctx_xfer_post_save_wait */
858 0x21f50698, 858 0xfd0012cf,
859 0x21f50226, 859 0x1bf40522,
860 0xf4bd0666, 860 0x3202f4fa,
861 0x065721f5, 861/* 0x0900: ctx_xfer_post */
862 0x981011f4, 862 0xf502f7f0,
863 0x11fd8001, 863 0xbd065721,
864 0x070bf405, 864 0x9821f5f4,
865 0x07df21f5, 865 0x2621f506,
866/* 0x0914: ctx_xfer_no_post_mmio */ 866 0x6621f502,
867 0x064921f5, 867 0xf5f4bd06,
868/* 0x0918: ctx_xfer_done */ 868 0xf4065721,
869 0x000000f8, 869 0x01981011,
870 0x00000000, 870 0x0511fd80,
871 0x00000000, 871 0xf5070bf4,
872 0x00000000, 872/* 0x092b: ctx_xfer_no_post_mmio */
873 0x00000000, 873 0xf507df21,
874 0x00000000, 874/* 0x092f: ctx_xfer_done */
875 0xf8064921,
875 0x00000000, 876 0x00000000,
876 0x00000000, 877 0x00000000,
877 0x00000000, 878 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
index 138eeaa28665..7fe9d7cf486b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
@@ -44,6 +44,9 @@ chipsets:
44.b8 0xe7 0 0 0 44.b8 0xe7 0 0 0
45.b16 #nve4_hub_mmio_head 45.b16 #nve4_hub_mmio_head
46.b16 #nve4_hub_mmio_tail 46.b16 #nve4_hub_mmio_tail
47.b8 0xe6 0 0 0
48.b16 #nve4_hub_mmio_head
49.b16 #nve4_hub_mmio_tail
47.b8 0 0 0 0 50.b8 0 0 0 0
48 51
49nve4_hub_mmio_head: 52nve4_hub_mmio_head:
@@ -680,6 +683,16 @@ ctx_mmio_exec:
680// on load it means: "a save preceeded this load" 683// on load it means: "a save preceeded this load"
681// 684//
682ctx_xfer: 685ctx_xfer:
686 // according to mwk, some kind of wait for idle
687 mov $r15 0xc00
688 shl b32 $r15 6
689 mov $r14 4
690 iowr I[$r15 + 0x200] $r14
691 ctx_xfer_idle:
692 iord $r14 I[$r15 + 0x000]
693 and $r14 0x2000
694 bra ne #ctx_xfer_idle
695
683 bra not $p1 #ctx_xfer_pre 696 bra not $p1 #ctx_xfer_pre
684 bra $p2 #ctx_xfer_pre_load 697 bra $p2 #ctx_xfer_pre_load
685 ctx_xfer_pre: 698 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
index decf0c60ca3b..e3421af68ab9 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
@@ -30,11 +30,13 @@ uint32_t nve0_grhub_data[] = {
30 0x00000000, 30 0x00000000,
31/* 0x005c: chipsets */ 31/* 0x005c: chipsets */
32 0x000000e4, 32 0x000000e4,
33 0x013c0070, 33 0x01440078,
34 0x000000e7, 34 0x000000e7,
35 0x013c0070, 35 0x01440078,
36 0x000000e6,
37 0x01440078,
36 0x00000000, 38 0x00000000,
37/* 0x0070: nve4_hub_mmio_head */ 39/* 0x0078: nve4_hub_mmio_head */
38 0x0417e91c, 40 0x0417e91c,
39 0x04400204, 41 0x04400204,
40 0x18404010, 42 0x18404010,
@@ -86,9 +88,7 @@ uint32_t nve0_grhub_data[] = {
86 0x00408840, 88 0x00408840,
87 0x08408900, 89 0x08408900,
88 0x00408980, 90 0x00408980,
89/* 0x013c: nve4_hub_mmio_tail */ 91/* 0x0144: nve4_hub_mmio_tail */
90 0x00000000,
91 0x00000000,
92 0x00000000, 92 0x00000000,
93 0x00000000, 93 0x00000000,
94 0x00000000, 94 0x00000000,
@@ -781,77 +781,78 @@ uint32_t nve0_grhub_code[] = {
781 0x0613f002, 781 0x0613f002,
782 0xf80601fa, 782 0xf80601fa,
783/* 0x07fb: ctx_xfer */ 783/* 0x07fb: ctx_xfer */
784 0xf400f803, 784 0xf100f803,
785 0x02f40611, 785 0xb60c00f7,
786/* 0x0801: ctx_xfer_pre */ 786 0xe7f006f4,
787 0x10f7f00d, 787 0x80fed004,
788 0x067221f5, 788/* 0x0808: ctx_xfer_idle */
789/* 0x080b: ctx_xfer_pre_load */ 789 0xf100fecf,
790 0xf01c11f4, 790 0xf42000e4,
791 0x21f502f7, 791 0x11f4f91b,
792 0x21f50631, 792 0x0d02f406,
793 0x21f50640, 793/* 0x0818: ctx_xfer_pre */
794 0xf4bd0652, 794 0xf510f7f0,
795 0x063121f5, 795 0xf4067221,
796 0x069221f5, 796/* 0x0822: ctx_xfer_pre_load */
797/* 0x0824: ctx_xfer_exec */ 797 0xf7f01c11,
798 0xf1160198, 798 0x3121f502,
799 0xb6041427, 799 0x4021f506,
800 0x20d00624, 800 0x5221f506,
801 0x00e7f100, 801 0xf5f4bd06,
802 0x41e3f0a5, 802 0xf5063121,
803 0xf4021fb9, 803/* 0x083b: ctx_xfer_exec */
804 0xe0b68d21, 804 0x98069221,
805 0x01fcf004, 805 0x27f11601,
806 0xb6022cf0, 806 0x24b60414,
807 0xf2fd0124, 807 0x0020d006,
808 0x8d21f405, 808 0xa500e7f1,
809 0x4afc17f1, 809 0xb941e3f0,
810 0xf00213f0, 810 0x21f4021f,
811 0x12d00c27, 811 0x04e0b68d,
812 0x0721f500, 812 0xf001fcf0,
813 0xfc27f102, 813 0x24b6022c,
814 0x0223f047, 814 0x05f2fd01,
815 0xf00020d0, 815 0xf18d21f4,
816 0x20b6012c, 816 0xf04afc17,
817 0x0012d003, 817 0x27f00213,
818 0xf001acf0, 818 0x0012d00c,
819 0xb7f006a5, 819 0x020721f5,
820 0x140c9800, 820 0x47fc27f1,
821 0xf0150d98, 821 0xd00223f0,
822 0x21f500e7, 822 0x2cf00020,
823 0xa7f0015c, 823 0x0320b601,
824 0x0321f508, 824 0xf00012d0,
825 0x0721f501, 825 0xa5f001ac,
826 0x2201f402, 826 0x00b7f006,
827 0xf40ca7f0, 827 0x98140c98,
828 0x17f1c921, 828 0xe7f0150d,
829 0x14b60a10, 829 0x5c21f500,
830 0x0527f006, 830 0x08a7f001,
831/* 0x08ab: ctx_xfer_post_save_wait */ 831 0x010321f5,
832 0xcf0012d0, 832 0x020721f5,
833 0x22fd0012, 833 0xf02201f4,
834 0xfa1bf405, 834 0x21f40ca7,
835/* 0x08b7: ctx_xfer_post */ 835 0x1017f1c9,
836 0xf02e02f4, 836 0x0614b60a,
837 0x21f502f7, 837 0xd00527f0,
838 0xf4bd0631, 838/* 0x08c2: ctx_xfer_post_save_wait */
839 0x067221f5, 839 0x12cf0012,
840 0x022621f5, 840 0x0522fd00,
841 0x064021f5, 841 0xf4fa1bf4,
842 0x21f5f4bd, 842/* 0x08ce: ctx_xfer_post */
843 0x11f40631, 843 0xf7f02e02,
844 0x80019810, 844 0x3121f502,
845 0xf40511fd, 845 0xf5f4bd06,
846 0x21f5070b, 846 0xf5067221,
847/* 0x08e2: ctx_xfer_no_post_mmio */ 847 0xf5022621,
848/* 0x08e2: ctx_xfer_done */ 848 0xbd064021,
849 0x00f807b1, 849 0x3121f5f4,
850 0x00000000, 850 0x1011f406,
851 0x00000000, 851 0xfd800198,
852 0x00000000, 852 0x0bf40511,
853 0x00000000, 853 0xb121f507,
854 0x00000000, 854/* 0x08f9: ctx_xfer_no_post_mmio */
855 0x00000000, 855/* 0x08f9: ctx_xfer_done */
856 0x0000f807,
856 0x00000000, 857 0x00000000,
857}; 858};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index 47a02081d708..45aff5f5085a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -516,18 +516,9 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
516{ 516{
517 struct nouveau_device *device = nv_device(parent); 517 struct nouveau_device *device = nv_device(parent);
518 struct nvc0_graph_priv *priv; 518 struct nvc0_graph_priv *priv;
519 bool enable = true;
520 int ret, i; 519 int ret, i;
521 520
522 switch (device->chipset) { 521 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
523 case 0xd9: /* known broken without binary driver firmware */
524 enable = false;
525 break;
526 default:
527 break;
528 }
529
530 ret = nouveau_graph_create(parent, engine, oclass, enable, &priv);
531 *pobject = nv_object(priv); 522 *pobject = nv_object(priv);
532 if (ret) 523 if (ret)
533 return ret; 524 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index 18d2210e12eb..a1e78de46456 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -121,6 +121,7 @@ nvc0_graph_class(void *obj)
121 return 0x9297; 121 return 0x9297;
122 case 0xe4: 122 case 0xe4:
123 case 0xe7: 123 case 0xe7:
124 case 0xe6:
124 return 0xa097; 125 return 0xa097;
125 default: 126 default:
126 return 0; 127 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
index 539d4c72f192..9f82e9702b46 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
@@ -203,7 +203,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
203 struct nvc0_graph_priv *priv; 203 struct nvc0_graph_priv *priv;
204 int ret, i; 204 int ret, i;
205 205
206 ret = nouveau_graph_create(parent, engine, oclass, false, &priv); 206 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
207 *pobject = nv_object(priv); 207 *pobject = nv_object(priv);
208 if (ret) 208 if (ret)
209 return ret; 209 return ret;
@@ -252,6 +252,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
252 priv->magic_not_rop_nr = 1; 252 priv->magic_not_rop_nr = 1;
253 break; 253 break;
254 case 0xe7: 254 case 0xe7:
255 case 0xe6:
255 priv->magic_not_rop_nr = 1; 256 priv->magic_not_rop_nr = 1;
256 break; 257 break;
257 default: 258 default:
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
index d145b25e6be4..5bd1ca8cd20d 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
@@ -17,6 +17,7 @@ struct nouveau_bios {
17 u8 chip; 17 u8 chip;
18 u8 minor; 18 u8 minor;
19 u8 micro; 19 u8 micro;
20 u8 patch;
20 } version; 21 } version;
21}; 22};
22 23
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
index 2bf178082a36..e6563b5cb08e 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
@@ -25,9 +25,11 @@ struct dcb_gpio_func {
25 u8 param; 25 u8 param;
26}; 26};
27 27
28u16 dcb_gpio_table(struct nouveau_bios *); 28u16 dcb_gpio_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver); 29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len);
30int dcb_gpio_parse(struct nouveau_bios *, int idx, u8 func, u8 line, 30u16 dcb_gpio_parse(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len,
31 struct dcb_gpio_func *); 31 struct dcb_gpio_func *);
32u16 dcb_gpio_match(struct nouveau_bios *, int idx, u8 func, u8 line,
33 u8 *ver, u8 *len, struct dcb_gpio_func *);
32 34
33#endif 35#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
index e69a8bdc6e97..ca2f6bf37f46 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
@@ -13,6 +13,7 @@ struct nvbios_init {
13 u32 nested; 13 u32 nested;
14 u16 repeat; 14 u16 repeat;
15 u16 repend; 15 u16 repend;
16 u32 ramcfg;
16}; 17};
17 18
18int nvbios_exec(struct nvbios_init *); 19int nvbios_exec(struct nvbios_init *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
index 9ea2b12cc15d..b75e8f18e52c 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
@@ -11,7 +11,7 @@ struct nouveau_gpio {
11 struct nouveau_subdev base; 11 struct nouveau_subdev base;
12 12
13 /* hardware interfaces */ 13 /* hardware interfaces */
14 void (*reset)(struct nouveau_gpio *); 14 void (*reset)(struct nouveau_gpio *, u8 func);
15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out); 15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out);
16 int (*sense)(struct nouveau_gpio *, int line); 16 int (*sense)(struct nouveau_gpio *, int line);
17 void (*irq_enable)(struct nouveau_gpio *, int line, bool); 17 void (*irq_enable)(struct nouveau_gpio *, int line, bool);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index dd111947eb86..f621f69fa1a2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -447,6 +447,7 @@ nouveau_bios_ctor(struct nouveau_object *parent,
447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2); 447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2);
448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1); 448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1);
449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0); 449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0);
450 bios->version.patch = nv_ro08(bios, bit_i.offset + 4);
450 } else 451 } else
451 if (bmp_version(bios)) { 452 if (bmp_version(bios)) {
452 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13); 453 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13);
@@ -455,9 +456,9 @@ nouveau_bios_ctor(struct nouveau_object *parent,
455 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10); 456 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10);
456 } 457 }
457 458
458 nv_info(bios, "version %02x.%02x.%02x.%02x\n", 459 nv_info(bios, "version %02x.%02x.%02x.%02x.%02x\n",
459 bios->version.major, bios->version.chip, 460 bios->version.major, bios->version.chip,
460 bios->version.minor, bios->version.micro); 461 bios->version.minor, bios->version.micro, bios->version.patch);
461 462
462 return 0; 463 return 0;
463} 464}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
index c90d4aa3ae4f..c84e93fa6d95 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
@@ -27,84 +27,105 @@
27#include <subdev/bios/gpio.h> 27#include <subdev/bios/gpio.h>
28 28
29u16 29u16
30dcb_gpio_table(struct nouveau_bios *bios) 30dcb_gpio_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
31{ 31{
32 u8 ver, hdr, cnt, len; 32 u16 data = 0x0000;
33 u16 dcb = dcb_table(bios, &ver, &hdr, &cnt, &len); 33 u16 dcb = dcb_table(bios, ver, hdr, cnt, len);
34 if (dcb) { 34 if (dcb) {
35 if (ver >= 0x30 && hdr >= 0x0c) 35 if (*ver >= 0x30 && *hdr >= 0x0c)
36 return nv_ro16(bios, dcb + 0x0a); 36 data = nv_ro16(bios, dcb + 0x0a);
37 if (ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13) 37 else
38 return nv_ro16(bios, dcb - 0x0f); 38 if (*ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13)
39 data = nv_ro16(bios, dcb - 0x0f);
40
41 if (data) {
42 *ver = nv_ro08(bios, data + 0x00);
43 if (*ver < 0x30) {
44 *hdr = 3;
45 *cnt = nv_ro08(bios, data + 0x02);
46 *len = nv_ro08(bios, data + 0x01);
47 } else
48 if (*ver <= 0x41) {
49 *hdr = nv_ro08(bios, data + 0x01);
50 *cnt = nv_ro08(bios, data + 0x02);
51 *len = nv_ro08(bios, data + 0x03);
52 } else {
53 data = 0x0000;
54 }
55 }
39 } 56 }
40 return 0x0000; 57 return data;
41} 58}
42 59
43u16 60u16
44dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver) 61dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len)
45{ 62{
46 u16 gpio = dcb_gpio_table(bios); 63 u8 hdr, cnt;
47 if (gpio) { 64 u16 gpio = !idx ? dcb_gpio_table(bios, ver, &hdr, &cnt, len) : 0x0000;
48 *ver = nv_ro08(bios, gpio); 65 if (gpio && ent < cnt)
49 if (*ver < 0x30 && ent < nv_ro08(bios, gpio + 2)) 66 return gpio + hdr + (ent * *len);
50 return gpio + 3 + (ent * nv_ro08(bios, gpio + 1));
51 else if (ent < nv_ro08(bios, gpio + 2))
52 return gpio + nv_ro08(bios, gpio + 1) +
53 (ent * nv_ro08(bios, gpio + 3));
54 }
55 return 0x0000; 67 return 0x0000;
56} 68}
57 69
58int 70u16
59dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line, 71dcb_gpio_parse(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len,
60 struct dcb_gpio_func *gpio) 72 struct dcb_gpio_func *gpio)
61{ 73{
62 u8 ver, hdr, cnt, len; 74 u16 data = dcb_gpio_entry(bios, idx, ent, ver, len);
63 u16 entry; 75 if (data) {
64 int i = -1; 76 if (*ver < 0x40) {
65 77 u16 info = nv_ro16(bios, data);
66 while ((entry = dcb_gpio_entry(bios, idx, ++i, &ver))) {
67 if (ver < 0x40) {
68 u16 data = nv_ro16(bios, entry);
69 *gpio = (struct dcb_gpio_func) { 78 *gpio = (struct dcb_gpio_func) {
70 .line = (data & 0x001f) >> 0, 79 .line = (info & 0x001f) >> 0,
71 .func = (data & 0x07e0) >> 5, 80 .func = (info & 0x07e0) >> 5,
72 .log[0] = (data & 0x1800) >> 11, 81 .log[0] = (info & 0x1800) >> 11,
73 .log[1] = (data & 0x6000) >> 13, 82 .log[1] = (info & 0x6000) >> 13,
74 .param = !!(data & 0x8000), 83 .param = !!(info & 0x8000),
75 }; 84 };
76 } else 85 } else
77 if (ver < 0x41) { 86 if (*ver < 0x41) {
78 u32 data = nv_ro32(bios, entry); 87 u32 info = nv_ro32(bios, data);
79 *gpio = (struct dcb_gpio_func) { 88 *gpio = (struct dcb_gpio_func) {
80 .line = (data & 0x0000001f) >> 0, 89 .line = (info & 0x0000001f) >> 0,
81 .func = (data & 0x0000ff00) >> 8, 90 .func = (info & 0x0000ff00) >> 8,
82 .log[0] = (data & 0x18000000) >> 27, 91 .log[0] = (info & 0x18000000) >> 27,
83 .log[1] = (data & 0x60000000) >> 29, 92 .log[1] = (info & 0x60000000) >> 29,
84 .param = !!(data & 0x80000000), 93 .param = !!(info & 0x80000000),
85 }; 94 };
86 } else { 95 } else {
87 u32 data = nv_ro32(bios, entry + 0); 96 u32 info = nv_ro32(bios, data + 0);
88 u8 data1 = nv_ro32(bios, entry + 4); 97 u8 info1 = nv_ro32(bios, data + 4);
89 *gpio = (struct dcb_gpio_func) { 98 *gpio = (struct dcb_gpio_func) {
90 .line = (data & 0x0000003f) >> 0, 99 .line = (info & 0x0000003f) >> 0,
91 .func = (data & 0x0000ff00) >> 8, 100 .func = (info & 0x0000ff00) >> 8,
92 .log[0] = (data1 & 0x30) >> 4, 101 .log[0] = (info1 & 0x30) >> 4,
93 .log[1] = (data1 & 0xc0) >> 6, 102 .log[1] = (info1 & 0xc0) >> 6,
94 .param = !!(data & 0x80000000), 103 .param = !!(info & 0x80000000),
95 }; 104 };
96 } 105 }
106 }
107
108 return data;
109}
97 110
111u16
112dcb_gpio_match(struct nouveau_bios *bios, int idx, u8 func, u8 line,
113 u8 *ver, u8 *len, struct dcb_gpio_func *gpio)
114{
115 u8 hdr, cnt, i = 0;
116 u16 data;
117
118 while ((data = dcb_gpio_parse(bios, idx, i++, ver, len, gpio))) {
98 if ((line == 0xff || line == gpio->line) && 119 if ((line == 0xff || line == gpio->line) &&
99 (func == 0xff || func == gpio->func)) 120 (func == 0xff || func == gpio->func))
100 return 0; 121 return data;
101 } 122 }
102 123
103 /* DCB 2.2, fixed TVDAC GPIO data */ 124 /* DCB 2.2, fixed TVDAC GPIO data */
104 if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len))) { 125 if ((data = dcb_table(bios, ver, &hdr, &cnt, len))) {
105 if (ver >= 0x22 && ver < 0x30 && func == DCB_GPIO_TVDAC0) { 126 if (*ver >= 0x22 && *ver < 0x30 && func == DCB_GPIO_TVDAC0) {
106 u8 conf = nv_ro08(bios, entry - 5); 127 u8 conf = nv_ro08(bios, data - 5);
107 u8 addr = nv_ro08(bios, entry - 4); 128 u8 addr = nv_ro08(bios, data - 4);
108 if (conf & 0x01) { 129 if (conf & 0x01) {
109 *gpio = (struct dcb_gpio_func) { 130 *gpio = (struct dcb_gpio_func) {
110 .func = DCB_GPIO_TVDAC0, 131 .func = DCB_GPIO_TVDAC0,
@@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
112 .log[0] = !!(conf & 0x02), 133 .log[0] = !!(conf & 0x02),
113 .log[1] = !(conf & 0x02), 134 .log[1] = !(conf & 0x02),
114 }; 135 };
115 return 0; 136 *ver = 0x00;
137 return data;
116 } 138 }
117 } 139 }
118 } 140 }
119 141
120 return -EINVAL; 142 return 0x0000;
121} 143}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index ae168bbb86d8..2917d552689b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -2,11 +2,12 @@
2#include <core/device.h> 2#include <core/device.h>
3 3
4#include <subdev/bios.h> 4#include <subdev/bios.h>
5#include <subdev/bios/conn.h>
6#include <subdev/bios/bmp.h> 5#include <subdev/bios/bmp.h>
7#include <subdev/bios/bit.h> 6#include <subdev/bios/bit.h>
7#include <subdev/bios/conn.h>
8#include <subdev/bios/dcb.h> 8#include <subdev/bios/dcb.h>
9#include <subdev/bios/dp.h> 9#include <subdev/bios/dp.h>
10#include <subdev/bios/gpio.h>
10#include <subdev/bios/init.h> 11#include <subdev/bios/init.h>
11#include <subdev/devinit.h> 12#include <subdev/devinit.h>
12#include <subdev/clock.h> 13#include <subdev/clock.h>
@@ -410,9 +411,25 @@ init_ram_restrict_group_count(struct nvbios_init *init)
410} 411}
411 412
412static u8 413static u8
414init_ram_restrict_strap(struct nvbios_init *init)
415{
416 /* This appears to be the behaviour of the VBIOS parser, and *is*
417 * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
418 * avoid fucking up the memory controller (somehow) by reading it
419 * on every INIT_RAM_RESTRICT_ZM_GROUP opcode.
420 *
421 * Preserving the non-caching behaviour on earlier chipsets just
422 * in case *not* re-reading the strap causes similar breakage.
423 */
424 if (!init->ramcfg || init->bios->version.major < 0x70)
425 init->ramcfg = init_rd32(init, 0x101000);
426 return (init->ramcfg & 0x00000003c) >> 2;
427}
428
429static u8
413init_ram_restrict(struct nvbios_init *init) 430init_ram_restrict(struct nvbios_init *init)
414{ 431{
415 u32 strap = (init_rd32(init, 0x101000) & 0x0000003c) >> 2; 432 u8 strap = init_ram_restrict_strap(init);
416 u16 table = init_ram_restrict_table(init); 433 u16 table = init_ram_restrict_table(init);
417 if (table) 434 if (table)
418 return nv_ro08(init->bios, table + strap); 435 return nv_ro08(init->bios, table + strap);
@@ -1781,7 +1798,7 @@ init_gpio(struct nvbios_init *init)
1781 init->offset += 1; 1798 init->offset += 1;
1782 1799
1783 if (init_exec(init) && gpio && gpio->reset) 1800 if (init_exec(init) && gpio && gpio->reset)
1784 gpio->reset(gpio); 1801 gpio->reset(gpio, DCB_GPIO_UNUSED);
1785} 1802}
1786 1803
1787/** 1804/**
@@ -1995,6 +2012,47 @@ init_i2c_long_if(struct nvbios_init *init)
1995 init_exec_set(init, false); 2012 init_exec_set(init, false);
1996} 2013}
1997 2014
2015/**
2016 * INIT_GPIO_NE - opcode 0xa9
2017 *
2018 */
2019static void
2020init_gpio_ne(struct nvbios_init *init)
2021{
2022 struct nouveau_bios *bios = init->bios;
2023 struct nouveau_gpio *gpio = nouveau_gpio(bios);
2024 struct dcb_gpio_func func;
2025 u8 count = nv_ro08(bios, init->offset + 1);
2026 u8 idx = 0, ver, len;
2027 u16 data, i;
2028
2029 trace("GPIO_NE\t");
2030 init->offset += 2;
2031
2032 for (i = init->offset; i < init->offset + count; i++)
2033 cont("0x%02x ", nv_ro08(bios, i));
2034 cont("\n");
2035
2036 while ((data = dcb_gpio_parse(bios, 0, idx++, &ver, &len, &func))) {
2037 if (func.func != DCB_GPIO_UNUSED) {
2038 for (i = init->offset; i < init->offset + count; i++) {
2039 if (func.func == nv_ro08(bios, i))
2040 break;
2041 }
2042
2043 trace("\tFUNC[0x%02x]", func.func);
2044 if (i == (init->offset + count)) {
2045 cont(" *");
2046 if (init_exec(init) && gpio && gpio->reset)
2047 gpio->reset(gpio, func.func);
2048 }
2049 cont("\n");
2050 }
2051 }
2052
2053 init->offset += count;
2054}
2055
1998static struct nvbios_init_opcode { 2056static struct nvbios_init_opcode {
1999 void (*exec)(struct nvbios_init *); 2057 void (*exec)(struct nvbios_init *);
2000} init_opcode[] = { 2058} init_opcode[] = {
@@ -2059,6 +2117,7 @@ static struct nvbios_init_opcode {
2059 [0x98] = { init_auxch }, 2117 [0x98] = { init_auxch },
2060 [0x99] = { init_zm_auxch }, 2118 [0x99] = { init_zm_auxch },
2061 [0x9a] = { init_i2c_long_if }, 2119 [0x9a] = { init_i2c_long_if },
2120 [0xa9] = { init_gpio_ne },
2062}; 2121};
2063 2122
2064#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) 2123#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0]))
diff --git a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
index 9b7881e76634..03a652876e73 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
@@ -109,6 +109,34 @@ nve0_identify(struct nouveau_device *device)
109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
111 break; 111 break;
112 case 0xe6:
113 device->cname = "GK106";
114 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
115 device->oclass[NVDEV_SUBDEV_GPIO ] = &nvd0_gpio_oclass;
116 device->oclass[NVDEV_SUBDEV_I2C ] = &nouveau_i2c_oclass;
117 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
118 device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass;
119 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
120 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass;
121 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
122 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
123 device->oclass[NVDEV_SUBDEV_FB ] = &nvc0_fb_oclass;
124 device->oclass[NVDEV_SUBDEV_LTCG ] = &nvc0_ltcg_oclass;
125 device->oclass[NVDEV_SUBDEV_IBUS ] = &nve0_ibus_oclass;
126 device->oclass[NVDEV_SUBDEV_INSTMEM] = &nv50_instmem_oclass;
127 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
128 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass;
129 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
130 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
131 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
132 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass;
133 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
134 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
135 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
136 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
137 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
138 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
139 break;
112 default: 140 default:
113 nv_fatal(device, "unknown Kepler chipset\n"); 141 nv_fatal(device, "unknown Kepler chipset\n");
114 return -EINVAL; 142 return -EINVAL;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
index acf818c58bf0..9fb0f9b92d49 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
@@ -43,10 +43,15 @@ static int
43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line, 43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line,
44 struct dcb_gpio_func *func) 44 struct dcb_gpio_func *func)
45{ 45{
46 struct nouveau_bios *bios = nouveau_bios(gpio);
47 u8 ver, len;
48 u16 data;
49
46 if (line == 0xff && tag == 0xff) 50 if (line == 0xff && tag == 0xff)
47 return -EINVAL; 51 return -EINVAL;
48 52
49 if (!dcb_gpio_parse(nouveau_bios(gpio), idx, tag, line, func)) 53 data = dcb_gpio_match(bios, idx, tag, line, &ver, &len, func);
54 if (data)
50 return 0; 55 return 0;
51 56
52 /* Apple iMac G4 NV18 */ 57 /* Apple iMac G4 NV18 */
@@ -265,7 +270,7 @@ nouveau_gpio_init(struct nouveau_gpio *gpio)
265 int ret = nouveau_subdev_init(&gpio->base); 270 int ret = nouveau_subdev_init(&gpio->base);
266 if (ret == 0 && gpio->reset) { 271 if (ret == 0 && gpio->reset) {
267 if (dmi_check_system(gpio_reset_ids)) 272 if (dmi_check_system(gpio_reset_ids))
268 gpio->reset(gpio); 273 gpio->reset(gpio, DCB_GPIO_UNUSED);
269 } 274 }
270 return ret; 275 return ret;
271} 276}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
index f3502c961cd9..bf13a1200f26 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
@@ -29,15 +29,15 @@ struct nv50_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nv50_gpio_reset(struct nouveau_gpio *gpio) 32nv50_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nv50_gpio_priv *priv = (void *)gpio; 35 struct nv50_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 static const u32 regs[] = { 0xe100, 0xe28c }; 41 static const u32 regs[] = { 0xe100, 0xe28c };
42 u32 data = nv_ro32(bios, entry); 42 u32 data = nv_ro32(bios, entry);
43 u8 line = (data & 0x0000001f); 43 u8 line = (data & 0x0000001f);
@@ -48,7 +48,8 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)
48 u32 val = (unk1 << 16) | unk0; 48 u32 val = (unk1 << 16) | unk0;
49 u32 reg = regs[line >> 4]; line &= 0x0f; 49 u32 reg = regs[line >> 4]; line &= 0x0f;
50 50
51 if (func == 0xff) 51 if ( func == DCB_GPIO_UNUSED ||
52 (match != DCB_GPIO_UNUSED && match != func))
52 continue; 53 continue;
53 54
54 gpio->set(gpio, 0, func, line, defs); 55 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
index 8d18fcad26e0..83e8b8f16e6a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
@@ -29,15 +29,15 @@ struct nvd0_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nvd0_gpio_reset(struct nouveau_gpio *gpio) 32nvd0_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nvd0_gpio_priv *priv = (void *)gpio; 35 struct nvd0_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 u32 data = nv_ro32(bios, entry); 41 u32 data = nv_ro32(bios, entry);
42 u8 line = (data & 0x0000003f); 42 u8 line = (data & 0x0000003f);
43 u8 defs = !!(data & 0x00000080); 43 u8 defs = !!(data & 0x00000080);
@@ -45,7 +45,8 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)
45 u8 unk0 = (data & 0x00ff0000) >> 16; 45 u8 unk0 = (data & 0x00ff0000) >> 16;
46 u8 unk1 = (data & 0x1f000000) >> 24; 46 u8 unk1 = (data & 0x1f000000) >> 24;
47 47
48 if (func == 0xff) 48 if ( func == DCB_GPIO_UNUSED ||
49 (match != DCB_GPIO_UNUSED && match != func))
49 continue; 50 continue;
50 51
51 gpio->set(gpio, 0, func, line, defs); 52 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
index 93e3ddf7303a..e286e132c7e7 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
@@ -260,7 +260,7 @@ nouveau_mxm_create_(struct nouveau_object *parent,
260 260
261 data = mxm_table(bios, &ver, &len); 261 data = mxm_table(bios, &ver, &len);
262 if (!data || !(ver = nv_ro08(bios, data))) { 262 if (!data || !(ver = nv_ro08(bios, data))) {
263 nv_info(mxm, "no VBIOS data, nothing to do\n"); 263 nv_debug(mxm, "no VBIOS data, nothing to do\n");
264 return 0; 264 return 0;
265 } 265 }
266 266
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 74c6b42d2597..7a445666e71f 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2654,6 +2654,35 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
2654 ib[idx+4] = upper_32_bits(offset) & 0xff; 2654 ib[idx+4] = upper_32_bits(offset) & 0xff;
2655 } 2655 }
2656 break; 2656 break;
2657 case PACKET3_MEM_WRITE:
2658 {
2659 u64 offset;
2660
2661 if (pkt->count != 3) {
2662 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2663 return -EINVAL;
2664 }
2665 r = evergreen_cs_packet_next_reloc(p, &reloc);
2666 if (r) {
2667 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2668 return -EINVAL;
2669 }
2670 offset = radeon_get_ib_value(p, idx+0);
2671 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2672 if (offset & 0x7) {
2673 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2674 return -EINVAL;
2675 }
2676 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2677 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2678 offset + 8, radeon_bo_size(reloc->robj));
2679 return -EINVAL;
2680 }
2681 offset += reloc->lobj.gpu_offset;
2682 ib[idx+0] = offset;
2683 ib[idx+1] = upper_32_bits(offset) & 0xff;
2684 break;
2685 }
2657 case PACKET3_COPY_DW: 2686 case PACKET3_COPY_DW:
2658 if (pkt->count != 4) { 2687 if (pkt->count != 4) {
2659 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2688 DRM_ERROR("bad COPY_DW (invalid count)\n");
@@ -3287,6 +3316,7 @@ static bool evergreen_vm_reg_valid(u32 reg)
3287 3316
3288 /* check config regs */ 3317 /* check config regs */
3289 switch (reg) { 3318 switch (reg) {
3319 case WAIT_UNTIL:
3290 case GRBM_GFX_INDEX: 3320 case GRBM_GFX_INDEX:
3291 case CP_STRMOUT_CNTL: 3321 case CP_STRMOUT_CNTL:
3292 case CP_COHER_CNTL: 3322 case CP_COHER_CNTL:
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0be768be530c..9ea13d07cc55 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2294,6 +2294,35 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
2294 ib[idx+4] = upper_32_bits(offset) & 0xff; 2294 ib[idx+4] = upper_32_bits(offset) & 0xff;
2295 } 2295 }
2296 break; 2296 break;
2297 case PACKET3_MEM_WRITE:
2298 {
2299 u64 offset;
2300
2301 if (pkt->count != 3) {
2302 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2303 return -EINVAL;
2304 }
2305 r = r600_cs_packet_next_reloc(p, &reloc);
2306 if (r) {
2307 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2308 return -EINVAL;
2309 }
2310 offset = radeon_get_ib_value(p, idx+0);
2311 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2312 if (offset & 0x7) {
2313 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2314 return -EINVAL;
2315 }
2316 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2317 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2318 offset + 8, radeon_bo_size(reloc->robj));
2319 return -EINVAL;
2320 }
2321 offset += reloc->lobj.gpu_offset;
2322 ib[idx+0] = offset;
2323 ib[idx+1] = upper_32_bits(offset) & 0xff;
2324 break;
2325 }
2297 case PACKET3_COPY_DW: 2326 case PACKET3_COPY_DW:
2298 if (pkt->count != 4) { 2327 if (pkt->count != 4) {
2299 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2328 DRM_ERROR("bad COPY_DW (invalid count)\n");
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5dc744d43d12..9b9422c4403a 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -225,12 +225,13 @@ struct radeon_fence {
225int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); 225int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
226int radeon_fence_driver_init(struct radeon_device *rdev); 226int radeon_fence_driver_init(struct radeon_device *rdev);
227void radeon_fence_driver_fini(struct radeon_device *rdev); 227void radeon_fence_driver_fini(struct radeon_device *rdev);
228void radeon_fence_driver_force_completion(struct radeon_device *rdev);
228int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring); 229int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring);
229void radeon_fence_process(struct radeon_device *rdev, int ring); 230void radeon_fence_process(struct radeon_device *rdev, int ring);
230bool radeon_fence_signaled(struct radeon_fence *fence); 231bool radeon_fence_signaled(struct radeon_fence *fence);
231int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); 232int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
232int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring); 233int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring);
233void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring); 234int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
234int radeon_fence_wait_any(struct radeon_device *rdev, 235int radeon_fence_wait_any(struct radeon_device *rdev,
235 struct radeon_fence **fences, 236 struct radeon_fence **fences,
236 bool intr); 237 bool intr);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 49b06590001e..cd756262924d 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1164,6 +1164,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1164 struct drm_crtc *crtc; 1164 struct drm_crtc *crtc;
1165 struct drm_connector *connector; 1165 struct drm_connector *connector;
1166 int i, r; 1166 int i, r;
1167 bool force_completion = false;
1167 1168
1168 if (dev == NULL || dev->dev_private == NULL) { 1169 if (dev == NULL || dev->dev_private == NULL) {
1169 return -ENODEV; 1170 return -ENODEV;
@@ -1206,8 +1207,16 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1206 1207
1207 mutex_lock(&rdev->ring_lock); 1208 mutex_lock(&rdev->ring_lock);
1208 /* wait for gpu to finish processing current batch */ 1209 /* wait for gpu to finish processing current batch */
1209 for (i = 0; i < RADEON_NUM_RINGS; i++) 1210 for (i = 0; i < RADEON_NUM_RINGS; i++) {
1210 radeon_fence_wait_empty_locked(rdev, i); 1211 r = radeon_fence_wait_empty_locked(rdev, i);
1212 if (r) {
1213 /* delay GPU reset to resume */
1214 force_completion = true;
1215 }
1216 }
1217 if (force_completion) {
1218 radeon_fence_driver_force_completion(rdev);
1219 }
1211 mutex_unlock(&rdev->ring_lock); 1220 mutex_unlock(&rdev->ring_lock);
1212 1221
1213 radeon_save_bios_scratch_regs(rdev); 1222 radeon_save_bios_scratch_regs(rdev);
@@ -1338,7 +1347,6 @@ retry:
1338 } 1347 }
1339 1348
1340 radeon_restore_bios_scratch_regs(rdev); 1349 radeon_restore_bios_scratch_regs(rdev);
1341 drm_helper_resume_force_mode(rdev->ddev);
1342 1350
1343 if (!r) { 1351 if (!r) {
1344 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1352 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
@@ -1358,11 +1366,14 @@ retry:
1358 } 1366 }
1359 } 1367 }
1360 } else { 1368 } else {
1369 radeon_fence_driver_force_completion(rdev);
1361 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1370 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
1362 kfree(ring_data[i]); 1371 kfree(ring_data[i]);
1363 } 1372 }
1364 } 1373 }
1365 1374
1375 drm_helper_resume_force_mode(rdev->ddev);
1376
1366 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); 1377 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
1367 if (r) { 1378 if (r) {
1368 /* bad news, how to tell it to userspace ? */ 1379 /* bad news, how to tell it to userspace ? */
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 9b1a727d3c9e..ff7593498a74 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -68,9 +68,10 @@
68 * 2.25.0 - eg+: new info request for num SE and num SH 68 * 2.25.0 - eg+: new info request for num SE and num SH
69 * 2.26.0 - r600-eg: fix htile size computation 69 * 2.26.0 - r600-eg: fix htile size computation
70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA 70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA
71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
71 */ 72 */
72#define KMS_DRIVER_MAJOR 2 73#define KMS_DRIVER_MAJOR 2
73#define KMS_DRIVER_MINOR 27 74#define KMS_DRIVER_MINOR 28
74#define KMS_DRIVER_PATCHLEVEL 0 75#define KMS_DRIVER_PATCHLEVEL 0
75int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 76int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
76int radeon_driver_unload_kms(struct drm_device *dev); 77int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 410a975a8eec..34356252567a 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -609,26 +609,20 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
609 * Returns 0 if the fences have passed, error for all other cases. 609 * Returns 0 if the fences have passed, error for all other cases.
610 * Caller must hold ring lock. 610 * Caller must hold ring lock.
611 */ 611 */
612void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring) 612int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)
613{ 613{
614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring]; 614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring];
615 int r;
615 616
616 while(1) { 617 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
617 int r; 618 if (r) {
618 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
619 if (r == -EDEADLK) { 619 if (r == -EDEADLK) {
620 mutex_unlock(&rdev->ring_lock); 620 return -EDEADLK;
621 r = radeon_gpu_reset(rdev);
622 mutex_lock(&rdev->ring_lock);
623 if (!r)
624 continue;
625 }
626 if (r) {
627 dev_err(rdev->dev, "error waiting for ring to become"
628 " idle (%d)\n", r);
629 } 621 }
630 return; 622 dev_err(rdev->dev, "error waiting for ring[%d] to become idle (%d)\n",
623 ring, r);
631 } 624 }
625 return 0;
632} 626}
633 627
634/** 628/**
@@ -854,13 +848,17 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
854 */ 848 */
855void radeon_fence_driver_fini(struct radeon_device *rdev) 849void radeon_fence_driver_fini(struct radeon_device *rdev)
856{ 850{
857 int ring; 851 int ring, r;
858 852
859 mutex_lock(&rdev->ring_lock); 853 mutex_lock(&rdev->ring_lock);
860 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { 854 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
861 if (!rdev->fence_drv[ring].initialized) 855 if (!rdev->fence_drv[ring].initialized)
862 continue; 856 continue;
863 radeon_fence_wait_empty_locked(rdev, ring); 857 r = radeon_fence_wait_empty_locked(rdev, ring);
858 if (r) {
859 /* no need to trigger GPU reset as we are unloading */
860 radeon_fence_driver_force_completion(rdev);
861 }
864 wake_up_all(&rdev->fence_queue); 862 wake_up_all(&rdev->fence_queue);
865 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg); 863 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg);
866 rdev->fence_drv[ring].initialized = false; 864 rdev->fence_drv[ring].initialized = false;
@@ -868,6 +866,25 @@ void radeon_fence_driver_fini(struct radeon_device *rdev)
868 mutex_unlock(&rdev->ring_lock); 866 mutex_unlock(&rdev->ring_lock);
869} 867}
870 868
869/**
870 * radeon_fence_driver_force_completion - force all fence waiter to complete
871 *
872 * @rdev: radeon device pointer
873 *
874 * In case of GPU reset failure make sure no process keep waiting on fence
875 * that will never complete.
876 */
877void radeon_fence_driver_force_completion(struct radeon_device *rdev)
878{
879 int ring;
880
881 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
882 if (!rdev->fence_drv[ring].initialized)
883 continue;
884 radeon_fence_write(rdev, rdev->fence_drv[ring].sync_seq[ring], ring);
885 }
886}
887
871 888
872/* 889/*
873 * Fence debugfs 890 * Fence debugfs
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index aa14dbb7e4fb..0bfa656aa87d 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -234,7 +234,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
234 234
235static void radeon_pm_set_clocks(struct radeon_device *rdev) 235static void radeon_pm_set_clocks(struct radeon_device *rdev)
236{ 236{
237 int i; 237 int i, r;
238 238
239 /* no need to take locks, etc. if nothing's going to change */ 239 /* no need to take locks, etc. if nothing's going to change */
240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && 240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
@@ -248,8 +248,17 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
248 /* wait for the rings to drain */ 248 /* wait for the rings to drain */
249 for (i = 0; i < RADEON_NUM_RINGS; i++) { 249 for (i = 0; i < RADEON_NUM_RINGS; i++) {
250 struct radeon_ring *ring = &rdev->ring[i]; 250 struct radeon_ring *ring = &rdev->ring[i];
251 if (ring->ready) 251 if (!ring->ready) {
252 radeon_fence_wait_empty_locked(rdev, i); 252 continue;
253 }
254 r = radeon_fence_wait_empty_locked(rdev, i);
255 if (r) {
256 /* needs a GPU reset dont reset here */
257 mutex_unlock(&rdev->ring_lock);
258 up_write(&rdev->pm.mclk_lock);
259 mutex_unlock(&rdev->ddev->struct_mutex);
260 return;
261 }
253 } 262 }
254 263
255 radeon_unmap_vram_bos(rdev); 264 radeon_unmap_vram_bos(rdev);
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 074410371e2a..656b2e3334a6 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,
102 ((mode->hsync_end - mode->hsync_start) << 0); 102 ((mode->hsync_end - mode->hsync_start) << 0);
103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH); 103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH);
104 104
105 value = ((mode->vsync_start - mode->vdisplay) << 16) |
106 ((mode->hsync_start - mode->hdisplay) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vtotal - mode->vsync_end) << 16) | 105 value = ((mode->vtotal - mode->vsync_end) << 16) |
110 ((mode->htotal - mode->hsync_end) << 0); 106 ((mode->htotal - mode->hsync_end) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vsync_start - mode->vdisplay) << 16) |
110 ((mode->hsync_start - mode->hdisplay) << 0);
111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH); 111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);
112 112
113 value = (mode->vdisplay << 16) | mode->hdisplay; 113 value = (mode->vdisplay << 16) | mode->hdisplay;
@@ -221,8 +221,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc,
221 win.stride = crtc->fb->pitches[0]; 221 win.stride = crtc->fb->pitches[0];
222 222
223 /* program window registers */ 223 /* program window registers */
224 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_WINDOW_HEADER); 224 value = WINDOW_A_SELECT;
225 value |= WINDOW_A_SELECT;
226 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); 225 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER);
227 226
228 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH); 227 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH);
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 3a843a77ddc7..741b5dc2742c 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -204,24 +204,6 @@ extern int tegra_output_parse_dt(struct tegra_output *output);
204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output); 204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output);
205extern int tegra_output_exit(struct tegra_output *output); 205extern int tegra_output_exit(struct tegra_output *output);
206 206
207/* from gem.c */
208extern struct tegra_gem_object *tegra_gem_alloc(struct drm_device *drm,
209 size_t size);
210extern int tegra_gem_handle_create(struct drm_device *drm,
211 struct drm_file *file, size_t size,
212 unsigned long flags, uint32_t *handle);
213extern int tegra_gem_dumb_create(struct drm_file *file, struct drm_device *drm,
214 struct drm_mode_create_dumb *args);
215extern int tegra_gem_dumb_map_offset(struct drm_file *file,
216 struct drm_device *drm, uint32_t handle,
217 uint64_t *offset);
218extern int tegra_gem_dumb_destroy(struct drm_file *file,
219 struct drm_device *drm, uint32_t handle);
220extern int tegra_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
221extern int tegra_gem_init_object(struct drm_gem_object *obj);
222extern void tegra_gem_free_object(struct drm_gem_object *obj);
223extern struct vm_operations_struct tegra_gem_vm_ops;
224
225/* from fb.c */ 207/* from fb.c */
226extern int tegra_drm_fb_init(struct drm_device *drm); 208extern int tegra_drm_fb_init(struct drm_device *drm);
227extern void tegra_drm_fb_exit(struct drm_device *drm); 209extern void tegra_drm_fb_exit(struct drm_device *drm);
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index ab4016412bbf..e060c7e6434d 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -149,7 +149,7 @@ struct tmds_config {
149}; 149};
150 150
151static const struct tmds_config tegra2_tmds_config[] = { 151static const struct tmds_config tegra2_tmds_config[] = {
152 { /* 480p modes */ 152 { /* slow pixel clock modes */
153 .pclk = 27000000, 153 .pclk = 27000000,
154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) | 155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) |
@@ -163,21 +163,8 @@ static const struct tmds_config tegra2_tmds_config[] = {
163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) | 163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) | 164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA), 165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
166 }, { /* 720p modes */ 166 },
167 .pclk = 74250000, 167 { /* high pixel clock modes */
168 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
169 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
170 SOR_PLL_TX_REG_LOAD(3),
171 .pll1 = SOR_PLL_TMDS_TERM_ENABLE | SOR_PLL_PE_EN,
172 .pe_current = PE_CURRENT0(PE_CURRENT_6_0_mA) |
173 PE_CURRENT1(PE_CURRENT_6_0_mA) |
174 PE_CURRENT2(PE_CURRENT_6_0_mA) |
175 PE_CURRENT3(PE_CURRENT_6_0_mA),
176 .drive_current = DRIVE_CURRENT_LANE0(DRIVE_CURRENT_7_125_mA) |
177 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
178 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
179 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
180 }, { /* 1080p modes */
181 .pclk = UINT_MAX, 168 .pclk = UINT_MAX,
182 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 169 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
183 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) | 170 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
@@ -479,7 +466,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
479 return; 466 return;
480 } 467 }
481 468
482 h_front_porch = mode->htotal - mode->hsync_end; 469 h_front_porch = mode->hsync_start - mode->hdisplay;
483 memset(&frame, 0, sizeof(frame)); 470 memset(&frame, 0, sizeof(frame));
484 frame.r = HDMI_AVI_R_SAME; 471 frame.r = HDMI_AVI_R_SAME;
485 472
@@ -634,8 +621,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
634 621
635 pclk = mode->clock * 1000; 622 pclk = mode->clock * 1000;
636 h_sync_width = mode->hsync_end - mode->hsync_start; 623 h_sync_width = mode->hsync_end - mode->hsync_start;
637 h_front_porch = mode->htotal - mode->hsync_end; 624 h_back_porch = mode->htotal - mode->hsync_end;
638 h_back_porch = mode->hsync_start - mode->hdisplay; 625 h_front_porch = mode->hsync_start - mode->hdisplay;
639 626
640 err = regulator_enable(hdmi->vdd); 627 err = regulator_enable(hdmi->vdd);
641 if (err < 0) { 628 if (err < 0) {
diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c
index bdb97a564d82..5d17b113a6fc 100644
--- a/drivers/gpu/drm/tegra/host1x.c
+++ b/drivers/gpu/drm/tegra/host1x.c
@@ -239,6 +239,8 @@ int host1x_register_client(struct host1x *host1x, struct host1x_client *client)
239 } 239 }
240 } 240 }
241 241
242 client->host1x = host1x;
243
242 return 0; 244 return 0;
243} 245}
244 246
diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
index a98c917b5888..789bd4fb329b 100644
--- a/drivers/hwmon/emc6w201.c
+++ b/drivers/hwmon/emc6w201.c
@@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)
187 * Sysfs callback functions 187 * Sysfs callback functions
188 */ 188 */
189 189
190static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 }; 190static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
191 191
192static ssize_t show_in(struct device *dev, struct device_attribute *devattr, 192static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
193 char *buf) 193 char *buf)
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 8fa2632cbbaf..7272176a9ec7 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
49 struct i2c_client *client = to_i2c_client(dev); 49 struct i2c_client *client = to_i2c_client(dev);
50 long temp; 50 long temp;
51 short value; 51 short value;
52 s32 err;
52 53
53 int status = kstrtol(buf, 10, &temp); 54 int status = kstrtol(buf, 10, &temp);
54 if (status < 0) 55 if (status < 0)
@@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
57 /* Write value */ 58 /* Write value */
58 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4), 59 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4),
59 (LM73_TEMP_MAX*4)) << 5; 60 (LM73_TEMP_MAX*4)) << 5;
60 i2c_smbus_write_word_swapped(client, attr->index, value); 61 err = i2c_smbus_write_word_swapped(client, attr->index, value);
61 return count; 62 return (err < 0) ? err : count;
62} 63}
63 64
64static ssize_t show_temp(struct device *dev, struct device_attribute *da, 65static ssize_t show_temp(struct device *dev, struct device_attribute *da,
@@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
66{ 67{
67 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 68 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
68 struct i2c_client *client = to_i2c_client(dev); 69 struct i2c_client *client = to_i2c_client(dev);
70 int temp;
71
72 s32 err = i2c_smbus_read_word_swapped(client, attr->index);
73 if (err < 0)
74 return err;
75
69 /* use integer division instead of equivalent right shift to 76 /* use integer division instead of equivalent right shift to
70 guarantee arithmetic shift and preserve the sign */ 77 guarantee arithmetic shift and preserve the sign */
71 int temp = ((s16) (i2c_smbus_read_word_swapped(client, 78 temp = (((s16) err) * 250) / 32;
72 attr->index))*250) / 32; 79 return scnprintf(buf, PAGE_SIZE, "%d\n", temp);
73 return sprintf(buf, "%d\n", temp);
74} 80}
75 81
76 82
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 125cd8e0ad25..3f491815e2c4 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -139,7 +139,7 @@ static unsigned short ali1535_offset;
139 Note the differences between kernels with the old PCI BIOS interface and 139 Note the differences between kernels with the old PCI BIOS interface and
140 newer kernels with the real PCI interface. In compat.h some things are 140 newer kernels with the real PCI interface. In compat.h some things are
141 defined to make the transition easier. */ 141 defined to make the transition easier. */
142static int __devinit ali1535_setup(struct pci_dev *dev) 142static int ali1535_setup(struct pci_dev *dev)
143{ 143{
144 int retval; 144 int retval;
145 unsigned char temp; 145 unsigned char temp;
@@ -502,7 +502,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
502 502
503MODULE_DEVICE_TABLE(pci, ali1535_ids); 503MODULE_DEVICE_TABLE(pci, ali1535_ids);
504 504
505static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) 505static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
506{ 506{
507 if (ali1535_setup(dev)) { 507 if (ali1535_setup(dev)) {
508 dev_warn(&dev->dev, 508 dev_warn(&dev->dev,
@@ -518,7 +518,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
518 return i2c_add_adapter(&ali1535_adapter); 518 return i2c_add_adapter(&ali1535_adapter);
519} 519}
520 520
521static void __devexit ali1535_remove(struct pci_dev *dev) 521static void ali1535_remove(struct pci_dev *dev)
522{ 522{
523 i2c_del_adapter(&ali1535_adapter); 523 i2c_del_adapter(&ali1535_adapter);
524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE); 524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
@@ -528,7 +528,7 @@ static struct pci_driver ali1535_driver = {
528 .name = "ali1535_smbus", 528 .name = "ali1535_smbus",
529 .id_table = ali1535_ids, 529 .id_table = ali1535_ids,
530 .probe = ali1535_probe, 530 .probe = ali1535_probe,
531 .remove = __devexit_p(ali1535_remove), 531 .remove = ali1535_remove,
532}; 532};
533 533
534module_pci_driver(ali1535_driver); 534module_pci_driver(ali1535_driver);
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
index e02d9f86c6a0..84ccd9496a5e 100644
--- a/drivers/i2c/busses/i2c-ali1563.c
+++ b/drivers/i2c/busses/i2c-ali1563.c
@@ -326,7 +326,7 @@ static u32 ali1563_func(struct i2c_adapter * a)
326} 326}
327 327
328 328
329static int __devinit ali1563_setup(struct pci_dev * dev) 329static int ali1563_setup(struct pci_dev *dev)
330{ 330{
331 u16 ctrl; 331 u16 ctrl;
332 332
@@ -390,8 +390,8 @@ static struct i2c_adapter ali1563_adapter = {
390 .algo = &ali1563_algorithm, 390 .algo = &ali1563_algorithm,
391}; 391};
392 392
393static int __devinit ali1563_probe(struct pci_dev * dev, 393static int ali1563_probe(struct pci_dev *dev,
394 const struct pci_device_id * id_table) 394 const struct pci_device_id *id_table)
395{ 395{
396 int error; 396 int error;
397 397
@@ -411,7 +411,7 @@ exit:
411 return error; 411 return error;
412} 412}
413 413
414static void __devexit ali1563_remove(struct pci_dev * dev) 414static void ali1563_remove(struct pci_dev *dev)
415{ 415{
416 i2c_del_adapter(&ali1563_adapter); 416 i2c_del_adapter(&ali1563_adapter);
417 ali1563_shutdown(dev); 417 ali1563_shutdown(dev);
@@ -428,7 +428,7 @@ static struct pci_driver ali1563_pci_driver = {
428 .name = "ali1563_smbus", 428 .name = "ali1563_smbus",
429 .id_table = ali1563_id_table, 429 .id_table = ali1563_id_table,
430 .probe = ali1563_probe, 430 .probe = ali1563_probe,
431 .remove = __devexit_p(ali1563_remove), 431 .remove = ali1563_remove,
432}; 432};
433 433
434module_pci_driver(ali1563_pci_driver); 434module_pci_driver(ali1563_pci_driver);
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index ce8d26d053a5..26bcc6127cee 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -131,7 +131,7 @@ MODULE_PARM_DESC(force_addr,
131static struct pci_driver ali15x3_driver; 131static struct pci_driver ali15x3_driver;
132static unsigned short ali15x3_smba; 132static unsigned short ali15x3_smba;
133 133
134static int __devinit ali15x3_setup(struct pci_dev *ALI15X3_dev) 134static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
135{ 135{
136 u16 a; 136 u16 a;
137 unsigned char temp; 137 unsigned char temp;
@@ -484,7 +484,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali15x3_ids) = {
484 484
485MODULE_DEVICE_TABLE (pci, ali15x3_ids); 485MODULE_DEVICE_TABLE (pci, ali15x3_ids);
486 486
487static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) 487static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
488{ 488{
489 if (ali15x3_setup(dev)) { 489 if (ali15x3_setup(dev)) {
490 dev_err(&dev->dev, 490 dev_err(&dev->dev,
@@ -500,7 +500,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
500 return i2c_add_adapter(&ali15x3_adapter); 500 return i2c_add_adapter(&ali15x3_adapter);
501} 501}
502 502
503static void __devexit ali15x3_remove(struct pci_dev *dev) 503static void ali15x3_remove(struct pci_dev *dev)
504{ 504{
505 i2c_del_adapter(&ali15x3_adapter); 505 i2c_del_adapter(&ali15x3_adapter);
506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
@@ -510,7 +510,7 @@ static struct pci_driver ali15x3_driver = {
510 .name = "ali15x3_smbus", 510 .name = "ali15x3_smbus",
511 .id_table = ali15x3_ids, 511 .id_table = ali15x3_ids,
512 .probe = ali15x3_probe, 512 .probe = ali15x3_probe,
513 .remove = __devexit_p(ali15x3_remove), 513 .remove = ali15x3_remove,
514}; 514};
515 515
516module_pci_driver(ali15x3_driver); 516module_pci_driver(ali15x3_driver);
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 304aa03b57b2..e13e2aa2d05d 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -324,8 +324,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd756_ids) = {
324 324
325MODULE_DEVICE_TABLE (pci, amd756_ids); 325MODULE_DEVICE_TABLE (pci, amd756_ids);
326 326
327static int __devinit amd756_probe(struct pci_dev *pdev, 327static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)
328 const struct pci_device_id *id)
329{ 328{
330 int nforce = (id->driver_data == NFORCE); 329 int nforce = (id->driver_data == NFORCE);
331 int error; 330 int error;
@@ -397,7 +396,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
397 return error; 396 return error;
398} 397}
399 398
400static void __devexit amd756_remove(struct pci_dev *dev) 399static void amd756_remove(struct pci_dev *dev)
401{ 400{
402 i2c_del_adapter(&amd756_smbus); 401 i2c_del_adapter(&amd756_smbus);
403 release_region(amd756_ioport, SMB_IOSIZE); 402 release_region(amd756_ioport, SMB_IOSIZE);
@@ -407,7 +406,7 @@ static struct pci_driver amd756_driver = {
407 .name = "amd756_smbus", 406 .name = "amd756_smbus",
408 .id_table = amd756_ids, 407 .id_table = amd756_ids,
409 .probe = amd756_probe, 408 .probe = amd756_probe,
410 .remove = __devexit_p(amd756_remove), 409 .remove = amd756_remove,
411}; 410};
412 411
413module_pci_driver(amd756_driver); 412module_pci_driver(amd756_driver);
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0919ac1d99aa..a44e6e77c5a1 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -422,8 +422,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd8111_ids) = {
422 422
423MODULE_DEVICE_TABLE (pci, amd8111_ids); 423MODULE_DEVICE_TABLE (pci, amd8111_ids);
424 424
425static int __devinit amd8111_probe(struct pci_dev *dev, 425static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
426 const struct pci_device_id *id)
427{ 426{
428 struct amd_smbus *smbus; 427 struct amd_smbus *smbus;
429 int error; 428 int error;
@@ -475,7 +474,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
475 return error; 474 return error;
476} 475}
477 476
478static void __devexit amd8111_remove(struct pci_dev *dev) 477static void amd8111_remove(struct pci_dev *dev)
479{ 478{
480 struct amd_smbus *smbus = pci_get_drvdata(dev); 479 struct amd_smbus *smbus = pci_get_drvdata(dev);
481 480
@@ -488,7 +487,7 @@ static struct pci_driver amd8111_driver = {
488 .name = "amd8111_smbus2", 487 .name = "amd8111_smbus2",
489 .id_table = amd8111_ids, 488 .id_table = amd8111_ids,
490 .probe = amd8111_probe, 489 .probe = amd8111_probe,
491 .remove = __devexit_p(amd8111_remove), 490 .remove = amd8111_remove,
492}; 491};
493 492
494module_pci_driver(amd8111_driver); 493module_pci_driver(amd8111_driver);
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index b4575ee4bdf3..2bfc04d0a1b1 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -145,7 +145,7 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)
145 * Calculate symmetric clock as stated in datasheet: 145 * Calculate symmetric clock as stated in datasheet:
146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset)) 146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset))
147 */ 147 */
148static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk) 148static void at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
149{ 149{
150 int ckdiv, cdiv, div; 150 int ckdiv, cdiv, div;
151 struct at91_twi_pdata *pdata = dev->pdata; 151 struct at91_twi_pdata *pdata = dev->pdata;
@@ -604,7 +604,7 @@ MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
604#define atmel_twi_dt_ids NULL 604#define atmel_twi_dt_ids NULL
605#endif 605#endif
606 606
607static bool __devinit filter(struct dma_chan *chan, void *slave) 607static bool filter(struct dma_chan *chan, void *slave)
608{ 608{
609 struct at_dma_slave *sl = slave; 609 struct at_dma_slave *sl = slave;
610 610
@@ -616,7 +616,7 @@ static bool __devinit filter(struct dma_chan *chan, void *slave)
616 } 616 }
617} 617}
618 618
619static int __devinit at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) 619static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)
620{ 620{
621 int ret = 0; 621 int ret = 0;
622 struct at_dma_slave *sdata; 622 struct at_dma_slave *sdata;
@@ -688,7 +688,7 @@ error:
688 return ret; 688 return ret;
689} 689}
690 690
691static struct at91_twi_pdata * __devinit at91_twi_get_driver_data( 691static struct at91_twi_pdata *at91_twi_get_driver_data(
692 struct platform_device *pdev) 692 struct platform_device *pdev)
693{ 693{
694 if (pdev->dev.of_node) { 694 if (pdev->dev.of_node) {
@@ -701,7 +701,7 @@ static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data; 701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;
702} 702}
703 703
704static int __devinit at91_twi_probe(struct platform_device *pdev) 704static int at91_twi_probe(struct platform_device *pdev)
705{ 705{
706 struct at91_twi_dev *dev; 706 struct at91_twi_dev *dev;
707 struct resource *mem; 707 struct resource *mem;
@@ -779,7 +779,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
779 return 0; 779 return 0;
780} 780}
781 781
782static int __devexit at91_twi_remove(struct platform_device *pdev) 782static int at91_twi_remove(struct platform_device *pdev)
783{ 783{
784 struct at91_twi_dev *dev = platform_get_drvdata(pdev); 784 struct at91_twi_dev *dev = platform_get_drvdata(pdev);
785 int rc; 785 int rc;
@@ -820,7 +820,7 @@ static const struct dev_pm_ops at91_twi_pm = {
820 820
821static struct platform_driver at91_twi_driver = { 821static struct platform_driver at91_twi_driver = {
822 .probe = at91_twi_probe, 822 .probe = at91_twi_probe,
823 .remove = __devexit_p(at91_twi_remove), 823 .remove = at91_twi_remove,
824 .id_table = at91_twi_devtypes, 824 .id_table = at91_twi_devtypes,
825 .driver = { 825 .driver = {
826 .name = "at91_i2c", 826 .name = "at91_i2c",
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 582d616db346..b278298787d7 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -313,7 +313,7 @@ static void i2c_au1550_disable(struct i2c_au1550_data *priv)
313 * Prior to calling us, the 50MHz clock frequency and routing 313 * Prior to calling us, the 50MHz clock frequency and routing
314 * must have been set up for the PSC indicated by the adapter. 314 * must have been set up for the PSC indicated by the adapter.
315 */ 315 */
316static int __devinit 316static int
317i2c_au1550_probe(struct platform_device *pdev) 317i2c_au1550_probe(struct platform_device *pdev)
318{ 318{
319 struct i2c_au1550_data *priv; 319 struct i2c_au1550_data *priv;
@@ -372,7 +372,7 @@ out:
372 return ret; 372 return ret;
373} 373}
374 374
375static int __devexit i2c_au1550_remove(struct platform_device *pdev) 375static int i2c_au1550_remove(struct platform_device *pdev)
376{ 376{
377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev); 377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
378 378
@@ -423,7 +423,7 @@ static struct platform_driver au1xpsc_smbus_driver = {
423 .pm = AU1XPSC_SMBUS_PMOPS, 423 .pm = AU1XPSC_SMBUS_PMOPS,
424 }, 424 },
425 .probe = i2c_au1550_probe, 425 .probe = i2c_au1550_probe,
426 .remove = __devexit_p(i2c_au1550_remove), 426 .remove = i2c_au1550_remove,
427}; 427};
428 428
429module_platform_driver(au1xpsc_smbus_driver); 429module_platform_driver(au1xpsc_smbus_driver);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096ba069..2e79c1024191 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -426,7 +426,7 @@ static const struct i2c_adapter cpm_ops = {
426 .algo = &cpm_i2c_algo, 426 .algo = &cpm_i2c_algo,
427}; 427};
428 428
429static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) 429static int cpm_i2c_setup(struct cpm_i2c *cpm)
430{ 430{
431 struct platform_device *ofdev = cpm->ofdev; 431 struct platform_device *ofdev = cpm->ofdev;
432 const u32 *data; 432 const u32 *data;
@@ -634,7 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
634 cpm_muram_free(cpm->i2c_addr); 634 cpm_muram_free(cpm->i2c_addr);
635} 635}
636 636
637static int __devinit cpm_i2c_probe(struct platform_device *ofdev) 637static int cpm_i2c_probe(struct platform_device *ofdev)
638{ 638{
639 int result, len; 639 int result, len;
640 struct cpm_i2c *cpm; 640 struct cpm_i2c *cpm;
@@ -688,7 +688,7 @@ out_free:
688 return result; 688 return result;
689} 689}
690 690
691static int __devexit cpm_i2c_remove(struct platform_device *ofdev) 691static int cpm_i2c_remove(struct platform_device *ofdev)
692{ 692{
693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); 693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev);
694 694
@@ -716,7 +716,7 @@ MODULE_DEVICE_TABLE(of, cpm_i2c_match);
716 716
717static struct platform_driver cpm_i2c_driver = { 717static struct platform_driver cpm_i2c_driver = {
718 .probe = cpm_i2c_probe, 718 .probe = cpm_i2c_probe,
719 .remove = __devexit_p(cpm_i2c_remove), 719 .remove = cpm_i2c_remove,
720 .driver = { 720 .driver = {
721 .name = "fsl-i2c-cpm", 721 .name = "fsl-i2c-cpm",
722 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 92a1e2c15baa..6add851e9dee 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -207,7 +207,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
207 return dev->controller->clk_khz; 207 return dev->controller->clk_khz;
208} 208}
209 209
210static int __devinit i2c_dw_pci_probe(struct pci_dev *pdev, 210static int i2c_dw_pci_probe(struct pci_dev *pdev,
211const struct pci_device_id *id) 211const struct pci_device_id *id)
212{ 212{
213 struct dw_i2c_dev *dev; 213 struct dw_i2c_dev *dev;
@@ -328,7 +328,7 @@ exit:
328 return r; 328 return r;
329} 329}
330 330
331static void __devexit i2c_dw_pci_remove(struct pci_dev *pdev) 331static void i2c_dw_pci_remove(struct pci_dev *pdev)
332{ 332{
333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev); 333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
334 334
@@ -368,7 +368,7 @@ static struct pci_driver dw_i2c_driver = {
368 .name = DRIVER_NAME, 368 .name = DRIVER_NAME,
369 .id_table = i2_designware_pci_ids, 369 .id_table = i2_designware_pci_ids,
370 .probe = i2c_dw_pci_probe, 370 .probe = i2c_dw_pci_probe,
371 .remove = __devexit_p(i2c_dw_pci_remove), 371 .remove = i2c_dw_pci_remove,
372 .driver = { 372 .driver = {
373 .pm = &i2c_dw_pm_ops, 373 .pm = &i2c_dw_pm_ops,
374 }, 374 },
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef8dc00..343357a2b5b4 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -50,7 +50,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
50 return clk_get_rate(dev->clk)/1000; 50 return clk_get_rate(dev->clk)/1000;
51} 51}
52 52
53static int __devinit dw_i2c_probe(struct platform_device *pdev) 53static int dw_i2c_probe(struct platform_device *pdev)
54{ 54{
55 struct dw_i2c_dev *dev; 55 struct dw_i2c_dev *dev;
56 struct i2c_adapter *adap; 56 struct i2c_adapter *adap;
@@ -169,7 +169,7 @@ err_release_region:
169 return r; 169 return r;
170} 170}
171 171
172static int __devexit dw_i2c_remove(struct platform_device *pdev) 172static int dw_i2c_remove(struct platform_device *pdev)
173{ 173{
174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
175 struct resource *mem; 175 struct resource *mem;
@@ -228,7 +228,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
228MODULE_ALIAS("platform:i2c_designware"); 228MODULE_ALIAS("platform:i2c_designware");
229 229
230static struct platform_driver dw_i2c_driver = { 230static struct platform_driver dw_i2c_driver = {
231 .remove = __devexit_p(dw_i2c_remove), 231 .remove = dw_i2c_remove,
232 .driver = { 232 .driver = {
233 .name = "i2c_designware", 233 .name = "i2c_designware",
234 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 259f7697bf25..5e7886e7136e 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -758,7 +758,7 @@ static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)
758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK); 758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK);
759} 759}
760 760
761static int __devinit pch_i2c_probe(struct pci_dev *pdev, 761static int pch_i2c_probe(struct pci_dev *pdev,
762 const struct pci_device_id *id) 762 const struct pci_device_id *id)
763{ 763{
764 void __iomem *base_addr; 764 void __iomem *base_addr;
@@ -851,7 +851,7 @@ err_pci_enable:
851 return ret; 851 return ret;
852} 852}
853 853
854static void __devexit pch_i2c_remove(struct pci_dev *pdev) 854static void pch_i2c_remove(struct pci_dev *pdev)
855{ 855{
856 int i; 856 int i;
857 struct adapter_info *adap_info = pci_get_drvdata(pdev); 857 struct adapter_info *adap_info = pci_get_drvdata(pdev);
@@ -948,7 +948,7 @@ static struct pci_driver pch_pcidriver = {
948 .name = KBUILD_MODNAME, 948 .name = KBUILD_MODNAME,
949 .id_table = pch_pcidev_id, 949 .id_table = pch_pcidev_id,
950 .probe = pch_i2c_probe, 950 .probe = pch_i2c_probe,
951 .remove = __devexit_p(pch_i2c_remove), 951 .remove = pch_i2c_remove,
952 .suspend = pch_i2c_suspend, 952 .suspend = pch_i2c_suspend,
953 .resume = pch_i2c_resume 953 .resume = pch_i2c_resume
954}; 954};
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 37e2e82a9c88..485497066ed7 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -205,7 +205,7 @@ static struct i2c_adapter pcf_isa_ops = {
205 .name = "i2c-elektor", 205 .name = "i2c-elektor",
206}; 206};
207 207
208static int __devinit elektor_match(struct device *dev, unsigned int id) 208static int elektor_match(struct device *dev, unsigned int id)
209{ 209{
210#ifdef __alpha__ 210#ifdef __alpha__
211 /* check to see we have memory mapped PCF8584 connected to the 211 /* check to see we have memory mapped PCF8584 connected to the
@@ -264,7 +264,7 @@ static int __devinit elektor_match(struct device *dev, unsigned int id)
264 return 1; 264 return 1;
265} 265}
266 266
267static int __devinit elektor_probe(struct device *dev, unsigned int id) 267static int elektor_probe(struct device *dev, unsigned int id)
268{ 268{
269 init_waitqueue_head(&pcf_wait); 269 init_waitqueue_head(&pcf_wait);
270 if (pcf_isa_init()) 270 if (pcf_isa_init())
@@ -293,7 +293,7 @@ static int __devinit elektor_probe(struct device *dev, unsigned int id)
293 return -ENODEV; 293 return -ENODEV;
294} 294}
295 295
296static int __devexit elektor_remove(struct device *dev, unsigned int id) 296static int elektor_remove(struct device *dev, unsigned int id)
297{ 297{
298 i2c_del_adapter(&pcf_isa_ops); 298 i2c_del_adapter(&pcf_isa_ops);
299 299
@@ -316,7 +316,7 @@ static int __devexit elektor_remove(struct device *dev, unsigned int id)
316static struct isa_driver i2c_elektor_driver = { 316static struct isa_driver i2c_elektor_driver = {
317 .match = elektor_match, 317 .match = elektor_match,
318 .probe = elektor_probe, 318 .probe = elektor_probe,
319 .remove = __devexit_p(elektor_remove), 319 .remove = elektor_remove,
320 .driver = { 320 .driver = {
321 .owner = THIS_MODULE, 321 .owner = THIS_MODULE,
322 .name = "i2c-elektor", 322 .name = "i2c-elektor",
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 257299a92df3..f3fa4332bbdf 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -85,7 +85,7 @@ static int i2c_gpio_getscl(void *data)
85 return gpio_get_value(pdata->scl_pin); 85 return gpio_get_value(pdata->scl_pin);
86} 86}
87 87
88static int __devinit of_i2c_gpio_probe(struct device_node *np, 88static int of_i2c_gpio_probe(struct device_node *np,
89 struct i2c_gpio_platform_data *pdata) 89 struct i2c_gpio_platform_data *pdata)
90{ 90{
91 u32 reg; 91 u32 reg;
@@ -117,7 +117,7 @@ static int __devinit of_i2c_gpio_probe(struct device_node *np,
117 return 0; 117 return 0;
118} 118}
119 119
120static int __devinit i2c_gpio_probe(struct platform_device *pdev) 120static int i2c_gpio_probe(struct platform_device *pdev)
121{ 121{
122 struct i2c_gpio_private_data *priv; 122 struct i2c_gpio_private_data *priv;
123 struct i2c_gpio_platform_data *pdata; 123 struct i2c_gpio_platform_data *pdata;
@@ -218,7 +218,7 @@ err_request_sda:
218 return ret; 218 return ret;
219} 219}
220 220
221static int __devexit i2c_gpio_remove(struct platform_device *pdev) 221static int i2c_gpio_remove(struct platform_device *pdev)
222{ 222{
223 struct i2c_gpio_private_data *priv; 223 struct i2c_gpio_private_data *priv;
224 struct i2c_gpio_platform_data *pdata; 224 struct i2c_gpio_platform_data *pdata;
@@ -251,7 +251,7 @@ static struct platform_driver i2c_gpio_driver = {
251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids), 251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids),
252 }, 252 },
253 .probe = i2c_gpio_probe, 253 .probe = i2c_gpio_probe,
254 .remove = __devexit_p(i2c_gpio_remove), 254 .remove = i2c_gpio_remove,
255}; 255};
256 256
257static int __init i2c_gpio_init(void) 257static int __init i2c_gpio_init(void)
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index 19515df61021..3351cc7ed11f 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -356,7 +356,7 @@ static const struct i2c_algorithm highlander_i2c_algo = {
356 .functionality = highlander_i2c_func, 356 .functionality = highlander_i2c_func,
357}; 357};
358 358
359static int __devinit highlander_i2c_probe(struct platform_device *pdev) 359static int highlander_i2c_probe(struct platform_device *pdev)
360{ 360{
361 struct highlander_i2c_dev *dev; 361 struct highlander_i2c_dev *dev;
362 struct i2c_adapter *adap; 362 struct i2c_adapter *adap;
@@ -441,7 +441,7 @@ err:
441 return ret; 441 return ret;
442} 442}
443 443
444static int __devexit highlander_i2c_remove(struct platform_device *pdev) 444static int highlander_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev); 446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev);
447 447
@@ -465,7 +465,7 @@ static struct platform_driver highlander_i2c_driver = {
465 }, 465 },
466 466
467 .probe = highlander_i2c_probe, 467 .probe = highlander_i2c_probe,
468 .remove = __devexit_p(highlander_i2c_remove), 468 .remove = highlander_i2c_remove,
469}; 469};
470 470
471module_platform_driver(highlander_i2c_driver); 471module_platform_driver(highlander_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c
index c9f95e1666a8..79c3d9069a48 100644
--- a/drivers/i2c/busses/i2c-hydra.c
+++ b/drivers/i2c/busses/i2c-hydra.c
@@ -112,7 +112,7 @@ static DEFINE_PCI_DEVICE_TABLE(hydra_ids) = {
112 112
113MODULE_DEVICE_TABLE (pci, hydra_ids); 113MODULE_DEVICE_TABLE (pci, hydra_ids);
114 114
115static int __devinit hydra_probe(struct pci_dev *dev, 115static int hydra_probe(struct pci_dev *dev,
116 const struct pci_device_id *id) 116 const struct pci_device_id *id)
117{ 117{
118 unsigned long base = pci_resource_start(dev, 0); 118 unsigned long base = pci_resource_start(dev, 0);
@@ -139,7 +139,7 @@ static int __devinit hydra_probe(struct pci_dev *dev,
139 return 0; 139 return 0;
140} 140}
141 141
142static void __devexit hydra_remove(struct pci_dev *dev) 142static void hydra_remove(struct pci_dev *dev)
143{ 143{
144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ 144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */
145 i2c_del_adapter(&hydra_adap); 145 i2c_del_adapter(&hydra_adap);
@@ -153,7 +153,7 @@ static struct pci_driver hydra_driver = {
153 .name = "hydra_smbus", 153 .name = "hydra_smbus",
154 .id_table = hydra_ids, 154 .id_table = hydra_ids,
155 .probe = hydra_probe, 155 .probe = hydra_probe,
156 .remove = __devexit_p(hydra_remove), 156 .remove = hydra_remove,
157}; 157};
158 158
159module_pci_driver(hydra_driver); 159module_pci_driver(hydra_driver);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 1e73638225e1..3092387f6ef4 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -841,14 +841,14 @@ struct dmi_onboard_device_info {
841 const char *i2c_type; 841 const char *i2c_type;
842}; 842};
843 843
844static struct dmi_onboard_device_info __devinitdata dmi_devices[] = { 844static const struct dmi_onboard_device_info dmi_devices[] = {
845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" }, 845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" },
846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" }, 846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" },
847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" }, 847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" },
848}; 848};
849 849
850static void __devinit dmi_check_onboard_device(u8 type, const char *name, 850static void dmi_check_onboard_device(u8 type, const char *name,
851 struct i2c_adapter *adap) 851 struct i2c_adapter *adap)
852{ 852{
853 int i; 853 int i;
854 struct i2c_board_info info; 854 struct i2c_board_info info;
@@ -871,8 +871,7 @@ static void __devinit dmi_check_onboard_device(u8 type, const char *name,
871/* We use our own function to check for onboard devices instead of 871/* We use our own function to check for onboard devices instead of
872 dmi_find_device() as some buggy BIOS's have the devices we are interested 872 dmi_find_device() as some buggy BIOS's have the devices we are interested
873 in marked as disabled */ 873 in marked as disabled */
874static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, 874static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
875 void *adap)
876{ 875{
877 int i, count; 876 int i, count;
878 877
@@ -901,7 +900,7 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
901} 900}
902 901
903/* Register optional slaves */ 902/* Register optional slaves */
904static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) 903static void i801_probe_optional_slaves(struct i801_priv *priv)
905{ 904{
906 /* Only register slaves on main SMBus channel */ 905 /* Only register slaves on main SMBus channel */
907 if (priv->features & FEATURE_IDF) 906 if (priv->features & FEATURE_IDF)
@@ -921,7 +920,7 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
921} 920}
922#else 921#else
923static void __init input_apanel_init(void) {} 922static void __init input_apanel_init(void) {}
924static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} 923static void i801_probe_optional_slaves(struct i801_priv *priv) {}
925#endif /* CONFIG_X86 && CONFIG_DMI */ 924#endif /* CONFIG_X86 && CONFIG_DMI */
926 925
927#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ 926#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
@@ -944,7 +943,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {
944 .n_gpios = 2, 943 .n_gpios = 2,
945}; 944};
946 945
947static struct dmi_system_id __devinitdata mux_dmi_table[] = { 946static const struct dmi_system_id mux_dmi_table[] = {
948 { 947 {
949 .matches = { 948 .matches = {
950 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 949 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
@@ -1012,7 +1011,7 @@ static struct dmi_system_id __devinitdata mux_dmi_table[] = {
1012}; 1011};
1013 1012
1014/* Setup multiplexing if needed */ 1013/* Setup multiplexing if needed */
1015static int __devinit i801_add_mux(struct i801_priv *priv) 1014static int i801_add_mux(struct i801_priv *priv)
1016{ 1015{
1017 struct device *dev = &priv->adapter.dev; 1016 struct device *dev = &priv->adapter.dev;
1018 const struct i801_mux_config *mux_config; 1017 const struct i801_mux_config *mux_config;
@@ -1048,13 +1047,13 @@ static int __devinit i801_add_mux(struct i801_priv *priv)
1048 return 0; 1047 return 0;
1049} 1048}
1050 1049
1051static void __devexit i801_del_mux(struct i801_priv *priv) 1050static void i801_del_mux(struct i801_priv *priv)
1052{ 1051{
1053 if (priv->mux_pdev) 1052 if (priv->mux_pdev)
1054 platform_device_unregister(priv->mux_pdev); 1053 platform_device_unregister(priv->mux_pdev);
1055} 1054}
1056 1055
1057static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) 1056static unsigned int i801_get_adapter_class(struct i801_priv *priv)
1058{ 1057{
1059 const struct dmi_system_id *id; 1058 const struct dmi_system_id *id;
1060 const struct i801_mux_config *mux_config; 1059 const struct i801_mux_config *mux_config;
@@ -1084,8 +1083,7 @@ static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)
1084} 1083}
1085#endif 1084#endif
1086 1085
1087static int __devinit i801_probe(struct pci_dev *dev, 1086static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1088 const struct pci_device_id *id)
1089{ 1087{
1090 unsigned char temp; 1088 unsigned char temp;
1091 int err, i; 1089 int err, i;
@@ -1226,7 +1224,7 @@ exit:
1226 return err; 1224 return err;
1227} 1225}
1228 1226
1229static void __devexit i801_remove(struct pci_dev *dev) 1227static void i801_remove(struct pci_dev *dev)
1230{ 1228{
1231 struct i801_priv *priv = pci_get_drvdata(dev); 1229 struct i801_priv *priv = pci_get_drvdata(dev);
1232 1230
@@ -1272,7 +1270,7 @@ static struct pci_driver i801_driver = {
1272 .name = "i801_smbus", 1270 .name = "i801_smbus",
1273 .id_table = i801_ids, 1271 .id_table = i801_ids,
1274 .probe = i801_probe, 1272 .probe = i801_probe,
1275 .remove = __devexit_p(i801_remove), 1273 .remove = i801_remove,
1276 .suspend = i801_suspend, 1274 .suspend = i801_suspend,
1277 .resume = i801_resume, 1275 .resume = i801_resume,
1278}; 1276};
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225f3de7..33a2abb6c063 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -660,7 +660,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
660 return (u8)((opb + 9) / 10 - 1); 660 return (u8)((opb + 9) / 10 - 1);
661} 661}
662 662
663static int __devinit iic_request_irq(struct platform_device *ofdev, 663static int iic_request_irq(struct platform_device *ofdev,
664 struct ibm_iic_private *dev) 664 struct ibm_iic_private *dev)
665{ 665{
666 struct device_node *np = ofdev->dev.of_node; 666 struct device_node *np = ofdev->dev.of_node;
@@ -691,7 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,
691/* 691/*
692 * Register single IIC interface 692 * Register single IIC interface
693 */ 693 */
694static int __devinit iic_probe(struct platform_device *ofdev) 694static int iic_probe(struct platform_device *ofdev)
695{ 695{
696 struct device_node *np = ofdev->dev.of_node; 696 struct device_node *np = ofdev->dev.of_node;
697 struct ibm_iic_private *dev; 697 struct ibm_iic_private *dev;
@@ -781,7 +781,7 @@ error_cleanup:
781/* 781/*
782 * Cleanup initialized IIC interface 782 * Cleanup initialized IIC interface
783 */ 783 */
784static int __devexit iic_remove(struct platform_device *ofdev) 784static int iic_remove(struct platform_device *ofdev)
785{ 785{
786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); 786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev);
787 787
@@ -812,7 +812,7 @@ static struct platform_driver ibm_iic_driver = {
812 .of_match_table = ibm_iic_match, 812 .of_match_table = ibm_iic_match,
813 }, 813 },
814 .probe = iic_probe, 814 .probe = iic_probe,
815 .remove = __devexit_p(iic_remove), 815 .remove = iic_remove,
816}; 816};
817 817
818module_platform_driver(ibm_iic_driver); 818module_platform_driver(ibm_iic_driver);
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c
index 7c28f10f95ca..de3736bf6465 100644
--- a/drivers/i2c/busses/i2c-intel-mid.c
+++ b/drivers/i2c/busses/i2c-intel-mid.c
@@ -947,7 +947,7 @@ static const struct dev_pm_ops intel_mid_i2c_pm_ops = {
947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization 947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization
948 * 6. Register I2C adapter in i2c-core 948 * 6. Register I2C adapter in i2c-core
949 */ 949 */
950static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, 950static int intel_mid_i2c_probe(struct pci_dev *dev,
951 const struct pci_device_id *id) 951 const struct pci_device_id *id)
952{ 952{
953 struct intel_mid_i2c_private *mrst; 953 struct intel_mid_i2c_private *mrst;
@@ -1079,7 +1079,7 @@ exit:
1079 return err; 1079 return err;
1080} 1080}
1081 1081
1082static void __devexit intel_mid_i2c_remove(struct pci_dev *dev) 1082static void intel_mid_i2c_remove(struct pci_dev *dev)
1083{ 1083{
1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev); 1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev);
1085 intel_mid_i2c_disable(&mrst->adap); 1085 intel_mid_i2c_disable(&mrst->adap);
@@ -1113,7 +1113,7 @@ static struct pci_driver intel_mid_i2c_driver = {
1113 .name = DRIVER_NAME, 1113 .name = DRIVER_NAME,
1114 .id_table = intel_mid_i2c_ids, 1114 .id_table = intel_mid_i2c_ids,
1115 .probe = intel_mid_i2c_probe, 1115 .probe = intel_mid_i2c_probe,
1116 .remove = __devexit_p(intel_mid_i2c_remove), 1116 .remove = intel_mid_i2c_remove,
1117}; 1117};
1118 1118
1119module_pci_driver(intel_mid_i2c_driver); 1119module_pci_driver(intel_mid_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index f90a6057508d..4099f79c2280 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -249,7 +249,7 @@ static struct i2c_adapter sch_adapter = {
249 .algo = &smbus_algorithm, 249 .algo = &smbus_algorithm,
250}; 250};
251 251
252static int __devinit smbus_sch_probe(struct platform_device *dev) 252static int smbus_sch_probe(struct platform_device *dev)
253{ 253{
254 struct resource *res; 254 struct resource *res;
255 int retval; 255 int retval;
@@ -284,7 +284,7 @@ static int __devinit smbus_sch_probe(struct platform_device *dev)
284 return retval; 284 return retval;
285} 285}
286 286
287static int __devexit smbus_sch_remove(struct platform_device *pdev) 287static int smbus_sch_remove(struct platform_device *pdev)
288{ 288{
289 struct resource *res; 289 struct resource *res;
290 if (sch_smba) { 290 if (sch_smba) {
@@ -303,7 +303,7 @@ static struct platform_driver smbus_sch_driver = {
303 .owner = THIS_MODULE, 303 .owner = THIS_MODULE,
304 }, 304 },
305 .probe = smbus_sch_probe, 305 .probe = smbus_sch_probe,
306 .remove = __devexit_p(smbus_sch_remove), 306 .remove = smbus_sch_remove,
307}; 307};
308 308
309module_platform_driver(smbus_sch_driver); 309module_platform_driver(smbus_sch_driver);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index ca86430cb4a2..a69459e5c3f3 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -175,7 +175,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
175} 175}
176 176
177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) 177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = { 178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, 179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, 180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},
181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28}, 181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28},
@@ -196,7 +196,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = {
196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f} 196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f}
197}; 197};
198 198
199static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, 199static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
200 int prescaler, u32 *real_clk) 200 int prescaler, u32 *real_clk)
201{ 201{
202 const struct mpc_i2c_divider *div = NULL; 202 const struct mpc_i2c_divider *div = NULL;
@@ -230,7 +230,7 @@ static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
230 return (int)div->fdr; 230 return (int)div->fdr;
231} 231}
232 232
233static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 233static void mpc_i2c_setup_52xx(struct device_node *node,
234 struct mpc_i2c *i2c, 234 struct mpc_i2c *i2c,
235 u32 clock, u32 prescaler) 235 u32 clock, u32 prescaler)
236{ 236{
@@ -252,7 +252,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
252 fdr); 252 fdr);
253} 253}
254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */ 254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */
255static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 255static void mpc_i2c_setup_52xx(struct device_node *node,
256 struct mpc_i2c *i2c, 256 struct mpc_i2c *i2c,
257 u32 clock, u32 prescaler) 257 u32 clock, u32 prescaler)
258{ 258{
@@ -260,7 +260,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */ 260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */
261 261
262#ifdef CONFIG_PPC_MPC512x 262#ifdef CONFIG_PPC_MPC512x
263static void __devinit mpc_i2c_setup_512x(struct device_node *node, 263static void mpc_i2c_setup_512x(struct device_node *node,
264 struct mpc_i2c *i2c, 264 struct mpc_i2c *i2c,
265 u32 clock, u32 prescaler) 265 u32 clock, u32 prescaler)
266{ 266{
@@ -288,7 +288,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler); 288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler);
289} 289}
290#else /* CONFIG_PPC_MPC512x */ 290#else /* CONFIG_PPC_MPC512x */
291static void __devinit mpc_i2c_setup_512x(struct device_node *node, 291static void mpc_i2c_setup_512x(struct device_node *node,
292 struct mpc_i2c *i2c, 292 struct mpc_i2c *i2c,
293 u32 clock, u32 prescaler) 293 u32 clock, u32 prescaler)
294{ 294{
@@ -296,7 +296,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
296#endif /* CONFIG_PPC_MPC512x */ 296#endif /* CONFIG_PPC_MPC512x */
297 297
298#ifdef CONFIG_FSL_SOC 298#ifdef CONFIG_FSL_SOC
299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = { 299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123}, 300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123},
301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102}, 301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102},
302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127}, 302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127},
@@ -316,7 +316,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = {
316 {49152, 0x011e}, {61440, 0x011f} 316 {49152, 0x011e}, {61440, 0x011f}
317}; 317};
318 318
319static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void) 319static u32 mpc_i2c_get_sec_cfg_8xxx(void)
320{ 320{
321 struct device_node *node = NULL; 321 struct device_node *node = NULL;
322 u32 __iomem *reg; 322 u32 __iomem *reg;
@@ -345,7 +345,7 @@ static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void)
345 return val; 345 return val;
346} 346}
347 347
348static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock, 348static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
349 u32 prescaler, u32 *real_clk) 349 u32 prescaler, u32 *real_clk)
350{ 350{
351 const struct mpc_i2c_divider *div = NULL; 351 const struct mpc_i2c_divider *div = NULL;
@@ -383,7 +383,7 @@ static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
383 return div ? (int)div->fdr : -EINVAL; 383 return div ? (int)div->fdr : -EINVAL;
384} 384}
385 385
386static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 386static void mpc_i2c_setup_8xxx(struct device_node *node,
387 struct mpc_i2c *i2c, 387 struct mpc_i2c *i2c,
388 u32 clock, u32 prescaler) 388 u32 clock, u32 prescaler)
389{ 389{
@@ -408,7 +408,7 @@ static void __devinit mpc_i2c_setup_8xxx(struct device_node *node,
408} 408}
409 409
410#else /* !CONFIG_FSL_SOC */ 410#else /* !CONFIG_FSL_SOC */
411static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 411static void mpc_i2c_setup_8xxx(struct device_node *node,
412 struct mpc_i2c *i2c, 412 struct mpc_i2c *i2c,
413 u32 clock, u32 prescaler) 413 u32 clock, u32 prescaler)
414{ 414{
@@ -615,7 +615,7 @@ static struct i2c_adapter mpc_ops = {
615}; 615};
616 616
617static const struct of_device_id mpc_i2c_of_match[]; 617static const struct of_device_id mpc_i2c_of_match[];
618static int __devinit fsl_i2c_probe(struct platform_device *op) 618static int fsl_i2c_probe(struct platform_device *op)
619{ 619{
620 const struct of_device_id *match; 620 const struct of_device_id *match;
621 struct mpc_i2c *i2c; 621 struct mpc_i2c *i2c;
@@ -706,7 +706,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
706 return result; 706 return result;
707}; 707};
708 708
709static int __devexit fsl_i2c_remove(struct platform_device *op) 709static int fsl_i2c_remove(struct platform_device *op)
710{ 710{
711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); 711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
712 712
@@ -746,24 +746,24 @@ static int mpc_i2c_resume(struct device *dev)
746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume); 746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);
747#endif 747#endif
748 748
749static const struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = { 749static const struct mpc_i2c_data mpc_i2c_data_512x = {
750 .setup = mpc_i2c_setup_512x, 750 .setup = mpc_i2c_setup_512x,
751}; 751};
752 752
753static const struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = { 753static const struct mpc_i2c_data mpc_i2c_data_52xx = {
754 .setup = mpc_i2c_setup_52xx, 754 .setup = mpc_i2c_setup_52xx,
755}; 755};
756 756
757static const struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = { 757static const struct mpc_i2c_data mpc_i2c_data_8313 = {
758 .setup = mpc_i2c_setup_8xxx, 758 .setup = mpc_i2c_setup_8xxx,
759}; 759};
760 760
761static const struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = { 761static const struct mpc_i2c_data mpc_i2c_data_8543 = {
762 .setup = mpc_i2c_setup_8xxx, 762 .setup = mpc_i2c_setup_8xxx,
763 .prescaler = 2, 763 .prescaler = 2,
764}; 764};
765 765
766static const struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = { 766static const struct mpc_i2c_data mpc_i2c_data_8544 = {
767 .setup = mpc_i2c_setup_8xxx, 767 .setup = mpc_i2c_setup_8xxx,
768 .prescaler = 3, 768 .prescaler = 3,
769}; 769};
@@ -785,7 +785,7 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
785/* Structure for a device driver */ 785/* Structure for a device driver */
786static struct platform_driver mpc_i2c_driver = { 786static struct platform_driver mpc_i2c_driver = {
787 .probe = fsl_i2c_probe, 787 .probe = fsl_i2c_probe,
788 .remove = __devexit_p(fsl_i2c_remove), 788 .remove = fsl_i2c_remove,
789 .driver = { 789 .driver = {
790 .owner = THIS_MODULE, 790 .owner = THIS_MODULE,
791 .name = DRV_NAME, 791 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 2e9d56719e99..8b20ef8524ac 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -495,7 +495,7 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
495 * 495 *
496 ***************************************************************************** 496 *****************************************************************************
497 */ 497 */
498static int __devinit 498static int
499mv64xxx_i2c_map_regs(struct platform_device *pd, 499mv64xxx_i2c_map_regs(struct platform_device *pd,
500 struct mv64xxx_i2c_data *drv_data) 500 struct mv64xxx_i2c_data *drv_data)
501{ 501{
@@ -530,13 +530,13 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
530} 530}
531 531
532#ifdef CONFIG_OF 532#ifdef CONFIG_OF
533static int __devinit 533static int
534mv64xxx_calc_freq(const int tclk, const int n, const int m) 534mv64xxx_calc_freq(const int tclk, const int n, const int m)
535{ 535{
536 return tclk / (10 * (m + 1) * (2 << n)); 536 return tclk / (10 * (m + 1) * (2 << n));
537} 537}
538 538
539static bool __devinit 539static bool
540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, 540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
541 u32 *best_m) 541 u32 *best_m)
542{ 542{
@@ -560,7 +560,7 @@ mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
560 return true; 560 return true;
561} 561}
562 562
563static int __devinit 563static int
564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
565 struct device_node *np) 565 struct device_node *np)
566{ 566{
@@ -597,7 +597,7 @@ out:
597#endif 597#endif
598} 598}
599#else /* CONFIG_OF */ 599#else /* CONFIG_OF */
600static int __devinit 600static int
601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
602 struct device_node *np) 602 struct device_node *np)
603{ 603{
@@ -605,7 +605,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
605} 605}
606#endif /* CONFIG_OF */ 606#endif /* CONFIG_OF */
607 607
608static int __devinit 608static int
609mv64xxx_i2c_probe(struct platform_device *pd) 609mv64xxx_i2c_probe(struct platform_device *pd)
610{ 610{
611 struct mv64xxx_i2c_data *drv_data; 611 struct mv64xxx_i2c_data *drv_data;
@@ -697,7 +697,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
697 return rc; 697 return rc;
698} 698}
699 699
700static int __devexit 700static int
701mv64xxx_i2c_remove(struct platform_device *dev) 701mv64xxx_i2c_remove(struct platform_device *dev)
702{ 702{
703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); 703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev);
@@ -718,7 +718,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
718 return rc; 718 return rc;
719} 719}
720 720
721static const struct of_device_id mv64xxx_i2c_of_match_table[] __devinitdata = { 721static const struct of_device_id mv64xxx_i2c_of_match_table[] = {
722 { .compatible = "marvell,mv64xxx-i2c", }, 722 { .compatible = "marvell,mv64xxx-i2c", },
723 {} 723 {}
724}; 724};
@@ -726,7 +726,7 @@ MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table);
726 726
727static struct platform_driver mv64xxx_i2c_driver = { 727static struct platform_driver mv64xxx_i2c_driver = {
728 .probe = mv64xxx_i2c_probe, 728 .probe = mv64xxx_i2c_probe,
729 .remove = __devexit_p(mv64xxx_i2c_remove), 729 .remove = mv64xxx_i2c_remove,
730 .driver = { 730 .driver = {
731 .owner = THIS_MODULE, 731 .owner = THIS_MODULE,
732 .name = MV64XXX_I2C_CTLR_NAME, 732 .name = MV64XXX_I2C_CTLR_NAME,
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 6ed53da9e1f4..1b1a936eccc9 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -432,7 +432,7 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
432 return 0; 432 return 0;
433} 433}
434 434
435static int __devinit mxs_i2c_probe(struct platform_device *pdev) 435static int mxs_i2c_probe(struct platform_device *pdev)
436{ 436{
437 struct device *dev = &pdev->dev; 437 struct device *dev = &pdev->dev;
438 struct mxs_i2c_dev *i2c; 438 struct mxs_i2c_dev *i2c;
@@ -515,7 +515,7 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
515 return 0; 515 return 0;
516} 516}
517 517
518static int __devexit mxs_i2c_remove(struct platform_device *pdev) 518static int mxs_i2c_remove(struct platform_device *pdev)
519{ 519{
520 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); 520 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev);
521 int ret; 521 int ret;
@@ -546,7 +546,7 @@ static struct platform_driver mxs_i2c_driver = {
546 .owner = THIS_MODULE, 546 .owner = THIS_MODULE,
547 .of_match_table = mxs_i2c_dt_ids, 547 .of_match_table = mxs_i2c_dt_ids,
548 }, 548 },
549 .remove = __devexit_p(mxs_i2c_remove), 549 .remove = mxs_i2c_remove,
550}; 550};
551 551
552static int __init mxs_i2c_init(void) 552static int __init mxs_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 392303b4be07..adac8542771d 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -117,7 +117,7 @@ struct nforce2_smbus {
117#define MAX_TIMEOUT 100 117#define MAX_TIMEOUT 100
118 118
119/* We disable the second SMBus channel on these boards */ 119/* We disable the second SMBus channel on these boards */
120static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { 120static const struct dmi_system_id nforce2_dmi_blacklist2[] = {
121 { 121 {
122 .ident = "DFI Lanparty NF4 Expert", 122 .ident = "DFI Lanparty NF4 Expert",
123 .matches = { 123 .matches = {
@@ -330,8 +330,8 @@ static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = {
330MODULE_DEVICE_TABLE (pci, nforce2_ids); 330MODULE_DEVICE_TABLE (pci, nforce2_ids);
331 331
332 332
333static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, 333static int nforce2_probe_smb(struct pci_dev *dev, int bar, int alt_reg,
334 int alt_reg, struct nforce2_smbus *smbus, const char *name) 334 struct nforce2_smbus *smbus, const char *name)
335{ 335{
336 int error; 336 int error;
337 337
@@ -382,7 +382,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
382} 382}
383 383
384 384
385static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id) 385static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)
386{ 386{
387 struct nforce2_smbus *smbuses; 387 struct nforce2_smbus *smbuses;
388 int res1, res2; 388 int res1, res2;
@@ -430,7 +430,7 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
430} 430}
431 431
432 432
433static void __devexit nforce2_remove(struct pci_dev *dev) 433static void nforce2_remove(struct pci_dev *dev)
434{ 434{
435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev); 435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev);
436 436
@@ -450,7 +450,7 @@ static struct pci_driver nforce2_driver = {
450 .name = "nForce2_smbus", 450 .name = "nForce2_smbus",
451 .id_table = nforce2_ids, 451 .id_table = nforce2_ids,
452 .probe = nforce2_probe, 452 .probe = nforce2_probe,
453 .remove = __devexit_p(nforce2_remove), 453 .remove = nforce2_remove,
454}; 454};
455 455
456module_pci_driver(nforce2_driver); 456module_pci_driver(nforce2_driver);
diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c
index a23b91b0b738..865ee350adb3 100644
--- a/drivers/i2c/busses/i2c-nuc900.c
+++ b/drivers/i2c/busses/i2c-nuc900.c
@@ -518,7 +518,7 @@ static const struct i2c_algorithm nuc900_i2c_algorithm = {
518 * called by the bus driver when a suitable device is found 518 * called by the bus driver when a suitable device is found
519*/ 519*/
520 520
521static int __devinit nuc900_i2c_probe(struct platform_device *pdev) 521static int nuc900_i2c_probe(struct platform_device *pdev)
522{ 522{
523 struct nuc900_i2c *i2c; 523 struct nuc900_i2c *i2c;
524 struct nuc900_platform_i2c *pdata; 524 struct nuc900_platform_i2c *pdata;
@@ -663,7 +663,7 @@ static int __devinit nuc900_i2c_probe(struct platform_device *pdev)
663 * called when device is removed from the bus 663 * called when device is removed from the bus
664*/ 664*/
665 665
666static int __devexit nuc900_i2c_remove(struct platform_device *pdev) 666static int nuc900_i2c_remove(struct platform_device *pdev)
667{ 667{
668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev); 668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev);
669 669
@@ -684,7 +684,7 @@ static int __devexit nuc900_i2c_remove(struct platform_device *pdev)
684 684
685static struct platform_driver nuc900_i2c_driver = { 685static struct platform_driver nuc900_i2c_driver = {
686 .probe = nuc900_i2c_probe, 686 .probe = nuc900_i2c_probe,
687 .remove = __devexit_p(nuc900_i2c_remove), 687 .remove = nuc900_i2c_remove,
688 .driver = { 688 .driver = {
689 .owner = THIS_MODULE, 689 .owner = THIS_MODULE,
690 .name = "nuc900-i2c0", 690 .name = "nuc900-i2c0",
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 9b35c9fbb2fe..a873d0ad1acb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -343,7 +343,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV 343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV
344#endif 344#endif
345 345
346static int __devinit ocores_i2c_probe(struct platform_device *pdev) 346static int ocores_i2c_probe(struct platform_device *pdev)
347{ 347{
348 struct ocores_i2c *i2c; 348 struct ocores_i2c *i2c;
349 struct ocores_i2c_platform_data *pdata; 349 struct ocores_i2c_platform_data *pdata;
@@ -441,7 +441,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
441 return 0; 441 return 0;
442} 442}
443 443
444static int __devexit ocores_i2c_remove(struct platform_device *pdev) 444static int ocores_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 446 struct ocores_i2c *i2c = platform_get_drvdata(pdev);
447 447
@@ -485,7 +485,7 @@ static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
485 485
486static struct platform_driver ocores_i2c_driver = { 486static struct platform_driver ocores_i2c_driver = {
487 .probe = ocores_i2c_probe, 487 .probe = ocores_i2c_probe,
488 .remove = __devexit_p(ocores_i2c_remove), 488 .remove = ocores_i2c_remove,
489 .driver = { 489 .driver = {
490 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,
491 .name = "ocores-i2c", 491 .name = "ocores-i2c",
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index f44c83549fe5..484ca771fdff 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -446,7 +446,7 @@ static struct i2c_adapter octeon_i2c_ops = {
446/** 446/**
447 * octeon_i2c_setclock - Calculate and set clock divisors. 447 * octeon_i2c_setclock - Calculate and set clock divisors.
448 */ 448 */
449static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c) 449static int octeon_i2c_setclock(struct octeon_i2c *i2c)
450{ 450{
451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff; 451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; 452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
@@ -489,7 +489,7 @@ static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)
489 return 0; 489 return 0;
490} 490}
491 491
492static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c) 492static int octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
493{ 493{
494 u8 status; 494 u8 status;
495 int tries; 495 int tries;
@@ -510,7 +510,7 @@ static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
510 return -EIO; 510 return -EIO;
511} 511}
512 512
513static int __devinit octeon_i2c_probe(struct platform_device *pdev) 513static int octeon_i2c_probe(struct platform_device *pdev)
514{ 514{
515 int irq, result = 0; 515 int irq, result = 0;
516 struct octeon_i2c *i2c; 516 struct octeon_i2c *i2c;
@@ -609,7 +609,7 @@ out:
609 return result; 609 return result;
610}; 610};
611 611
612static int __devexit octeon_i2c_remove(struct platform_device *pdev) 612static int octeon_i2c_remove(struct platform_device *pdev)
613{ 613{
614 struct octeon_i2c *i2c = platform_get_drvdata(pdev); 614 struct octeon_i2c *i2c = platform_get_drvdata(pdev);
615 615
@@ -628,7 +628,7 @@ MODULE_DEVICE_TABLE(of, octeon_i2c_match);
628 628
629static struct platform_driver octeon_i2c_driver = { 629static struct platform_driver octeon_i2c_driver = {
630 .probe = octeon_i2c_probe, 630 .probe = octeon_i2c_probe,
631 .remove = __devexit_p(octeon_i2c_remove), 631 .remove = octeon_i2c_remove,
632 .driver = { 632 .driver = {
633 .owner = THIS_MODULE, 633 .owner = THIS_MODULE,
634 .name = DRV_NAME, 634 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 7a62acb7d262..20d41bfa7c19 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1069,7 +1069,7 @@ MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
1069#define OMAP_I2C_SCHEME_0 0 1069#define OMAP_I2C_SCHEME_0 0
1070#define OMAP_I2C_SCHEME_1 1 1070#define OMAP_I2C_SCHEME_1 1
1071 1071
1072static int __devinit 1072static int
1073omap_i2c_probe(struct platform_device *pdev) 1073omap_i2c_probe(struct platform_device *pdev)
1074{ 1074{
1075 struct omap_i2c_dev *dev; 1075 struct omap_i2c_dev *dev;
@@ -1267,7 +1267,7 @@ err_free_mem:
1267 return r; 1267 return r;
1268} 1268}
1269 1269
1270static int __devexit omap_i2c_remove(struct platform_device *pdev) 1270static int omap_i2c_remove(struct platform_device *pdev)
1271{ 1271{
1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev); 1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
1273 int ret; 1273 int ret;
@@ -1333,7 +1333,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
1333 1333
1334static struct platform_driver omap_i2c_driver = { 1334static struct platform_driver omap_i2c_driver = {
1335 .probe = omap_i2c_probe, 1335 .probe = omap_i2c_probe,
1336 .remove = __devexit_p(omap_i2c_remove), 1336 .remove = omap_i2c_remove,
1337 .driver = { 1337 .driver = {
1338 .name = "omap_i2c", 1338 .name = "omap_i2c",
1339 .owner = THIS_MODULE, 1339 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 4b95f7a63a3b..aa9577881925 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -135,7 +135,7 @@ static struct lineop parport_ctrl_irq = {
135 .port = PORT_CTRL, 135 .port = PORT_CTRL,
136}; 136};
137 137
138static int __devinit i2c_parport_probe(struct platform_device *pdev) 138static int i2c_parport_probe(struct platform_device *pdev)
139{ 139{
140 int err; 140 int err;
141 141
@@ -169,7 +169,7 @@ static int __devinit i2c_parport_probe(struct platform_device *pdev)
169 return 0; 169 return 0;
170} 170}
171 171
172static int __devexit i2c_parport_remove(struct platform_device *pdev) 172static int i2c_parport_remove(struct platform_device *pdev)
173{ 173{
174 if (ara) { 174 if (ara) {
175 line_set(0, &parport_ctrl_irq); 175 line_set(0, &parport_ctrl_irq);
@@ -191,7 +191,7 @@ static struct platform_driver i2c_parport_driver = {
191 .name = DRVNAME, 191 .name = DRVNAME,
192 }, 192 },
193 .probe = i2c_parport_probe, 193 .probe = i2c_parport_probe,
194 .remove = __devexit_p(i2c_parport_remove), 194 .remove = i2c_parport_remove,
195}; 195};
196 196
197static int __init i2c_parport_device_add(u16 address) 197static int __init i2c_parport_device_add(u16 address)
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index 12edefd4183a..615f632c846f 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -340,7 +340,7 @@ static const struct i2c_algorithm smbus_algorithm = {
340 .functionality = pasemi_smb_func, 340 .functionality = pasemi_smb_func,
341}; 341};
342 342
343static int __devinit pasemi_smb_probe(struct pci_dev *dev, 343static int pasemi_smb_probe(struct pci_dev *dev,
344 const struct pci_device_id *id) 344 const struct pci_device_id *id)
345{ 345{
346 struct pasemi_smbus *smbus; 346 struct pasemi_smbus *smbus;
@@ -392,7 +392,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
392 return error; 392 return error;
393} 393}
394 394
395static void __devexit pasemi_smb_remove(struct pci_dev *dev) 395static void pasemi_smb_remove(struct pci_dev *dev)
396{ 396{
397 struct pasemi_smbus *smbus = pci_get_drvdata(dev); 397 struct pasemi_smbus *smbus = pci_get_drvdata(dev);
398 398
@@ -412,7 +412,7 @@ static struct pci_driver pasemi_smb_driver = {
412 .name = "i2c-pasemi", 412 .name = "i2c-pasemi",
413 .id_table = pasemi_smb_ids, 413 .id_table = pasemi_smb_ids,
414 .probe = pasemi_smb_probe, 414 .probe = pasemi_smb_probe,
415 .remove = __devexit_p(pasemi_smb_remove), 415 .remove = pasemi_smb_remove,
416}; 416};
417 417
418module_pci_driver(pasemi_smb_driver); 418module_pci_driver(pasemi_smb_driver);
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index 29933f87d8fa..323f061a3163 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -119,7 +119,7 @@ static struct i2c_adapter pca_isa_ops = {
119 .timeout = HZ, 119 .timeout = HZ,
120}; 120};
121 121
122static int __devinit pca_isa_match(struct device *dev, unsigned int id) 122static int pca_isa_match(struct device *dev, unsigned int id)
123{ 123{
124 int match = base != 0; 124 int match = base != 0;
125 125
@@ -132,7 +132,7 @@ static int __devinit pca_isa_match(struct device *dev, unsigned int id)
132 return match; 132 return match;
133} 133}
134 134
135static int __devinit pca_isa_probe(struct device *dev, unsigned int id) 135static int pca_isa_probe(struct device *dev, unsigned int id)
136{ 136{
137 init_waitqueue_head(&pca_wait); 137 init_waitqueue_head(&pca_wait);
138 138
@@ -174,7 +174,7 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
174 return -ENODEV; 174 return -ENODEV;
175} 175}
176 176
177static int __devexit pca_isa_remove(struct device *dev, unsigned int id) 177static int pca_isa_remove(struct device *dev, unsigned int id)
178{ 178{
179 i2c_del_adapter(&pca_isa_ops); 179 i2c_del_adapter(&pca_isa_ops);
180 180
@@ -190,7 +190,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id)
190static struct isa_driver pca_isa_driver = { 190static struct isa_driver pca_isa_driver = {
191 .match = pca_isa_match, 191 .match = pca_isa_match,
192 .probe = pca_isa_probe, 192 .probe = pca_isa_probe,
193 .remove = __devexit_p(pca_isa_remove), 193 .remove = pca_isa_remove,
194 .driver = { 194 .driver = {
195 .owner = THIS_MODULE, 195 .owner = THIS_MODULE,
196 .name = DRIVER, 196 .name = DRIVER,
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 675878f49f76..a30d2f613c03 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -131,7 +131,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
131} 131}
132 132
133 133
134static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) 134static int i2c_pca_pf_probe(struct platform_device *pdev)
135{ 135{
136 struct i2c_pca_pf_data *i2c; 136 struct i2c_pca_pf_data *i2c;
137 struct resource *res; 137 struct resource *res;
@@ -257,7 +257,7 @@ e_print:
257 return ret; 257 return ret;
258} 258}
259 259
260static int __devexit i2c_pca_pf_remove(struct platform_device *pdev) 260static int i2c_pca_pf_remove(struct platform_device *pdev)
261{ 261{
262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev); 262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
263 platform_set_drvdata(pdev, NULL); 263 platform_set_drvdata(pdev, NULL);
@@ -279,7 +279,7 @@ static int __devexit i2c_pca_pf_remove(struct platform_device *pdev)
279 279
280static struct platform_driver i2c_pca_pf_driver = { 280static struct platform_driver i2c_pca_pf_driver = {
281 .probe = i2c_pca_pf_probe, 281 .probe = i2c_pca_pf_probe,
282 .remove = __devexit_p(i2c_pca_pf_remove), 282 .remove = i2c_pca_pf_remove,
283 .driver = { 283 .driver = {
284 .name = "i2c-pca-platform", 284 .name = "i2c-pca-platform",
285 .owner = THIS_MODULE, 285 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index f7216ed2f3a9..39ab78c1a02c 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -99,7 +99,7 @@ MODULE_PARM_DESC(force_addr,
99static int srvrworks_csb5_delay; 99static int srvrworks_csb5_delay;
100static struct pci_driver piix4_driver; 100static struct pci_driver piix4_driver;
101 101
102static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { 102static const struct dmi_system_id piix4_dmi_blacklist[] = {
103 { 103 {
104 .ident = "Sapphire AM2RD790", 104 .ident = "Sapphire AM2RD790",
105 .matches = { 105 .matches = {
@@ -119,7 +119,7 @@ static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = {
119 119
120/* The IBM entry is in a separate table because we only check it 120/* The IBM entry is in a separate table because we only check it
121 on Intel-based systems */ 121 on Intel-based systems */
122static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { 122static const struct dmi_system_id piix4_dmi_ibm[] = {
123 { 123 {
124 .ident = "IBM", 124 .ident = "IBM",
125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, 125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), },
@@ -131,8 +131,8 @@ struct i2c_piix4_adapdata {
131 unsigned short smba; 131 unsigned short smba;
132}; 132};
133 133
134static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, 134static int piix4_setup(struct pci_dev *PIIX4_dev,
135 const struct pci_device_id *id) 135 const struct pci_device_id *id)
136{ 136{
137 unsigned char temp; 137 unsigned char temp;
138 unsigned short piix4_smba; 138 unsigned short piix4_smba;
@@ -230,8 +230,8 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
230 return piix4_smba; 230 return piix4_smba;
231} 231}
232 232
233static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, 233static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
234 const struct pci_device_id *id) 234 const struct pci_device_id *id)
235{ 235{
236 unsigned short piix4_smba; 236 unsigned short piix4_smba;
237 unsigned short smba_idx = 0xcd6; 237 unsigned short smba_idx = 0xcd6;
@@ -294,9 +294,9 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
294 return piix4_smba; 294 return piix4_smba;
295} 295}
296 296
297static int __devinit piix4_setup_aux(struct pci_dev *PIIX4_dev, 297static int piix4_setup_aux(struct pci_dev *PIIX4_dev,
298 const struct pci_device_id *id, 298 const struct pci_device_id *id,
299 unsigned short base_reg_addr) 299 unsigned short base_reg_addr)
300{ 300{
301 /* Set up auxiliary SMBus controllers found on some 301 /* Set up auxiliary SMBus controllers found on some
302 * AMD chipsets e.g. SP5100 (SB700 derivative) */ 302 * AMD chipsets e.g. SP5100 (SB700 derivative) */
@@ -540,9 +540,8 @@ MODULE_DEVICE_TABLE (pci, piix4_ids);
540static struct i2c_adapter *piix4_main_adapter; 540static struct i2c_adapter *piix4_main_adapter;
541static struct i2c_adapter *piix4_aux_adapter; 541static struct i2c_adapter *piix4_aux_adapter;
542 542
543static int __devinit piix4_add_adapter(struct pci_dev *dev, 543static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
544 unsigned short smba, 544 struct i2c_adapter **padap)
545 struct i2c_adapter **padap)
546{ 545{
547 struct i2c_adapter *adap; 546 struct i2c_adapter *adap;
548 struct i2c_piix4_adapdata *adapdata; 547 struct i2c_piix4_adapdata *adapdata;
@@ -588,8 +587,7 @@ static int __devinit piix4_add_adapter(struct pci_dev *dev,
588 return 0; 587 return 0;
589} 588}
590 589
591static int __devinit piix4_probe(struct pci_dev *dev, 590static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
592 const struct pci_device_id *id)
593{ 591{
594 int retval; 592 int retval;
595 593
@@ -626,7 +624,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,
626 return 0; 624 return 0;
627} 625}
628 626
629static void __devexit piix4_adap_remove(struct i2c_adapter *adap) 627static void piix4_adap_remove(struct i2c_adapter *adap)
630{ 628{
631 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); 629 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap);
632 630
@@ -638,7 +636,7 @@ static void __devexit piix4_adap_remove(struct i2c_adapter *adap)
638 } 636 }
639} 637}
640 638
641static void __devexit piix4_remove(struct pci_dev *dev) 639static void piix4_remove(struct pci_dev *dev)
642{ 640{
643 if (piix4_main_adapter) { 641 if (piix4_main_adapter) {
644 piix4_adap_remove(piix4_main_adapter); 642 piix4_adap_remove(piix4_main_adapter);
@@ -655,7 +653,7 @@ static struct pci_driver piix4_driver = {
655 .name = "piix4_smbus", 653 .name = "piix4_smbus",
656 .id_table = piix4_ids, 654 .id_table = piix4_ids,
657 .probe = piix4_probe, 655 .probe = piix4_probe,
658 .remove = __devexit_p(piix4_remove), 656 .remove = piix4_remove,
659}; 657};
660 658
661module_pci_driver(piix4_driver); 659module_pci_driver(piix4_driver);
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 3d71395ae1f7..083d68cfaf0b 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -270,7 +270,7 @@ static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr)
270/* 270/*
271 * Probe for and register the device and return 0 if there is one. 271 * Probe for and register the device and return 0 if there is one.
272 */ 272 */
273static int __devinit pmcmsptwi_probe(struct platform_device *pldev) 273static int pmcmsptwi_probe(struct platform_device *pldev)
274{ 274{
275 struct resource *res; 275 struct resource *res;
276 int rc = -ENODEV; 276 int rc = -ENODEV;
@@ -368,7 +368,7 @@ ret_err:
368/* 368/*
369 * Release the device and return 0 if there is one. 369 * Release the device and return 0 if there is one.
370 */ 370 */
371static int __devexit pmcmsptwi_remove(struct platform_device *pldev) 371static int pmcmsptwi_remove(struct platform_device *pldev)
372{ 372{
373 struct resource *res; 373 struct resource *res;
374 374
@@ -628,7 +628,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {
628 628
629static struct platform_driver pmcmsptwi_driver = { 629static struct platform_driver pmcmsptwi_driver = {
630 .probe = pmcmsptwi_probe, 630 .probe = pmcmsptwi_probe,
631 .remove = __devexit_p(pmcmsptwi_remove), 631 .remove = pmcmsptwi_remove,
632 .driver = { 632 .driver = {
633 .name = DRV_NAME, 633 .name = DRV_NAME,
634 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 8488bddfe465..ce4097012e97 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -619,7 +619,7 @@ static SIMPLE_DEV_PM_OPS(i2c_pnx_pm,
619#define PNX_I2C_PM NULL 619#define PNX_I2C_PM NULL
620#endif 620#endif
621 621
622static int __devinit i2c_pnx_probe(struct platform_device *pdev) 622static int i2c_pnx_probe(struct platform_device *pdev)
623{ 623{
624 unsigned long tmp; 624 unsigned long tmp;
625 int ret = 0; 625 int ret = 0;
@@ -765,7 +765,7 @@ err_kzalloc:
765 return ret; 765 return ret;
766} 766}
767 767
768static int __devexit i2c_pnx_remove(struct platform_device *pdev) 768static int i2c_pnx_remove(struct platform_device *pdev)
769{ 769{
770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
771 771
@@ -797,7 +797,7 @@ static struct platform_driver i2c_pnx_driver = {
797 .pm = PNX_I2C_PM, 797 .pm = PNX_I2C_PM,
798 }, 798 },
799 .probe = i2c_pnx_probe, 799 .probe = i2c_pnx_probe,
800 .remove = __devexit_p(i2c_pnx_remove), 800 .remove = i2c_pnx_remove,
801}; 801};
802 802
803static int __init i2c_adap_pnx_init(void) 803static int __init i2c_adap_pnx_init(void)
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 5285f8565de4..0dd5b334d090 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -210,7 +210,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
210}; 210};
211 211
212 212
213static int __devexit i2c_powermac_remove(struct platform_device *dev) 213static int i2c_powermac_remove(struct platform_device *dev)
214{ 214{
215 struct i2c_adapter *adapter = platform_get_drvdata(dev); 215 struct i2c_adapter *adapter = platform_get_drvdata(dev);
216 int rc; 216 int rc;
@@ -227,7 +227,7 @@ static int __devexit i2c_powermac_remove(struct platform_device *dev)
227 return 0; 227 return 0;
228} 228}
229 229
230static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap, 230static u32 i2c_powermac_get_addr(struct i2c_adapter *adap,
231 struct pmac_i2c_bus *bus, 231 struct pmac_i2c_bus *bus,
232 struct device_node *node) 232 struct device_node *node)
233{ 233{
@@ -255,7 +255,7 @@ static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap,
255 return 0xffffffff; 255 return 0xffffffff;
256} 256}
257 257
258static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap, 258static void i2c_powermac_create_one(struct i2c_adapter *adap,
259 const char *type, 259 const char *type,
260 u32 addr) 260 u32 addr)
261{ 261{
@@ -271,7 +271,7 @@ static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap,
271 type); 271 type);
272} 272}
273 273
274static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap, 274static void i2c_powermac_add_missing(struct i2c_adapter *adap,
275 struct pmac_i2c_bus *bus, 275 struct pmac_i2c_bus *bus,
276 bool found_onyx) 276 bool found_onyx)
277{ 277{
@@ -297,7 +297,7 @@ static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap,
297 } 297 }
298} 298}
299 299
300static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap, 300static bool i2c_powermac_get_type(struct i2c_adapter *adap,
301 struct device_node *node, 301 struct device_node *node,
302 u32 addr, char *type, int type_size) 302 u32 addr, char *type, int type_size)
303{ 303{
@@ -336,7 +336,7 @@ static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap,
336 return false; 336 return false;
337} 337}
338 338
339static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, 339static void i2c_powermac_register_devices(struct i2c_adapter *adap,
340 struct pmac_i2c_bus *bus) 340 struct pmac_i2c_bus *bus)
341{ 341{
342 struct i2c_client *newdev; 342 struct i2c_client *newdev;
@@ -403,7 +403,7 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap,
403 i2c_powermac_add_missing(adap, bus, found_onyx); 403 i2c_powermac_add_missing(adap, bus, found_onyx);
404} 404}
405 405
406static int __devinit i2c_powermac_probe(struct platform_device *dev) 406static int i2c_powermac_probe(struct platform_device *dev)
407{ 407{
408 struct pmac_i2c_bus *bus = dev->dev.platform_data; 408 struct pmac_i2c_bus *bus = dev->dev.platform_data;
409 struct device_node *parent = NULL; 409 struct device_node *parent = NULL;
@@ -467,7 +467,7 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
467 467
468static struct platform_driver i2c_powermac_driver = { 468static struct platform_driver i2c_powermac_driver = {
469 .probe = i2c_powermac_probe, 469 .probe = i2c_powermac_probe,
470 .remove = __devexit_p(i2c_powermac_remove), 470 .remove = i2c_powermac_remove,
471 .driver = { 471 .driver = {
472 .name = "i2c-powermac", 472 .name = "i2c-powermac",
473 .bus = &platform_bus_type, 473 .bus = &platform_bus_type,
diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c
index d8515be00b98..d7c512d717a7 100644
--- a/drivers/i2c/busses/i2c-puv3.c
+++ b/drivers/i2c/busses/i2c-puv3.c
@@ -184,7 +184,7 @@ static struct i2c_algorithm puv3_i2c_algorithm = {
184/* 184/*
185 * Main initialization routine. 185 * Main initialization routine.
186 */ 186 */
187static int __devinit puv3_i2c_probe(struct platform_device *pdev) 187static int puv3_i2c_probe(struct platform_device *pdev)
188{ 188{
189 struct i2c_adapter *adapter; 189 struct i2c_adapter *adapter;
190 struct resource *mem; 190 struct resource *mem;
@@ -231,7 +231,7 @@ fail_nomem:
231 return rc; 231 return rc;
232} 232}
233 233
234static int __devexit puv3_i2c_remove(struct platform_device *pdev) 234static int puv3_i2c_remove(struct platform_device *pdev)
235{ 235{
236 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 236 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
237 struct resource *mem; 237 struct resource *mem;
@@ -276,7 +276,7 @@ static SIMPLE_DEV_PM_OPS(puv3_i2c_pm, puv3_i2c_suspend, NULL);
276 276
277static struct platform_driver puv3_i2c_driver = { 277static struct platform_driver puv3_i2c_driver = {
278 .probe = puv3_i2c_probe, 278 .probe = puv3_i2c_probe,
279 .remove = __devexit_p(puv3_i2c_remove), 279 .remove = puv3_i2c_remove,
280 .driver = { 280 .driver = {
281 .name = "PKUnity-v3-I2C", 281 .name = "PKUnity-v3-I2C",
282 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c
index 4dc9bef17d77..3d4985695aed 100644
--- a/drivers/i2c/busses/i2c-pxa-pci.c
+++ b/drivers/i2c/busses/i2c-pxa-pci.c
@@ -94,7 +94,7 @@ out:
94 return ERR_PTR(ret); 94 return ERR_PTR(ret);
95} 95}
96 96
97static int __devinit ce4100_i2c_probe(struct pci_dev *dev, 97static int ce4100_i2c_probe(struct pci_dev *dev,
98 const struct pci_device_id *ent) 98 const struct pci_device_id *ent)
99{ 99{
100 int ret; 100 int ret;
@@ -135,7 +135,7 @@ err_mem:
135 return ret; 135 return ret;
136} 136}
137 137
138static void __devexit ce4100_i2c_remove(struct pci_dev *dev) 138static void ce4100_i2c_remove(struct pci_dev *dev)
139{ 139{
140 struct ce4100_devices *sds; 140 struct ce4100_devices *sds;
141 unsigned int i; 141 unsigned int i;
@@ -160,7 +160,7 @@ static struct pci_driver ce4100_i2c_driver = {
160 .name = "ce4100_i2c", 160 .name = "ce4100_i2c",
161 .id_table = ce4100_i2c_devices, 161 .id_table = ce4100_i2c_devices,
162 .probe = ce4100_i2c_probe, 162 .probe = ce4100_i2c_probe,
163 .remove = __devexit_p(ce4100_i2c_remove), 163 .remove = ce4100_i2c_remove,
164}; 164};
165 165
166module_pci_driver(ce4100_i2c_driver); 166module_pci_driver(ce4100_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 72a8071a5556..9bd4d73d29e3 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -613,7 +613,7 @@ static const struct i2c_algorithm rcar_i2c_algo = {
613 .functionality = rcar_i2c_func, 613 .functionality = rcar_i2c_func,
614}; 614};
615 615
616static int __devinit rcar_i2c_probe(struct platform_device *pdev) 616static int rcar_i2c_probe(struct platform_device *pdev)
617{ 617{
618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data; 618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;
619 struct rcar_i2c_priv *priv; 619 struct rcar_i2c_priv *priv;
@@ -682,7 +682,7 @@ static int __devinit rcar_i2c_probe(struct platform_device *pdev)
682 return 0; 682 return 0;
683} 683}
684 684
685static int __devexit rcar_i2c_remove(struct platform_device *pdev) 685static int rcar_i2c_remove(struct platform_device *pdev)
686{ 686{
687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev); 687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
688 struct device *dev = &pdev->dev; 688 struct device *dev = &pdev->dev;
@@ -699,7 +699,7 @@ static struct platform_driver rcar_i2c_driver = {
699 .owner = THIS_MODULE, 699 .owner = THIS_MODULE,
700 }, 700 },
701 .probe = rcar_i2c_probe, 701 .probe = rcar_i2c_probe,
702 .remove = __devexit_p(rcar_i2c_remove), 702 .remove = rcar_i2c_remove,
703}; 703};
704 704
705module_platform_driver(rcar_i2c_driver); 705module_platform_driver(rcar_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index b76a29d1f8e4..008836409efe 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -248,7 +248,7 @@ static struct i2c_algorithm s6i2c_algorithm = {
248 .functionality = s6i2c_functionality, 248 .functionality = s6i2c_functionality,
249}; 249};
250 250
251static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns) 251static u16 nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
252{ 252{
253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000; 253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000;
254 if (dividend > 0xffff) 254 if (dividend > 0xffff)
@@ -256,7 +256,7 @@ static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
256 return dividend; 256 return dividend;
257} 257}
258 258
259static int __devinit s6i2c_probe(struct platform_device *dev) 259static int s6i2c_probe(struct platform_device *dev)
260{ 260{
261 struct s6i2c_if *iface = &s6i2c_if; 261 struct s6i2c_if *iface = &s6i2c_if;
262 struct i2c_adapter *p_adap; 262 struct i2c_adapter *p_adap;
@@ -361,7 +361,7 @@ err_out:
361 return rc; 361 return rc;
362} 362}
363 363
364static int __devexit s6i2c_remove(struct platform_device *pdev) 364static int s6i2c_remove(struct platform_device *pdev)
365{ 365{
366 struct s6i2c_if *iface = platform_get_drvdata(pdev); 366 struct s6i2c_if *iface = platform_get_drvdata(pdev);
367 i2c_wr16(iface, S6_I2C_ENABLE, 0); 367 i2c_wr16(iface, S6_I2C_ENABLE, 0);
@@ -378,7 +378,7 @@ static int __devexit s6i2c_remove(struct platform_device *pdev)
378 378
379static struct platform_driver s6i2c_driver = { 379static struct platform_driver s6i2c_driver = {
380 .probe = s6i2c_probe, 380 .probe = s6i2c_probe,
381 .remove = __devexit_p(s6i2c_remove), 381 .remove = s6i2c_remove,
382 .driver = { 382 .driver = {
383 .name = DRV_NAME, 383 .name = DRV_NAME,
384 .owner = THIS_MODULE, 384 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index c0c9dffbdb12..3a2253e1bf59 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -390,7 +390,7 @@ static const struct i2c_algorithm sh7760_i2c_algo = {
390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz. 390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz.
391 * scl = iclk/(SCGD*8 + 20). 391 * scl = iclk/(SCGD*8 + 20).
392 */ 392 */
393static int __devinit calc_CCR(unsigned long scl_hz) 393static int calc_CCR(unsigned long scl_hz)
394{ 394{
395 struct clk *mclk; 395 struct clk *mclk;
396 unsigned long mck, m1, dff, odff, iclk; 396 unsigned long mck, m1, dff, odff, iclk;
@@ -430,7 +430,7 @@ static int __devinit calc_CCR(unsigned long scl_hz)
430 return ((scgdm << 2) | cdfm); 430 return ((scgdm << 2) | cdfm);
431} 431}
432 432
433static int __devinit sh7760_i2c_probe(struct platform_device *pdev) 433static int sh7760_i2c_probe(struct platform_device *pdev)
434{ 434{
435 struct sh7760_i2c_platdata *pd; 435 struct sh7760_i2c_platdata *pd;
436 struct resource *res; 436 struct resource *res;
@@ -536,7 +536,7 @@ out0:
536 return ret; 536 return ret;
537} 537}
538 538
539static int __devexit sh7760_i2c_remove(struct platform_device *pdev) 539static int sh7760_i2c_remove(struct platform_device *pdev)
540{ 540{
541 struct cami2c *id = platform_get_drvdata(pdev); 541 struct cami2c *id = platform_get_drvdata(pdev);
542 542
@@ -557,7 +557,7 @@ static struct platform_driver sh7760_i2c_drv = {
557 .owner = THIS_MODULE, 557 .owner = THIS_MODULE,
558 }, 558 },
559 .probe = sh7760_i2c_probe, 559 .probe = sh7760_i2c_probe,
560 .remove = __devexit_p(sh7760_i2c_remove), 560 .remove = sh7760_i2c_remove,
561}; 561};
562 562
563module_platform_driver(sh7760_i2c_drv); 563module_platform_driver(sh7760_i2c_drv);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 9411c1b892c0..b6e7a83a8296 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -758,7 +758,7 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = {
758 .runtime_resume = sh_mobile_i2c_runtime_nop, 758 .runtime_resume = sh_mobile_i2c_runtime_nop,
759}; 759};
760 760
761static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = { 761static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
762 { .compatible = "renesas,rmobile-iic", }, 762 { .compatible = "renesas,rmobile-iic", },
763 {}, 763 {},
764}; 764};
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 5574a47792fb..3f1818b87974 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -258,7 +258,7 @@ static const struct i2c_algorithm i2c_sirfsoc_algo = {
258 .functionality = i2c_sirfsoc_func, 258 .functionality = i2c_sirfsoc_func,
259}; 259};
260 260
261static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev) 261static int i2c_sirfsoc_probe(struct platform_device *pdev)
262{ 262{
263 struct sirfsoc_i2c *siic; 263 struct sirfsoc_i2c *siic;
264 struct i2c_adapter *adap; 264 struct i2c_adapter *adap;
@@ -385,7 +385,7 @@ err_get_clk:
385 return err; 385 return err;
386} 386}
387 387
388static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev) 388static int i2c_sirfsoc_remove(struct platform_device *pdev)
389{ 389{
390 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 390 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
391 struct sirfsoc_i2c *siic = adapter->algo_data; 391 struct sirfsoc_i2c *siic = adapter->algo_data;
@@ -433,7 +433,7 @@ static const struct dev_pm_ops i2c_sirfsoc_pm_ops = {
433}; 433};
434#endif 434#endif
435 435
436static const struct of_device_id sirfsoc_i2c_of_match[] __devinitconst = { 436static const struct of_device_id sirfsoc_i2c_of_match[] = {
437 { .compatible = "sirf,prima2-i2c", }, 437 { .compatible = "sirf,prima2-i2c", },
438 {}, 438 {},
439}; 439};
@@ -449,7 +449,7 @@ static struct platform_driver i2c_sirfsoc_driver = {
449 .of_match_table = sirfsoc_i2c_of_match, 449 .of_match_table = sirfsoc_i2c_of_match,
450 }, 450 },
451 .probe = i2c_sirfsoc_probe, 451 .probe = i2c_sirfsoc_probe,
452 .remove = __devexit_p(i2c_sirfsoc_remove), 452 .remove = i2c_sirfsoc_remove,
453}; 453};
454module_platform_driver(i2c_sirfsoc_driver); 454module_platform_driver(i2c_sirfsoc_driver);
455 455
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index 87e5126d449c..79fd96a04386 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -142,7 +142,7 @@ static void sis5595_write(u8 reg, u8 data)
142 outb(data, sis5595_base + SMB_DAT); 142 outb(data, sis5595_base + SMB_DAT);
143} 143}
144 144
145static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev) 145static int sis5595_setup(struct pci_dev *SIS5595_dev)
146{ 146{
147 u16 a; 147 u16 a;
148 u8 val; 148 u8 val;
@@ -376,7 +376,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = {
376 376
377MODULE_DEVICE_TABLE (pci, sis5595_ids); 377MODULE_DEVICE_TABLE (pci, sis5595_ids);
378 378
379static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id) 379static int sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)
380{ 380{
381 int err; 381 int err;
382 382
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index 5d6723b7525e..de6dddb9f865 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -389,7 +389,7 @@ static u32 sis630_func(struct i2c_adapter *adapter)
389 I2C_FUNC_SMBUS_BLOCK_DATA; 389 I2C_FUNC_SMBUS_BLOCK_DATA;
390} 390}
391 391
392static int __devinit sis630_setup(struct pci_dev *sis630_dev) 392static int sis630_setup(struct pci_dev *sis630_dev)
393{ 393{
394 unsigned char b; 394 unsigned char b;
395 struct pci_dev *dummy = NULL; 395 struct pci_dev *dummy = NULL;
@@ -480,7 +480,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = {
480 480
481MODULE_DEVICE_TABLE (pci, sis630_ids); 481MODULE_DEVICE_TABLE (pci, sis630_ids);
482 482
483static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) 483static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
484{ 484{
485 if (sis630_setup(dev)) { 485 if (sis630_setup(dev)) {
486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n"); 486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n");
@@ -496,7 +496,7 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
496 return i2c_add_adapter(&sis630_adapter); 496 return i2c_add_adapter(&sis630_adapter);
497} 497}
498 498
499static void __devexit sis630_remove(struct pci_dev *dev) 499static void sis630_remove(struct pci_dev *dev)
500{ 500{
501 if (acpi_base) { 501 if (acpi_base) {
502 i2c_del_adapter(&sis630_adapter); 502 i2c_del_adapter(&sis630_adapter);
@@ -510,7 +510,7 @@ static struct pci_driver sis630_driver = {
510 .name = "sis630_smbus", 510 .name = "sis630_smbus",
511 .id_table = sis630_ids, 511 .id_table = sis630_ids,
512 .probe = sis630_probe, 512 .probe = sis630_probe,
513 .remove = __devexit_p(sis630_remove), 513 .remove = sis630_remove,
514}; 514};
515 515
516module_pci_driver(sis630_driver); 516module_pci_driver(sis630_driver);
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 7b72614a9bc0..b9faf9b6002b 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -252,7 +252,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis96x_ids) = {
252 252
253MODULE_DEVICE_TABLE (pci, sis96x_ids); 253MODULE_DEVICE_TABLE (pci, sis96x_ids);
254 254
255static int __devinit sis96x_probe(struct pci_dev *dev, 255static int sis96x_probe(struct pci_dev *dev,
256 const struct pci_device_id *id) 256 const struct pci_device_id *id)
257{ 257{
258 u16 ww = 0; 258 u16 ww = 0;
@@ -308,7 +308,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
308 return retval; 308 return retval;
309} 309}
310 310
311static void __devexit sis96x_remove(struct pci_dev *dev) 311static void sis96x_remove(struct pci_dev *dev)
312{ 312{
313 if (sis96x_smbus_base) { 313 if (sis96x_smbus_base) {
314 i2c_del_adapter(&sis96x_adapter); 314 i2c_del_adapter(&sis96x_adapter);
@@ -321,7 +321,7 @@ static struct pci_driver sis96x_driver = {
321 .name = "sis96x_smbus", 321 .name = "sis96x_smbus",
322 .id_table = sis96x_ids, 322 .id_table = sis96x_ids,
323 .probe = sis96x_probe, 323 .probe = sis96x_probe,
324 .remove = __devexit_p(sis96x_remove), 324 .remove = sis96x_remove,
325}; 325};
326 326
327module_pci_driver(sis96x_driver); 327module_pci_driver(sis96x_driver);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index dcea77bf6f50..7b38877ffec1 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -642,7 +642,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
642 642
643#if defined(CONFIG_OF) 643#if defined(CONFIG_OF)
644/* Match table for of_platform binding */ 644/* Match table for of_platform binding */
645static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { 645static const struct of_device_id tegra_i2c_of_match[] = {
646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, 646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, 647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, 648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
@@ -651,7 +651,7 @@ static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); 651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
652#endif 652#endif
653 653
654static int __devinit tegra_i2c_probe(struct platform_device *pdev) 654static int tegra_i2c_probe(struct platform_device *pdev)
655{ 655{
656 struct tegra_i2c_dev *i2c_dev; 656 struct tegra_i2c_dev *i2c_dev;
657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; 657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -769,7 +769,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
769 return 0; 769 return 0;
770} 770}
771 771
772static int __devexit tegra_i2c_remove(struct platform_device *pdev) 772static int tegra_i2c_remove(struct platform_device *pdev)
773{ 773{
774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
775 i2c_del_adapter(&i2c_dev->adapter); 775 i2c_del_adapter(&i2c_dev->adapter);
@@ -817,7 +817,7 @@ static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume);
817 817
818static struct platform_driver tegra_i2c_driver = { 818static struct platform_driver tegra_i2c_driver = {
819 .probe = tegra_i2c_probe, 819 .probe = tegra_i2c_probe,
820 .remove = __devexit_p(tegra_i2c_remove), 820 .remove = tegra_i2c_remove,
821 .driver = { 821 .driver = {
822 .name = "tegra-i2c", 822 .name = "tegra-i2c",
823 .owner = THIS_MODULE, 823 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 7ffee71ca190..be662511c58b 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -96,7 +96,7 @@ static DEFINE_PCI_DEVICE_TABLE(vt586b_ids) = {
96 96
97MODULE_DEVICE_TABLE (pci, vt586b_ids); 97MODULE_DEVICE_TABLE (pci, vt586b_ids);
98 98
99static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id) 99static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
100{ 100{
101 u16 base; 101 u16 base;
102 u8 rev; 102 u8 rev;
@@ -146,7 +146,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i
146 return 0; 146 return 0;
147} 147}
148 148
149static void __devexit vt586b_remove(struct pci_dev *dev) 149static void vt586b_remove(struct pci_dev *dev)
150{ 150{
151 i2c_del_adapter(&vt586b_adapter); 151 i2c_del_adapter(&vt586b_adapter);
152 release_region(I2C_DIR, IOSPACE); 152 release_region(I2C_DIR, IOSPACE);
@@ -158,7 +158,7 @@ static struct pci_driver vt586b_driver = {
158 .name = "vt586b_smbus", 158 .name = "vt586b_smbus",
159 .id_table = vt586b_ids, 159 .id_table = vt586b_ids,
160 .probe = vt586b_probe, 160 .probe = vt586b_probe,
161 .remove = __devexit_p(vt586b_remove), 161 .remove = vt586b_remove,
162}; 162};
163 163
164module_pci_driver(vt586b_driver); 164module_pci_driver(vt586b_driver);
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 271c9a2b0fd7..b2d90e105f41 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -320,8 +320,8 @@ static struct i2c_adapter vt596_adapter = {
320 .algo = &smbus_algorithm, 320 .algo = &smbus_algorithm,
321}; 321};
322 322
323static int __devinit vt596_probe(struct pci_dev *pdev, 323static int vt596_probe(struct pci_dev *pdev,
324 const struct pci_device_id *id) 324 const struct pci_device_id *id)
325{ 325{
326 unsigned char temp; 326 unsigned char temp;
327 int error; 327 int error;
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
index f5fa20dea906..f45c32c1ace6 100644
--- a/drivers/i2c/busses/i2c-viperboard.c
+++ b/drivers/i2c/busses/i2c-viperboard.c
@@ -360,7 +360,7 @@ static const struct i2c_algorithm vprbrd_algorithm = {
360 .functionality = vprbrd_i2c_func, 360 .functionality = vprbrd_i2c_func,
361}; 361};
362 362
363static int __devinit vprbrd_i2c_probe(struct platform_device *pdev) 363static int vprbrd_i2c_probe(struct platform_device *pdev)
364{ 364{
365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); 365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
366 struct vprbrd_i2c *vb_i2c; 366 struct vprbrd_i2c *vb_i2c;
@@ -418,7 +418,7 @@ error:
418 return ret; 418 return ret;
419} 419}
420 420
421static int __devexit vprbrd_i2c_remove(struct platform_device *pdev) 421static int vprbrd_i2c_remove(struct platform_device *pdev)
422{ 422{
423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); 423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev);
424 int ret; 424 int ret;
@@ -432,7 +432,7 @@ static struct platform_driver vprbrd_i2c_driver = {
432 .driver.name = "viperboard-i2c", 432 .driver.name = "viperboard-i2c",
433 .driver.owner = THIS_MODULE, 433 .driver.owner = THIS_MODULE,
434 .probe = vprbrd_i2c_probe, 434 .probe = vprbrd_i2c_probe,
435 .remove = __devexit_p(vprbrd_i2c_remove), 435 .remove = vprbrd_i2c_remove,
436}; 436};
437 437
438static int __init vprbrd_i2c_init(void) 438static int __init vprbrd_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5e3303..f042f6da0ace 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -689,7 +689,7 @@ static struct i2c_adapter xiic_adapter = {
689}; 689};
690 690
691 691
692static int __devinit xiic_i2c_probe(struct platform_device *pdev) 692static int xiic_i2c_probe(struct platform_device *pdev)
693{ 693{
694 struct xiic_i2c *i2c; 694 struct xiic_i2c *i2c;
695 struct xiic_i2c_platform_data *pdata; 695 struct xiic_i2c_platform_data *pdata;
@@ -774,7 +774,7 @@ resource_missing:
774 return -ENOENT; 774 return -ENOENT;
775} 775}
776 776
777static int __devexit xiic_i2c_remove(struct platform_device* pdev) 777static int xiic_i2c_remove(struct platform_device *pdev)
778{ 778{
779 struct xiic_i2c *i2c = platform_get_drvdata(pdev); 779 struct xiic_i2c *i2c = platform_get_drvdata(pdev);
780 struct resource *res; 780 struct resource *res;
@@ -800,7 +800,7 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
800} 800}
801 801
802#if defined(CONFIG_OF) 802#if defined(CONFIG_OF)
803static const struct of_device_id xiic_of_match[] __devinitconst = { 803static const struct of_device_id xiic_of_match[] = {
804 { .compatible = "xlnx,xps-iic-2.00.a", }, 804 { .compatible = "xlnx,xps-iic-2.00.a", },
805 {}, 805 {},
806}; 806};
@@ -809,7 +809,7 @@ MODULE_DEVICE_TABLE(of, xiic_of_match);
809 809
810static struct platform_driver xiic_i2c_driver = { 810static struct platform_driver xiic_i2c_driver = {
811 .probe = xiic_i2c_probe, 811 .probe = xiic_i2c_probe,
812 .remove = __devexit_p(xiic_i2c_remove), 812 .remove = xiic_i2c_remove,
813 .driver = { 813 .driver = {
814 .owner = THIS_MODULE, 814 .owner = THIS_MODULE,
815 .name = DRIVER_NAME, 815 .name = DRIVER_NAME,
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index 96d3fabd8883..a005265461da 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -214,7 +214,7 @@ static struct i2c_algorithm xlr_i2c_algo = {
214 .functionality = xlr_func, 214 .functionality = xlr_func,
215}; 215};
216 216
217static int __devinit xlr_i2c_probe(struct platform_device *pdev) 217static int xlr_i2c_probe(struct platform_device *pdev)
218{ 218{
219 struct xlr_i2c_private *priv; 219 struct xlr_i2c_private *priv;
220 struct resource *res; 220 struct resource *res;
@@ -251,7 +251,7 @@ static int __devinit xlr_i2c_probe(struct platform_device *pdev)
251 return 0; 251 return 0;
252} 252}
253 253
254static int __devexit xlr_i2c_remove(struct platform_device *pdev) 254static int xlr_i2c_remove(struct platform_device *pdev)
255{ 255{
256 struct xlr_i2c_private *priv; 256 struct xlr_i2c_private *priv;
257 257
@@ -263,7 +263,7 @@ static int __devexit xlr_i2c_remove(struct platform_device *pdev)
263 263
264static struct platform_driver xlr_i2c_driver = { 264static struct platform_driver xlr_i2c_driver = {
265 .probe = xlr_i2c_probe, 265 .probe = xlr_i2c_probe,
266 .remove = __devexit_p(xlr_i2c_remove), 266 .remove = xlr_i2c_remove,
267 .driver = { 267 .driver = {
268 .name = "xlr-i2cbus", 268 .name = "xlr-i2cbus",
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 08aab57337dd..3862a953239c 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -389,7 +389,7 @@ static const struct i2c_algorithm scx200_acb_algorithm = {
389static struct scx200_acb_iface *scx200_acb_list; 389static struct scx200_acb_iface *scx200_acb_list;
390static DEFINE_MUTEX(scx200_acb_list_mutex); 390static DEFINE_MUTEX(scx200_acb_list_mutex);
391 391
392static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface) 392static int scx200_acb_probe(struct scx200_acb_iface *iface)
393{ 393{
394 u8 val; 394 u8 val;
395 395
@@ -424,7 +424,7 @@ static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface)
424 return 0; 424 return 0;
425} 425}
426 426
427static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text, 427static struct scx200_acb_iface *scx200_create_iface(const char *text,
428 struct device *dev, int index) 428 struct device *dev, int index)
429{ 429{
430 struct scx200_acb_iface *iface; 430 struct scx200_acb_iface *iface;
@@ -449,7 +449,7 @@ static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text,
449 return iface; 449 return iface;
450} 450}
451 451
452static int __devinit scx200_acb_create(struct scx200_acb_iface *iface) 452static int scx200_acb_create(struct scx200_acb_iface *iface)
453{ 453{
454 struct i2c_adapter *adapter; 454 struct i2c_adapter *adapter;
455 int rc; 455 int rc;
@@ -480,7 +480,7 @@ static int __devinit scx200_acb_create(struct scx200_acb_iface *iface)
480 return 0; 480 return 0;
481} 481}
482 482
483static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text, 483static struct scx200_acb_iface *scx200_create_dev(const char *text,
484 unsigned long base, int index, struct device *dev) 484 unsigned long base, int index, struct device *dev)
485{ 485{
486 struct scx200_acb_iface *iface; 486 struct scx200_acb_iface *iface;
@@ -508,7 +508,7 @@ static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text,
508 return NULL; 508 return NULL;
509} 509}
510 510
511static int __devinit scx200_probe(struct platform_device *pdev) 511static int scx200_probe(struct platform_device *pdev)
512{ 512{
513 struct scx200_acb_iface *iface; 513 struct scx200_acb_iface *iface;
514 struct resource *res; 514 struct resource *res;
@@ -530,14 +530,14 @@ static int __devinit scx200_probe(struct platform_device *pdev)
530 return 0; 530 return 0;
531} 531}
532 532
533static void __devexit scx200_cleanup_iface(struct scx200_acb_iface *iface) 533static void scx200_cleanup_iface(struct scx200_acb_iface *iface)
534{ 534{
535 i2c_del_adapter(&iface->adapter); 535 i2c_del_adapter(&iface->adapter);
536 release_region(iface->base, 8); 536 release_region(iface->base, 8);
537 kfree(iface); 537 kfree(iface);
538} 538}
539 539
540static int __devexit scx200_remove(struct platform_device *pdev) 540static int scx200_remove(struct platform_device *pdev)
541{ 541{
542 struct scx200_acb_iface *iface; 542 struct scx200_acb_iface *iface;
543 543
@@ -554,7 +554,7 @@ static struct platform_driver scx200_pci_driver = {
554 .owner = THIS_MODULE, 554 .owner = THIS_MODULE,
555 }, 555 },
556 .probe = scx200_probe, 556 .probe = scx200_probe,
557 .remove = __devexit_p(scx200_remove), 557 .remove = scx200_remove,
558}; 558};
559 559
560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = { 560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = {
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 3b7bc06fe8a6..9f50ef04a4bd 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -53,14 +53,14 @@ static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan)
53 return 0; 53 return 0;
54} 54}
55 55
56static int __devinit match_gpio_chip_by_label(struct gpio_chip *chip, 56static int match_gpio_chip_by_label(struct gpio_chip *chip,
57 void *data) 57 void *data)
58{ 58{
59 return !strcmp(chip->label, data); 59 return !strcmp(chip->label, data);
60} 60}
61 61
62#ifdef CONFIG_OF 62#ifdef CONFIG_OF
63static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 63static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
64 struct platform_device *pdev) 64 struct platform_device *pdev)
65{ 65{
66 struct device_node *np = pdev->dev.of_node; 66 struct device_node *np = pdev->dev.of_node;
@@ -125,14 +125,14 @@ static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux,
125 return 0; 125 return 0;
126} 126}
127#else 127#else
128static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 128static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
129 struct platform_device *pdev) 129 struct platform_device *pdev)
130{ 130{
131 return 0; 131 return 0;
132} 132}
133#endif 133#endif
134 134
135static int __devinit i2c_mux_gpio_probe(struct platform_device *pdev) 135static int i2c_mux_gpio_probe(struct platform_device *pdev)
136{ 136{
137 struct gpiomux *mux; 137 struct gpiomux *mux;
138 struct i2c_adapter *parent; 138 struct i2c_adapter *parent;
@@ -239,7 +239,7 @@ alloc_failed:
239 return ret; 239 return ret;
240} 240}
241 241
242static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev) 242static int i2c_mux_gpio_remove(struct platform_device *pdev)
243{ 243{
244 struct gpiomux *mux = platform_get_drvdata(pdev); 244 struct gpiomux *mux = platform_get_drvdata(pdev);
245 int i; 245 int i;
@@ -256,7 +256,7 @@ static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev)
256 return 0; 256 return 0;
257} 257}
258 258
259static const struct of_device_id i2c_mux_gpio_of_match[] __devinitconst = { 259static const struct of_device_id i2c_mux_gpio_of_match[] = {
260 { .compatible = "i2c-mux-gpio", }, 260 { .compatible = "i2c-mux-gpio", },
261 {}, 261 {},
262}; 262};
@@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_gpio_of_match);
264 264
265static struct platform_driver i2c_mux_gpio_driver = { 265static struct platform_driver i2c_mux_gpio_driver = {
266 .probe = i2c_mux_gpio_probe, 266 .probe = i2c_mux_gpio_probe,
267 .remove = __devexit_p(i2c_mux_gpio_remove), 267 .remove = i2c_mux_gpio_remove,
268 .driver = { 268 .driver = {
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
270 .name = "i2c-mux-gpio", 270 .name = "i2c-mux-gpio",
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
index 7fa5b24b16db..1e44d04d1b22 100644
--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
@@ -129,7 +129,7 @@ static inline int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
129} 129}
130#endif 130#endif
131 131
132static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) 132static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
133{ 133{
134 struct i2c_mux_pinctrl *mux; 134 struct i2c_mux_pinctrl *mux;
135 int (*deselect)(struct i2c_adapter *, void *, u32); 135 int (*deselect)(struct i2c_adapter *, void *, u32);
@@ -241,7 +241,7 @@ err:
241 return ret; 241 return ret;
242} 242}
243 243
244static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev) 244static int i2c_mux_pinctrl_remove(struct platform_device *pdev)
245{ 245{
246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev); 246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev);
247 int i; 247 int i;
@@ -255,7 +255,7 @@ static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev)
255} 255}
256 256
257#ifdef CONFIG_OF 257#ifdef CONFIG_OF
258static const struct of_device_id i2c_mux_pinctrl_of_match[] __devinitconst = { 258static const struct of_device_id i2c_mux_pinctrl_of_match[] = {
259 { .compatible = "i2c-mux-pinctrl", }, 259 { .compatible = "i2c-mux-pinctrl", },
260 {}, 260 {},
261}; 261};
@@ -269,7 +269,7 @@ static struct platform_driver i2c_mux_pinctrl_driver = {
269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match), 269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match),
270 }, 270 },
271 .probe = i2c_mux_pinctrl_probe, 271 .probe = i2c_mux_pinctrl_probe,
272 .remove = __devexit_p(i2c_mux_pinctrl_remove), 272 .remove = i2c_mux_pinctrl_remove,
273}; 273};
274module_platform_driver(i2c_mux_pinctrl_driver); 274module_platform_driver(i2c_mux_pinctrl_driver);
275 275
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 1885a26776b1..a0d931bcb37c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -127,8 +127,9 @@ static int create_gpio_led(const struct gpio_led *template,
127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
128 128
129 ret = devm_gpio_request_one(parent, template->gpio, 129 ret = devm_gpio_request_one(parent, template->gpio,
130 GPIOF_DIR_OUT | (led_dat->active_low ^ state), 130 (led_dat->active_low ^ state) ?
131 template->name); 131 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
132 template->name);
132 if (ret < 0) 133 if (ret < 0)
133 return ret; 134 return ret;
134 135
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index a9f6de5b69d8..2e8c0cb79c3d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -71,8 +71,6 @@
71#include <media/v4l2-common.h> 71#include <media/v4l2-common.h>
72#include <media/v4l2-device.h> 72#include <media/v4l2-device.h>
73 73
74#include <plat/cpu.h>
75
76#include "isp.h" 74#include "isp.h"
77#include "ispreg.h" 75#include "ispreg.h"
78#include "ispccdc.h" 76#include "ispccdc.h"
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 516a5b188ea5..2bb7613ddebb 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
1061 1061
1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); 1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
1063 if (ctrl == NULL) { 1063 if (ctrl == NULL) {
1064 ret = -ENOENT; 1064 ret = -EINVAL;
1065 goto done; 1065 goto done;
1066 } 1066 }
1067 1067
@@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
1099 return -ERESTARTSYS; 1099 return -ERESTARTSYS;
1100 1100
1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping); 1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping);
1102 if (ctrl == NULL) { 1102 if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) {
1103 ret = -ENOENT; 1103 ret = -EINVAL;
1104 goto done; 1104 goto done;
1105 } 1105 }
1106 1106
1107 if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU || 1107 if (query_menu->index >= mapping->menu_count) {
1108 query_menu->index >= mapping->menu_count) {
1109 ret = -EINVAL; 1108 ret = -EINVAL;
1110 goto done; 1109 goto done;
1111 } 1110 }
@@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
1264 1263
1265 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); 1264 ctrl = uvc_find_control(handle->chain, sev->id, &mapping);
1266 if (ctrl == NULL) { 1265 if (ctrl == NULL) {
1267 ret = -ENOENT; 1266 ret = -EINVAL;
1268 goto done; 1267 goto done;
1269 } 1268 }
1270 1269
@@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain,
1415 1414
1416 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1415 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1417 if (ctrl == NULL) 1416 if (ctrl == NULL)
1418 return -ENOENT; 1417 return -EINVAL;
1419 1418
1420 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); 1419 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value);
1421} 1420}
@@ -1432,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
1432 int ret; 1431 int ret;
1433 1432
1434 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1433 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1435 if (ctrl == NULL) 1434 if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
1436 return -ENOENT; 1435 return -EINVAL;
1437 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
1438 return -EACCES;
1439 1436
1440 /* Clamp out of range values. */ 1437 /* Clamp out of range values. */
1441 switch (mapping->v4l2_type) { 1438 switch (mapping->v4l2_type) {
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 8e056046bc20..f2ee8c6b0d8d 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -607,10 +607,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
607 607
608 ret = uvc_ctrl_get(chain, &xctrl); 608 ret = uvc_ctrl_get(chain, &xctrl);
609 uvc_ctrl_rollback(handle); 609 uvc_ctrl_rollback(handle);
610 if (ret < 0) 610 if (ret >= 0)
611 return ret == -ENOENT ? -EINVAL : ret; 611 ctrl->value = xctrl.value;
612
613 ctrl->value = xctrl.value;
614 break; 612 break;
615 } 613 }
616 614
@@ -634,7 +632,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
634 ret = uvc_ctrl_set(chain, &xctrl); 632 ret = uvc_ctrl_set(chain, &xctrl);
635 if (ret < 0) { 633 if (ret < 0) {
636 uvc_ctrl_rollback(handle); 634 uvc_ctrl_rollback(handle);
637 return ret == -ENOENT ? -EINVAL : ret; 635 return ret;
638 } 636 }
639 ret = uvc_ctrl_commit(handle, &xctrl, 1); 637 ret = uvc_ctrl_commit(handle, &xctrl, 1);
640 if (ret == 0) 638 if (ret == 0)
@@ -661,7 +659,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
661 uvc_ctrl_rollback(handle); 659 uvc_ctrl_rollback(handle);
662 ctrls->error_idx = ret == -ENOENT 660 ctrls->error_idx = ret == -ENOENT
663 ? ctrls->count : i; 661 ? ctrls->count : i;
664 return ret == -ENOENT ? -EINVAL : ret; 662 return ret;
665 } 663 }
666 } 664 }
667 ctrls->error_idx = 0; 665 ctrls->error_idx = 0;
@@ -691,7 +689,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
691 ctrls->error_idx = (ret == -ENOENT && 689 ctrls->error_idx = (ret == -ENOENT &&
692 cmd == VIDIOC_S_EXT_CTRLS) 690 cmd == VIDIOC_S_EXT_CTRLS)
693 ? ctrls->count : i; 691 ? ctrls->count : i;
694 return ret == -ENOENT ? -EINVAL : ret; 692 return ret;
695 } 693 }
696 } 694 }
697 695
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6d6002bab060..74f1c157a480 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
141 return 0; 141 return 0;
142} 142}
143 143
144static int __devinit orion_mdio_probe(struct platform_device *pdev) 144static int orion_mdio_probe(struct platform_device *pdev)
145{ 145{
146 struct device_node *np = pdev->dev.of_node; 146 struct device_node *np = pdev->dev.of_node;
147 struct mii_bus *bus; 147 struct mii_bus *bus;
@@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit orion_mdio_remove(struct platform_device *pdev) 200static int orion_mdio_remove(struct platform_device *pdev)
201{ 201{
202 struct mii_bus *bus = platform_get_drvdata(pdev); 202 struct mii_bus *bus = platform_get_drvdata(pdev);
203 mdiobus_unregister(bus); 203 mdiobus_unregister(bus);
@@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);
214 214
215static struct platform_driver orion_mdio_driver = { 215static struct platform_driver orion_mdio_driver = {
216 .probe = orion_mdio_probe, 216 .probe = orion_mdio_probe,
217 .remove = __devexit_p(orion_mdio_remove), 217 .remove = orion_mdio_remove,
218 .driver = { 218 .driver = {
219 .name = "orion-mdio", 219 .name = "orion-mdio",
220 .of_match_table = orion_mdio_match, 220 .of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b9f5e5..b6025c305e10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
635 635
636 636
637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
638static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 638static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
639{ 639{
640 u32 val; 640 u32 val;
641 641
@@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
650} 650}
651 651
652/* Config SGMII port */ 652/* Config SGMII port */
653static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) 653static void mvneta_port_sgmii_config(struct mvneta_port *pp)
654{ 654{
655 u32 val; 655 u32 val;
656 656
@@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
2564}; 2564};
2565 2565
2566/* Initialize hw */ 2566/* Initialize hw */
2567static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) 2567static int mvneta_init(struct mvneta_port *pp, int phy_addr)
2568{ 2568{
2569 int queue; 2569 int queue;
2570 2570
@@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
2613} 2613}
2614 2614
2615/* platform glue : initialize decoding windows */ 2615/* platform glue : initialize decoding windows */
2616static void __devinit 2616static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
2617mvneta_conf_mbus_windows(struct mvneta_port *pp, 2617 const struct mbus_dram_target_info *dram)
2618 const struct mbus_dram_target_info *dram)
2619{ 2618{
2620 u32 win_enable; 2619 u32 win_enable;
2621 u32 win_protect; 2620 u32 win_protect;
@@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
2648} 2647}
2649 2648
2650/* Power up the port */ 2649/* Power up the port */
2651static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2650static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2652{ 2651{
2653 u32 val; 2652 u32 val;
2654 2653
@@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2671} 2670}
2672 2671
2673/* Device initialization routine */ 2672/* Device initialization routine */
2674static int __devinit mvneta_probe(struct platform_device *pdev) 2673static int mvneta_probe(struct platform_device *pdev)
2675{ 2674{
2676 const struct mbus_dram_target_info *dram_target_info; 2675 const struct mbus_dram_target_info *dram_target_info;
2677 struct device_node *dn = pdev->dev.of_node; 2676 struct device_node *dn = pdev->dev.of_node;
@@ -2803,7 +2802,7 @@ err_free_netdev:
2803} 2802}
2804 2803
2805/* Device removal routine */ 2804/* Device removal routine */
2806static int __devexit mvneta_remove(struct platform_device *pdev) 2805static int mvneta_remove(struct platform_device *pdev)
2807{ 2806{
2808 struct net_device *dev = platform_get_drvdata(pdev); 2807 struct net_device *dev = platform_get_drvdata(pdev);
2809 struct mvneta_port *pp = netdev_priv(dev); 2808 struct mvneta_port *pp = netdev_priv(dev);
@@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
2828 2827
2829static struct platform_driver mvneta_driver = { 2828static struct platform_driver mvneta_driver = {
2830 .probe = mvneta_probe, 2829 .probe = mvneta_probe,
2831 .remove = __devexit_p(mvneta_remove), 2830 .remove = mvneta_remove,
2832 .driver = { 2831 .driver = {
2833 .name = MVNETA_DRIVER_NAME, 2832 .name = MVNETA_DRIVER_NAME,
2834 .of_match_table = mvneta_match, 2833 .of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 5e62c1aeeffb..463597f919f1 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
247 cpts->refclk = NULL; 247 cpts->refclk = NULL;
248 return; 248 return;
249 } 249 }
250 clk_enable(cpts->refclk); 250 clk_prepare_enable(cpts->refclk);
251 cpts->freq = cpts->refclk->recalc(cpts->refclk);
252} 251}
253 252
254static void cpts_clk_release(struct cpts *cpts) 253static void cpts_clk_release(struct cpts *cpts)
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index e1bba3a496b2..fe993cdd7e23 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -120,7 +120,6 @@ struct cpts {
120 struct delayed_work overflow_work; 120 struct delayed_work overflow_work;
121 int phc_index; 121 int phc_index;
122 struct clk *refclk; 122 struct clk *refclk;
123 unsigned long freq;
124 struct list_head events; 123 struct list_head events;
125 struct list_head pool; 124 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS]; 125 struct cpts_event pool_data[CPTS_MAX_EVENTS];
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 504f7f1cad94..fbd106edbe59 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -180,7 +180,6 @@ struct tun_struct {
180 int debug; 180 int debug;
181#endif 181#endif
182 spinlock_t lock; 182 spinlock_t lock;
183 struct kmem_cache *flow_cache;
184 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; 183 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
185 struct timer_list flow_gc_timer; 184 struct timer_list flow_gc_timer;
186 unsigned long ageing_time; 185 unsigned long ageing_time;
@@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
209 struct hlist_head *head, 208 struct hlist_head *head,
210 u32 rxhash, u16 queue_index) 209 u32 rxhash, u16 queue_index)
211{ 210{
212 struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, 211 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
213 GFP_ATOMIC); 212
214 if (e) { 213 if (e) {
215 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", 214 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
216 rxhash, queue_index); 215 rxhash, queue_index);
@@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
223 return e; 222 return e;
224} 223}
225 224
226static void tun_flow_free(struct rcu_head *head)
227{
228 struct tun_flow_entry *e
229 = container_of(head, struct tun_flow_entry, rcu);
230 kmem_cache_free(e->tun->flow_cache, e);
231}
232
233static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) 225static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
234{ 226{
235 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", 227 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
236 e->rxhash, e->queue_index); 228 e->rxhash, e->queue_index);
237 hlist_del_rcu(&e->hash_link); 229 hlist_del_rcu(&e->hash_link);
238 call_rcu(&e->rcu, tun_flow_free); 230 kfree_rcu(e, rcu);
239} 231}
240 232
241static void tun_flow_flush(struct tun_struct *tun) 233static void tun_flow_flush(struct tun_struct *tun)
@@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun)
833{ 825{
834 int i; 826 int i;
835 827
836 tun->flow_cache = kmem_cache_create("tun_flow_cache",
837 sizeof(struct tun_flow_entry), 0, 0,
838 NULL);
839 if (!tun->flow_cache)
840 return -ENOMEM;
841
842 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) 828 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
843 INIT_HLIST_HEAD(&tun->flows[i]); 829 INIT_HLIST_HEAD(&tun->flows[i]);
844 830
@@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
854{ 840{
855 del_timer_sync(&tun->flow_gc_timer); 841 del_timer_sync(&tun->flow_gc_timer);
856 tun_flow_flush(tun); 842 tun_flow_flush(tun);
857
858 /* Wait for completion of call_rcu()'s */
859 rcu_barrier();
860 kmem_cache_destroy(tun->flow_cache);
861} 843}
862 844
863/* Initialize net device. */ 845/* Initialize net device. */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b3fdf648ea7..40f2cc135a49 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
506 struct sock *sk = vn->sock->sk; 506 struct sock *sk = vn->sock->sk;
507 struct ip_mreqn mreq = { 507 struct ip_mreqn mreq = {
508 .imr_multiaddr.s_addr = vxlan->gaddr, 508 .imr_multiaddr.s_addr = vxlan->gaddr,
509 .imr_ifindex = vxlan->link,
509 }; 510 };
510 int err; 511 int err;
511 512
@@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
532 int err = 0; 533 int err = 0;
533 struct sock *sk = vn->sock->sk; 534 struct sock *sk = vn->sock->sk;
534 struct ip_mreqn mreq = { 535 struct ip_mreqn mreq = {
535 .imr_multiaddr.s_addr = vxlan->gaddr, 536 .imr_multiaddr.s_addr = vxlan->gaddr,
537 .imr_ifindex = vxlan->link,
536 }; 538 };
537 539
538 /* Only leave group when last vxlan is done. */ 540 /* Only leave group when last vxlan is done. */
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index 18b0bc51766b..bb7cc90bafb2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
342}; 342};
343 343
344static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { 344static struct pci_device_id rtl8723ae_pci_ids[] = {
345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, 345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
346 {}, 346 {},
347}; 347};
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 05b78b16d20b..9c6e9bb674ec 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,
422} 422}
423 423
424/* 424/*
425 * num_vfs > 0; number of vfs to enable 425 * num_vfs > 0; number of VFs to enable
426 * num_vfs = 0; disable all vfs 426 * num_vfs = 0; disable all VFs
427 * 427 *
428 * Note: SRIOV spec doesn't allow partial VF 428 * Note: SRIOV spec doesn't allow partial VF
429 * disable, so its all or none. 429 * disable, so it's all or none.
430 */ 430 */
431static ssize_t sriov_numvfs_store(struct device *dev, 431static ssize_t sriov_numvfs_store(struct device *dev,
432 struct device_attribute *attr, 432 struct device_attribute *attr,
433 const char *buf, size_t count) 433 const char *buf, size_t count)
434{ 434{
435 struct pci_dev *pdev = to_pci_dev(dev); 435 struct pci_dev *pdev = to_pci_dev(dev);
436 int num_vfs_enabled = 0; 436 int ret;
437 int num_vfs; 437 u16 num_vfs;
438 int ret = 0;
439 u16 total;
440 438
441 if (kstrtoint(buf, 0, &num_vfs) < 0) 439 ret = kstrtou16(buf, 0, &num_vfs);
442 return -EINVAL; 440 if (ret < 0)
441 return ret;
442
443 if (num_vfs > pci_sriov_get_totalvfs(pdev))
444 return -ERANGE;
445
446 if (num_vfs == pdev->sriov->num_VFs)
447 return count; /* no change */
443 448
444 /* is PF driver loaded w/callback */ 449 /* is PF driver loaded w/callback */
445 if (!pdev->driver || !pdev->driver->sriov_configure) { 450 if (!pdev->driver || !pdev->driver->sriov_configure) {
446 dev_info(&pdev->dev, 451 dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");
447 "Driver doesn't support SRIOV configuration via sysfs\n");
448 return -ENOSYS; 452 return -ENOSYS;
449 } 453 }
450 454
451 /* if enabling vf's ... */ 455 if (num_vfs == 0) {
452 total = pci_sriov_get_totalvfs(pdev); 456 /* disable VFs */
453 /* Requested VFs to enable < totalvfs and none enabled already */ 457 ret = pdev->driver->sriov_configure(pdev, 0);
454 if ((num_vfs > 0) && (num_vfs <= total)) { 458 if (ret < 0)
455 if (pdev->sriov->num_VFs == 0) { 459 return ret;
456 num_vfs_enabled = 460 return count;
457 pdev->driver->sriov_configure(pdev, num_vfs);
458 if ((num_vfs_enabled >= 0) &&
459 (num_vfs_enabled != num_vfs)) {
460 dev_warn(&pdev->dev,
461 "Only %d VFs enabled\n",
462 num_vfs_enabled);
463 return count;
464 } else if (num_vfs_enabled < 0)
465 /* error code from driver callback */
466 return num_vfs_enabled;
467 } else if (num_vfs == pdev->sriov->num_VFs) {
468 dev_warn(&pdev->dev,
469 "%d VFs already enabled; no enable action taken\n",
470 num_vfs);
471 return count;
472 } else {
473 dev_warn(&pdev->dev,
474 "%d VFs already enabled. Disable before enabling %d VFs\n",
475 pdev->sriov->num_VFs, num_vfs);
476 return -EINVAL;
477 }
478 } 461 }
479 462
480 /* disable vfs */ 463 /* enable VFs */
481 if (num_vfs == 0) { 464 if (pdev->sriov->num_VFs) {
482 if (pdev->sriov->num_VFs != 0) { 465 dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n",
483 ret = pdev->driver->sriov_configure(pdev, 0); 466 pdev->sriov->num_VFs, num_vfs);
484 return ret ? ret : count; 467 return -EBUSY;
485 } else {
486 dev_warn(&pdev->dev,
487 "All VFs disabled; no disable action taken\n");
488 return count;
489 }
490 } 468 }
491 469
492 dev_err(&pdev->dev, 470 ret = pdev->driver->sriov_configure(pdev, num_vfs);
493 "Invalid value for number of VFs to enable: %d\n", num_vfs); 471 if (ret < 0)
472 return ret;
494 473
495 return -EINVAL; 474 if (ret != num_vfs)
475 dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n",
476 num_vfs, ret);
477
478 return count;
496} 479}
497 480
498static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); 481static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index d4824cb78b49..08c243ab034e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev)
134 return 0; 134 return 0;
135} 135}
136 136
137static int pci_dev_pme_poll(struct pci_dev *pdev, void *data)
138{
139 bool *pme_poll = data;
140
141 if (pdev->pme_poll)
142 *pme_poll = true;
143 return 0;
144}
145
137static int pcie_port_runtime_idle(struct device *dev) 146static int pcie_port_runtime_idle(struct device *dev)
138{ 147{
148 struct pci_dev *pdev = to_pci_dev(dev);
149 bool pme_poll = false;
150
151 /*
152 * If any subordinate device needs pme poll, we should keep
153 * the port in D0, because we need port in D0 to poll it.
154 */
155 pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll);
139 /* Delay for a short while to prevent too frequent suspend/resume */ 156 /* Delay for a short while to prevent too frequent suspend/resume */
140 pm_schedule_suspend(dev, 10); 157 if (!pme_poll)
158 pm_schedule_suspend(dev, 10);
141 return -EBUSY; 159 return -EBUSY;
142} 160}
143#else 161#else
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8f7a6344e79e..0369fb6fc1da 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2725 if (PCI_FUNC(dev->devfn)) 2725 if (PCI_FUNC(dev->devfn))
2726 return; 2726 return;
2727 /* 2727 /*
2728 * RICOH 0xe823 SD/MMC card reader fails to recognize 2728 * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize
2729 * certain types of SD/MMC cards. Lowering the SD base 2729 * certain types of SD/MMC cards. Lowering the SD base
2730 * clock frequency from 200Mhz to 50Mhz fixes this issue. 2730 * clock frequency from 200Mhz to 50Mhz fixes this issue.
2731 * 2731 *
@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2736 * 0xf9 - Key register for 0x150 2736 * 0xf9 - Key register for 0x150
2737 * 0xfc - key register for 0xe1 2737 * 0xfc - key register for 0xe1
2738 */ 2738 */
2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { 2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 ||
2740 dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
2740 pci_write_config_byte(dev, 0xf9, 0xfc); 2741 pci_write_config_byte(dev, 0xf9, 0xfc);
2741 pci_write_config_byte(dev, 0x150, 0x10); 2742 pci_write_config_byte(dev, 0x150, 0x10);
2742 pci_write_config_byte(dev, 0xf9, 0x00); 2743 pci_write_config_byte(dev, 0xf9, 0x00);
@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2763} 2764}
2764DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2765DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2765DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2766DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2768DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2766DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2769DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2770DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2768#endif /*CONFIG_MMC_RICOH_MMC*/ 2771#endif /*CONFIG_MMC_RICOH_MMC*/
diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c
index 40c9c3eecd94..9cc219f61000 100644
--- a/drivers/pinctrl/mvebu/pinctrl-dove.c
+++ b/drivers/pinctrl/mvebu/pinctrl-dove.c
@@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev)
595 * grab clk to make sure it is ticking. 595 * grab clk to make sure it is ticking.
596 */ 596 */
597 clk = devm_clk_get(&pdev->dev, NULL); 597 clk = devm_clk_get(&pdev->dev, NULL);
598 if (!IS_ERR(clk)) 598 if (IS_ERR(clk)) {
599 clk_prepare_enable(clk); 599 dev_err(&pdev->dev, "Unable to get pdma clock");
600 return PTR_RET(clk);
601 }
602 clk_prepare_enable(clk);
600 603
601 return mvebu_pinctrl_probe(pdev); 604 return mvebu_pinctrl_probe(pdev);
602} 605}
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index a17d08411723..6b2238bb6a81 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -27,8 +27,6 @@
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/power/smartreflex.h> 28#include <linux/power/smartreflex.h>
29 29
30#include <plat/cpu.h>
31
32#define SMARTREFLEX_NAME_LEN 16 30#define SMARTREFLEX_NAME_LEN 16
33#define NVALUE_NAME_LEN 40 31#define NVALUE_NAME_LEN 40
34#define SR_DISABLE_TIMEOUT 200 32#define SR_DISABLE_TIMEOUT 200
diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
index 0491e5335d02..adc943b3fc3f 100644
--- a/drivers/power/reset/gpio-poweroff.c
+++ b/drivers/power/reset/gpio-poweroff.c
@@ -29,15 +29,16 @@ static int gpio_active_low;
29 29
30static void gpio_poweroff_do_poweroff(void) 30static void gpio_poweroff_do_poweroff(void)
31{ 31{
32 BUG_ON(gpio_num == -1); 32 BUG_ON(!gpio_is_valid(gpio_num));
33 33
34 /* drive it active */ 34 /* drive it active, also inactive->active edge */
35 gpio_direction_output(gpio_num, !gpio_active_low); 35 gpio_direction_output(gpio_num, !gpio_active_low);
36 mdelay(100); 36 mdelay(100);
37 /* rising edge or drive inactive */ 37 /* drive inactive, also active->inactive edge */
38 gpio_set_value(gpio_num, gpio_active_low); 38 gpio_set_value(gpio_num, gpio_active_low);
39 mdelay(100); 39 mdelay(100);
40 /* falling edge */ 40
41 /* drive it active, also inactive->active edge */
41 gpio_set_value(gpio_num, !gpio_active_low); 42 gpio_set_value(gpio_num, !gpio_active_low);
42 43
43 /* give it some time */ 44 /* give it some time */
@@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev)
60 } 61 }
61 62
62 gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); 63 gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
63 if (gpio_num < 0) { 64 if (!gpio_is_valid(gpio_num))
64 pr_err("%s: Could not get GPIO configuration: %d", 65 return gpio_num;
65 __func__, gpio_num); 66
66 return -ENODEV;
67 }
68 gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; 67 gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;
69 68
70 if (of_get_property(pdev->dev.of_node, "input", NULL)) 69 input = of_property_read_bool(pdev->dev.of_node, "input");
71 input = true;
72 70
73 ret = gpio_request(gpio_num, "poweroff-gpio"); 71 ret = gpio_request(gpio_num, "poweroff-gpio");
74 if (ret) { 72 if (ret) {
@@ -98,8 +96,7 @@ err:
98 96
99static int __devexit gpio_poweroff_remove(struct platform_device *pdev) 97static int __devexit gpio_poweroff_remove(struct platform_device *pdev)
100{ 98{
101 if (gpio_num != -1) 99 gpio_free(gpio_num);
102 gpio_free(gpio_num);
103 if (pm_power_off == &gpio_poweroff_do_poweroff) 100 if (pm_power_off == &gpio_poweroff_do_poweroff)
104 pm_power_off = NULL; 101 pm_power_off = NULL;
105 102
@@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = {
115 .probe = gpio_poweroff_probe, 112 .probe = gpio_poweroff_probe,
116 .remove = __devexit_p(gpio_poweroff_remove), 113 .remove = __devexit_p(gpio_poweroff_remove),
117 .driver = { 114 .driver = {
118 .name = "poweroff-gpio", 115 .name = "poweroff-gpio",
119 .owner = THIS_MODULE, 116 .owner = THIS_MODULE,
120 .of_match_table = of_gpio_poweroff_match, 117 .of_match_table = of_gpio_poweroff_match,
121 }, 118 },
122}; 119};
123 120
124module_platform_driver(gpio_poweroff_driver); 121module_platform_driver(gpio_poweroff_driver);
125 122
126MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>"); 123MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>");
127MODULE_DESCRIPTION("GPIO poweroff driver"); 124MODULE_DESCRIPTION("GPIO poweroff driver");
128MODULE_LICENSE("GPL"); 125MODULE_LICENSE("GPL v2");
129MODULE_ALIAS("platform:poweroff-gpio"); 126MODULE_ALIAS("platform:poweroff-gpio");
diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
index 709ea1aefebb..f5ad10546fc9 100644
--- a/drivers/watchdog/da9055_wdt.c
+++ b/drivers/watchdog/da9055_wdt.c
@@ -72,20 +72,21 @@ static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
72 DA9055_TWDSCALE_MASK, 72 DA9055_TWDSCALE_MASK,
73 da9055_wdt_maps[i].reg_val << 73 da9055_wdt_maps[i].reg_val <<
74 DA9055_TWDSCALE_SHIFT); 74 DA9055_TWDSCALE_SHIFT);
75 if (ret < 0) 75 if (ret < 0) {
76 dev_err(da9055->dev, 76 dev_err(da9055->dev,
77 "Failed to update timescale bit, %d\n", ret); 77 "Failed to update timescale bit, %d\n", ret);
78 return ret;
79 }
78 80
79 wdt_dev->timeout = timeout; 81 wdt_dev->timeout = timeout;
80 82
81 return ret; 83 return 0;
82} 84}
83 85
84static int da9055_wdt_ping(struct watchdog_device *wdt_dev) 86static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
85{ 87{
86 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev); 88 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
87 struct da9055 *da9055 = driver_data->da9055; 89 struct da9055 *da9055 = driver_data->da9055;
88 int ret;
89 90
90 /* 91 /*
91 * We have a minimum time for watchdog window called TWDMIN. A write 92 * We have a minimum time for watchdog window called TWDMIN. A write
@@ -94,18 +95,12 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
94 mdelay(DA9055_TWDMIN); 95 mdelay(DA9055_TWDMIN);
95 96
96 /* Reset the watchdog timer */ 97 /* Reset the watchdog timer */
97 ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E, 98 return da9055_reg_update(da9055, DA9055_REG_CONTROL_E,
98 DA9055_WATCHDOG_MASK, 1); 99 DA9055_WATCHDOG_MASK, 1);
99
100 return ret;
101} 100}
102 101
103static void da9055_wdt_release_resources(struct kref *r) 102static void da9055_wdt_release_resources(struct kref *r)
104{ 103{
105 struct da9055_wdt_data *driver_data =
106 container_of(r, struct da9055_wdt_data, kref);
107
108 kfree(driver_data);
109} 104}
110 105
111static void da9055_wdt_ref(struct watchdog_device *wdt_dev) 106static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 34ed61ea02b4..b0e541d022e6 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -296,7 +296,6 @@ static int omap_wdt_remove(struct platform_device *pdev)
296{ 296{
297 struct watchdog_device *wdog = platform_get_drvdata(pdev); 297 struct watchdog_device *wdog = platform_get_drvdata(pdev);
298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog); 298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
299 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
300 299
301 pm_runtime_disable(wdev->dev); 300 pm_runtime_disable(wdev->dev);
302 watchdog_unregister_device(wdog); 301 watchdog_unregister_device(wdog);
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c
index 81918cf8993b..0f03106f7516 100644
--- a/drivers/watchdog/twl4030_wdt.c
+++ b/drivers/watchdog/twl4030_wdt.c
@@ -131,14 +131,21 @@ static int twl4030_wdt_resume(struct platform_device *pdev)
131#define twl4030_wdt_resume NULL 131#define twl4030_wdt_resume NULL
132#endif 132#endif
133 133
134static const struct of_device_id twl_wdt_of_match[] = {
135 { .compatible = "ti,twl4030-wdt", },
136 { },
137};
138MODULE_DEVICE_TABLE(of, twl_wdt_of_match);
139
134static struct platform_driver twl4030_wdt_driver = { 140static struct platform_driver twl4030_wdt_driver = {
135 .probe = twl4030_wdt_probe, 141 .probe = twl4030_wdt_probe,
136 .remove = twl4030_wdt_remove, 142 .remove = twl4030_wdt_remove,
137 .suspend = twl4030_wdt_suspend, 143 .suspend = twl4030_wdt_suspend,
138 .resume = twl4030_wdt_resume, 144 .resume = twl4030_wdt_resume,
139 .driver = { 145 .driver = {
140 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
141 .name = "twl4030_wdt", 147 .name = "twl4030_wdt",
148 .of_match_table = twl_wdt_of_match,
142 }, 149 },
143}; 150};
144 151