drm/exynos: fix to pointer manager member of struct exynos_drm_subdrv
authorJoonyoung Shim <jy0922.shim@samsung.com>
Thu, 5 Apr 2012 11:49:27 +0000 (20:49 +0900)
committerInki Dae <inki.dae@samsung.com>
Thu, 12 Apr 2012 05:51:27 +0000 (14:51 +0900)
The struct exynos_drm_manager has to exist for exynos drm sub driver
using encoder and connector. If it isn't NULL to member of struct
exynos_drm_subdrv, will create encoder and connector else will not. And
the is_local member also doesn't need.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_core.c
drivers/gpu/drm/exynos/exynos_drm_drv.h
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/exynos/exynos_drm_hdmi.c
drivers/gpu/drm/exynos/exynos_drm_vidi.c

index 411832e8e17aa9fcd9eed13fc614be878f781403..eaf630dc5dba951e78f8a68c2d0bcc1b25ae40b3 100644 (file)
@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev,
                 *
                 * P.S. note that this driver is considered for modularization.
                 */
-               ret = subdrv->probe(dev, subdrv->manager.dev);
+               ret = subdrv->probe(dev, subdrv->dev);
                if (ret)
                        return ret;
        }
 
-       if (subdrv->is_local)
+       if (!subdrv->manager)
                return 0;
 
+       subdrv->manager->dev = subdrv->dev;
+
        /* create and initialize a encoder for this sub driver. */
-       encoder = exynos_drm_encoder_create(dev, &subdrv->manager,
+       encoder = exynos_drm_encoder_create(dev, subdrv->manager,
                        (1 << MAX_CRTC) - 1);
        if (!encoder) {
                DRM_ERROR("failed to create encoder\n");
@@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
 
        list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {
                if (subdrv->open) {
-                       ret = subdrv->open(dev, subdrv->manager.dev, file);
+                       ret = subdrv->open(dev, subdrv->dev, file);
                        if (ret)
                                goto err;
                }
@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file)
 err:
        list_for_each_entry_reverse(subdrv, &subdrv->list, list) {
                if (subdrv->close)
-                       subdrv->close(dev, subdrv->manager.dev, file);
+                       subdrv->close(dev, subdrv->dev, file);
        }
        return ret;
 }
@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file)
 
        list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) {
                if (subdrv->close)
-                       subdrv->close(dev, subdrv->manager.dev, file);
+                       subdrv->close(dev, subdrv->dev, file);
        }
 }
 EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close);
