ChangeSet 1.972, 2002/12/30 22:46:52-08:00, greg@kroah.com USB: convert more dbg() calls to dev_dbg for the usb core diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c --- a/drivers/usb/core/hcd.c Mon Dec 30 22:51:52 2002 +++ b/drivers/usb/core/hcd.c Mon Dec 30 22:51:52 2002 @@ -346,7 +346,7 @@ /* FALLTHROUGH */ case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: case DeviceOutRequest | USB_REQ_SET_FEATURE: - dbg ("no device features yet yet"); + dev_dbg (*hcd->controller, "no device features yet yet\n"); break; case DeviceRequest | USB_REQ_GET_CONFIGURATION: ubuf [0] = 1; @@ -404,7 +404,7 @@ /* FALLTHROUGH */ case EndpointOutRequest | USB_REQ_CLEAR_FEATURE: case EndpointOutRequest | USB_REQ_SET_FEATURE: - dbg ("no endpoint features yet"); + dev_dbg (*hcd->controller, "no endpoint features yet\n"); break; /* CLASS REQUESTS (and errors) */ @@ -418,12 +418,12 @@ error: /* "protocol stall" on error */ urb->status = -EPIPE; - dbg ("unsupported hub control message (maxchild %d)", + dev_dbg (*hcd->controller, "unsupported hub control message (maxchild %d)\n", urb->dev->maxchild); } if (urb->status) { urb->actual_length = 0; - dbg ("CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d", + dev_dbg (*hcd->controller, "CTRL: TypeReq=0x%x val=0x%x idx=0x%x len=%d ==> %d\n", typeReq, wValue, wIndex, wLength, urb->status); } if (bufp) { @@ -456,7 +456,7 @@ if (timer_pending (&hcd->rh_timer) || urb->status != -EINPROGRESS || urb->transfer_buffer_length < len) { - dbg ("not queuing status urb, stat %d", urb->status); + dev_dbg (*hcd->controller, "not queuing status urb, stat %d\n", urb->status); return -EINVAL; } @@ -667,7 +667,7 @@ usbfs_add_bus (bus); - info ("new USB bus registered, assigned bus number %d", bus->busnum); + dev_info (*bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum); } EXPORT_SYMBOL (usb_register_bus); @@ -681,7 +681,7 @@ */ void usb_deregister_bus (struct usb_bus *bus) { - info ("USB bus %d deregistered", bus->busnum); + dev_info (*bus->controller, "USB bus %d deregistered\n", bus->busnum); /* * NOTE: make sure that all the devices are removed by the @@ -824,7 +824,7 @@ #else "would have "; #endif - dbg ("usb_check_bandwidth %sFAILED: %d + %ld = %d usec", + dev_dbg (dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n", mode, old_alloc, bustime, new_alloc); #endif #ifdef CONFIG_USB_BANDWIDTH @@ -863,7 +863,7 @@ urb->bandwidth = bustime; #ifdef USB_BANDWIDTH_MESSAGES - dbg ("bandwidth alloc increased by %d (%s) to %d for %d requesters", + dev_dbg (dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n", bustime, isoc ? "ISOC" : "INTR", dev->bus->bandwidth_allocated, @@ -892,7 +892,7 @@ dev->bus->bandwidth_int_reqs--; #ifdef USB_BANDWIDTH_MESSAGES - dbg ("bandwidth alloc reduced by %d (%s) to %d for %d requesters", + dev_dbg (dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n", urb->bandwidth, isoc ? "ISOC" : "INTR", dev->bus->bandwidth_allocated, @@ -1153,7 +1153,7 @@ */ if (!(urb->transfer_flags & URB_ASYNC_UNLINK)) { if (in_interrupt ()) { - dbg ("non-async unlink in_interrupt"); + dev_dbg (*hcd->controller, "non-async unlink in_interrupt"); retval = -EWOULDBLOCK; goto done; } @@ -1233,7 +1233,7 @@ /* device driver problem with refcounts? */ if (!list_empty (&dev->urb_list)) { - dbg ("free busy dev, %s devnum %d (bug!)", + dev_dbg (*hcd->controller, "free busy dev, %s devnum %d (bug!)\n", hcd->self.bus_name, udev->devnum); return -EINVAL; } @@ -1366,7 +1366,7 @@ dev = list_entry (devlist, struct hcd_dev, dev_list); list_for_each (urblist, &dev->urb_list) { urb = list_entry (urblist, struct urb, urb_list); - dbg ("shutdown %s urb %p pipe %x, current status %d", + dev_dbg (*hcd->controller, "shutdown %s urb %p pipe %x, current status %d\n", hcd->self.bus_name, urb, urb->pipe, urb->status); if (urb->status == -EINPROGRESS) urb->status = -ESHUTDOWN; diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c Mon Dec 30 22:51:52 2002 +++ b/drivers/usb/core/hub.c Mon Dec 30 22:51:52 2002 @@ -263,7 +263,8 @@ int i; /* Enable power to the ports */ - dbg("enabling power on all ports"); + dev_dbg(*hubdev(interface_to_usbdev(hub->intf)), + "enabling power on all ports\n"); dev = interface_to_usbdev(hub->intf); for (i = 0; i < hub->descriptor->bNbrPorts; i++) usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); @@ -276,6 +277,7 @@ struct usb_endpoint_descriptor *endpoint) { struct usb_device *dev = interface_to_usbdev (hub->intf); + struct device *hub_dev; struct usb_hub_status hubstatus; unsigned int pipe; int maxp, ret; @@ -303,8 +305,9 @@ goto fail; } + hub_dev = hubdev(dev); dev->maxchild = hub->descriptor->bNbrPorts; - dev_info (*hubdev (dev), "%d port%s detected\n", dev->maxchild, + dev_info (*hub_dev, "%d port%s detected\n", dev->maxchild, (dev->maxchild == 1) ? "" : "s"); le16_to_cpus(&hub->descriptor->wHubCharacteristics); @@ -318,33 +321,33 @@ [((i + 1) / 8)] & (1 << ((i + 1) % 8)) ? 'F' : 'R'; portstr[dev->maxchild] = 0; - dbg("compound device; port removable status: %s", portstr); + dev_dbg(*hub_dev, "compound device; port removable status: %s\n", portstr); } else - dbg("standalone hub"); + dev_dbg(*hub_dev, "standalone hub\n"); switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) { case 0x00: - dbg("ganged power switching"); + dev_dbg(*hub_dev, "ganged power switching\n"); break; case 0x01: - dbg("individual port power switching"); + dev_dbg(*hub_dev, "individual port power switching\n"); break; case 0x02: case 0x03: - dbg("unknown reserved power switching mode"); + dev_dbg(*hub_dev, "unknown reserved power switching mode\n"); break; } switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) { case 0x00: - dbg("global over-current protection"); + dev_dbg(*hub_dev, "global over-current protection\n"); break; case 0x08: - dbg("individual port over-current protection"); + dev_dbg(*hub_dev, "individual port over-current protection\n"); break; case 0x10: case 0x18: - dbg("no over-current protection"); + dev_dbg(*hub_dev, "no over-current protection\n"); break; } @@ -355,16 +358,16 @@ case 0: break; case 1: - dbg("Single TT"); + dev_dbg(*hub_dev, "Single TT\n"); hub->tt.hub = dev; break; case 2: - dbg("TT per port"); + dev_dbg(*hub_dev, "TT per port\n"); hub->tt.hub = dev; hub->tt.multi = 1; break; default: - dbg("Unrecognized hub protocol %d", + dev_dbg(*hub_dev, "Unrecognized hub protocol %d\n", dev->descriptor.bDeviceProtocol); break; } @@ -372,26 +375,26 @@ switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) { case 0x00: if (dev->descriptor.bDeviceProtocol != 0) - dbg("TT requires at most 8 FS bit times"); + dev_dbg(*hub_dev, "TT requires at most 8 FS bit times\n"); break; case 0x20: - dbg("TT requires at most 16 FS bit times"); + dev_dbg(*hub_dev, "TT requires at most 16 FS bit times\n"); break; case 0x40: - dbg("TT requires at most 24 FS bit times"); + dev_dbg(*hub_dev, "TT requires at most 24 FS bit times\n"); break; case 0x60: - dbg("TT requires at most 32 FS bit times"); + dev_dbg(*hub_dev, "TT requires at most 32 FS bit times\n"); break; } - dbg("Port indicators are %s supported", + dev_dbg(*hub_dev, "Port indicators are %s supported\n", (hub->descriptor->wHubCharacteristics & HUB_CHAR_PORTIND) ? "" : "not"); - dbg("power on to power good time: %dms", + dev_dbg(*hub_dev, "power on to power good time: %dms\n", hub->descriptor->bPwrOn2PwrGood * 2); - dbg("hub controller current requirement: %dmA", + dev_dbg(*hub_dev, "hub controller current requirement: %dmA\n", hub->descriptor->bHubContrCurrent); ret = usb_get_hub_status(dev, &hubstatus); @@ -402,11 +405,11 @@ le16_to_cpus(&hubstatus.wHubStatus); - dbg("local power source is %s", + dev_dbg(*hub_dev, "local power source is %s\n", (hubstatus.wHubStatus & HUB_STATUS_LOCAL_POWER) ? "lost (inactive)" : "good"); - dbg("%sover-current condition exists", + dev_dbg(*hub_dev, "%sover-current condition exists\n", (hubstatus.wHubStatus & HUB_STATUS_OVERCURRENT) ? "" : "no "); /* Start the interrupt endpoint */ diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c --- a/drivers/usb/core/usb.c Mon Dec 30 22:51:52 2002 +++ b/drivers/usb/core/usb.c Mon Dec 30 22:51:52 2002 @@ -84,19 +84,19 @@ const struct usb_device_id *id; int error = -ENODEV; - dbg("%s", __FUNCTION__); + dev_dbg(*dev, "%s\n", __FUNCTION__); if (!driver->probe) return error; if (!try_module_get(driver->owner)) { - err ("Can't get a module reference for %s", driver->name); + dev_err (*dev, "Can't get a module reference for %s\n", driver->name); return error; } id = usb_match_id (intf, driver->id_table); if (id) { - dbg ("%s - got id", __FUNCTION__); + dev_dbg (*dev, "%s - got id\n", __FUNCTION__); down (&driver->serialize); error = driver->probe (intf, id); up (&driver->serialize); @@ -118,7 +118,7 @@ driver = to_usb_driver(dev->driver); if (!driver) { - err("%s does not have a valid driver to work with!", + dev_err(*dev, "%s does not have a valid driver to work with!", __FUNCTION__); return -ENODEV; } @@ -126,7 +126,7 @@ if (!try_module_get(driver->owner)) { // FIXME this happens even when we just rmmod // drivers that aren't in active use... - err("Dieing driver still bound to device.\n"); + dev_err(*dev, "Dieing driver still bound to device.\n"); return -EIO; } @@ -1042,7 +1042,7 @@ wait_ms(200); } if (err < 0) { - err("USB device not accepting new address=%d (error=%d)", + dev_err(dev->dev, "USB device not accepting new address=%d (error=%d)\n", dev->devnum, err); clear_bit(dev->devnum, dev->bus->devmap.devicemap); dev->devnum = -1; @@ -1060,9 +1060,9 @@ if (err < 8) { if (err < 0) - err("USB device not responding, giving up (error=%d)", err); + dev_err(dev->dev, "USB device not responding, giving up (error=%d)\n", err); else - err("USB device descriptor short read (expected %i, got %i)", 8, err); + dev_err(dev->dev, "USB device descriptor short read (expected %i, got %i)\n", 8, err); clear_bit(dev->devnum, dev->bus->devmap.devicemap); dev->devnum = -1; return 1; @@ -1077,9 +1077,9 @@ err = usb_get_device_descriptor(dev); if (err < (signed)sizeof(dev->descriptor)) { if (err < 0) - err("unable to get device descriptor (error=%d)", err); + dev_err(dev->dev, "unable to get device descriptor (error=%d)\n", err); else - err("USB device descriptor short read (expected %Zi, got %i)", + dev_err(dev->dev, "USB device descriptor short read (expected %Zi, got %i)\n", sizeof(dev->descriptor), err); clear_bit(dev->devnum, dev->bus->devmap.devicemap); @@ -1089,7 +1089,7 @@ err = usb_get_configuration(dev); if (err < 0) { - err("unable to get device %d configuration (error=%d)", + dev_err(dev->dev, "unable to get device %d configuration (error=%d)\n", dev->devnum, err); clear_bit(dev->devnum, dev->bus->devmap.devicemap); dev->devnum = -1; @@ -1099,7 +1099,7 @@ /* we set the default configuration here */ err = usb_set_configuration(dev, dev->config[0].desc.bConfigurationValue); if (err) { - err("failed to set device %d default configuration (error=%d)", + dev_err(dev->dev, "failed to set device %d default configuration (error=%d)\n", dev->devnum, err); clear_bit(dev->devnum, dev->bus->devmap.devicemap); dev->devnum = -1; @@ -1151,7 +1151,7 @@ dev->bus->bus_name, dev->devpath, desc->bInterfaceNumber); } - dbg ("%s - registering %s", __FUNCTION__, interface->dev.bus_id); + dev_dbg (dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id); device_add (&interface->dev); usb_create_driverfs_intf_files (interface); }