All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Exynos DRM: resolve problems with DMA and virtual exynos-drm device
@ 2016-02-18 13:34 Marek Szyprowski
  2016-02-18 13:34 ` [PATCH 1/2] drm/exynos: refactor driver and device registration code Marek Szyprowski
  2016-02-18 13:34 ` [PATCH 2/2] drm/exynos: use real device for DMA-mapping operations Marek Szyprowski
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Szyprowski @ 2016-02-18 13:34 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Seung-Woo Kim,
	Andrzej Hajda, Marek Szyprowski

Hello,

This patchset resolves the issues with using 'exynos-drm' virtual device
for allocating DMA buffers and performing various DMA-mapping operations
inside Exynos DRM driver.

'exynos-drm' is a pure virtual device and some architectures (like
ARM64) doesn't configure DMA-mapping operations for such devices. Also
on ARM architecture some hacks were needed to setup IOMMU-based
DMA-mapping ops for this virtual device to use common IO/DMA address
space for all devices, which are a part of Exynos DRM subsystem.

Instead of configuring DMA-mapping ops for virtual device (like I
initially proposed in this patch:
http://www.spinics.net/lists/linux-samsung-soc/msg50699.html ),
different device is is used by Exynos GEM code for DMA-mapping operations.
In this approach, the real device of one of the CRTC devices is used for
all DMA-mapping operations. This way all hacks related to configuring
DMA-mapping ops for virtual device are avoided. This approach also works
fine in case of Exynos DRM driver built as module. Patch no 2 implements
this approach.

Patch no 1 is a simple refactoring of driver and device registeration
procedure. It groups all pointers to the subdrivers in one array with
additional flags, instead of having them in 3 separate arrays (with
possible duplication). Implementing the main feature of this patchset
without this refactoring would result in one more array with duplicated
entries for all CRTC drivers.

Patches are based on the currect exynos-drm-next branch.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland


Patch summary:

Marek Szyprowski (2):
  drm/exynos: refactor driver and device registration code
  drm/exynos: use real device for DMA-mapping operations

 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 265 ++++++++++++++++--------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |   9 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_g2d.c   |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.c   |  14 +-
 drivers/gpu/drm/exynos/exynos_drm_iommu.c |  37 +----
 drivers/gpu/drm/exynos/exynos_drm_iommu.h |   5 +-
 7 files changed, 169 insertions(+), 169 deletions(-)

-- 
1.9.2

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] drm/exynos: refactor driver and device registration code
  2016-02-18 13:34 [PATCH 0/2] Exynos DRM: resolve problems with DMA and virtual exynos-drm device Marek Szyprowski
