From patchwork Tue Jul 1 14:46:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 4459611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A2F38BEEAA for ; Tue, 1 Jul 2014 14:49:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9E362021F for ; Tue, 1 Jul 2014 14:49:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D28C4203FB for ; Tue, 1 Jul 2014 14:49:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1zLO-00059h-RY; Tue, 01 Jul 2014 14:47:38 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1zL2-0004nT-Tp for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 14:47:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:In-reply-to:Cc:To:From; bh=yo3eNC7JoBt21Lp9KuEiQvKkNaKr6An6XBPrwzNjIvU=; b=htceFsYGqK6tKKWtl6/Qh2IU3fbruUvh3ahud9prCSNBKeEthnw9np8LNWdel6YjA7eUDVTrMRYuKMNdzZQ6wVuBfpv+/BWa9tXH7wbgNAfK8tjgEtDQeKqMIW/wi13ecLROJ9gwYoth7bgqlDX0Zj4+6/emW7BLowbNj7q6BK0=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:56882 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1X1zKg-0002u4-Qp; Tue, 01 Jul 2014 15:46:54 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1X1zKg-0000cY-DS; Tue, 01 Jul 2014 15:46:54 +0100 From: Russell King To: Greg Kroah-Hartman , David Airlie In-reply-to: <20140701144011.GU32514@n2100.arm.linux.org.uk> Subject: [PATCH v3 5/8] imx-drm: update to use component match support Message-Id: Date: Tue, 01 Jul 2014 15:46:54 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_074717_287479_0D3D5ADF X-CRM114-Status: GOOD ( 14.34 ) X-Spam-Score: -0.1 (/) Cc: devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no 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 Update the imx-drm driver to use the component match support rather than add_components. Signed-off-by: Russell King --- This patch is destined for Greg's driver and staging trees. drivers/staging/imx-drm/imx-drm-core.c | 57 +++------------------------------- 1 file changed, 4 insertions(+), 53 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index def8280d7ee6..47ee6c79857a 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -570,22 +570,6 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static LIST_HEAD(imx_drm_components); - -static int imx_drm_add_components(struct device *master, struct master *m) -{ - struct imx_drm_component *component; - int ret; - - list_for_each_entry(component, &imx_drm_components, list) { - ret = component_master_add_child(m, compare_of, - component->of_node); - if (ret) - return ret; - } - return 0; -} - static int imx_drm_bind(struct device *dev) { return drm_platform_init(&imx_drm_driver, to_platform_device(dev)); @@ -597,43 +581,14 @@ static void imx_drm_unbind(struct device *dev) } static const struct component_master_ops imx_drm_ops = { - .add_components = imx_drm_add_components, .bind = imx_drm_bind, .unbind = imx_drm_unbind, }; -static struct imx_drm_component *imx_drm_find_component(struct device *dev, - struct device_node *node) -{ - struct imx_drm_component *component; - - list_for_each_entry(component, &imx_drm_components, list) - if (component->of_node == node) - return component; - - return NULL; -} - -static int imx_drm_add_component(struct device *dev, struct device_node *node) -{ - struct imx_drm_component *component; - - if (imx_drm_find_component(dev, node)) - return 0; - - component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); - if (!component) - return -ENOMEM; - - component->of_node = node; - list_add_tail(&component->list, &imx_drm_components); - - return 0; -} - static int imx_drm_platform_probe(struct platform_device *pdev) { struct device_node *ep, *port, *remote; + struct component_match *match = NULL; int ret; int i; @@ -647,9 +602,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) if (!port) break; - ret = imx_drm_add_component(&pdev->dev, port); - if (ret < 0) - return ret; + component_match_add(&pdev->dev, &match, compare_of, port); } if (i == 0) { @@ -675,10 +628,8 @@ static int imx_drm_platform_probe(struct platform_device *pdev) continue; } - ret = imx_drm_add_component(&pdev->dev, remote); + component_match_add(&pdev->dev, &match, compare_of, remote); of_node_put(remote); - if (ret < 0) - return ret; } of_node_put(port); } @@ -687,7 +638,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev) if (ret) return ret; - return component_master_add(&pdev->dev, &imx_drm_ops); + return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match); } static int imx_drm_platform_remove(struct platform_device *pdev)