From patchwork Thu Oct 15 16:11:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55053 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f71.google.com (mail-lf0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 257E722FFA for ; Thu, 15 Oct 2015 16:13:03 +0000 (UTC) Received: by lffv3 with SMTP id v3sf4886163lff.1 for ; Thu, 15 Oct 2015 09:13:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=xY9FHVHjKo9iRfBr2dXWX87Fr5WjC4cIjHXnYYc4XyU=; b=T15VG4OcGJVrBBm8XzzOOsbce3VLYzZvLl7KQ8OgljSIVeN77jXikdzYue0tJG6AAE 4sB7CzSjIzBBBsBHnf0y1sAPLVdabrOtFe/fwmT0lVp3Q+7GJYbERaqRevA6SGYk4bZr yx++eaFzDz/AI3RD3Sw24Wu44dIFK9o2uFXPd1hswzKN1cmc4q0myzvI9tdhlasbn4pG XvvuliFuwLg1501+JedZLLF3+xs2dfLzkFyXU++yAy2Sjp4G+2fkvJ5tdojdqf/gYffZ k0oublKC0v13jwkgzGPhxGZNe0mWhKb3/DbORn/HFx15UbjJ2efGaNLRFw8JFs/01e8o HY8Q== X-Gm-Message-State: ALoCoQnTM58h/iEreUhFCoPK+CKYZd3zoAWMz2r4WamqiwvAeqzYJ5i/XAs+P13AYJ1o0sOMRJNi X-Received: by 10.194.118.65 with SMTP id kk1mr2361356wjb.5.1444925582090; Thu, 15 Oct 2015 09:13:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.207.195 with SMTP id f186ls189747lfg.32.gmail; Thu, 15 Oct 2015 09:13:01 -0700 (PDT) X-Received: by 10.25.22.38 with SMTP id m38mr3366571lfi.10.1444925581902; Thu, 15 Oct 2015 09:13:01 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id g128si9594524lfb.137.2015.10.15.09.13.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 09:13:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbwr8 with SMTP id r8so74743053lbw.2 for ; Thu, 15 Oct 2015 09:13:00 -0700 (PDT) X-Received: by 10.112.168.228 with SMTP id zz4mr5134345lbb.73.1444925580395; Thu, 15 Oct 2015 09:13:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp726045lbq; Thu, 15 Oct 2015 09:12:59 -0700 (PDT) X-Received: by 10.50.30.101 with SMTP id r5mr11856830igh.35.1444925579220; Thu, 15 Oct 2015 09:12:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qh1si12201780igb.51.2015.10.15.09.12.58; Thu, 15 Oct 2015 09:12:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753749AbbJOQMv (ORCPT + 30 others); Thu, 15 Oct 2015 12:12:51 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:28871 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753479AbbJOQMK (ORCPT ); Thu, 15 Oct 2015 12:12:10 -0400 Received: from e106497-lin.cambridge.arm.com (e106497-lin.cambridge.arm.com [10.2.131.158]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id t9FGBBSM020260; Thu, 15 Oct 2015 17:11:12 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Cc: dri-devel , linux-rockchip , LAKML , LKML Subject: [RFC PATCH 2/4] drm/imx: Convert the probe function to the generic drm_of_component_probe() Date: Thu, 15 Oct 2015 17:11:08 +0100 Message-Id: <1444925470-9963-3-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1444925470-9963-1-git-send-email-Liviu.Dudau@arm.com> References: <1444925470-9963-1-git-send-email-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: liviu.dudau@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The generic function is functionally equivalent to the driver's imx_drm_platform_probe(). Use the generic function and reduce the overall code size. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/imx/imx-drm-core.c | 54 +------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 74f505b..c25e39d 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -531,59 +531,7 @@ static const struct component_master_ops imx_drm_ops = { 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; - - /* - * Bind the IPU display interface ports first, so that - * imx_drm_encoder_parse_of called from encoder .bind callbacks - * works as expected. - */ - for (i = 0; ; i++) { - port = of_parse_phandle(pdev->dev.of_node, "ports", i); - if (!port) - break; - - component_match_add(&pdev->dev, &match, compare_of, port); - } - - if (i == 0) { - dev_err(&pdev->dev, "missing 'ports' property\n"); - return -ENODEV; - } - - /* Then bind all encoders */ - for (i = 0; ; i++) { - port = of_parse_phandle(pdev->dev.of_node, "ports", i); - if (!port) - break; - - for_each_child_of_node(port, ep) { - remote = of_graph_get_remote_port_parent(ep); - if (!remote || !of_device_is_available(remote)) { - of_node_put(remote); - continue; - } else if (!of_device_is_available(remote->parent)) { - dev_warn(&pdev->dev, "parent device of %s is not available\n", - remote->full_name); - of_node_put(remote); - continue; - } - - component_match_add(&pdev->dev, &match, compare_of, - remote); - of_node_put(remote); - } - of_node_put(port); - } - - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - - return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match); + return drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); } static int imx_drm_platform_remove(struct platform_device *pdev)