@ 2016-02-18 13:34 ` Marek Szyprowski
  2016-02-29  8:52   ` Inki Dae
  2016-02-18 13:34 ` [PATCH 2/2] drm/exynos: use real device for DMA-mapping operations Marek Szyprowski
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2016-02-18 13:34 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

This patch refactors driver and device registration by moving all drivers
to the common array. This way additional flags can be added later for
new features. #ifdef-based code has been replaced by IS_ENABLED() macro
usage.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 233 +++++++++++++++-----------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h |   1 -
 2 files changed, 107 insertions(+), 127 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 68f0f36f6e7e..5ab8f1240d7b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -495,69 +495,64 @@ static const struct dev_pm_ops exynos_drm_pm_ops = {
 /* forward declaration */
 static struct platform_driver exynos_drm_platform_driver;
 
+struct exynos_drm_driver_info {
+	struct platform_driver *driver;
+	unsigned int flags;
+};
+
+#define DRM_COMPONENT_DRIVER	BIT(0)	/* supports component framework */
+#define DRM_VIRTUAL_DEVICE	BIT(1)	/* create virtual platform device */
+
+#define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL)
+
 /*
  * Connector drivers should not be placed before associated crtc drivers,
  * because connector requires pipe number of its crtc during initialization.
  */
-static struct platform_driver *const exynos_drm_kms_drivers[] = {
-#ifdef CONFIG_DRM_EXYNOS_FIMD
-	&fimd_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS5433_DECON
-	&exynos5433_decon_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS7_DECON
-	&decon_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_MIC
-	&mic_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_DP
-	&dp_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_DSI
-	&dsi_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_MIXER
-	&mixer_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_HDMI
-	&hdmi_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_VIDI
-	&vidi_driver,
-#endif
-};
-
-static struct platform_driver *const exynos_drm_non_kms_drivers[] = {
-#ifdef CONFIG_DRM_EXYNOS_G2D
-	&g2d_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_FIMC
-	&fimc_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_ROTATOR
-	&rotator_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_GSC
-	&gsc_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_IPP
-	&ipp_driver,
-#endif
-	&exynos_drm_platform_driver,
-};
-
-static struct platform_driver *const exynos_drm_drv_with_simple_dev[] = {
-#ifdef CONFIG_DRM_EXYNOS_VIDI
-	&vidi_driver,
-#endif
-#ifdef CONFIG_DRM_EXYNOS_IPP
-	&ipp_driver,
-#endif
-	&exynos_drm_platform_driver,
+static struct exynos_drm_driver_info exynos_drm_drivers[] = {
+	{
+		DRV_PTR(fimd_driver, CONFIG_DRM_EXYNOS_FIMD),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(exynos5433_decon_driver, CONFIG_DRM_EXYNOS5433_DECON),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(decon_driver, CONFIG_DRM_EXYNOS7_DECON),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
+		DRM_COMPONENT_DRIVER
+	}, {
+		DRV_PTR(vidi_driver, CONFIG_DRM_EXYNOS_VIDI),
+		DRM_COMPONENT_DRIVER | DRM_VIRTUAL_DEVICE
+	}, {
+		DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D),
+	}, {
+		DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC),
+	}, {
+		DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR),
+	}, {
+		DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC),
+	}, {
+		DRV_PTR(ipp_driver, CONFIG_DRM_EXYNOS_IPP),
+		DRM_VIRTUAL_DEVICE
+	}, {
+		&exynos_drm_platform_driver,
+		DRM_VIRTUAL_DEVICE
+	}
 };
-#define PDEV_COUNT ARRAY_SIZE(exynos_drm_drv_with_simple_dev)
 
 static int compare_dev(struct device *dev, void *data)
 {
@@ -569,11 +564,15 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
 	struct component_match *match = NULL;
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(exynos_drm_kms_drivers); ++i) {
-		struct device_driver *drv = &exynos_drm_kms_drivers[i]->driver;
+	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
 		struct device *p = NULL, *d;
 
-		while ((d = bus_find_device(&platform_bus_type, p, drv,
+		if (!info->driver || !(info->flags & DRM_COMPONENT_DRIVER))
+			continue;
+
+		while ((d = bus_find_device(&platform_bus_type, p,
+					    &info->driver->driver,
 					    (void *)platform_bus_type.match))) {
 			put_device(p);
 			component_match_add(dev, &match, compare_dev, d);
@@ -630,91 +629,81 @@ static struct platform_driver exynos_drm_platform_driver = {
 	},
 };
 
-static struct platform_device *exynos_drm_pdevs[PDEV_COUNT];
-
 static void exynos_drm_unregister_devices(void)
 {
-	int i = PDEV_COUNT;
+	int i;
+
+	for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
+		struct device *dev;
 
-	while (--i >= 0) {
-		platform_device_unregister(exynos_drm_pdevs[i]);
-		exynos_drm_pdevs[i] = NULL;
+		if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
+			continue;
+
+		while ((dev = bus_find_device(&platform_bus_type, NULL,
+					    &info->driver->driver,
+					    (void *)platform_bus_type.match))) {
+			put_device(dev);
+			platform_device_unregister(to_platform_device(dev));
+		}
 	}
 }
 
 static int exynos_drm_register_devices(void)
 {
+	struct platform_device *pdev;
 	int i;
 
-	for (i = 0; i < PDEV_COUNT; ++i) {
-		struct platform_driver *d = exynos_drm_drv_with_simple_dev[i];
-		struct platform_device *pdev =
-			platform_device_register_simple(d->driver.name, -1,
-							NULL, 0);
+	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
 
-		if (!IS_ERR(pdev)) {
-			exynos_drm_pdevs[i] = pdev;
+		if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
 			continue;
-		}
-		while (--i >= 0) {
-			platform_device_unregister(exynos_drm_pdevs[i]);
-			exynos_drm_pdevs[i] = NULL;
-		}
 
-		return PTR_ERR(pdev);
+		pdev = platform_device_register_simple(
+					info->driver->driver.name, -1, NULL, 0);
+		if (IS_ERR(pdev))
+			goto fail;
 	}
 
 	return 0;
+fail:
+	exynos_drm_unregister_devices();
+	return PTR_ERR(pdev);
 }
 
-static void exynos_drm_unregister_drivers(struct platform_driver * const *drv,
-					  int count)
+static void exynos_drm_unregister_drivers(void)
 {
-	while (--count >= 0)
-		platform_driver_unregister(drv[count]);
-}
+	int i;
 
-static int exynos_drm_register_drivers(struct platform_driver * const *drv,
-				       int count)
-{
-	int i, ret;
+	for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
 
-	for (i = 0; i < count; ++i) {
-		ret = platform_driver_register(drv[i]);
-		if (!ret)
+		if (!info->driver)
 			continue;
 
-		while (--i >= 0)
-			platform_driver_unregister(drv[i]);
-
-		return ret;
+		platform_driver_unregister(info->driver);
 	}
-
-	return 0;
 }
 
-static inline int exynos_drm_register_kms_drivers(void)
+static int exynos_drm_register_drivers(void)
 {
-	return exynos_drm_register_drivers(exynos_drm_kms_drivers,
-					ARRAY_SIZE(exynos_drm_kms_drivers));
-}
+	int i, ret;
 
-static inline int exynos_drm_register_non_kms_drivers(void)
-{
-	return exynos_drm_register_drivers(exynos_drm_non_kms_drivers,
-					ARRAY_SIZE(exynos_drm_non_kms_drivers));
-}
+	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
 
-static inline void exynos_drm_unregister_kms_drivers(void)
-{
-	exynos_drm_unregister_drivers(exynos_drm_kms_drivers,
-					ARRAY_SIZE(exynos_drm_kms_drivers));
-}
+		if (!info->driver)
+			continue;
 
-static inline void exynos_drm_unregister_non_kms_drivers(void)
-{
-	exynos_drm_unregister_drivers(exynos_drm_non_kms_drivers,
-					ARRAY_SIZE(exynos_drm_non_kms_drivers));
+		ret = platform_driver_register(info->driver);
+		if (ret)
+			goto fail;
+	}
+	return 0;
+fail:
+	exynos_drm_unregister_drivers();
+	return ret;
 }
 
 static int exynos_drm_init(void)
@@ -725,19 +714,12 @@ static int exynos_drm_init(void)
 	if (ret)
 		return ret;
 
-	ret = exynos_drm_register_kms_drivers();
+	ret = exynos_drm_register_drivers();
 	if (ret)
 		goto err_unregister_pdevs;
 
-	ret = exynos_drm_register_non_kms_drivers();
-	if (ret)
-		goto err_unregister_kms_drivers;
-
 	return 0;
 
-err_unregister_kms_drivers:
-	exynos_drm_unregister_kms_drivers();
-
 err_unregister_pdevs:
 	exynos_drm_unregister_devices();
 
@@ -746,8 +728,7 @@ err_unregister_pdevs:
 
 static void exynos_drm_exit(void)
 {
-	exynos_drm_unregister_non_kms_drivers();
-	exynos_drm_unregister_kms_drivers();
+	exynos_drm_unregister_drivers();
 	exynos_drm_unregister_devices();
 }
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 17b5ded72ff1..34a139b2fb8d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -297,7 +297,6 @@ extern struct platform_driver dp_driver;
 extern struct platform_driver dsi_driver;
 extern struct platform_driver mixer_driver;
 extern struct platform_driver hdmi_driver;
-extern struct platform_driver exynos_drm_common_hdmi_driver;
 extern struct platform_driver vidi_driver;
 extern struct platform_driver g2d_driver;
 extern struct platform_driver fimc_driver;
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/exynos: use real device for DMA-mapping operations
  2016-02-18 13:34 [PATCH 0/2] Exynos DRM: resolve problems with DMA and virtual exynos-drm device Marek Szyprowski
  2016-02-18 13:34 ` [PATCH 1/2] drm/exynos: refactor driver and device registration code Marek Szyprowski
