From patchwork Wed Dec 21 03:27:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 9482465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5208560772 for ; Wed, 21 Dec 2016 03:27:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F89328138 for ; Wed, 21 Dec 2016 03:27:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33D5728159; Wed, 21 Dec 2016 03:27:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D11CC280FC for ; Wed, 21 Dec 2016 03:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756956AbcLUD11 (ORCPT ); Tue, 20 Dec 2016 22:27:27 -0500 Received: from mleia.com ([178.79.152.223]:49258 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756944AbcLUD10 (ORCPT ); Tue, 20 Dec 2016 22:27:26 -0500 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id C6484386B60; Wed, 21 Dec 2016 03:27:24 +0000 (GMT) From: Vladimir Zapolskiy To: Tomi Valkeinen , Russell King Cc: Linus Walleij , Arnd Bergmann , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] video: ARM CLCD: use panel device node for getting backlight and mode Date: Wed, 21 Dec 2016 05:27:16 +0200 Message-Id: <20161221032717.13154-4-vz@mleia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161221032717.13154-1-vz@mleia.com> References: <20161221032717.13154-1-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20161221_032724_841398_330DE081 X-CRM114-Status: GOOD ( 13.89 ) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Having obtained panel device node in clcdfb_of_init_display() it allows to generalize and simplify two more helper functions clcdfb_of_get_backlight() and clcdfb_of_get_mode(). Signed-off-by: Vladimir Zapolskiy --- drivers/video/fbdev/amba-clcd.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index f25b5fc..0fab92c 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -624,16 +624,11 @@ static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode) mode->refresh); } -static int clcdfb_of_get_backlight(struct device_node *endpoint, +static int clcdfb_of_get_backlight(struct device_node *panel, struct clcd_panel *clcd_panel) { - struct device_node *panel; struct device_node *backlight; - panel = of_graph_get_remote_port_parent(endpoint); - if (!panel) - return -ENODEV; - /* Look up the optional backlight phandle */ backlight = of_parse_phandle(panel, "backlight", 0); if (backlight) { @@ -646,19 +641,14 @@ static int clcdfb_of_get_backlight(struct device_node *endpoint, return 0; } -static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint, - struct clcd_panel *clcd_panel) +static int clcdfb_of_get_mode(struct device *dev, struct device_node *panel, + struct clcd_panel *clcd_panel) { int err; - struct device_node *panel; struct fb_videomode *mode; char *name; int len; - panel = of_graph_get_remote_port_parent(endpoint); - if (!panel) - return -ENODEV; - /* Only directly connected DPI panels supported for now */ if (of_device_is_compatible(panel, "panel-dpi")) err = clcdfb_of_get_dpi_panel_mode(panel, clcd_panel); @@ -791,11 +781,11 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) return err; } - err = clcdfb_of_get_backlight(endpoint, fb->panel); + err = clcdfb_of_get_backlight(panel, fb->panel); if (err) return err; - err = clcdfb_of_get_mode(&fb->dev->dev, endpoint, fb->panel); + err = clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel); if (err) return err;