index fbd0a232c93dea173fc4582ebf9aa98c3c620f90..1d814175cd491d39d0411b31fa330c498f02c8c3 100644 (file)
@@ -225,24 +225,25 @@ struct exynos_drm_private {
  * Exynos drm sub driver structure.
  *
  * @list: sub driver has its own list object to register to exynos drm driver.
+ * @dev: pointer to device object for subdrv device driver.
  * @drm_dev: pointer to drm_device and this pointer would be set
  *     when sub driver calls exynos_drm_subdrv_register().
- * @is_local: appear encoder and connector disrelated device.
+ * @manager: subdrv has its own manager to control a hardware appropriately
+ *     and we can access a hardware drawing on this manager.
  * @probe: this callback would be called by exynos drm driver after
  *     subdrv is registered to it.
  * @remove: this callback is used to release resources created
  *     by probe callback.
  * @open: this would be called with drm device file open.
  * @close: this would be called with drm device file close.
- * @manager: subdrv has its own manager to control a hardware appropriately
- *     and we can access a hardware drawing on this manager.
  * @encoder: encoder object owned by this sub driver.
  * @connector: connector object owned by this sub driver.
  */
 struct exynos_drm_subdrv {
        struct list_head list;
+       struct device *dev;
        struct drm_device *drm_dev;
-       bool is_local;
+       struct exynos_drm_manager *manager;
 
        int (*probe)(struct drm_device *drm_dev, struct device *dev);
        void (*remove)(struct drm_device *dev);
@@ -251,7 +252,6 @@ struct exynos_drm_subdrv {
        void (*close)(struct drm_device *drm_dev, struct device *dev,
                        struct drm_file *file);
 
-       struct exynos_drm_manager manager;
        struct drm_encoder *encoder;
        struct drm_connector *connector;
 };
index ecb6db2297008f420ebb7b05e9e19b333bd37286..29fdbfeb43cb79645d034da2d7f8a7aba27dbe5b 100644 (file)
@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode)
 static void fimd_apply(struct device *subdrv_dev)
 {
        struct fimd_context *ctx = get_fimd_context(subdrv_dev);
-       struct exynos_drm_manager *mgr = &ctx->subdrv.manager;
+       struct exynos_drm_manager *mgr = ctx->subdrv.manager;
        struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
        struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
        struct fimd_win_data *win_data;
@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = {
        .disable = fimd_win_disable,
 };
 
+static struct exynos_drm_manager fimd_manager = {
+       .pipe           = -1,
+       .ops            = &fimd_manager_ops,
+       .overlay_ops    = &fimd_overlay_ops,
+       .display_ops    = &fimd_display_ops,
+};
+
 static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
 {
        struct exynos_drm_private *dev_priv = drm_dev->dev_private;
@@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
        struct fimd_context *ctx = (struct fimd_context *)dev_id;
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
        struct drm_device *drm_dev = subdrv->drm_dev;
-       struct exynos_drm_manager *manager = &subdrv->manager;
+       struct exynos_drm_manager *manager = subdrv->manager;
        u32 val;
 
        val = readl(ctx->regs + VIDINTCON1);
@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win)
 static int fimd_power_on(struct fimd_context *ctx, bool enable)
 {
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-       struct device *dev = subdrv->manager.dev;
+       struct device *dev = subdrv->dev;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev)
 
        subdrv = &ctx->subdrv;
 
+       subdrv->dev = dev;
+       subdrv->manager = &fimd_manager;
        subdrv->probe = fimd_subdrv_probe;
        subdrv->remove = fimd_subdrv_remove;
-       subdrv->manager.pipe = -1;
-       subdrv->manager.ops = &fimd_manager_ops;
-       subdrv->manager.overlay_ops = &fimd_overlay_ops;
-       subdrv->manager.display_ops = &fimd_display_ops;
-       subdrv->manager.dev = dev;
 
        mutex_init(&ctx->lock);
 
index 348048b766a92d402c57614f574bb11d878d8b67..3424463676e0997d4f653b11a400c7cf1f8aefd9 100644 (file)
@@ -117,7 +117,7 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)
 {
        struct drm_hdmi_context *ctx = to_context(subdrv_dev);
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-       struct exynos_drm_manager *manager = &subdrv->manager;
+       struct exynos_drm_manager *manager = subdrv->manager;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
@@ -251,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = {
        .disable = drm_mixer_disable,
 };
 
+static struct exynos_drm_manager hdmi_manager = {
+       .pipe           = -1,
+       .ops            = &drm_hdmi_manager_ops,
+       .overlay_ops    = &drm_hdmi_overlay_ops,
+       .display_ops    = &drm_hdmi_display_ops,
+};
 
 static int hdmi_subdrv_probe(struct drm_device *drm_dev,
                struct device *dev)
@@ -318,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
 
        subdrv = &ctx->subdrv;
 
+       subdrv->dev = dev;
+       subdrv->manager = &hdmi_manager;
        subdrv->probe = hdmi_subdrv_probe;
-       subdrv->manager.pipe = -1;
-       subdrv->manager.ops = &drm_hdmi_manager_ops;
-       subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops;
-       subdrv->manager.display_ops = &drm_hdmi_display_ops;
-       subdrv->manager.dev = dev;
 
        platform_set_drvdata(pdev, subdrv);
 
index 8e1339f9fe1fac6bcfde1a07e46d53f3e6558d00..7b9c153dceb610776f59711d4c5c3c303ff21228 100644 (file)
@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode)
 static void vidi_apply(struct device *subdrv_dev)
 {
        struct vidi_context *ctx = get_vidi_context(subdrv_dev);
-       struct exynos_drm_manager *mgr = &ctx->subdrv.manager;
+       struct exynos_drm_manager *mgr = ctx->subdrv.manager;
        struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
        struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops;
        struct vidi_win_data *win_data;
@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = {
        .disable = vidi_win_disable,
 };
 
+static struct exynos_drm_manager vidi_manager = {
+       .pipe           = -1,
+       .ops            = &vidi_manager_ops,
+       .overlay_ops    = &vidi_overlay_ops,
+       .display_ops    = &vidi_display_ops,
+};
+
 static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc)
 {
        struct exynos_drm_private *dev_priv = drm_dev->dev_private;
@@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
        struct vidi_context *ctx = container_of(work, struct vidi_context,
                                        work);
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-       struct exynos_drm_manager *manager = &subdrv->manager;
+       struct exynos_drm_manager *manager = subdrv->manager;
 
        if (manager->pipe < 0)
                return;
@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev)
 static int vidi_power_on(struct vidi_context *ctx, bool enable)
 {
        struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
-       struct device *dev = subdrv->manager.dev;
+       struct device *dev = subdrv->dev;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev)
        ctx->raw_edid = (struct edid *)fake_edid_info;
 
        subdrv = &ctx->subdrv;
+       subdrv->dev = dev;
+       subdrv->manager = &vidi_manager;
        subdrv->probe = vidi_subdrv_probe;
        subdrv->remove = vidi_subdrv_remove;
-       subdrv->manager.pipe = -1;
-       subdrv->manager.ops = &vidi_manager_ops;
-       subdrv->manager.overlay_ops = &vidi_overlay_ops;
-       subdrv->manager.display_ops = &vidi_display_ops;
-       subdrv->manager.dev = dev;
 
        mutex_init(&ctx->lock);