svn commit: r254590 - head/sys/dev/uart

Ian Lepore ian at FreeBSD.org
Wed Aug 21 04:08:58 UTC 2013


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;


More information about the svn-src-head mailing list