Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2013 04:08:58 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254590 - head/sys/dev/uart
Message-ID:  <201308210408.r7L48w2X045489@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308210408.r7L48w2X045489>