From patchwork Mon Sep 28 23:54:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 7281581 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CD3CD9F39B for ; Mon, 28 Sep 2015 23:54:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CF6D2070E for ; Mon, 28 Sep 2015 23:54:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3638920702 for ; Mon, 28 Sep 2015 23:54:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 46A416EA76; Mon, 28 Sep 2015 16:54:27 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from annarchy.freedesktop.org (annarchy.freedesktop.org [131.252.210.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 07F4F6EA76; Mon, 28 Sep 2015 16:54:26 -0700 (PDT) Received: from eliezer.anholt.net (annarchy.freedesktop.org [127.0.0.1]) by annarchy.freedesktop.org (Postfix) with ESMTP id ED07C18190; Mon, 28 Sep 2015 16:54:25 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 639A4F00079; Mon, 28 Sep 2015 16:54:09 -0700 (PDT) From: Eric Anholt To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/exynos: Use the core platform_driver component matching helper. Date: Mon, 28 Sep 2015 16:54:09 -0700 Message-Id: <1443484449-31868-2-git-send-email-eric@anholt.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443484449-31868-1-git-send-email-eric@anholt.net> References: <1443484449-31868-1-git-send-email-eric@anholt.net> Cc: Greg Kroah-Hartman , Seung-Woo Kim , linux-kernel@vger.kernel.org, Kyungmin Park X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Eric Anholt Reviewed-by: Gustavo Padovan --- 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);