diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index fdf35cd..d37695e 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -217,7 +217,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
 	if (dev->switch_power_state != DRM_SWITCH_POWER_ON && dev->switch_power_state != DRM_SWITCH_POWER_DYNAMIC_OFF)
 		return -EINVAL;
 
-	DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor->index);
+	DRM_DEBUG("pid = %d, devt = 0x%lx\n", task_pid_nr(current),
+		  (long)old_encode_dev(minor->kdev->devt));
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
 	if (!priv)
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
index 7473035..b5a4b0a 100644
--- a/drivers/gpu/drm/drm_info.c
+++ b/drivers/gpu/drm/drm_info.c
@@ -190,7 +190,7 @@ int drm_clients_info(struct seq_file *m, void *data)
 	list_for_each_entry(priv, &dev->filelist, lhead) {
 		seq_printf(m, "%c %3d %5d %5d %10u\n",
 			   priv->authenticated ? 'y' : 'n',
-			   priv->minor->index,
+			   drm_minor_get_id(priv->minor),
 			   pid_vnr(priv->pid),
 			   from_kuid_munged(seq_user_ns(m), priv->uid),
 			   priv->magic);
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 9ded847..4e6f5ea 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -338,7 +338,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
 
 	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
 		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, pci_name(pdev), dev->primary->index);
+		 driver->date, pci_name(pdev), dev->minor_base);
 
 	/* No locking needed since shadow-attach is single-threaded since it may
 	 * only be called from the per-driver module init hook. */
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 319ff53..7521571 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -59,7 +59,7 @@ static int drm_get_platform_dev(struct platform_device *platdev,
 
 	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
 		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
+		 driver->date, dev->minor_base);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 0f84bf6..2567ecb 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -339,7 +339,6 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
 		return -ENOMEM;
 
 	minor->type = type;
-	minor->index = drm_minor_type_to_id(dev, type);
 	minor->dev = dev;
 	INIT_LIST_HEAD(&minor->master_list);
 
@@ -369,7 +368,8 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
 	if (!new_minor)
 		return 0;
 
-	ret = drm_debugfs_init(new_minor, new_minor->index, drm_debugfs_root);
+	ret = drm_debugfs_init(new_minor, drm_minor_get_id(new_minor),
+			       drm_debugfs_root);
 	if (ret) {
 		DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
 		return ret;
@@ -381,7 +381,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
 		goto err_debugfs;
 	}
 
-	DRM_DEBUG("new minor assigned %d\n", new_minor->index);
+	DRM_DEBUG("new minor assigned %d\n", drm_minor_get_id(new_minor));
 	return 0;
 
 err_debugfs:
@@ -459,6 +459,17 @@ void drm_minor_release(struct drm_minor *minor)
 }
 
 /**
+ * drm_minor_get_id - Return minor-ID of DRM-minor object
+ * @minor: DRM-minor object
+ *
+ * Returns the minor-ID of the given DRM-minor object.
+ */
+unsigned int drm_minor_get_id(struct drm_minor *minor)
+{
+	return drm_minor_type_to_id(minor->dev, minor->type);
+}
+
+/**
  * Called via drm_exit() at module unload time or when pci device is
  * unplugged.
  *
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index c22c309..9be02d9 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -380,7 +380,7 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
 
 	connector->kdev = device_create(drm_class, dev->primary->kdev,
 					0, connector, "card%d-%s",
-					dev->primary->index, drm_get_connector_name(connector));
+					dev->minor_base, drm_get_connector_name(connector));
 	DRM_DEBUG("adding \"%s\" to sysfs\n",
 		  drm_get_connector_name(connector));
 
@@ -505,6 +505,7 @@ static void drm_sysfs_release(struct device *dev)
  */
 int drm_sysfs_device_add(struct drm_minor *minor)
 {
+	unsigned int minor_id;
 	char *minor_str;
 	int r;
 
@@ -521,15 +522,16 @@ int drm_sysfs_device_add(struct drm_minor *minor)
 		goto error;
 	}
 
+	minor_id = drm_minor_get_id(minor);
 	device_initialize(minor->kdev);
