Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2013 08:45:25 +0300
From:      Aleksandr Rybalko <ray@ddteam.net>
To:        Ian Lepore <ian@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r254590 - head/sys/dev/uart
Message-ID:  <b93d4fb7-8568-42e7-a89a-1e24381a561e@email.android.com>
In-Reply-To: <201308210408.r7L48w2X045489@svn.freebsd.org>
References:  <201308210408.r7L48w2X045489@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Ian Lepore <ian@FreeBSD.org> написав(ла):
>Author: ian
>Date: Wed Aug 21 04:08:58 2013
>New Revision: 254590
>URL: http://svnweb.freebsd.org/changeset/base/254590
>
>Log:
> Use an if/else sequence rather than unrelated if statements, so that a
>device compatible with multiple drivers matches the more specific
>driver
>  first and doesn't overwrite it later with the more generic.  Move the
>  generic ns16550 to the end of the list.
>
>Modified:
>  head/sys/dev/uart/uart_cpu_fdt.c
>
>Modified: head/sys/dev/uart/uart_cpu_fdt.c
>==============================================================================
>--- head/sys/dev/uart/uart_cpu_fdt.c	Wed Aug 21 04:05:06 2013	(r254589)
>+++ head/sys/dev/uart/uart_cpu_fdt.c	Wed Aug 21 04:08:58 2013	(r254590)
>@@ -141,18 +141,18 @@ uart_cpu_getdev(int devtype, struct uart
> 	 */
> 	if (fdt_is_compatible(node, "fsl,imx-uart"))
> 		class = &uart_imx_class;
>-	if (fdt_is_compatible(node, "quicc"))
>+	else if (fdt_is_compatible(node, "quicc"))
> 		class = &uart_quicc_class;
>-	if (fdt_is_compatible(node, "lpc"))
>+	else if (fdt_is_compatible(node, "lpc"))
> 		class = &uart_lpc_class;
>-	if (fdt_is_compatible(node, "ns16550"))
>-		class = &uart_ns8250_class;
>-	if (fdt_is_compatible(node, "arm,pl011"))
>+	else if (fdt_is_compatible(node, "arm,pl011"))
> 		class = &uart_pl011_class;
>-	if (fdt_is_compatible(node, "exynos"))
>+	else if (fdt_is_compatible(node, "exynos"))
> 		class = &uart_s3c2410_class;
>-	if (fdt_is_compatible(node, "cadence,uart"))
>+	else if (fdt_is_compatible(node, "cadence,uart"))
> 		class = &uart_cdnc_class;
>+	else if (fdt_is_compatible(node, "ns16550"))
>+		class = &uart_ns8250_class;
> 
> 	di->bas.chan = 0;
> 	di->bas.regshft = (u_int)shift;

Hi Ian!

Correct order should be specified in compatible list, other thing must be covered by some quirks. Maybe inside driver or in machine/board specific fixup handler.

Thanks.
WBW
------
Aleksandr Rybalko <ray@ddteam.net>





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b93d4fb7-8568-42e7-a89a-1e24381a561e>