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: 9482469 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 0B31D60772 for ; Wed, 21 Dec 2016 03:30:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0B8B27F2B for ; Wed, 21 Dec 2016 03:30:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E591B2818B; Wed, 21 Dec 2016 03:30:17 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FF0627F2B for ; Wed, 21 Dec 2016 03:30:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJXZH-00040T-Tv; Wed, 21 Dec 2016 03:27:51 +0000 Received: from mleia.com ([178.79.152.223] helo=mail.mleia.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cJXZD-0003xx-CG for linux-arm-kernel@lists.infradead.org; Wed, 21 Dec 2016 03:27:48 +0000 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 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 ) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161221_032724_841398_330DE081 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij , linux-fbdev@vger.kernel.org, Arnd Bergmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;