struct drm_driver has a union containing the different drivers.
This field is unused in case of a usb or platform device. For
pci devices it is only used in drm_pci_get_name() which uses
the pci_driver to return the pci driver name. For all existing
drm drivers this driver name matches the struct drm_device->name,
so return this name instead and remove the now unnecessary code.

Signed-off-by: Sascha Hauer <s.ha...@pengutronix.de>
---
 drivers/gpu/drm/drm_pci.c      |   10 +++-------
 drivers/gpu/drm/drm_platform.c |    1 -
 drivers/gpu/drm/drm_usb.c      |    1 -
 include/drm/drmP.h             |    5 -----
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index d4d10b7..1c06d3a 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -148,14 +148,12 @@ static int drm_pci_get_irq(struct drm_device *dev)
 
 static const char *drm_pci_get_name(struct drm_device *dev)
 {
-       struct pci_driver *pdriver = dev->driver->kdriver.pci;
-       return pdriver->name;
+       return dev->driver->name;
 }
 
 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
 {
        int len, ret;
-       struct pci_driver *pdriver = dev->driver->kdriver.pci;
        master->unique_len = 40;
        master->unique_size = master->unique_len;
        master->unique = kmalloc(master->unique_size, GFP_KERNEL);
@@ -178,7 +176,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
                master->unique_len = len;
 
        dev->devname =
-               kmalloc(strlen(pdriver->name) +
+               kmalloc(strlen(dev->driver->name) +
                        master->unique_len + 2, GFP_KERNEL);
 
        if (dev->devname == NULL) {
@@ -186,8 +184,7 @@ int drm_pci_set_busid(struct drm_device *dev, struct 
drm_master *master)
                goto err;
        }
 
-       sprintf(dev->devname, "%s@%s", pdriver->name,
-               master->unique);
+       sprintf(dev->devname, "%s@%s", dev->driver->name, master->unique);
 
        return 0;
 err:
@@ -410,7 +407,6 @@ int drm_pci_init(struct drm_driver *driver, struct 
pci_driver *pdriver)
        DRM_DEBUG("\n");
 
        INIT_LIST_HEAD(&driver->device_list);
-       driver->kdriver.pci = pdriver;
        driver->bus = &drm_pci_bus;
 
        if (driver->driver_features & DRIVER_MODESET)
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index ae9db5e..f21243c 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -179,7 +179,6 @@ int drm_platform_init(struct drm_driver *driver, struct 
platform_device *platfor
 {
        DRM_DEBUG("\n");
 
-       driver->kdriver.platform_device = platform_device;
        driver->bus = &drm_platform_bus;
        INIT_LIST_HEAD(&driver->device_list);
        return drm_get_platform_dev(platform_device, driver);
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index 445003f..bd7fe72 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -101,7 +101,6 @@ int drm_usb_init(struct drm_driver *driver, struct 
usb_driver *udriver)
        DRM_DEBUG("\n");
 
        INIT_LIST_HEAD(&driver->device_list);
-       driver->kdriver.usb = udriver;
        driver->bus = &drm_usb_bus;
 
        res = usb_register(udriver);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 92f0981..38b95cb 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -919,11 +919,6 @@ struct drm_driver {
        struct drm_ioctl_desc *ioctls;
        int num_ioctls;
        const struct file_operations *fops;
-       union {
-               struct pci_driver *pci;
-               struct platform_device *platform_device;
-               struct usb_driver *usb;
-       } kdriver;
        struct drm_bus *bus;
 
        /* List of devices hanging off this driver */
-- 
1.7.8.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to