@ 2016-02-18 13:34 ` Marek Szyprowski
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2016-02-18 13:34 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Inki Dae, Joonyoung Shim, Seung-Woo Kim,
	Andrzej Hajda, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

This patch changes device pointer provided to all calls to DMA-mapping
subsystem from the virtual exynos-drm 'device' to the real device pointer
of one of the CRTC devices (decon, fimd or mixer). This way no more hacks
will be needed to configure proper DMA-mapping address space on the common
virtual exynos-drm device. This change also removes the need for some
hacks in IOMMU related code. It also finally solves the problem of Exynos
DRM driver not working on ARM64 architecture, which provides noop-based
DMA-mapping operations for virtual platform devices.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 42 ++++++++++++++++++++++++++++---
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  8 ++++++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_g2d.c   |  6 ++---
 drivers/gpu/drm/exynos/exynos_drm_gem.c   | 14 +++++------
 drivers/gpu/drm/exynos/exynos_drm_iommu.c | 37 ++++++---------------------
 drivers/gpu/drm/exynos/exynos_drm_iommu.h |  5 ++--
 7 files changed, 67 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 5ab8f1240d7b..c7fce7ffeef5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -130,6 +130,8 @@ static void exynos_drm_atomic_work(struct work_struct *work)
 	exynos_atomic_commit_complete(commit);
 }
 
+static struct device *exynos_drm_get_dma_device(void);
+
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 {
 	struct exynos_drm_private *private;
@@ -147,6 +149,16 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 	dev_set_drvdata(dev->dev, dev);
 	dev->dev_private = (void *)private;
 
+	/* the first real CRTC device is used for all dma mapping operations */
+	private->dma_dev = exynos_drm_get_dma_device();
+	if (!private->dma_dev) {
+		DRM_ERROR("no device found for DMA mapping operations.\n");
+		ret = -ENODEV;
+		goto err_free_private;
+	}
+	DRM_INFO("Exynos DRM: using %s device for DMA mapping operations\n",
+		 dev_name(private->dma_dev));
+
 	/*
 	 * create mapping to manage iommu table and set a pointer to iommu
 	 * mapping structure to iommu_mapping of private data.
@@ -502,6 +514,7 @@ struct exynos_drm_driver_info {
 
 #define DRM_COMPONENT_DRIVER	BIT(0)	/* supports component framework */
 #define DRM_VIRTUAL_DEVICE	BIT(1)	/* create virtual platform device */
+#define DRM_DMA_DEVICE		BIT(2)	/* can be used for dma allocations */
 
 #define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL)
 
@@ -512,16 +525,16 @@ struct exynos_drm_driver_info {
 static struct exynos_drm_driver_info exynos_drm_drivers[] = {
 	{
 		DRV_PTR(fimd_driver, CONFIG_DRM_EXYNOS_FIMD),
-		DRM_COMPONENT_DRIVER
+		DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
 	}, {
 		DRV_PTR(exynos5433_decon_driver, CONFIG_DRM_EXYNOS5433_DECON),
-		DRM_COMPONENT_DRIVER
+		DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
 	}, {
 		DRV_PTR(decon_driver, CONFIG_DRM_EXYNOS7_DECON),
-		DRM_COMPONENT_DRIVER
+		DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
 	}, {
 		DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
-		DRM_COMPONENT_DRIVER
+		DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
 	}, {
 		DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
 		DRM_COMPONENT_DRIVER
@@ -629,6 +642,27 @@ static struct platform_driver exynos_drm_platform_driver = {
 	},
 };
 
+static struct device *exynos_drm_get_dma_device(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
+		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
+		struct device *dev;
+
+		if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
+			continue;
+
+		while ((dev = bus_find_device(&platform_bus_type, NULL,
+					    &info->driver->driver,
+					    (void *)platform_bus_type.match))) {
+			put_device(dev);
+			return dev;
+		}
+	}
+	return NULL;
+}
+
 static void exynos_drm_unregister_devices(void)
 {
 	int i;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 34a139b2fb8d..303056311c0c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -219,8 +219,10 @@ struct exynos_drm_private {
 	struct drm_crtc *crtc[MAX_CRTC];
 	struct drm_property *plane_zpos_property;
 
+	struct device *dma_dev;
 	unsigned long da_start;
 	unsigned long da_space_size;
+	void *mapping;
 
 	unsigned int pipe;
 
@@ -230,6 +232,12 @@ struct exynos_drm_private {
 	wait_queue_head_t	wait;
 };
 
+static inline struct device *to_dma_dev(struct drm_device *dev)
+{
+	struct exynos_drm_private *priv = dev->dev_private;
+	return priv->dma_dev;
+}
+
 /*
  * Exynos drm sub driver structure.
  *
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 8baabd813ff5..4ae860c44f1d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -50,7 +50,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
 	if (vm_size > exynos_gem->size)
 		return -EINVAL;
 
-	ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->cookie,
+	ret = dma_mmap_attrs(to_dma_dev(helper->dev), vma, exynos_gem->cookie,
 			     exynos_gem->dma_addr, exynos_gem->size,
 			     &exynos_gem->dma_attrs);
 	if (ret < 0) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index c17efdb238a6..c2223a8861df 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -259,7 +259,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d)
 	init_dma_attrs(&g2d->cmdlist_dma_attrs);
 	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs);
 
-	g2d->cmdlist_pool_virt = dma_alloc_attrs(subdrv->drm_dev->dev,
+	g2d->cmdlist_pool_virt = dma_alloc_attrs(to_dma_dev(subdrv->drm_dev),
 						G2D_CMDLIST_POOL_SIZE,
 						&g2d->cmdlist_pool, GFP_KERNEL,
 						&g2d->cmdlist_dma_attrs);
@@ -293,7 +293,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d)
 	return 0;
 
 err:
-	dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE,
+	dma_free_attrs(to_dma_dev(subdrv->drm_dev), G2D_CMDLIST_POOL_SIZE,
 			g2d->cmdlist_pool_virt,
 			g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs);
 	return ret;
@@ -306,7 +306,7 @@ static void g2d_fini_cmdlist(struct g2d_data *g2d)
 	kfree(g2d->cmdlist_node);
 
 	if (g2d->cmdlist_pool_virt && g2d->cmdlist_pool) {
-		dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE,
+		dma_free_attrs(to_dma_dev(subdrv->drm_dev), G2D_CMDLIST_POOL_SIZE,
 				g2d->cmdlist_pool_virt,
 				g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs);
 	}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 037436d18422..f15ade86f771 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -65,7 +65,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
 		return -ENOMEM;
 	}
 
-	exynos_gem->cookie = dma_alloc_attrs(dev->dev, exynos_gem->size,
+	exynos_gem->cookie = dma_alloc_attrs(to_dma_dev(dev), exynos_gem->size,
 					     &exynos_gem->dma_addr, GFP_KERNEL,
 					     &exynos_gem->dma_attrs);
 	if (!exynos_gem->cookie) {
@@ -73,7 +73,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
 		goto err_free;
 	}
 
-	ret = dma_get_sgtable_attrs(dev->dev, &sgt, exynos_gem->cookie,
+	ret = dma_get_sgtable_attrs(to_dma_dev(dev), &sgt, exynos_gem->cookie,
 				    exynos_gem->dma_addr, exynos_gem->size,
 				    &exynos_gem->dma_attrs);
 	if (ret < 0) {
@@ -98,7 +98,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
 err_sgt_free:
 	sg_free_table(&sgt);
 err_dma_free:
-	dma_free_attrs(dev->dev, exynos_gem->size, exynos_gem->cookie,
+	dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie,
 		       exynos_gem->dma_addr, &exynos_gem->dma_attrs);
 err_free:
 	drm_free_large(exynos_gem->pages);
@@ -118,7 +118,7 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem)
 	DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n",
 			(unsigned long)exynos_gem->dma_addr, exynos_gem->size);
 
-	dma_free_attrs(dev->dev, exynos_gem->size, exynos_gem->cookie,
+	dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie,
 			(dma_addr_t)exynos_gem->dma_addr,
 			&exynos_gem->dma_attrs);
 
@@ -335,7 +335,7 @@ static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem,
 	if (vm_size > exynos_gem->size)
 		return -EINVAL;
 
-	ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->cookie,
+	ret = dma_mmap_attrs(to_dma_dev(drm_dev), vma, exynos_gem->cookie,
 			     exynos_gem->dma_addr, exynos_gem->size,
 			     &exynos_gem->dma_attrs);
 	if (ret < 0) {
@@ -381,7 +381,7 @@ int exynos_gem_map_sgt_with_dma(struct drm_device *drm_dev,
 
 	mutex_lock(&drm_dev->struct_mutex);
 
-	nents = dma_map_sg(drm_dev->dev, sgt->sgl, sgt->nents, dir);
+	nents = dma_map_sg(to_dma_dev(drm_dev), sgt->sgl, sgt->nents, dir);
 	if (!nents) {
 		DRM_ERROR("failed to map sgl with dma.\n");
 		mutex_unlock(&drm_dev->struct_mutex);
@@ -396,7 +396,7 @@ void exynos_gem_unmap_sgt_from_dma(struct drm_device *drm_dev,
 				struct sg_table *sgt,
 				enum dma_data_direction dir)
 {
-	dma_unmap_sg(drm_dev->dev, sgt->sgl, sgt->nents, dir);
+	dma_unmap_sg(to_dma_dev(drm_dev), sgt->sgl, sgt->nents, dir);
 }
 
 void exynos_drm_gem_free_object(struct drm_gem_object *obj)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c
index d73b9ad35b7a..146ac88078ae 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c
@@ -30,7 +30,6 @@ int drm_create_iommu_mapping(struct drm_device *drm_dev)
 {
 	struct dma_iommu_mapping *mapping = NULL;
 	struct exynos_drm_private *priv = drm_dev->dev_private;
-	struct device *dev = drm_dev->dev;
 
 	if (!priv->da_start)
 		priv->da_start = EXYNOS_DEV_ADDR_START;
@@ -43,18 +42,9 @@ int drm_create_iommu_mapping(struct drm_device *drm_dev)
 	if (IS_ERR(mapping))
 		return PTR_ERR(mapping);
 
-	dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
-					GFP_KERNEL);
-	if (!dev->dma_parms)
-		goto error;
-
-	dma_set_max_seg_size(dev, 0xffffffffu);
-	dev->archdata.mapping = mapping;
+	priv->mapping = mapping;
 
 	return 0;
-error:
-	arm_iommu_release_mapping(mapping);
-	return -ENOMEM;
 }
 
 /*
@@ -67,9 +57,9 @@ error:
  */
 void drm_release_iommu_mapping(struct drm_device *drm_dev)
 {
-	struct device *dev = drm_dev->dev;
+	struct exynos_drm_private *priv = drm_dev->dev_private;
 
-	arm_iommu_release_mapping(dev->archdata.mapping);
+	arm_iommu_release_mapping(priv->mapping);
 }
 
 /*
@@ -84,10 +74,10 @@ void drm_release_iommu_mapping(struct drm_device *drm_dev)
 int drm_iommu_attach_device(struct drm_device *drm_dev,
 				struct device *subdrv_dev)
 {
-	struct device *dev = drm_dev->dev;
+	struct exynos_drm_private *priv = drm_dev->dev_private;
 	int ret;
 
-	if (!dev->archdata.mapping)
+	if (!priv->mapping)
 		return 0;
 
 	subdrv_dev->dma_parms = devm_kzalloc(subdrv_dev,
@@ -101,23 +91,12 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
 	if (subdrv_dev->archdata.mapping)
 		arm_iommu_detach_device(subdrv_dev);
 
-	ret = arm_iommu_attach_device(subdrv_dev, dev->archdata.mapping);
+	ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
 	if (ret < 0) {
 		DRM_DEBUG_KMS("failed iommu attach.\n");
 		return ret;
 	}
 
-	/*
-	 * Set dma_ops to drm_device just one time.
-	 *
-	 * The dma mapping api needs device object and the api is used
-	 * to allocate physial memory and map it with iommu table.
-	 * If iommu attach succeeded, the sub driver would have dma_ops
-	 * for iommu and also all sub drivers have same dma_ops.
-	 */
-	if (get_dma_ops(dev) == get_dma_ops(NULL))
-		set_dma_ops(dev, get_dma_ops(subdrv_dev));
-
 	return 0;
 }
 
@@ -133,8 +112,8 @@ int drm_iommu_attach_device(struct drm_device *drm_dev,
 void drm_iommu_detach_device(struct drm_device *drm_dev,
 				struct device *subdrv_dev)
 {
-	struct device *dev = drm_dev->dev;
-	struct dma_iommu_mapping *mapping = dev->archdata.mapping;
+	struct exynos_drm_private *priv = drm_dev->dev_private;
+	struct dma_iommu_mapping *mapping = priv->mapping;
 
 	if (!mapping || !mapping->domain)
 		return;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
index dc1b5441f491..c1584f24d23d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
@@ -29,9 +29,8 @@ void drm_iommu_detach_device(struct drm_device *dev_dev,
 
 static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
 {
-	struct device *dev = drm_dev->dev;
-
-	return dev->archdata.mapping ? true : false;
+	struct exynos_drm_private *priv = drm_dev->dev_private;
+	return priv->mapping ? true : false;
 }
 
 #else
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] drm/exynos: refactor driver and device registration code
  2016-02-18 13:34 ` [PATCH 1/2] drm/exynos: refactor driver and device registration code Marek Szyprowski
