summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-08-18 11:42:11 +0000
committerjoe <joe@FreeBSD.org>2002-08-18 11:42:11 +0000
commit34ab7e6f066392de893e453985babfb2a57a5d8f (patch)
tree36d770d4b836f1cd41dbc38867cd3408853d1a88
parentf6cebc060671b6c67f52080c35a0e55d5498cbf0 (diff)
downloadFreeBSD-src-34ab7e6f066392de893e453985babfb2a57a5d8f.zip
FreeBSD-src-34ab7e6f066392de893e453985babfb2a57a5d8f.tar.gz
Add a comment to remind that uhci_pci_match will never return NULL.
Don't display the "New UHCI DeviceId" message unless booting verbosely. Use a switch statement for the vendor match code.
-rw-r--r--sys/dev/usb/uhci_pci.c17
-rw-r--r--sys/pci/uhci_pci.c17
2 files changed, 22 insertions, 12 deletions
diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c
index 2cf9405..961de65 100644
--- a/sys/dev/usb/uhci_pci.c
+++ b/sys/dev/usb/uhci_pci.c
@@ -250,15 +250,20 @@ uhci_pci_attach(device_t self)
}
device_set_ivars(sc->sc_bus.bdev, sc);
+ /* uhci_pci_match must never return NULL if uhci_pci_probe succeeded */
device_set_desc(sc->sc_bus.bdev, uhci_pci_match(self));
- if (pci_get_vendor(self) == PCI_UHCI_VENDORID_INTEL) {
+ switch (pci_get_vendor(self)) {
+ case PCI_UHCI_VENDORID_INTEL:
sprintf(sc->sc_vendor, "Intel");
- } else if (pci_get_vendor(self) == PCI_UHCI_VENDORID_VIA) {
+ break;
+ case PCI_UHCI_VENDORID_VIA:
sprintf(sc->sc_vendor, "VIA");
- } else {
- device_printf(self, "(New UHCI DeviceId=0x%08x)\n",
- pci_get_devid(self));
- sprintf(sc->sc_vendor, "(0x%08x)", pci_get_devid(self));
+ break;
+ default:
+ if (bootverbose)
+ device_printf(self, "(New UHCI DeviceId=0x%08x)\n",
+ pci_get_devid(self));
+ sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self));
}
switch (pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) {
diff --git a/sys/pci/uhci_pci.c b/sys/pci/uhci_pci.c
index 2cf9405..961de65 100644
--- a/sys/pci/uhci_pci.c
+++ b/sys/pci/uhci_pci.c
@@ -250,15 +250,20 @@ uhci_pci_attach(device_t self)
}
device_set_ivars(sc->sc_bus.bdev, sc);
+ /* uhci_pci_match must never return NULL if uhci_pci_probe succeeded */
device_set_desc(sc->sc_bus.bdev, uhci_pci_match(self));
- if (pci_get_vendor(self) == PCI_UHCI_VENDORID_INTEL) {
+ switch (pci_get_vendor(self)) {
+ case PCI_UHCI_VENDORID_INTEL:
sprintf(sc->sc_vendor, "Intel");
- } else if (pci_get_vendor(self) == PCI_UHCI_VENDORID_VIA) {
+ break;
+ case PCI_UHCI_VENDORID_VIA:
sprintf(sc->sc_vendor, "VIA");
- } else {
- device_printf(self, "(New UHCI DeviceId=0x%08x)\n",
- pci_get_devid(self));
- sprintf(sc->sc_vendor, "(0x%08x)", pci_get_devid(self));
+ break;
+ default:
+ if (bootverbose)
+ device_printf(self, "(New UHCI DeviceId=0x%08x)\n",
+ pci_get_devid(self));
+ sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self));
}
switch (pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) {
OpenPOWER on IntegriCloud