diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index bb3a4a8..0d98f70 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -68,7 +68,7 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data)
 	uintptr_t list = (uintptr_t) node->info_ent->data;
 	struct list_head *head;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv;
 	spinlock_t *lock = NULL;
 
@@ -125,7 +125,7 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_request *gem_request;
 
 	seq_printf(m, "Request:\n");
@@ -141,7 +141,7 @@ static int i915_gem_seqno_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (dev_priv->hw_status_page != NULL) {
 		seq_printf(m, "Current sequence: %d\n",
@@ -160,7 +160,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (!HAS_PCH_SPLIT(dev)) {
 		seq_printf(m, "Interrupt enable:    %08x\n",
@@ -212,7 +212,7 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int i;
 
 	seq_printf(m, "Reserved fences = %d\n", dev_priv->fence_reg_start);
@@ -247,7 +247,7 @@ static int i915_hws_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int i;
 	volatile u32 *hws;
 
@@ -280,7 +280,7 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 	int ret;
@@ -313,7 +313,7 @@ static int i915_ringbuffer_data(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u8 *virt;
 	uint32_t *ptr, off;
 
@@ -336,7 +336,7 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned int head, tail;
 
 	head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
@@ -384,7 +384,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_error_state *error;
 	unsigned long flags;
 	int i, page, offset, elt;
@@ -475,7 +475,7 @@ static int i915_rstdby_delays(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u16 crstanddelay = I915_READ16(CRSTANDVID);
 
 	seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f));
@@ -487,7 +487,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u16 rgvswctl = I915_READ16(MEMSWCTL);
 
 	seq_printf(m, "Last command: 0x%01x\n", (rgvswctl >> 13) & 0x3);
@@ -502,7 +502,7 @@ static int i915_delayfreq_table(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 delayfreq;
 	int i;
 
@@ -523,7 +523,7 @@ static int i915_inttoext_table(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 inttoext;
 	int i;
 
@@ -539,7 +539,7 @@ static int i915_drpc_info(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 rgvmodectl = I915_READ(MEMMODECTL);
 
 	seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ?
@@ -567,7 +567,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
 	struct drm_crtc *crtc;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	bool fbc_enabled = false;
 
 	if (!dev_priv->display.fbc_enabled) {
@@ -614,7 +614,7 @@ static int i915_sr_status(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	bool sr_enabled = false;
 
 	if (IS_I965G(dev) || IS_I945G(dev) || IS_I945GM(dev))
@@ -645,7 +645,7 @@ i915_wedged_read(struct file *filp,
 		 loff_t *ppos)
 {
 	struct drm_device *dev = filp->private_data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	char buf[80];
 	int len;
 
@@ -663,7 +663,7 @@ i915_wedged_write(struct file *filp,
 		  loff_t *ppos)
 {
 	struct drm_device *dev = filp->private_data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	char buf[20];
 	int val = 1;
 
@@ -696,7 +696,7 @@ static const struct file_operations i915_wedged_fops = {
 	.write = i915_wedged_write,
 };
 
-/* As the drm_debugfs_init() routines are called before dev->dev_private is
+/* As the drm_debugfs_init() routines are called before to_intel_dev(dev) is
  * allocated we need to hook into the minor for release. */
 static int
 drm_add_fake_info_node(struct drm_minor *minor,
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 3e658d6..d036789 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -45,7 +45,7 @@
  */
 int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_ring_buffer_t *ring = &(dev_priv->ring);
 	u32 acthd_reg = IS_I965G(dev) ? ACTHD_I965 : ACTHD;
 	u32 last_acthd = I915_READ(acthd_reg);
@@ -93,7 +93,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller)
  */
 int i915_wrap_ring(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	volatile unsigned int *virt;
 	int rem;
 
@@ -122,7 +122,7 @@ int i915_wrap_ring(struct drm_device *dev)
  */
 static int i915_init_phys_hws(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	/* Program Hardware Status Page */
 	dev_priv->status_page_dmah =
 		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
@@ -151,7 +151,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
  */
 static void i915_free_hws(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	if (dev_priv->status_page_dmah) {
 		drm_pci_free(dev, dev_priv->status_page_dmah);
 		dev_priv->status_page_dmah = NULL;
@@ -168,7 +168,7 @@ static void i915_free_hws(struct drm_device *dev)
 
 void i915_kernel_lost_context(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv;
 	drm_i915_ring_buffer_t *ring = &(dev_priv->ring);
 
@@ -195,7 +195,7 @@ void i915_kernel_lost_context(struct drm_device * dev)
 
 static int i915_dma_cleanup(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
@@ -219,7 +219,7 @@ static int i915_dma_cleanup(struct drm_device * dev)
 
 static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 
 	master_priv->sarea = drm_getsarea(dev);
@@ -274,7 +274,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
 
 static int i915_dma_resume(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	DRM_DEBUG_DRIVER("%s\n", __func__);
 
@@ -403,7 +403,7 @@ static int validate_cmd(int cmd)
 
 static int i915_emit_cmds(struct drm_device * dev, int *buffer, int dwords)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int i;
 	RING_LOCALS;
 
@@ -440,7 +440,7 @@ i915_emit_box(struct drm_device *dev,
 	      struct drm_clip_rect *boxes,
 	      int i, int DR1, int DR4)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_clip_rect box = boxes[i];
 	RING_LOCALS;
 
@@ -477,7 +477,7 @@ i915_emit_box(struct drm_device *dev,
 
 static void i915_emit_breadcrumb(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	RING_LOCALS;
 
@@ -533,7 +533,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
 				     drm_i915_batchbuffer_t * batch,
 				     struct drm_clip_rect *cliprects)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int nbox = batch->num_cliprects;
 	int i = 0, count;
 	RING_LOCALS;
@@ -582,7 +582,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
 
 static int i915_dispatch_flip(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv =
 		dev->primary->master->driver_priv;
 	RING_LOCALS;
@@ -635,7 +635,7 @@ static int i915_dispatch_flip(struct drm_device * dev)
 
 static int i915_quiescent(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	i915_kernel_lost_context(dev);
 	return i915_wait_ring(dev, dev_priv->ring.Size - 8, __func__);
@@ -658,7 +658,7 @@ static int i915_flush_ioctl(struct drm_device *dev, void *data,
 static int i915_batchbuffer(struct drm_device *dev, void *data,
 			    struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
 	    master_priv->sarea_priv;
@@ -709,7 +709,7 @@ fail_free:
 static int i915_cmdbuffer(struct drm_device *dev, void *data,
 			  struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *)
 	    master_priv->sarea_priv;
@@ -787,7 +787,7 @@ static int i915_flip_bufs(struct drm_device *dev, void *data,
 static int i915_getparam(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_getparam_t *param = data;
 	int value;
 
@@ -842,7 +842,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
 static int i915_setparam(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_setparam_t *param = data;
 
 	if (!dev_priv) {
@@ -878,7 +878,7 @@ static int i915_setparam(struct drm_device *dev, void *data,
 static int i915_set_status_page(struct drm_device *dev, void *data,
 				struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_hws_addr_t *hws = data;
 
 	if (!I915_NEED_GFX_HWS(dev))
@@ -925,7 +925,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data,
 
 static int i915_get_bridge_dev(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
 	if (!dev_priv->bridge_dev) {
@@ -946,7 +946,7 @@ static int i915_get_bridge_dev(struct drm_device *dev)
 static int
 intel_alloc_mchbar_resource(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp_lo, temp_hi = 0;
 	u64 mchbar_addr;
@@ -992,7 +992,7 @@ out:
 static void
 intel_setup_mchbar(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int mchbar_reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp;
 	bool enabled;
@@ -1029,7 +1029,7 @@ intel_setup_mchbar(struct drm_device *dev)
 static void
 intel_teardown_mchbar(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int mchbar_reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915;
 	u32 temp;
 
@@ -1063,7 +1063,7 @@ static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size,
 			  uint32_t *preallocated_size,
 			  uint32_t *start)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u16 tmp = 0;
 	unsigned long overhead;
 	unsigned long stolen;
@@ -1305,7 +1305,7 @@ static void i915_warn_stolen(struct drm_device *dev)
 
 static void i915_setup_compression(struct drm_device *dev, int size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_mm_node *compressed_fb, *compressed_llb;
 	unsigned long cfb_base;
 	unsigned long ll_base = 0;
@@ -1386,7 +1386,7 @@ static int i915_load_modeset_init(struct drm_device *dev,
 				  unsigned long prealloc_size,
 				  unsigned long agp_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int fb_bar = IS_I9XX(dev) ? 2 : 0;
 	int ret = 0;
 
@@ -1496,7 +1496,7 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
 
 static void i915_get_mem_freq(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 tmp;
 
 	if (!IS_PINEVIEW(dev))
@@ -1545,7 +1545,7 @@ static void i915_get_mem_freq(struct drm_device *dev)
  */
 int i915_driver_load(struct drm_device *dev, unsigned long flags)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	resource_size_t base, size;
 	int ret = 0, mmio_bar;
 	uint32_t agp_size, prealloc_size, prealloc_start;
@@ -1708,7 +1708,7 @@ free_priv:
 
 int i915_driver_unload(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	i915_destroy_error_state(dev);
 
@@ -1798,7 +1798,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv)
  */
 void i915_driver_lastclose(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) {
 		drm_fb_helper_restore();
@@ -1815,7 +1815,7 @@ void i915_driver_lastclose(struct drm_device * dev)
 
 void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	i915_gem_release(dev, file_priv);
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		i915_mem_release(dev, file_priv, dev_priv->agp_heap);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 02de6ae..602fcd1 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -189,7 +189,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
 
 static int i915_drm_freeze(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	pci_save_state(dev->pdev);
 
@@ -242,7 +242,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
 
 static int i915_drm_thaw(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int error = 0;
 
 	i915_restore_state(dev);
@@ -296,7 +296,7 @@ static int i915_resume(struct drm_device *dev)
  */
 int i965_reset(struct drm_device *dev, u8 flags)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long timeout;
 	u8 gdrst;
 	/*
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0a526d9..d51736a 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -629,6 +629,8 @@ typedef struct drm_i915_private {
 	enum no_fbc_reason no_fbc_reason;
 } drm_i915_private_t;
 
+#define to_intel_dev(x) ((drm_i915_private_t *) (x)->dev_private)
+
 /** driver private structure attached to each drm_gem_object */
 struct drm_i915_gem_object {
 	struct drm_gem_object *obj;
@@ -1061,7 +1063,7 @@ extern void g4x_disable_fbc(struct drm_device *dev);
 extern int i915_wrap_ring(struct drm_device * dev);
 extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 
-#define INTEL_INFO(dev)	(((struct drm_i915_private *) (dev)->dev_private)->info)
+#define INTEL_INFO(dev)	(to_intel_dev(dev)->info)
 
 #define IS_I830(dev)		((dev)->pci_device == 0x3577)
 #define IS_845G(dev)		((dev)->pci_device == 0x2562)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2c68ffb..a0019ba 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -61,7 +61,7 @@ static DEFINE_SPINLOCK(shrink_list_lock);
 int i915_gem_do_init(struct drm_device *dev, unsigned long start,
 		     unsigned long end)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (start >= end ||
 	    (start & (PAGE_SIZE - 1)) != 0 ||
@@ -161,7 +161,7 @@ fast_shmem_read(struct page **pages,
 
 static int i915_gem_object_needs_bit17_swizzle(struct drm_gem_object *obj)
 {
-	drm_i915_private_t *dev_priv = obj->dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(obj->dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 &&
@@ -581,7 +581,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
 			 struct drm_file *file_priv)
 {
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	ssize_t remain;
 	loff_t offset, page_base;
 	char __user *user_data;
@@ -655,7 +655,7 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, struct drm_gem_object *obj,
 			 struct drm_file *file_priv)
 {
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	ssize_t remain;
 	loff_t gtt_page_base, offset;
 	loff_t first_data_page, last_data_page, num_pages;
@@ -1006,7 +1006,7 @@ int
 i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 			  struct drm_file *file_priv)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_set_domain *args = data;
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
@@ -1165,7 +1165,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct drm_gem_object *obj = vma->vm_private_data;
 	struct drm_device *dev = obj->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	pgoff_t page_offset;
 	unsigned long pfn;
@@ -1391,7 +1391,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *file_priv)
 {
 	struct drm_i915_gem_mmap_gtt *args = data;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 	int ret;
@@ -1487,7 +1487,7 @@ static void
 i915_gem_object_move_to_active(struct drm_gem_object *obj, uint32_t seqno)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	/* Add a reference if we're newly entering the active list. */
@@ -1507,7 +1507,7 @@ static void
 i915_gem_object_move_to_flushing(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	BUG_ON(!obj_priv->active);
@@ -1539,7 +1539,7 @@ static void
 i915_gem_object_move_to_inactive(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -1562,7 +1562,7 @@ static void
 i915_gem_process_flushing_list(struct drm_device *dev,
 			       uint32_t flush_domains, uint32_t seqno)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv, *next;
 
 	list_for_each_entry_safe(obj_priv, next,
@@ -1602,7 +1602,7 @@ uint32_t
 i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
 		 uint32_t flush_domains)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_file_private *i915_file_priv = NULL;
 	struct drm_i915_gem_request *request;
 	uint32_t seqno;
@@ -1668,7 +1668,7 @@ i915_add_request(struct drm_device *dev, struct drm_file *file_priv,
 static uint32_t
 i915_retire_commands(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	uint32_t cmd = MI_FLUSH | MI_NO_WRITE_FLUSH;
 	uint32_t flush_domains = 0;
 	RING_LOCALS;
@@ -1691,7 +1691,7 @@ static void
 i915_gem_retire_request(struct drm_device *dev,
 			struct drm_i915_gem_request *request)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	trace_i915_gem_request_retire(dev, request->seqno);
 
@@ -1752,7 +1752,7 @@ i915_seqno_passed(uint32_t seq1, uint32_t seq2)
 uint32_t
 i915_get_gem_seqno(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	return READ_HWSP(dev_priv, I915_GEM_HWS_INDEX);
 }
@@ -1763,7 +1763,7 @@ i915_get_gem_seqno(struct drm_device *dev)
 void
 i915_gem_retire_requests(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	uint32_t seqno;
 
 	if (!dev_priv->hw_status_page || list_empty(&dev_priv->mm.request_list))
@@ -1819,7 +1819,7 @@ i915_gem_retire_work_handler(struct work_struct *work)
 int
 i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 ier;
 	int ret = 0;
 
@@ -1891,7 +1891,7 @@ i915_gem_flush(struct drm_device *dev,
 	       uint32_t invalidate_domains,
 	       uint32_t flush_domains)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	uint32_t cmd;
 	RING_LOCALS;
 
@@ -1998,7 +1998,7 @@ int
 i915_gem_object_unbind(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int ret = 0;
 
@@ -2070,7 +2070,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
 static struct drm_gem_object *
 i915_gem_find_inactive_object(struct drm_device *dev, int min_size)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_gem_object *best = NULL;
 	struct drm_gem_object *first = NULL;
@@ -2097,7 +2097,7 @@ i915_gem_find_inactive_object(struct drm_device *dev, int min_size)
 static int
 i915_gpu_idle(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	bool lists_empty;
 	uint32_t seqno;
 
@@ -2121,7 +2121,7 @@ i915_gpu_idle(struct drm_device *dev)
 static int
 i915_gem_evict_everything(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 	bool lists_empty;
 
@@ -2158,7 +2158,7 @@ i915_gem_evict_everything(struct drm_device *dev)
 static int
 i915_gem_evict_something(struct drm_device *dev, int min_size)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	int ret;
 
@@ -2297,7 +2297,7 @@ static void sandybridge_write_fence_reg(struct drm_i915_fence_reg *reg)
 {
 	struct drm_gem_object *obj = reg->obj;
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int regnum = obj_priv->fence_reg;
 	uint64_t val;
@@ -2319,7 +2319,7 @@ static void i965_write_fence_reg(struct drm_i915_fence_reg *reg)
 {
 	struct drm_gem_object *obj = reg->obj;
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int regnum = obj_priv->fence_reg;
 	uint64_t val;
@@ -2339,7 +2339,7 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
 {
 	struct drm_gem_object *obj = reg->obj;
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int regnum = obj_priv->fence_reg;
 	int tile_width;
@@ -2381,7 +2381,7 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
 {
 	struct drm_gem_object *obj = reg->obj;
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int regnum = obj_priv->fence_reg;
 	uint32_t val;
@@ -2415,7 +2415,7 @@ static int i915_find_fence_reg(struct drm_device *dev)
 {
 	struct drm_i915_fence_reg *reg = NULL;
 	struct drm_i915_gem_object *obj_priv = NULL;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj = NULL;
 	int i, avail, ret;
 
@@ -2480,7 +2480,7 @@ int
 i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	struct drm_i915_fence_reg *reg = NULL;
 	int ret;
@@ -2547,7 +2547,7 @@ static void
 i915_gem_clear_fence_reg(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	if (IS_GEN6(dev)) {
@@ -2621,7 +2621,7 @@ static int
 i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	struct drm_mm_node *free_space;
 	gfp_t gfpmask =  __GFP_NORETRY | __GFP_NOWARN;
@@ -3286,7 +3286,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
 				 struct drm_i915_gem_relocation_entry *relocs)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int i, ret;
 	void __iomem *reloc_page;
@@ -3495,7 +3495,7 @@ i915_dispatch_gem_execbuffer(struct drm_device *dev,
 			      struct drm_clip_rect *cliprects,
 			      uint64_t exec_offset)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int nbox = exec->num_cliprects;
 	int i = 0, count;
 	uint32_t exec_start, exec_len;
@@ -3681,7 +3681,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev,
 			       struct drm_gem_object **object_list,
 			       int count)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv;
 	DEFINE_WAIT(wait);
 	int i, ret = 0;
@@ -3717,7 +3717,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 		       struct drm_i915_gem_execbuffer2 *args,
 		       struct drm_i915_gem_exec_object2 *exec_list)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object **object_list = NULL;
 	struct drm_gem_object *batch_obj;
 	struct drm_i915_gem_object *obj_priv;
@@ -4210,7 +4210,7 @@ void
 i915_gem_object_unpin(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 
 	i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -4481,7 +4481,7 @@ void i915_gem_free_object(struct drm_gem_object *obj)
 static int
 i915_gem_evict_from_inactive_list(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	while (!list_empty(&dev_priv->mm.inactive_list)) {
 		struct drm_gem_object *obj;
@@ -4504,7 +4504,7 @@ i915_gem_evict_from_inactive_list(struct drm_device *dev)
 int
 i915_gem_idle(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 
 	mutex_lock(&dev->struct_mutex);
@@ -4550,7 +4550,7 @@ i915_gem_idle(struct drm_device *dev)
 static int
 i915_gem_init_hws(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 	int ret;
@@ -4602,7 +4602,7 @@ i915_gem_init_hws(struct drm_device *dev)
 static void
 i915_gem_cleanup_hws(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 
@@ -4627,7 +4627,7 @@ i915_gem_cleanup_hws(struct drm_device *dev)
 int
 i915_gem_init_ringbuffer(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 	drm_i915_ring_buffer_t *ring = &dev_priv->ring;
@@ -4736,7 +4736,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
 void
 i915_gem_cleanup_ringbuffer(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (dev_priv->ring.ring_obj == NULL)
 		return;
@@ -4755,7 +4755,7 @@ int
 i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
@@ -4817,7 +4817,7 @@ void
 i915_gem_load(struct drm_device *dev)
 {
 	int i;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	spin_lock_init(&dev_priv->mm.active_list_lock);
 	INIT_LIST_HEAD(&dev_priv->mm.active_list);
@@ -4865,7 +4865,7 @@ i915_gem_load(struct drm_device *dev)
 int i915_gem_init_phys_object(struct drm_device *dev,
 			      int id, int size)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_phys_object *phys_obj;
 	int ret;
 
@@ -4897,7 +4897,7 @@ kfree_obj:
 
 void i915_gem_free_phys_object(struct drm_device *dev, int id)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_phys_object *phys_obj;
 
 	if (!dev_priv->mm.phys_objs[id - 1])
@@ -4962,7 +4962,7 @@ int
 i915_gem_attach_phys_object(struct drm_device *dev,
 			    struct drm_gem_object *obj, int id)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv;
 	int ret = 0;
 	int page_count;
diff --git a/drivers/gpu/drm/i915/i915_gem_debug.c b/drivers/gpu/drm/i915/i915_gem_debug.c
index 35507cf..f81a0f9 100644
--- a/drivers/gpu/drm/i915/i915_gem_debug.c
+++ b/drivers/gpu/drm/i915/i915_gem_debug.c
@@ -34,7 +34,7 @@
 void
 i915_verify_inactive(struct drm_device *dev, char *file, int line)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 
@@ -101,7 +101,7 @@ i915_gem_dump_object(struct drm_gem_object *obj, int len,
 void
 i915_dump_lru(struct drm_device *dev, const char *where)
 {
-	drm_i915_private_t		*dev_priv = dev->dev_private;
+	drm_i915_private_t		*dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object	*obj_priv;
 
 	DRM_INFO("active list %s {\n", where);
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index a10380f..38f60f8 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -88,7 +88,7 @@
 void
 i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	uint32_t swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
 	uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
 
@@ -272,7 +272,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
 		   struct drm_file *file_priv)
 {
 	struct drm_i915_gem_set_tiling *args = data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 	int ret = 0;
@@ -354,7 +354,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
 		   struct drm_file *file_priv)
 {
 	struct drm_i915_gem_get_tiling *args = data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	struct drm_i915_gem_object *obj_priv;
 
@@ -423,7 +423,7 @@ void
 i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int page_count = obj->size >> PAGE_SHIFT;
 	int i;
@@ -452,7 +452,7 @@ void
 i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj)
 {
 	struct drm_device *dev = obj->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
 	int page_count = obj->size >> PAGE_SHIFT;
 	int i;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index bfbdad9..cdf0cb4 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -164,7 +164,7 @@ i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask)
  */
 void intel_enable_asle (struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (HAS_PCH_SPLIT(dev))
 		ironlake_enable_display_irq(dev_priv, DE_GSE);
@@ -185,7 +185,7 @@ void intel_enable_asle (struct drm_device *dev)
 static int
 i915_pipe_enabled(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF;
 
 	if (I915_READ(pipeconf) & PIPEACONF_ENABLE)
@@ -199,7 +199,7 @@ i915_pipe_enabled(struct drm_device *dev, int pipe)
  */
 u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long high_frame;
 	unsigned long low_frame;
 	u32 high1, high2, low, count;
@@ -234,7 +234,7 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
 
 u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
 
 	if (!i915_pipe_enabled(dev, pipe)) {
@@ -271,7 +271,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
 static void i915_handle_rps_change(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 busy_up, busy_down, max_avg, min_avg;
 	u16 rgvswctl;
 	u8 new_delay = dev_priv->cur_delay;
@@ -322,7 +322,7 @@ static void i915_handle_rps_change(struct drm_device *dev)
 
 irqreturn_t ironlake_irq_handler(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret = IRQ_NONE;
 	u32 de_iir, gt_iir, de_ier, pch_iir;
 	struct drm_i915_master_private *master_priv;
@@ -518,7 +518,7 @@ i915_get_bbaddr(struct drm_device *dev, u32 *ring)
 static u32
 i915_ringbuffer_last_batch(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 head, bbaddr;
 	u32 *ring;
 
@@ -558,7 +558,7 @@ i915_ringbuffer_last_batch(struct drm_device *dev)
  */
 static void i915_capture_error_state(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_i915_error_state *error;
 	struct drm_gem_object *batchbuffer[2];
@@ -682,7 +682,7 @@ static void i915_capture_error_state(struct drm_device *dev)
 
 void i915_destroy_error_state(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_error_state *error;
 
 	spin_lock(&dev_priv->error_lock);
@@ -706,7 +706,7 @@ void i915_destroy_error_state(struct drm_device *dev)
  */
 static void i915_handle_error(struct drm_device *dev, bool wedged)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 eir = I915_READ(EIR);
 	u32 pipea_stats = I915_READ(PIPEASTAT);
 	u32 pipeb_stats = I915_READ(PIPEBSTAT);
@@ -829,7 +829,7 @@ static void i915_handle_error(struct drm_device *dev, bool wedged)
 irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 {
 	struct drm_device *dev = (struct drm_device *) arg;
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv;
 	u32 iir, new_iir;
 	u32 pipea_stats, pipeb_stats;
@@ -972,7 +972,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 
 static int i915_emit_irq(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	RING_LOCALS;
 
@@ -998,7 +998,7 @@ static int i915_emit_irq(struct drm_device * dev)
 
 void i915_user_irq_get(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long irqflags;
 
 	spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
@@ -1013,7 +1013,7 @@ void i915_user_irq_get(struct drm_device *dev)
 
 void i915_user_irq_put(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long irqflags;
 
 	spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
@@ -1029,7 +1029,7 @@ void i915_user_irq_put(struct drm_device *dev)
 
 void i915_trace_irq_get(struct drm_device *dev, u32 seqno)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (dev_priv->trace_irq_seqno == 0)
 		i915_user_irq_get(dev);
@@ -1039,7 +1039,7 @@ void i915_trace_irq_get(struct drm_device *dev, u32 seqno)
 
 static int i915_wait_irq(struct drm_device * dev, int irq_nr)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	int ret = 0;
 
@@ -1073,7 +1073,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
 int i915_irq_emit(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_irq_emit_t *emit = data;
 	int result;
 
@@ -1101,7 +1101,7 @@ int i915_irq_emit(struct drm_device *dev, void *data,
 int i915_irq_wait(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_irq_wait_t *irqwait = data;
 
 	if (!dev_priv) {
@@ -1117,7 +1117,7 @@ int i915_irq_wait(struct drm_device *dev, void *data,
  */
 int i915_enable_vblank(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long irqflags;
 	int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
 	u32 pipeconf;
@@ -1145,7 +1145,7 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
  */
 void i915_disable_vblank(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	unsigned long irqflags;
 
 	spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
@@ -1161,7 +1161,7 @@ void i915_disable_vblank(struct drm_device *dev, int pipe)
 
 void i915_enable_interrupt (struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (!HAS_PCH_SPLIT(dev))
 		opregion_enable_asle(dev);
@@ -1174,7 +1174,7 @@ void i915_enable_interrupt (struct drm_device *dev)
 int i915_vblank_pipe_set(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (!dev_priv) {
 		DRM_ERROR("called with no initialization\n");
@@ -1187,7 +1187,7 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data,
 int i915_vblank_pipe_get(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_vblank_pipe_t *pipe = data;
 
 	if (!dev_priv) {
@@ -1224,7 +1224,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
 }
 
 struct drm_i915_gem_request *i915_get_tail_request(struct drm_device *dev) {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	return list_entry(dev_priv->mm.request_list.prev, struct drm_i915_gem_request, list);
 }
 
@@ -1237,7 +1237,7 @@ struct drm_i915_gem_request *i915_get_tail_request(struct drm_device *dev) {
 void i915_hangcheck_elapsed(unsigned long data)
 {
 	struct drm_device *dev = (struct drm_device *)data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	uint32_t acthd;
 
 	/* No reset support on this chip yet. */
@@ -1277,7 +1277,7 @@ void i915_hangcheck_elapsed(unsigned long data)
 */
 static void ironlake_irq_preinstall(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	I915_WRITE(HWSTAM, 0xeffe);
 
@@ -1300,7 +1300,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
 
 static int ironlake_irq_postinstall(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	/* enable kind of interrupts always enabled */
 	u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
 			   DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
@@ -1346,7 +1346,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
 
 void i915_driver_irq_preinstall(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	atomic_set(&dev_priv->irq_received, 0);
 
@@ -1377,7 +1377,7 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
  */
 int i915_driver_irq_postinstall(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR;
 	u32 error_mask;
 
@@ -1452,7 +1452,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
 
 static void ironlake_irq_uninstall(struct drm_device *dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	I915_WRITE(HWSTAM, 0xffffffff);
 
 	I915_WRITE(DEIMR, 0xffffffff);
@@ -1466,7 +1466,7 @@ static void ironlake_irq_uninstall(struct drm_device *dev)
 
 void i915_driver_irq_uninstall(struct drm_device * dev)
 {
-	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (!dev_priv)
 		return;
diff --git a/drivers/gpu/drm/i915/i915_mem.c b/drivers/gpu/drm/i915/i915_mem.c
index 83b7b81..7b3a763 100644
--- a/drivers/gpu/drm/i915/i915_mem.c
+++ b/drivers/gpu/drm/i915/i915_mem.c
@@ -45,7 +45,7 @@
  */
 static void mark_block(struct drm_device * dev, struct mem_block *p, int in_use)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 	drm_i915_sarea_t *sarea_priv = master_priv->sarea_priv;
 	struct drm_tex_region *list;
@@ -272,7 +272,7 @@ static struct mem_block **get_heap(drm_i915_private_t * dev_priv, int region)
 int i915_mem_alloc(struct drm_device *dev, void *data,
 		   struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_mem_alloc_t *alloc = data;
 	struct mem_block *block, **heap;
 
@@ -310,7 +310,7 @@ int i915_mem_alloc(struct drm_device *dev, void *data,
 int i915_mem_free(struct drm_device *dev, void *data,
 		  struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_mem_free_t *memfree = data;
 	struct mem_block *block, **heap;
 
@@ -338,7 +338,7 @@ int i915_mem_free(struct drm_device *dev, void *data,
 int i915_mem_init_heap(struct drm_device *dev, void *data,
 		       struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_mem_init_heap_t *initheap = data;
 	struct mem_block **heap;
 
@@ -362,7 +362,7 @@ int i915_mem_init_heap(struct drm_device *dev, void *data,
 int i915_mem_destroy_heap( struct drm_device *dev, void *data,
 			   struct drm_file *file_priv )
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	drm_i915_mem_destroy_heap_t *destroyheap = data;
 	struct mem_block **heap;
 
diff --git a/drivers/gpu/drm/i915/i915_opregion.c b/drivers/gpu/drm/i915/i915_opregion.c
index 7cc8410..4ff3a98 100644
--- a/drivers/gpu/drm/i915/i915_opregion.c
+++ b/drivers/gpu/drm/i915/i915_opregion.c
@@ -149,7 +149,7 @@ struct opregion_asle {
 
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 blc_pwm_ctl, blc_pwm_ctl2;
 	u32 max_backlight, level, shift;
@@ -195,7 +195,7 @@ static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi)
 
 static u32 asle_set_pwm_freq(struct drm_device *dev, u32 pfmb)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	if (pfmb & ASLE_PFMB_PWM_VALID) {
 		u32 blc_pwm_ctl = I915_READ(BLC_PWM_CTL);
 		u32 pwm = pfmb & ASLE_PFMB_PWM_MASK;
@@ -217,7 +217,7 @@ static u32 asle_set_pfit(struct drm_device *dev, u32 pfit)
 
 void opregion_asle_intr(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 asle_stat = 0;
 	u32 asle_req;
@@ -249,7 +249,7 @@ void opregion_asle_intr(struct drm_device *dev)
 
 static u32 asle_set_backlight_ironlake(struct drm_device *dev, u32 bclp)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 cpu_pwm_ctl, pch_pwm_ctl2;
 	u32 max_backlight, level;
@@ -279,7 +279,7 @@ static u32 asle_set_backlight_ironlake(struct drm_device *dev, u32 bclp)
 
 void ironlake_opregion_gse_intr(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	u32 asle_stat = 0;
 	u32 asle_req;
@@ -321,7 +321,7 @@ void ironlake_opregion_gse_intr(struct drm_device *dev)
 
 void opregion_enable_asle(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 
 	if (asle) {
@@ -379,7 +379,7 @@ static struct notifier_block intel_opregion_notifier = {
 
 static void intel_didl_outputs(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_opregion *opregion = &dev_priv->opregion;
 	struct drm_connector *connector;
 	int i = 0;
@@ -424,7 +424,7 @@ static void intel_didl_outputs(struct drm_device *dev)
 
 int intel_opregion_init(struct drm_device *dev, int resume)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_opregion *opregion = &dev_priv->opregion;
 	void *base;
 	u32 asls, mboxes;
@@ -494,7 +494,7 @@ err_out:
 
 void intel_opregion_free(struct drm_device *dev, int suspend)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_opregion *opregion = &dev_priv->opregion;
 
 	if (!opregion->enabled)
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index ac0d1a7..a719088 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -31,7 +31,7 @@
 
 static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32	dpll_reg;
 
 	if (IS_IRONLAKE(dev)) {
@@ -45,7 +45,7 @@ static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe)
 
 static void i915_save_palette(struct drm_device *dev, enum pipe pipe)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	unsigned long reg = (pipe == PIPE_A ? PALETTE_A : PALETTE_B);
 	u32 *array;
 	int i;
@@ -67,7 +67,7 @@ static void i915_save_palette(struct drm_device *dev, enum pipe pipe)
 
 static void i915_restore_palette(struct drm_device *dev, enum pipe pipe)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	unsigned long reg = (pipe == PIPE_A ? PALETTE_A : PALETTE_B);
 	u32 *array;
 	int i;
@@ -89,7 +89,7 @@ static void i915_restore_palette(struct drm_device *dev, enum pipe pipe)
 
 static u8 i915_read_indexed(struct drm_device *dev, u16 index_port, u16 data_port, u8 reg)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	I915_WRITE8(index_port, reg);
 	return I915_READ8(data_port);
@@ -97,7 +97,7 @@ static u8 i915_read_indexed(struct drm_device *dev, u16 index_port, u16 data_por
 
 static u8 i915_read_ar(struct drm_device *dev, u16 st01, u8 reg, u16 palette_enable)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	I915_READ8(st01);
 	I915_WRITE8(VGA_AR_INDEX, palette_enable | reg);
@@ -106,7 +106,7 @@ static u8 i915_read_ar(struct drm_device *dev, u16 st01, u8 reg, u16 palette_ena
 
 static void i915_write_ar(struct drm_device *dev, u16 st01, u8 reg, u8 val, u16 palette_enable)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	I915_READ8(st01);
 	I915_WRITE8(VGA_AR_INDEX, palette_enable | reg);
@@ -115,7 +115,7 @@ static void i915_write_ar(struct drm_device *dev, u16 st01, u8 reg, u8 val, u16
 
 static void i915_write_indexed(struct drm_device *dev, u16 index_port, u16 data_port, u8 reg, u8 val)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	I915_WRITE8(index_port, reg);
 	I915_WRITE8(data_port, val);
@@ -123,7 +123,7 @@ static void i915_write_indexed(struct drm_device *dev, u16 index_port, u16 data_
 
 static void i915_save_vga(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int i;
 	u16 cr_index, cr_data, st01;
 
@@ -181,7 +181,7 @@ static void i915_save_vga(struct drm_device *dev)
 
 static void i915_restore_vga(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int i;
 	u16 cr_index, cr_data, st01;
 
@@ -234,7 +234,7 @@ static void i915_restore_vga(struct drm_device *dev)
 
 static void i915_save_modeset_reg(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (drm_core_check_feature(dev, DRIVER_MODESET))
 		return;
@@ -362,7 +362,7 @@ static void i915_save_modeset_reg(struct drm_device *dev)
 
 static void i915_restore_modeset_reg(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int dpll_a_reg, fpa0_reg, fpa1_reg;
 	int dpll_b_reg, fpb0_reg, fpb1_reg;
 
@@ -526,7 +526,7 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
 
 void i915_save_display(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	/* Display arbitration control */
 	dev_priv->saveDSPARB = I915_READ(DSPARB);
@@ -624,7 +624,7 @@ void i915_save_display(struct drm_device *dev)
 
 void i915_restore_display(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	/* Display arbitration */
 	I915_WRITE(DSPARB, dev_priv->saveDSPARB);
@@ -729,7 +729,7 @@ void i915_restore_display(struct drm_device *dev)
 
 int i915_save_state(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int i;
 
 	pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
@@ -789,7 +789,7 @@ int i915_save_state(struct drm_device *dev)
 
 int i915_restore_state(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int i;
 
 	pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 70c9d4b..2920b68 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -518,7 +518,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
 bool
 intel_init_bios(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct pci_dev *pdev = dev->pdev;
 	struct vbt_header *vbt = NULL;
 	struct bdb_header *bdb;
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index fccf074..7a818c7 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -36,7 +36,7 @@
 static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 temp, reg;
 
 	if (HAS_PCH_SPLIT(dev))
@@ -103,7 +103,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
 	struct drm_device *dev = encoder->dev;
 	struct drm_crtc *crtc = encoder->crtc;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int dpll_md_reg;
 	u32 adpa, dpll_md;
 	u32 adpa_reg;
@@ -150,7 +150,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 adpa;
 	bool ret;
 
@@ -198,7 +198,7 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 static bool intel_crt_detect_hotplug(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 hotplug_en;
 	int i, tries = 0;
 
@@ -260,7 +260,7 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output)
 {
 	struct drm_encoder *encoder = &intel_output->enc;
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	uint32_t pipe = intel_crtc->pipe;
 	uint32_t save_bclrpat;
@@ -506,7 +506,7 @@ void intel_crt_init(struct drm_device *dev)
 {
 	struct drm_connector *connector;
 	struct intel_output *intel_output;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 i2c_reg;
 
 	intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 678f17f..5a5b9f6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -628,7 +628,7 @@ static const intel_limit_t intel_limits_ironlake_display_port = {
 static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	const intel_limit_t *limit;
 	int refclk = 120;
 
@@ -661,7 +661,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	const intel_limit_t *limit;
 
 	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
@@ -813,7 +813,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
 
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	intel_clock_t clock;
 	int err = target;
 
@@ -875,7 +875,7 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
 			int target, int refclk, intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	intel_clock_t clock;
 	int max_n;
 	bool found;
@@ -999,7 +999,7 @@ intel_wait_for_vblank(struct drm_device *dev)
 static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_framebuffer *fb = crtc->fb;
 	struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
@@ -1045,7 +1045,7 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
 
 void i8xx_disable_fbc(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 fbc_ctl;
 
 	if (!I915_HAS_FBC(dev))
@@ -1068,7 +1068,7 @@ void i8xx_disable_fbc(struct drm_device *dev)
 static bool i8xx_fbc_enabled(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	return I915_READ(FBC_CONTROL) & FBC_CTL_EN;
 }
@@ -1076,7 +1076,7 @@ static bool i8xx_fbc_enabled(struct drm_crtc *crtc)
 static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_framebuffer *fb = crtc->fb;
 	struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
 	struct drm_i915_gem_object *obj_priv = to_intel_bo(intel_fb->obj);
@@ -1112,7 +1112,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
 
 void g4x_disable_fbc(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 dpfc_ctl;
 
 	/* Disable compression */
@@ -1127,7 +1127,7 @@ void g4x_disable_fbc(struct drm_device *dev)
 static bool g4x_fbc_enabled(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN;
 }
@@ -1156,7 +1156,7 @@ static void intel_update_fbc(struct drm_crtc *crtc,
 			     struct drm_display_mode *mode)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_framebuffer *fb = crtc->fb;
 	struct intel_framebuffer *intel_fb;
 	struct drm_i915_gem_object *obj_priv;
@@ -1288,7 +1288,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		    struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_framebuffer *intel_fb;
@@ -1428,7 +1428,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 /* Disable the VGA plane that we never use */
 static void i915_disable_vga (struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u8 sr1;
 	u32 vga_reg;
 
@@ -1451,7 +1451,7 @@ static void i915_disable_vga (struct drm_device *dev)
 static void ironlake_disable_pll_edp (struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 dpa_ctl;
 
 	DRM_DEBUG_KMS("\n");
@@ -1463,7 +1463,7 @@ static void ironlake_disable_pll_edp (struct drm_crtc *crtc)
 static void ironlake_enable_pll_edp (struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 dpa_ctl;
 
 	dpa_ctl = I915_READ(DP_A);
@@ -1476,7 +1476,7 @@ static void ironlake_enable_pll_edp (struct drm_crtc *crtc)
 static void ironlake_set_pll_edp (struct drm_crtc *crtc, int clock)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 dpa_ctl;
 
 	DRM_DEBUG_KMS("eDP PLL enable for clock %d\n", clock);
@@ -1512,7 +1512,7 @@ static void ironlake_set_pll_edp (struct drm_crtc *crtc, int clock)
 static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
@@ -1935,7 +1935,7 @@ static void intel_crtc_dpms_overlay(struct intel_crtc *intel_crtc, bool enable)
 static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
@@ -2051,7 +2051,7 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
 static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_i915_master_private *master_priv;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
@@ -2194,7 +2194,7 @@ static int i830_get_display_clock_speed(struct drm_device *dev)
  */
 int intel_panel_fitter_pipe (struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32  pfit_control;
 
 	/* i830 doesn't have a panel fitter */
@@ -2438,7 +2438,7 @@ static struct cxsr_latency *intel_get_cxsr_latency(int is_desktop, int fsb,
 
 static void pineview_disable_cxsr(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 reg;
 
 	/* deactivate cxsr */
@@ -2451,7 +2451,7 @@ static void pineview_disable_cxsr(struct drm_device *dev)
 static void pineview_enable_cxsr(struct drm_device *dev, unsigned long clock,
 				 int pixel_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 reg;
 	unsigned long wm;
 	struct cxsr_latency *latency;
@@ -2526,7 +2526,7 @@ static const int latency_ns = 5000;
 
 static int i9xx_get_fifo_size(struct drm_device *dev, int plane)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t dsparb = I915_READ(DSPARB);
 	int size;
 
@@ -2544,7 +2544,7 @@ static int i9xx_get_fifo_size(struct drm_device *dev, int plane)
 
 static int i85x_get_fifo_size(struct drm_device *dev, int plane)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t dsparb = I915_READ(DSPARB);
 	int size;
 
@@ -2563,7 +2563,7 @@ static int i85x_get_fifo_size(struct drm_device *dev, int plane)
 
 static int i845_get_fifo_size(struct drm_device *dev, int plane)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t dsparb = I915_READ(DSPARB);
 	int size;
 
@@ -2579,7 +2579,7 @@ static int i845_get_fifo_size(struct drm_device *dev, int plane)
 
 static int i830_get_fifo_size(struct drm_device *dev, int plane)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t dsparb = I915_READ(DSPARB);
 	int size;
 
@@ -2595,7 +2595,7 @@ static int i830_get_fifo_size(struct drm_device *dev, int plane)
 static void g4x_update_wm(struct drm_device *dev,  int planea_clock,
 			  int planeb_clock, int sr_hdisplay, int pixel_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int total_size, cacheline_size;
 	int planea_wm, planeb_wm, cursora_wm, cursorb_wm, cursor_sr;
 	struct intel_watermark_params planea_params, planeb_params;
@@ -2669,7 +2669,7 @@ static void g4x_update_wm(struct drm_device *dev,  int planea_clock,
 static void i965_update_wm(struct drm_device *dev, int planea_clock,
 			   int planeb_clock, int sr_hdisplay, int pixel_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	unsigned long line_time_us;
 	int sr_clock, sr_entries, srwm = 1;
 
@@ -2709,7 +2709,7 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
 static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
 			   int planeb_clock, int sr_hdisplay, int pixel_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t fwater_lo;
 	uint32_t fwater_hi;
 	int total_size, cacheline_size, cwm, srwm = 1;
@@ -2797,7 +2797,7 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock,
 static void i830_update_wm(struct drm_device *dev, int planea_clock, int unused,
 			   int unused2, int pixel_size)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t fwater_lo = I915_READ(FW_BLC) & ~0xfff;
 	int planea_wm;
 
@@ -2845,7 +2845,7 @@ static void i830_update_wm(struct drm_device *dev, int planea_clock, int unused,
   */
 static void intel_update_watermarks(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc;
 	struct intel_crtc *intel_crtc;
 	int sr_hdisplay = 0;
@@ -2898,7 +2898,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 			       struct drm_framebuffer *old_fb)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	int plane = intel_crtc->plane;
@@ -3444,7 +3444,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 void intel_crtc_load_lut(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int palreg = (intel_crtc->pipe == 0) ? PALETTE_A : PALETTE_B;
 	int i;
@@ -3472,7 +3472,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 				 uint32_t width, uint32_t height)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct drm_gem_object *bo;
 	struct drm_i915_gem_object *obj_priv;
@@ -3579,7 +3579,7 @@ fail:
 static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_framebuffer *intel_fb;
 	int pipe = intel_crtc->pipe;
@@ -3781,7 +3781,7 @@ void intel_release_load_detect_pipe(struct intel_output *intel_output, int dpms_
 /* Returns the clock of the currently programmed mode of the given pipe. */
 static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	u32 dpll = I915_READ((pipe == 0) ? DPLL_A : DPLL_B);
@@ -3869,7 +3869,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
 struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
 					     struct drm_crtc *crtc)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	struct drm_display_mode *mode;
@@ -3904,7 +3904,7 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
 static void intel_gpu_idle_timer(unsigned long arg)
 {
 	struct drm_device *dev = (struct drm_device *)arg;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	DRM_DEBUG_DRIVER("idle timer fired, downclocking\n");
 
@@ -3919,7 +3919,7 @@ static void intel_crtc_idle_timer(unsigned long arg)
 {
 	struct intel_crtc *intel_crtc = (struct intel_crtc *)arg;
 	struct drm_crtc *crtc = &intel_crtc->base;
-	drm_i915_private_t *dev_priv = crtc->dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(crtc->dev);
 
 	DRM_DEBUG_DRIVER("idle timer fired, downclocking\n");
 
@@ -3931,7 +3931,7 @@ static void intel_crtc_idle_timer(unsigned long arg)
 static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule)
 {
 	struct drm_device *dev = crtc->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
@@ -3970,7 +3970,7 @@ static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule)
 static void intel_decrease_pllclock(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
@@ -4056,7 +4056,7 @@ static void intel_idle_update(struct work_struct *work)
  */
 void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc = NULL;
 	struct intel_framebuffer *intel_fb;
 	struct intel_crtc *intel_crtc;
@@ -4138,7 +4138,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
 
 void intel_finish_page_flip(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe];
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_unpin_work *work;
@@ -4191,7 +4191,7 @@ void intel_finish_page_flip(struct drm_device *dev, int pipe)
 
 void intel_prepare_page_flip(struct drm_device *dev, int plane)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc =
 		to_intel_crtc(dev_priv->plane_to_crtc_mapping[plane]);
 	unsigned long flags;
@@ -4210,7 +4210,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 				struct drm_pending_vblank_event *event)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_framebuffer *intel_fb;
 	struct drm_i915_gem_object *obj_priv;
 	struct drm_gem_object *obj;
@@ -4310,7 +4310,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
 
 static void intel_crtc_init(struct drm_device *dev, int pipe)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc;
 	int i;
 
@@ -4355,7 +4355,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
 				struct drm_file *file_priv)
 {
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_i915_get_pipe_from_crtc_id *pipe_from_crtc_id = data;
 	struct drm_mode_object *drmmode_obj;
 	struct intel_crtc *crtc;
@@ -4409,7 +4409,7 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask)
 
 static void intel_setup_outputs(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_connector *connector;
 
 	intel_crt_init(dev);
@@ -4625,7 +4625,7 @@ err_unref:
 
 void ironlake_enable_drps(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 rgvmodectl = I915_READ(MEMMODECTL), rgvswctl;
 	u8 fmax, fmin, fstart, vstart;
 	int i = 0;
@@ -4684,7 +4684,7 @@ void ironlake_enable_drps(struct drm_device *dev)
 
 void ironlake_disable_drps(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 rgvswctl;
 	u8 fstart;
 
@@ -4710,7 +4710,7 @@ void ironlake_disable_drps(struct drm_device *dev)
 
 void intel_init_clock_gating(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	/*
 	 * Disable clock gating reported to work incorrectly according to the
@@ -4786,7 +4786,7 @@ void intel_init_clock_gating(struct drm_device *dev)
 /* Set up chip specific display functions */
 static void intel_init_display(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	/* We always want a DPMS function */
 	if (HAS_PCH_SPLIT(dev))
@@ -4854,7 +4854,7 @@ static void intel_init_display(struct drm_device *dev)
 
 void intel_modeset_init(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int num_pipe;
 	int i;
 
@@ -4918,7 +4918,7 @@ void intel_modeset_init(struct drm_device *dev)
 
 void intel_modeset_cleanup(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc;
 	struct intel_crtc *intel_crtc;
 
@@ -4973,7 +4973,7 @@ struct drm_encoder *intel_best_encoder(struct drm_connector *connector)
  */
 int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u16 gmch_ctrl;
 
 	pci_read_config_word(dev_priv->bridge_dev, INTEL_GMCH_CTRL, &gmch_ctrl);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3ef3a0d..8a2b251 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -128,7 +128,7 @@ static int
 intel_dp_link_required(struct drm_device *dev,
 		       struct intel_output *intel_output, int pixel_clock)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (IS_eDP(intel_output))
 		return (pixel_clock * dev_priv->edp_bpp) / 8;
@@ -181,7 +181,7 @@ unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes)
 static int
 intel_hrawclk(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t clkcfg;
 
 	clkcfg = I915_READ(CLKCFG);
@@ -215,7 +215,7 @@ intel_dp_aux_ch(struct intel_output *intel_output,
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 	uint32_t output_reg = dp_priv->output_reg;
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t ch_ctl = output_reg + 0x10;
 	uint32_t ch_data = ch_ctl + 4;
 	int i;
@@ -555,7 +555,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	struct drm_device *dev = crtc->dev;
 	struct drm_mode_config *mode_config = &dev->mode_config;
 	struct drm_connector *connector;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int lane_count = 4;
 	struct intel_dp_m_n m_n;
@@ -678,7 +678,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
 
 static void ironlake_edp_backlight_on (struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 pp;
 
 	DRM_DEBUG_KMS("\n");
@@ -689,7 +689,7 @@ static void ironlake_edp_backlight_on (struct drm_device *dev)
 
 static void ironlake_edp_backlight_off (struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 pp;
 
 	DRM_DEBUG_KMS("\n");
@@ -704,7 +704,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	uint32_t dp_reg = I915_READ(dp_priv->output_reg);
 
 	if (mode != DRM_MODE_DPMS_ON) {
@@ -753,7 +753,7 @@ intel_dp_save(struct drm_connector *connector)
 {
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 
 	dp_priv->save_DP = I915_READ(dp_priv->output_reg);
@@ -948,7 +948,7 @@ intel_dp_set_link_train(struct intel_output *intel_output,
 			bool first)
 {
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 	int ret;
 
@@ -974,7 +974,7 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
 		    uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE])
 {
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 	uint8_t	train_set[4];
 	uint8_t link_status[DP_LINK_STATUS_SIZE];
@@ -1077,7 +1077,7 @@ static void
 intel_dp_link_down(struct intel_output *intel_output, uint32_t DP)
 {
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 
 	DRM_DEBUG_KMS("\n");
@@ -1169,7 +1169,7 @@ intel_dp_detect(struct drm_connector *connector)
 {
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_dp_priv *dp_priv = intel_output->dev_priv;
 	uint32_t temp, bit;
 	enum drm_connector_status status;
@@ -1223,7 +1223,7 @@ static int intel_dp_get_modes(struct drm_connector *connector)
 {
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int ret;
 
 	/* We should parse the EDID data and find out if it has an audio sink
@@ -1301,7 +1301,7 @@ intel_dp_hot_plug(struct intel_output *intel_output)
 void
 intel_dp_init(struct drm_device *dev, int output_reg)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_connector *connector;
 	struct intel_output *intel_output;
 	struct intel_dp_priv *dp_priv;
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index a4d2606..89ad878 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -78,7 +78,7 @@ static struct intel_dvo_device intel_dvo_devices[] = {
 
 static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
 {
-	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(encoder->dev);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
 	u32 dvo_reg = dvo->dvo_reg;
@@ -97,7 +97,7 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
 
 static void intel_dvo_save(struct drm_connector *connector)
 {
-	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(connector->dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
 
@@ -113,7 +113,7 @@ static void intel_dvo_save(struct drm_connector *connector)
 
 static void intel_dvo_restore(struct drm_connector *connector)
 {
-	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(connector->dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
 
@@ -183,7 +183,7 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
 			       struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
@@ -298,7 +298,7 @@ static void intel_dvo_destroy (struct drm_connector *connector)
 static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
 	int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT);
@@ -350,7 +350,7 @@ static struct drm_display_mode *
 intel_dvo_get_current_mode (struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_dvo_device *dvo = intel_output->dev_priv;
 	uint32_t dvo_reg = dvo->dvo_reg;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index a30f8bf..7d1741d 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -47,7 +47,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 				struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc = encoder->crtc;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
@@ -72,7 +72,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
 	u32 temp;
@@ -108,7 +108,7 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
 static void intel_hdmi_save(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
 
@@ -118,7 +118,7 @@ static void intel_hdmi_save(struct drm_connector *connector)
 static void intel_hdmi_restore(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
 
@@ -227,7 +227,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
 
 void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_connector *connector;
 	struct intel_output *intel_output;
 	struct intel_hdmi_priv *hdmi_priv;
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index fcc753c..a034c4a 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -36,7 +36,7 @@
 
 void intel_i2c_quirk_set(struct drm_device *dev, bool enable)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	/* When using bit bashing for I2C, this bit needs to be set to 1 */
 	if (!IS_PINEVIEW(dev))
@@ -58,7 +58,7 @@ void intel_i2c_quirk_set(struct drm_device *dev, bool enable)
 static int get_clock(void *data)
 {
 	struct intel_i2c_chan *chan = data;
-	struct drm_i915_private *dev_priv = chan->drm_dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(chan->drm_dev);
 	u32 val;
 
 	val = I915_READ(chan->reg);
@@ -68,7 +68,7 @@ static int get_clock(void *data)
 static int get_data(void *data)
 {
 	struct intel_i2c_chan *chan = data;
-	struct drm_i915_private *dev_priv = chan->drm_dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(chan->drm_dev);
 	u32 val;
 
 	val = I915_READ(chan->reg);
@@ -79,7 +79,7 @@ static void set_clock(void *data, int state_high)
 {
 	struct intel_i2c_chan *chan = data;
 	struct drm_device *dev = chan->drm_dev;
-	struct drm_i915_private *dev_priv = chan->drm_dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(chan->drm_dev);
 	u32 reserved = 0, clock_bits;
 
 	/* On most chips, these bits must be preserved in software. */
@@ -100,7 +100,7 @@ static void set_data(void *data, int state_high)
 {
 	struct intel_i2c_chan *chan = data;
 	struct drm_device *dev = chan->drm_dev;
-	struct drm_i915_private *dev_priv = chan->drm_dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(chan->drm_dev);
 	u32 reserved = 0, data_bits;
 
 	/* On most chips, these bits must be preserved in software. */
@@ -126,7 +126,7 @@ static void set_data(void *data, int state_high)
 void
 intel_i2c_reset_gmbus(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(PCH_GMBUS0, 0);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 14e516f..f0e75f0 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -53,7 +53,7 @@ struct intel_lvds_priv {
  */
 static void intel_lvds_set_backlight(struct drm_device *dev, int level)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 blc_pwm_ctl, reg;
 
 	if (HAS_PCH_SPLIT(dev))
@@ -71,7 +71,7 @@ static void intel_lvds_set_backlight(struct drm_device *dev, int level)
  */
 static u32 intel_lvds_get_max_backlight(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 reg;
 
 	if (HAS_PCH_SPLIT(dev))
@@ -88,7 +88,7 @@ static u32 intel_lvds_get_max_backlight(struct drm_device *dev)
  */
 static void intel_lvds_set_power(struct drm_device *dev, bool on)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 pp_status, ctl_reg, status_reg, lvds_reg;
 
 	if (HAS_PCH_SPLIT(dev)) {
@@ -141,7 +141,7 @@ static void intel_lvds_dpms(struct drm_encoder *encoder, int mode)
 static void intel_lvds_save(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 pp_on_reg, pp_off_reg, pp_ctl_reg, pp_div_reg;
 	u32 pwm_ctl_reg;
 
@@ -178,7 +178,7 @@ static void intel_lvds_save(struct drm_connector *connector)
 static void intel_lvds_restore(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 pp_on_reg, pp_off_reg, pp_ctl_reg, pp_div_reg;
 	u32 pwm_ctl_reg;
 
@@ -211,7 +211,7 @@ static int intel_lvds_mode_valid(struct drm_connector *connector,
 				 struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_display_mode *fixed_mode = dev_priv->panel_fixed_mode;
 
 	if (fixed_mode)	{
@@ -235,7 +235,7 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
 	 */
 #define PANEL_RATIO_FACTOR 8192
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct drm_encoder *tmp_encoder;
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
@@ -553,7 +553,7 @@ out:
 static void intel_lvds_prepare(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	u32 reg;
 
 	if (HAS_PCH_SPLIT(dev))
@@ -571,7 +571,7 @@ static void intel_lvds_prepare(struct drm_encoder *encoder)
 static void intel_lvds_commit( struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (dev_priv->backlight_duty_cycle == 0)
 		dev_priv->backlight_duty_cycle =
@@ -585,7 +585,7 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
 				struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_lvds_priv *lvds_priv = intel_output->dev_priv;
 
@@ -685,7 +685,7 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 	struct intel_output *intel_output = to_intel_output(connector);
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	int ret = 0;
 
 	ret = intel_ddc_get_modes(intel_output);
@@ -765,7 +765,7 @@ static void intel_lvds_destroy(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 	struct intel_output *intel_output = to_intel_output(connector);
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	if (intel_output->ddc_bus)
 		intel_i2c_destroy(intel_output->ddc_bus);
@@ -921,7 +921,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
 static void intel_find_lvds_downclock(struct drm_device *dev,
 				struct drm_connector *connector)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_display_mode *scan, *panel_fixed_mode;
 	int temp_downclock;
 
@@ -978,7 +978,7 @@ static void intel_find_lvds_downclock(struct drm_device *dev,
  */
 static int lvds_is_present_in_vbt(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct child_device_config *p_child;
 	int i, ret;
 
@@ -1016,7 +1016,7 @@ static int lvds_is_present_in_vbt(struct drm_device *dev)
  */
 void intel_lvds_init(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output;
 	struct drm_connector *connector;
 	struct drm_encoder *encoder;
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 31bb96e..3c5f803 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -177,7 +177,7 @@ struct overlay_registers {
 
 static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
 {
-        drm_i915_private_t *dev_priv = overlay->dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(overlay->dev);
 	struct overlay_registers *regs;
 
 	/* no recursive mappings */
@@ -211,7 +211,7 @@ static void intel_overlay_unmap_regs_atomic(struct intel_overlay *overlay)
 static int intel_overlay_on(struct intel_overlay *overlay)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 	RING_LOCALS;
 
@@ -245,7 +245,7 @@ static void intel_overlay_continue(struct intel_overlay *overlay,
 			    bool load_polyphase_filter)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 flip_addr = overlay->flip_addr;
 	u32 tmp;
 	RING_LOCALS;
@@ -271,7 +271,7 @@ static void intel_overlay_continue(struct intel_overlay *overlay,
 static int intel_overlay_wait_flip(struct intel_overlay *overlay)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 	u32 tmp;
 	RING_LOCALS;
@@ -314,7 +314,7 @@ static int intel_overlay_off(struct intel_overlay *overlay)
 {
 	u32 flip_addr = overlay->flip_addr;
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	int ret;
 	RING_LOCALS;
 
@@ -390,7 +390,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
 					 int interruptible)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct drm_gem_object *obj;
 	u32 flip_addr;
 	int ret;
@@ -856,7 +856,7 @@ int intel_overlay_switch_off(struct intel_overlay *overlay)
 static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
 					  struct intel_crtc *crtc)
 {
-        drm_i915_private_t *dev_priv = overlay->dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(overlay->dev);
 	u32 pipeconf;
 	int pipeconf_reg = (crtc->pipe == 0) ? PIPEACONF : PIPEBCONF;
 
@@ -875,7 +875,7 @@ static int check_overlay_possible_on_crtc(struct intel_overlay *overlay,
 static void update_pfit_vscale_ratio(struct intel_overlay *overlay)
 {
 	struct drm_device *dev = overlay->dev;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	u32 ratio;
 	u32 pfit_control = I915_READ(PFIT_CONTROL);
 
@@ -1031,7 +1031,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
                             struct drm_file *file_priv)
 {
 	struct drm_intel_overlay_put_image *put_image_rec = data;
-	drm_i915_private_t *dev_priv = dev->dev_private;
+	drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_overlay *overlay;
 	struct drm_mode_object *drmmode_obj;
 	struct intel_crtc *crtc;
@@ -1223,7 +1223,7 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
                         struct drm_file *file_priv)
 {
 	struct drm_intel_overlay_attrs *attrs = data;
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_overlay *overlay;
 	struct overlay_registers *regs;
 	int ret;
@@ -1322,7 +1322,7 @@ out_unlock:
 
 void intel_setup_overlay(struct drm_device *dev)
 {
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 	struct intel_overlay *overlay;
 	struct drm_gem_object *reg_bo;
 	struct overlay_registers *regs;
@@ -1388,7 +1388,7 @@ out_free:
 
 void intel_cleanup_overlay(struct drm_device *dev)
 {
-        drm_i915_private_t *dev_priv = dev->dev_private;
+        drm_i915_private_t *dev_priv = to_intel_dev(dev);
 
 	if (dev_priv->overlay) {
 		/* The bo's should be free'd by the generic code already.
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 48daee5..faf704c 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -171,7 +171,7 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags);
 static void intel_sdvo_write_sdvox(struct intel_output *intel_output, u32 val)
 {
 	struct drm_device *dev = intel_output->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_sdvo_priv   *sdvo_priv = intel_output->dev_priv;
 	u32 bval = val, cval = val;
 	int i;
@@ -1178,7 +1178,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 				struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc = encoder->crtc;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_output *output = enc_to_intel_output(encoder);
@@ -1304,7 +1304,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
 	struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
 	u32 temp;
@@ -1354,7 +1354,7 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
 static void intel_sdvo_save(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
 	int o;
@@ -1858,7 +1858,7 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
 static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
 {
 	struct intel_output *intel_output = to_intel_output(connector);
-	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(connector->dev);
 	struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
 	struct drm_display_mode *newmode;
 
@@ -2250,7 +2250,7 @@ static struct i2c_algorithm intel_sdvo_i2c_bit_algo = {
 static u8
 intel_sdvo_get_slave_addr(struct drm_device *dev, int output_device)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct sdvo_device_mapping *my_mapping, *other_mapping;
 
 	if (output_device == SDVOB) {
@@ -2766,7 +2766,7 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
 
 bool intel_sdvo_init(struct drm_device *dev, int output_device)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_connector *connector;
 	struct intel_output *intel_output;
 	struct intel_sdvo_priv *sdvo_priv;
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 552ec11..68b5f1a 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -902,7 +902,7 @@ static void
 intel_tv_dpms(struct drm_encoder *encoder, int mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 
 	switch(mode) {
 	case DRM_MODE_DPMS_ON:
@@ -920,7 +920,7 @@ static void
 intel_tv_save(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_tv_priv *tv_priv = intel_output->dev_priv;
 	int i;
@@ -970,7 +970,7 @@ static void
 intel_tv_restore(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct intel_output *intel_output = to_intel_output(connector);
 	struct intel_tv_priv *tv_priv = intel_output->dev_priv;
 	struct drm_crtc *crtc = connector->encoder->crtc;
@@ -1118,7 +1118,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
 		  struct drm_display_mode *adjusted_mode)
 {
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_crtc *crtc = encoder->crtc;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_output *intel_output = enc_to_intel_output(encoder);
@@ -1364,7 +1364,7 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output)
 {
 	struct drm_encoder *encoder = &intel_output->enc;
 	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	unsigned long irqflags;
 	u32 tv_ctl, save_tv_ctl;
 	u32 tv_dac, save_tv_dac;
@@ -1708,7 +1708,7 @@ static const struct drm_encoder_funcs intel_tv_enc_funcs = {
  */
 static int tv_is_present_in_vbt(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct child_device_config *p_child;
 	int i, ret;
 
@@ -1738,7 +1738,7 @@ static int tv_is_present_in_vbt(struct drm_device *dev)
 void
 intel_tv_init(struct drm_device *dev)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = to_intel_dev(dev);
 	struct drm_connector *connector;
 	struct intel_output *intel_output;
 	struct intel_tv_priv *tv_priv;
