Date: Sat, 6 Nov 2010 11:22:53 -0700 From: Garrett Cooper <gcooper@FreeBSD.org> To: hackers@freebsd.org Subject: [PATCH] Simplify uart_bus_pci_probe Message-ID: <AANLkTimMt4Ucm%2BfRipzk3sq0M=1DNaC6EGQJ8M0ZWwob@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Some of the logic could have been simplified in the probe. The
proposed patch makes the detection process a tad bit more
straightforward.
Comments, review (and maybe a commit :P) are more than welcome :).
Thanks!
-Garrett
[-- Attachment #2 --]
Index: sys/dev/uart/uart_bus_pci.c
===================================================================
--- sys/dev/uart/uart_bus_pci.c (revision 214857)
+++ sys/dev/uart/uart_bus_pci.c (working copy)
@@ -150,14 +150,13 @@
sc = device_get_softc(dev);
id = uart_pci_match(dev, pci_ns8250_ids);
- if (id != NULL) {
- sc->sc_class = &uart_ns8250_class;
- goto match;
+ if (id == NULL) {
+ /* Add checks for non-ns8250 IDs here. */
+ return (ENXIO);
}
- /* Add checks for non-ns8250 IDs here. */
- return (ENXIO);
- match:
+ sc->sc_class = &uart_ns8250_class;
+
if (id->desc)
device_set_desc(dev, id->desc);
return (uart_bus_probe(dev, 0, id->rclk, id->rid, 0));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimMt4Ucm%2BfRipzk3sq0M=1DNaC6EGQJ8M0ZWwob>
