[PATCH 02/12] drm: remove platformdev and usbdev from struct drm_device

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 2 03:57:54 PST 2012


struct drm_device has a struct usbdevice * and a
struct platform_device *. This is unused, so remove it.
If the platform_device or usbdevice is needed, we can
always get it using to_usb_device or to to_platform_device.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/gpu/drm/drm_platform.c            |   18 +++++++++++-------
 drivers/gpu/drm/drm_usb.c                 |    1 -
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |    3 +--
 include/drm/drmP.h                        |    3 ---
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index f21243c..1c1d581 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -51,7 +51,6 @@ int drm_get_platform_dev(struct platform_device *platdev,
 	if (!dev)
 		return -ENOMEM;
 
-	dev->platformdev = platdev;
 	dev->dev = &platdev->dev;
 
 	mutex_lock(&drm_global_mutex);
@@ -112,19 +111,24 @@ EXPORT_SYMBOL(drm_get_platform_dev);
 
 static int drm_platform_get_irq(struct drm_device *dev)
 {
-	return platform_get_irq(dev->platformdev, 0);
+	struct platform_device *pdev = to_platform_device(dev->dev);
+
+	return platform_get_irq(pdev, 0);
 }
 
 static const char *drm_platform_get_name(struct drm_device *dev)
 {
-	return dev->platformdev->name;
+	struct platform_device *pdev = to_platform_device(dev->dev);
+
+	return pdev->name;
 }
 
 static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master)
 {
+	struct platform_device *pdev = to_platform_device(dev->dev);
 	int len, ret;
 
-	master->unique_len = 13 + strlen(dev->platformdev->name);
+	master->unique_len = 13 + strlen(pdev->name);
 	master->unique_size = master->unique_len;
 	master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
 
@@ -132,7 +136,7 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas
 		return -ENOMEM;
 
 	len = snprintf(master->unique, master->unique_len,
-			"platform:%s:%02d", dev->platformdev->name, dev->platformdev->id);
+			"platform:%s:%02d", pdev->name, pdev->id);
 
 	if (len > master->unique_len) {
 		DRM_ERROR("Unique buffer overflowed\n");
@@ -141,7 +145,7 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas
 	}
 
 	dev->devname =
-		kmalloc(strlen(dev->platformdev->name) +
+		kmalloc(strlen(pdev->name) +
 			master->unique_len + 2, GFP_KERNEL);
 
 	if (dev->devname == NULL) {
@@ -149,7 +153,7 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas
 		goto err;
 	}
 
-	sprintf(dev->devname, "%s@%s", dev->platformdev->name,
+	sprintf(dev->devname, "%s@%s", pdev->name,
 		master->unique);
 	return 0;
 err:
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index bd7fe72..224dbdd 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -18,7 +18,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
 		return -ENOMEM;
 
 	usbdev = interface_to_usbdev(interface);
-	dev->usbdev = usbdev;
 	dev->dev = &usbdev->dev;
 
 	mutex_lock(&drm_global_mutex);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index d7ae29d..3a9589b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -125,7 +125,6 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
 	struct drm_device *dev = helper->dev;
 	struct fb_info *fbi;
 	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
-	struct platform_device *pdev = dev->platformdev;
 	unsigned long size;
 	int ret;
 
@@ -143,7 +142,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
 
 	mutex_lock(&dev->struct_mutex);
 
-	fbi = framebuffer_alloc(0, &pdev->dev);
+	fbi = framebuffer_alloc(0, dev->dev);
 	if (!fbi) {
 		DRM_ERROR("failed to allocate fb info.\n");
 		ret = -ENOMEM;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 38b95cb..d770eef 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1140,9 +1140,6 @@ struct drm_device {
 	struct pci_controller *hose;
 #endif
 
-	struct platform_device *platformdev; /**< Platform device struture */
-	struct usb_device *usbdev;
-
 	struct drm_sg_mem *sg;	/**< Scatter gather memory */
 	unsigned int num_crtcs;                  /**< Number of CRTCs on this device */
 	void *dev_private;		/**< device private data */
-- 
1.7.8.3



More information about the dri-devel mailing list