@ 2016-02-29  8:52   ` Inki Dae
  0 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2016-02-29  8:52 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Joonyoung Shim, Seung-Woo Kim, Andrzej Hajda, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz

For 1 and 2, picked it up.

Thanks,
Inki Dae


2016년 02월 18일 22:34에 Marek Szyprowski 이(가) 쓴 글:
> This patch refactors driver and device registration by moving all drivers
> to the common array. This way additional flags can be added later for
> new features. #ifdef-based code has been replaced by IS_ENABLED() macro
> usage.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 233 +++++++++++++++-----------------
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |   1 -
>  2 files changed, 107 insertions(+), 127 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 68f0f36f6e7e..5ab8f1240d7b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -495,69 +495,64 @@ static const struct dev_pm_ops exynos_drm_pm_ops = {
>  /* forward declaration */
>  static struct platform_driver exynos_drm_platform_driver;
>  
> +struct exynos_drm_driver_info {
> +	struct platform_driver *driver;
> +	unsigned int flags;
> +};
> +
> +#define DRM_COMPONENT_DRIVER	BIT(0)	/* supports component framework */
> +#define DRM_VIRTUAL_DEVICE	BIT(1)	/* create virtual platform device */
> +
> +#define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL)
> +
>  /*
>   * Connector drivers should not be placed before associated crtc drivers,
>   * because connector requires pipe number of its crtc during initialization.
>   */
> -static struct platform_driver *const exynos_drm_kms_drivers[] = {
> -#ifdef CONFIG_DRM_EXYNOS_FIMD
> -	&fimd_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS5433_DECON
> -	&exynos5433_decon_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS7_DECON
> -	&decon_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_MIC
> -	&mic_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_DP
> -	&dp_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_DSI
> -	&dsi_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_MIXER
> -	&mixer_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_HDMI
> -	&hdmi_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_VIDI
> -	&vidi_driver,
> -#endif
> -};
> -
> -static struct platform_driver *const exynos_drm_non_kms_drivers[] = {
> -#ifdef CONFIG_DRM_EXYNOS_G2D
> -	&g2d_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_FIMC
> -	&fimc_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_ROTATOR
> -	&rotator_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_GSC
> -	&gsc_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_IPP
> -	&ipp_driver,
> -#endif
> -	&exynos_drm_platform_driver,
> -};
> -
> -static struct platform_driver *const exynos_drm_drv_with_simple_dev[] = {
> -#ifdef CONFIG_DRM_EXYNOS_VIDI
> -	&vidi_driver,
> -#endif
> -#ifdef CONFIG_DRM_EXYNOS_IPP
> -	&ipp_driver,
> -#endif
> -	&exynos_drm_platform_driver,
> +static struct exynos_drm_driver_info exynos_drm_drivers[] = {
> +	{
> +		DRV_PTR(fimd_driver, CONFIG_DRM_EXYNOS_FIMD),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(exynos5433_decon_driver, CONFIG_DRM_EXYNOS5433_DECON),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(decon_driver, CONFIG_DRM_EXYNOS7_DECON),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
> +		DRM_COMPONENT_DRIVER
> +	}, {
> +		DRV_PTR(vidi_driver, CONFIG_DRM_EXYNOS_VIDI),
> +		DRM_COMPONENT_DRIVER | DRM_VIRTUAL_DEVICE
> +	}, {
> +		DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D),
> +	}, {
> +		DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC),
> +	}, {
> +		DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR),
> +	}, {
> +		DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC),
> +	}, {
> +		DRV_PTR(ipp_driver, CONFIG_DRM_EXYNOS_IPP),
> +		DRM_VIRTUAL_DEVICE
> +	}, {
> +		&exynos_drm_platform_driver,
> +		DRM_VIRTUAL_DEVICE
> +	}
>  };
> -#define PDEV_COUNT ARRAY_SIZE(exynos_drm_drv_with_simple_dev)
>  
>  static int compare_dev(struct device *dev, void *data)
>  {
> @@ -569,11 +564,15 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
>  	struct component_match *match = NULL;
>  	int i;
>  
> -	for (i = 0; i < ARRAY_SIZE(exynos_drm_kms_drivers); ++i) {
> -		struct device_driver *drv = &exynos_drm_kms_drivers[i]->driver;
> +	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
> +		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
>  		struct device *p = NULL, *d;
>  
> -		while ((d = bus_find_device(&platform_bus_type, p, drv,
> +		if (!info->driver || !(info->flags & DRM_COMPONENT_DRIVER))
> +			continue;
> +
> +		while ((d = bus_find_device(&platform_bus_type, p,
> +					    &info->driver->driver,
>  					    (void *)platform_bus_type.match))) {
>  			put_device(p);
>  			component_match_add(dev, &match, compare_dev, d);
> @@ -630,91 +629,81 @@ static struct platform_driver exynos_drm_platform_driver = {
>  	},
>  };
>  
> -static struct platform_device *exynos_drm_pdevs[PDEV_COUNT];
> -
>  static void exynos_drm_unregister_devices(void)
>  {
> -	int i = PDEV_COUNT;
> +	int i;
> +
> +	for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
> +		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
> +		struct device *dev;
>  
> -	while (--i >= 0) {
> -		platform_device_unregister(exynos_drm_pdevs[i]);
> -		exynos_drm_pdevs[i] = NULL;
> +		if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
> +			continue;
> +
> +		while ((dev = bus_find_device(&platform_bus_type, NULL,
> +					    &info->driver->driver,
> +					    (void *)platform_bus_type.match))) {
> +			put_device(dev);
> +			platform_device_unregister(to_platform_device(dev));
> +		}
>  	}
>  }
>  
>  static int exynos_drm_register_devices(void)
>  {
> +	struct platform_device *pdev;
>  	int i;
>  
> -	for (i = 0; i < PDEV_COUNT; ++i) {
> -		struct platform_driver *d = exynos_drm_drv_with_simple_dev[i];
> -		struct platform_device *pdev =
> -			platform_device_register_simple(d->driver.name, -1,
> -							NULL, 0);
> +	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
> +		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
>  
> -		if (!IS_ERR(pdev)) {
> -			exynos_drm_pdevs[i] = pdev;
> +		if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
>  			continue;
> -		}
> -		while (--i >= 0) {
> -			platform_device_unregister(exynos_drm_pdevs[i]);
> -			exynos_drm_pdevs[i] = NULL;
> -		}
>  
> -		return PTR_ERR(pdev);
> +		pdev = platform_device_register_simple(
> +					info->driver->driver.name, -1, NULL, 0);
> +		if (IS_ERR(pdev))
> +			goto fail;
>  	}
>  
>  	return 0;
> +fail:
> +	exynos_drm_unregister_devices();
> +	return PTR_ERR(pdev);
>  }
>  
> -static void exynos_drm_unregister_drivers(struct platform_driver * const *drv,
> -					  int count)
> +static void exynos_drm_unregister_drivers(void)
>  {
> -	while (--count >= 0)
> -		platform_driver_unregister(drv[count]);
> -}
> +	int i;
>  
> -static int exynos_drm_register_drivers(struct platform_driver * const *drv,
> -				       int count)
> -{
> -	int i, ret;
> +	for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
> +		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
>  
> -	for (i = 0; i < count; ++i) {
> -		ret = platform_driver_register(drv[i]);
> -		if (!ret)
> +		if (!info->driver)
>  			continue;
>  
> -		while (--i >= 0)
> -			platform_driver_unregister(drv[i]);
> -
> -		return ret;
> +		platform_driver_unregister(info->driver);
>  	}
> -
> -	return 0;
>  }
>  
> -static inline int exynos_drm_register_kms_drivers(void)
> +static int exynos_drm_register_drivers(void)
>  {
> -	return exynos_drm_register_drivers(exynos_drm_kms_drivers,
> -					ARRAY_SIZE(exynos_drm_kms_drivers));
> -}
> +	int i, ret;
>  
> -static inline int exynos_drm_register_non_kms_drivers(void)
> -{
> -	return exynos_drm_register_drivers(exynos_drm_non_kms_drivers,
> -					ARRAY_SIZE(exynos_drm_non_kms_drivers));
> -}
> +	for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
> +		struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
>  
> -static inline void exynos_drm_unregister_kms_drivers(void)
> -{
> -	exynos_drm_unregister_drivers(exynos_drm_kms_drivers,
> -					ARRAY_SIZE(exynos_drm_kms_drivers));
> -}
> +		if (!info->driver)
> +			continue;
>  
> -static inline void exynos_drm_unregister_non_kms_drivers(void)
> -{
> -	exynos_drm_unregister_drivers(exynos_drm_non_kms_drivers,
> -					ARRAY_SIZE(exynos_drm_non_kms_drivers));
> +		ret = platform_driver_register(info->driver);
> +		if (ret)
> +			goto fail;
> +	}
> +	return 0;
> +fail:
> +	exynos_drm_unregister_drivers();
> +	return ret;
>  }
>  
>  static int exynos_drm_init(void)
> @@ -725,19 +714,12 @@ static int exynos_drm_init(void)
>  	if (ret)
>  		return ret;
>  
> -	ret = exynos_drm_register_kms_drivers();
> +	ret = exynos_drm_register_drivers();
>  	if (ret)
>  		goto err_unregister_pdevs;
>  
> -	ret = exynos_drm_register_non_kms_drivers();
> -	if (ret)
> -		goto err_unregister_kms_drivers;
> -
>  	return 0;
>  
> -err_unregister_kms_drivers:
> -	exynos_drm_unregister_kms_drivers();
> -
>  err_unregister_pdevs:
>  	exynos_drm_unregister_devices();
>  
> @@ -746,8 +728,7 @@ err_unregister_pdevs:
>  
>  static void exynos_drm_exit(void)
>  {
> -	exynos_drm_unregister_non_kms_drivers();
> -	exynos_drm_unregister_kms_drivers();
> +	exynos_drm_unregister_drivers();
>  	exynos_drm_unregister_devices();
>  }
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 17b5ded72ff1..34a139b2fb8d 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -297,7 +297,6 @@ extern struct platform_driver dp_driver;
>  extern struct platform_driver dsi_driver;
>  extern struct platform_driver mixer_driver;
>  extern struct platform_driver hdmi_driver;
> -extern struct platform_driver exynos_drm_common_hdmi_driver;
>  extern struct platform_driver vidi_driver;
>  extern struct platform_driver g2d_driver;
>  extern struct platform_driver fimc_driver;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-29  8:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 13:34 [PATCH 0/2] Exynos DRM: resolve problems with DMA and virtual exynos-drm device Marek Szyprowski
2016-02-18 13:34 ` [PATCH 1/2] drm/exynos: refactor driver and device registration code Marek Szyprowski
2016-02-29  8:52   ` Inki Dae
2016-02-18 13:34 ` [PATCH 2/2] drm/exynos: use real device for DMA-mapping operations Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.