drm: Remove the struct drm_device platformdev field
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sat, 17 Dec 2016 22:01:19 +0000 (00:01 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 17 Feb 2017 13:27:24 +0000 (15:27 +0200)
The field contains a pointer to the parent platform device of the DRM
device. As struct drm_device also contains a dev pointer to the struct
device embedded in the platform_device structure, the platformdev field
is redundant. Remove it and use the dev pointer directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Vincent Abriou <vincent.abriou@st.com> # For sti
Acked-by: Russell King <rmk+kernel@armlinux.org.uk> # For armada
Acked-by: Rob Clark <robdclark@gmail.com> # For msm
Acked-by: Xinwei Kong<kong.kongxinwei@hisilicon.com>
drivers/gpu/drm/armada/armada_drv.c
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_mdss.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/tilcdc/tilcdc_drv.c
include/drm/drmP.h

index 63f42d001f33d9ac1737d358c21ccdb4184083ff..b4e5e0529eae90a18635b0f86c04f96697f20b66 100644 (file)
@@ -154,10 +154,9 @@ static int armada_drm_bind(struct device *dev)
                return ret;
        }
 
-       priv->drm.platformdev = to_platform_device(dev);
        priv->drm.dev_private = priv;
 
-       platform_set_drvdata(priv->drm.platformdev, &priv->drm);
+       dev_set_drvdata(dev, &priv->drm);
 
        INIT_WORK(&priv->fb_unref_work, armada_drm_unref_work);
        INIT_KFIFO(priv->fb_unref);
index 94ea963519b28206ff2cc47c231ed45c752df9cf..a4e1206a66a8dfa676661822801fbdd08cbfe431 100644 (file)
@@ -434,7 +434,7 @@ fail:
 
 struct msm_kms *mdp4_kms_init(struct drm_device *dev)
 {
-       struct platform_device *pdev = dev->platformdev;
+       struct platform_device *pdev = to_platform_device(dev->dev);
        struct mdp4_platform_config *config = mdp4_get_config(pdev);
        struct mdp4_kms *mdp4_kms;
        struct msm_kms *kms = NULL;
index 34ab553f6897656c0eddc14b0f65a88f9e693e11..ba2d017f6591419ca7c32146c6e7031aa61fe916 100644 (file)
@@ -505,7 +505,7 @@ struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
                uint32_t major, uint32_t minor)
 {
        struct drm_device *dev = mdp5_kms->dev;
-       struct platform_device *pdev = dev->platformdev;
+       struct platform_device *pdev = to_platform_device(dev->dev);
        struct mdp5_cfg_handler *cfg_handler;
        struct mdp5_cfg_platform *pconfig;
        int i, ret = 0;
index d444a6901fff869ddabb735630a64243091297db..f8f48d014978c0ccd5cc9ffcc3d699b86f779399 100644 (file)
@@ -160,7 +160,7 @@ void msm_mdss_destroy(struct drm_device *dev)
 
 int msm_mdss_init(struct drm_device *dev)
 {
-       struct platform_device *pdev = dev->platformdev;
+       struct platform_device *pdev = to_platform_device(dev->dev);
        struct msm_drm_private *priv = dev->dev_private;
        struct msm_mdss *mdss;
        int ret;
index 70226eaa5cac24ad34a85e1b0117492acca3d471..19435079b11f32a5b2ca4135f361be82878483c1 100644 (file)
@@ -383,7 +383,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
        }
 
        platform_set_drvdata(pdev, ddev);
-       ddev->platformdev = pdev;
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv) {
index dd7b52ab505a023f9491ee29bc97d1318726de6d..e4ddd43c2c796d33ae148d9addb4f3ad8dd979a8 100644 (file)
@@ -106,7 +106,7 @@ nouveau_name(struct drm_device *dev)
        if (dev->pdev)
                return nouveau_pci_name(dev->pdev);
        else
-               return nouveau_platform_name(dev->platformdev);
+               return nouveau_platform_name(to_platform_device(dev->dev));
 }
 
 static int
@@ -1088,7 +1088,6 @@ nouveau_platform_device_create(const struct nvkm_device_tegra_func *func,
                goto err_free;
        }
 
-       drm->platformdev = pdev;
        platform_set_drvdata(pdev, drm);
 
        return drm;
index e6c1646b9c53ac2de3b26fd5bbc8679d150f3f8a..fedade400eebed8d466a0382ce9157d9fc40aea7 100644 (file)
@@ -273,8 +273,6 @@ static int sti_bind(struct device *dev)
        if (IS_ERR(ddev))
                return PTR_ERR(ddev);
 
-       ddev->platformdev = to_platform_device(dev);
-
        ret = sti_init(ddev);
        if (ret)
                goto err_drm_dev_unref;
index 372d86fbb093865816845331aea01651a6e6f1c0..ea6a228a217fbf03950e59c9f9f1e50f69cbbce5 100644 (file)
@@ -245,7 +245,6 @@ static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
        if (IS_ERR(ddev))
                return PTR_ERR(ddev);
 
-       ddev->platformdev = pdev;
        ddev->dev_private = priv;
        platform_set_drvdata(pdev, ddev);
        drm_mode_config_init(ddev);
index 231a6cc925ddca2c43571474504f71b15eb4f07f..aa8f203142370b2cb2e5348871224efe31632370 100644 (file)
@@ -610,7 +610,6 @@ struct drm_device {
        struct pci_controller *hose;
 #endif
 
-       struct platform_device *platformdev; /**< Platform device struture */
        struct virtio_device *virtdev;
 
        struct drm_sg_mem *sg;  /**< Scatter gather memory */