-	minor->kdev->devt = MKDEV(DRM_MAJOR, minor->index);
+	minor->kdev->devt = MKDEV(DRM_MAJOR, minor_id);
 	minor->kdev->class = drm_class;
 	minor->kdev->type = &drm_sysfs_device_minor;
 	minor->kdev->parent = minor->dev->dev;
 	minor->kdev->release = drm_sysfs_release;
 	dev_set_drvdata(minor->kdev, minor);
 
-	r = dev_set_name(minor->kdev, minor_str, minor->index);
+	r = dev_set_name(minor->kdev, minor_str, minor_id);
 	if (r < 0)
 		goto error;
 
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index c3406aa..eb02ad3 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -25,7 +25,7 @@ int drm_get_usb_dev(struct usb_interface *interface,
 
 	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
 		 driver->name, driver->major, driver->minor, driver->patchlevel,
-		 driver->date, dev->primary->index);
+		 driver->date, dev->minor_base);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index a707cca..07442fb 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -914,7 +914,7 @@ void i915_capture_error_state(struct drm_device *dev)
 	}
 
 	DRM_INFO("GPU crash dump saved to /sys/class/drm/card%d/error\n",
-		 dev->primary->index);
+		 dev->minor_base);
 	DRM_INFO("GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.\n");
 	DRM_INFO("Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel\n");
 	DRM_INFO("drm/i915 developers can then reassign to the right component if it's not a kernel issue.\n");
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 6e580c9..a03e4e2 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -207,7 +207,7 @@ TRACE_EVENT(i915_gem_evict,
 			    ),
 
 	    TP_fast_assign(
-			   __entry->dev = dev->primary->index;
+			   __entry->dev = dev->minor_base;
 			   __entry->size = size;
 			   __entry->align = align;
 			   __entry->mappable = mappable;
@@ -227,7 +227,7 @@ TRACE_EVENT(i915_gem_evict_everything,
 			    ),
 
 	    TP_fast_assign(
-			   __entry->dev = dev->primary->index;
+			   __entry->dev = dev->minor_base;
 			  ),
 
 	    TP_printk("dev=%d", __entry->dev)
@@ -245,7 +245,7 @@ TRACE_EVENT(i915_gem_evict_vm,
 			   __entry->vm = vm;
 			  ),
 
-	    TP_printk("dev=%d, vm=%p", __entry->vm->dev->primary->index, __entry->vm)
+	    TP_printk("dev=%d, vm=%p", __entry->vm->dev->minor_base, __entry->vm)
 );
 
 TRACE_EVENT(i915_gem_ring_sync_to,
@@ -262,7 +262,7 @@ TRACE_EVENT(i915_gem_ring_sync_to,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = from->dev->primary->index;
+			   __entry->dev = from->dev->minor_base;
 			   __entry->sync_from = from->id;
 			   __entry->sync_to = to->id;
 			   __entry->seqno = seqno;
@@ -286,7 +286,7 @@ TRACE_EVENT(i915_gem_ring_dispatch,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   __entry->seqno = seqno;
 			   __entry->flags = flags;
@@ -309,7 +309,7 @@ TRACE_EVENT(i915_gem_ring_flush,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   __entry->invalidate = invalidate;
 			   __entry->flush = flush;
@@ -331,7 +331,7 @@ DECLARE_EVENT_CLASS(i915_gem_request,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   __entry->seqno = seqno;
 			   ),
@@ -356,7 +356,7 @@ TRACE_EVENT(i915_gem_request_complete,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   __entry->seqno = ring->get_seqno(ring, false);
 			   ),
@@ -388,7 +388,7 @@ TRACE_EVENT(i915_gem_request_wait_begin,
 	     * less desirable.
 	     */
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   __entry->seqno = seqno;
 			   __entry->blocking = mutex_is_locked(&ring->dev->struct_mutex);
@@ -414,7 +414,7 @@ DECLARE_EVENT_CLASS(i915_ring,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = ring->dev->primary->index;
+			   __entry->dev = ring->dev->minor_base;
 			   __entry->ring = ring->id;
 			   ),
 
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 6c6d7d4..5fc48b9 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -83,7 +83,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
 	/* allocate backing bo */
 	size = mode_cmd.pitches[0] * mode_cmd.height;
-	DBG("allocating %d bytes for fb %d", size, dev->primary->index);
+	DBG("allocating %d bytes for fb %d", size, dev->minor_base);
 	mutex_lock(&dev->struct_mutex);
 	fbdev->bo = msm_gem_new(dev, size, MSM_BO_SCANOUT | MSM_BO_WC);
 	mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 002988d..bd9f9a7 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -176,7 +176,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 	gsize = (union omap_gem_size){
 		.bytes = PAGE_ALIGN(mode_cmd.pitches[0] * mode_cmd.height),
 	};
-	DBG("allocating %d bytes for fb %d", gsize.bytes, dev->primary->index);
+	DBG("allocating %d bytes for fb %d", gsize.bytes, dev->minor_base);
 	fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT | OMAP_BO_WC);
 	if (!fbdev->bo) {
 		dev_err(dev->dev, "failed to allocate buffer object\n");
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index a42d615..f5cc894 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -212,7 +212,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
 	props.max_brightness = RADEON_MAX_BL_LEVEL;
 	props.type = BACKLIGHT_RAW;
 	snprintf(bl_name, sizeof(bl_name),
-		 "radeon_bl%d", dev->primary->index);
+		 "radeon_bl%d", dev->minor_base);
 	bd = backlight_device_register(bl_name, drm_connector->kdev,
 				       pdata, &radeon_atom_backlight_ops, &props);
 	if (IS_ERR(bd)) {
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index c89971d..ef82bdb 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -391,7 +391,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
 	props.max_brightness = RADEON_MAX_BL_LEVEL;
 	props.type = BACKLIGHT_RAW;
 	snprintf(bl_name, sizeof(bl_name),
-		 "radeon_bl%d", dev->primary->index);
+		 "radeon_bl%d", dev->minor_base);
 	bd = backlight_device_register(bl_name, drm_connector->kdev,
 				       pdata, &radeon_backlight_ops, &props);
 	if (IS_ERR(bd)) {
diff --git a/drivers/gpu/drm/radeon/radeon_trace.h b/drivers/gpu/drm/radeon/radeon_trace.h
index 0473257..84b56df 100644
--- a/drivers/gpu/drm/radeon/radeon_trace.h
+++ b/drivers/gpu/drm/radeon/radeon_trace.h
@@ -116,7 +116,7 @@ DECLARE_EVENT_CLASS(radeon_fence_request,
 			     ),
 
 	    TP_fast_assign(
-			   __entry->dev = dev->primary->index;
+			   __entry->dev = dev->minor_base;
 			   __entry->seqno = seqno;
 			   ),
 
diff --git a/drivers/gpu/drm/tegra/bus.c b/drivers/gpu/drm/tegra/bus.c
index 71cef5c..7d2aace 100644
--- a/drivers/gpu/drm/tegra/bus.c
+++ b/drivers/gpu/drm/tegra/bus.c
@@ -58,7 +58,7 @@ int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)
 
 	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
 		 driver->major, driver->minor, driver->patchlevel,
-		 driver->date, drm->primary->index);
+		 driver->date, drm->minor_base);
 
 	return 0;
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index cdc5362..5339a9c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1038,7 +1038,6 @@ struct drm_info_node {
  * DRM minor structure. This structure represents a drm minor number.
  */
 struct drm_minor {
-	int index;			/**< Minor device number */
 	int type;                       /**< Control or render */
 	struct device *kdev;		/**< Linux device */
 	struct drm_device *dev;
@@ -1670,6 +1669,7 @@ void drm_dev_unref(struct drm_device *dev);
 int drm_dev_register(struct drm_device *dev, unsigned long flags);
 void drm_dev_unregister(struct drm_device *dev);
 
+unsigned int drm_minor_get_id(struct drm_minor *minor);
 struct drm_minor *drm_minor_acquire(unsigned int minor_id);
 void drm_minor_release(struct drm_minor *minor);
 
