[{"id":1766790,"web_url":"http://patchwork.ozlabs.org/comment/1766790/","msgid":"<ce468a58-79c3-3eeb-bc94-18b2a8dae6bd@arm.com>","list_archive_url":null,"date":"2017-09-12T09:14:34","subject":"Re: [U-Boot] [linux-sunxi] [PATCH v2 1/2] video: sunxi: extract\n\tsimplefb match code to a new file","submitter":{"id":61837,"url":"http://patchwork.ozlabs.org/api/people/61837/","name":"Andre Przywara","email":"andre.przywara@arm.com"},"content":"Hi Icenowy,\n\nthanks for sending this!\n\nOn 11/09/17 16:54, Icenowy Zheng wrote:\n> As the DE2 simplefb setup code can also benefit from the simplefb match\n> code, extract it to a new source file.\n> \n> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>\n> ---\n>  drivers/video/sunxi/Makefile          |  2 +-\n>  drivers/video/sunxi/simplefb_common.c | 29 +++++++++++++++++++++++++++++\n>  drivers/video/sunxi/simplefb_common.h | 22 ++++++++++++++++++++++\n>  drivers/video/sunxi/sunxi_display.c   | 13 ++-----------\n>  4 files changed, 54 insertions(+), 12 deletions(-)\n>  create mode 100644 drivers/video/sunxi/simplefb_common.c\n>  create mode 100644 drivers/video/sunxi/simplefb_common.h\n> \n> diff --git a/drivers/video/sunxi/Makefile b/drivers/video/sunxi/Makefile\n> index 0d64c2021f..10862edaca 100644\n> --- a/drivers/video/sunxi/Makefile\n> +++ b/drivers/video/sunxi/Makefile\n> @@ -5,5 +5,5 @@\n>  # SPDX-License-Identifier:\tGPL-2.0+\n>  #\n>  \n> -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o lcdc.o tve_common.o ../videomodes.o\n> +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o simplefb_common.o lcdc.o tve_common.o ../videomodes.o\n>  obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o lcdc.o ../dw_hdmi.o\n> diff --git a/drivers/video/sunxi/simplefb_common.c b/drivers/video/sunxi/simplefb_common.c\n> new file mode 100644\n> index 0000000000..4823f13a0c\n> --- /dev/null\n> +++ b/drivers/video/sunxi/simplefb_common.c\n> @@ -0,0 +1,29 @@\n> +/*\n> + * Common code for Allwinner SimpleFB with pipeline.\n> + *\n> + * (C) Copyright 2014-2015 Hans de Goede <hdegoede@redhat.com>\n> + * (C) Copyright 2017 Icenowy Zheng <icenowy@aosc.io>\n> + *\n> + * SPDX-License-Identifier:\tGPL-2.0+\n> + */\n> +\n> +#include <fdtdec.h>\n> +\n> +int sunxi_simplefb_fdt_match(void *blob, const char *pipeline)\n> +{\n> +\tint offset, ret;\n> +\n> +\t/* Find a prefilled simpefb node, matching out pipeline config */\n> +\toffset = fdt_node_offset_by_compatible(blob, -1,\n> +\t\t\t\t\t       \"allwinner,simple-framebuffer\");\n> +\twhile (offset >= 0) {\n> +\t\tret = fdt_stringlist_search(blob, offset, \"allwinner,pipeline\",\n> +\t\t\t\t\t    pipeline);\n> +\t\tif (ret == 0)\n> +\t\t\tbreak;\n> +\t\toffset = fdt_node_offset_by_compatible(blob, offset,\n> +\t\t\t\t\t       \"allwinner,simple-framebuffer\");\n> +\t}\n> +\n> +\treturn offset;\n> +}\n> diff --git a/drivers/video/sunxi/simplefb_common.h b/drivers/video/sunxi/simplefb_common.h\n> new file mode 100644\n> index 0000000000..ac9bfcb087\n> --- /dev/null\n> +++ b/drivers/video/sunxi/simplefb_common.h\n> @@ -0,0 +1,22 @@\n> +/*\n> + * (C) Copyright 2017 Icenowy Zheng <icenowy@aosc.io>\n> + *\n> + * SPDX-License-Identifier:\tGPL-2.0+\n> + */\n> +\n> +#ifndef __SIMPLEFB_COMMON_H\n> +#define __SIMPLEFB_COMMON_H\n> +\n> +/*\n\nJust a nit, but I think kerndoc requires two asterisks here (\"/**\").\n\nThe rest looks fine to me, so:\n\nReviewed-by: Andre Przywara <andre.przywara@arm.com>\n\nCheers,\nAndre.\n\n> + * sunxi_simplefb_fdt_match() - match a sunxi simplefb node\n> + *\n> + * Match a sunxi simplefb device node with a specified pipeline, and\n> + * return its offset.\n> + *\n> + * @blob: device tree blob\n> + * @pipeline: display pipeline\n> + * @return device node offset in blob, or negative values if failed\n> + */\n> +int sunxi_simplefb_fdt_match(void *blob, const char *pipeline);\n> +\n> +#endif\n> diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c\n> index de768ba94a..7f25ed5f26 100644\n> --- a/drivers/video/sunxi/sunxi_display.c\n> +++ b/drivers/video/sunxi/sunxi_display.c\n> @@ -29,6 +29,7 @@\n>  #include \"../anx9804.h\"\n>  #include \"../hitachi_tx18d42vm_lcd.h\"\n>  #include \"../ssd2828.h\"\n> +#include \"simplefb_common.h\"\n>  \n>  #ifdef CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW\n>  #define PWM_ON 0\n> @@ -1377,17 +1378,7 @@ int sunxi_simplefb_setup(void *blob)\n>  \t\tbreak;\n>  \t}\n>  \n> -\t/* Find a prefilled simpefb node, matching out pipeline config */\n> -\toffset = fdt_node_offset_by_compatible(blob, -1,\n> -\t\t\t\t\t       \"allwinner,simple-framebuffer\");\n> -\twhile (offset >= 0) {\n> -\t\tret = fdt_stringlist_search(blob, offset, \"allwinner,pipeline\",\n> -\t\t\t\t\t    pipeline);\n> -\t\tif (ret == 0)\n> -\t\t\tbreak;\n> -\t\toffset = fdt_node_offset_by_compatible(blob, offset,\n> -\t\t\t\t\t       \"allwinner,simple-framebuffer\");\n> -\t}\n> +\toffset = sunxi_simplefb_fdt_match(blob, pipeline);\n>  \tif (offset < 0) {\n>  \t\teprintf(\"Cannot setup simplefb: node not found\\n\");\n>  \t\treturn 0; /* Keep older kernels working */\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrzdj0yqHz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 19:14:48 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid A7C3AC21F1F; Tue, 12 Sep 2017 09:14:40 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id B2126C21DC4;\n\tTue, 12 Sep 2017 09:14:37 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B9F07C21DC4; Tue, 12 Sep 2017 09:14:36 +0000 (UTC)","from foss.arm.com (foss.arm.com [217.140.101.70])\n\tby lists.denx.de (Postfix) with ESMTP id 10DCCC21C57\n\tfor <u-boot@lists.denx.de>; Tue, 12 Sep 2017 09:14:36 +0000 (UTC)","from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85DDA80D;\n\tTue, 12 Sep 2017 02:14:34 -0700 (PDT)","from [192.168.67.35] (usa-sjc-imap-foss1.foss.arm.com\n\t[10.72.51.249])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\t8999C3F483; Tue, 12 Sep 2017 02:14:33 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI\n\tautolearn=unavailable autolearn_force=no version=3.4.0","To":"icenowy@aosc.io, Maxime Ripard <maxime.ripard@free-electrons.com>,\n\tJagan Teki <jteki@openedev.com>","References":"<20170911155458.62806-1-icenowy@aosc.io>\n\t<20170911155458.62806-2-icenowy@aosc.io>","From":"Andre Przywara <andre.przywara@arm.com>","Message-ID":"<ce468a58-79c3-3eeb-bc94-18b2a8dae6bd@arm.com>","Date":"Tue, 12 Sep 2017 10:14:34 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170911155458.62806-2-icenowy@aosc.io>","Content-Language":"en-GB","Cc":"u-boot@lists.denx.de, linux-sunxi@googlegroups.com","Subject":"Re: [U-Boot] [linux-sunxi] [PATCH v2 1/2] video: sunxi: extract\n\tsimplefb match code to a new file","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]