Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234577

[PATCH 2/2] drm/exynos: Use the core platform_driver component matching helper.

From Eric Anholt <eric@anholt.net>
Newsgroups linux.kernel
Subject [PATCH 2/2] drm/exynos: Use the core platform_driver component matching helper.
Date 2015-09-29 02:00 +0200
Message-ID <qdQuS-6hZ-3@gated-at.bofh.it> (permalink)
References <qdQuR-6hZ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 37 +++++++--------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 831d2e4..74826ec 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -566,32 +566,6 @@ static struct platform_driver *const exynos_drm_drv_with_simple_dev[] = {
 };
 #define PDEV_COUNT ARRAY_SIZE(exynos_drm_drv_with_simple_dev)
 
-static int compare_dev(struct device *dev, void *data)
-{
-	return dev == (struct device *)data;
-}
-
-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;
-		struct device *p = NULL, *d;
-
-		while ((d = bus_find_device(&platform_bus_type, p, drv,
-					    (void *)platform_bus_type.match))) {
-			put_device(p);
-			component_match_add(dev, &match, compare_dev, d);
-			p = d;
-		}
-		put_device(p);
-	}
-
-	return match ?: ERR_PTR(-ENODEV);
-}
-
 static int exynos_drm_bind(struct device *dev)
 {
 	return drm_platform_init(&exynos_drm_driver, to_platform_device(dev));
@@ -609,14 +583,17 @@ static const struct component_master_ops exynos_drm_ops = {
 
 static int exynos_drm_platform_probe(struct platform_device *pdev)
 {
-	struct component_match *match;
+	struct component_match *match = NULL;
 
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
 
-	match = exynos_drm_match_add(&pdev->dev);
-	if (IS_ERR(match))
-		return PTR_ERR(match);
+	component_match_add_platform_drivers(&pdev->dev, &match,
+					     exynos_drm_kms_drivers,
+					     ARRAY_SIZE(exynos_drm_kms_drivers));
+
+	if (!match)
+		return -ENODEV;
 
 	return component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
 					       match);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] component: Make a "match_add all devices matching my drivers" helper. Eric Anholt <eric@anholt.net> - 2015-09-29 02:00 +0200
  [PATCH 2/2] drm/exynos: Use the core platform_driver component matching helper. Eric Anholt <eric@anholt.net> - 2015-09-29 02:00 +0200
    Re: [PATCH 2/2] drm/exynos: Use the core platform_driver component  matching helper. Gustavo Padovan <gustavo@padovan.org> - 2015-09-30 16:40 +0200
  Re: [PATCH 1/2] component: Make a "match_add all devices matching my  drivers" helper. Gustavo Padovan <gustavo@padovan.org> - 2015-09-30 16:40 +0200

csiph-web