ChangeSet 1.946.3.7, 2002/12/26 12:17:51-08:00, greg@kroah.com [PATCH] USB: convert usbserial core to use dev_err() and dev_info() macros diff -Nru a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c --- a/drivers/usb/serial/bus.c Fri Dec 27 23:57:54 2002 +++ b/drivers/usb/serial/bus.c Fri Dec 27 23:57:54 2002 @@ -66,7 +66,7 @@ driver = port->serial->type; if (driver->port_probe) { if (!try_module_get(driver->owner)) { - err ("module get failed, exiting"); + dev_err(*dev, "module get failed, exiting\n"); retval = -EIO; goto exit; } @@ -79,8 +79,8 @@ minor = port->number; tty_register_devfs (&usb_serial_tty_driver, 0, minor); - info("%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)", - driver->name, minor, minor); + dev_info(*dev, "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n", + driver->name, minor, minor); exit: return retval; @@ -101,7 +101,7 @@ driver = port->serial->type; if (driver->port_remove) { if (!try_module_get(driver->owner)) { - err ("module get failed, exiting"); + dev_err(*dev, "module get failed, exiting\n"); retval = -EIO; goto exit; } @@ -111,8 +111,8 @@ exit: minor = port->number; tty_unregister_devfs (&usb_serial_tty_driver, minor); - info("%s converter now disconnected from ttyUSB%d", - driver->name, minor); + dev_info(*dev, "%s converter now disconnected from ttyUSB%d\n", + driver->name, minor); return retval; } diff -Nru a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c --- a/drivers/usb/serial/ezusb.c Fri Dec 27 23:57:53 2002 +++ b/drivers/usb/serial/ezusb.c Fri Dec 27 23:57:53 2002 @@ -41,7 +41,7 @@ transfer_buffer = kmalloc (length, GFP_KERNEL); if (!transfer_buffer) { - err("%s - kmalloc(%d) failed.", __FUNCTION__, length); + dev_err(serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, length); return -ENOMEM; } memcpy (transfer_buffer, data, length); @@ -56,7 +56,7 @@ dbg("%s - %d", __FUNCTION__, reset_bit); response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) { - err("%s- %d failed", __FUNCTION__, reset_bit); + dev_err(serial->dev->dev, "%s- %d failed\n", __FUNCTION__, reset_bit); } return response; } diff -Nru a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c --- a/drivers/usb/serial/generic.c Fri Dec 27 23:57:53 2002 +++ b/drivers/usb/serial/generic.c Fri Dec 27 23:57:53 2002 @@ -106,7 +106,7 @@ port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + dev_err(port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); } return result; @@ -176,7 +176,7 @@ /* send the data out the bulk port */ result = usb_submit_urb(port->write_urb, GFP_ATOMIC); if (result) - err("%s - failed submitting write urb, error %d", __FUNCTION__, result); + dev_err(port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); else result = count; @@ -266,7 +266,7 @@ usb_serial_generic_read_bulk_callback), port); result = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (result) - err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); + dev_err(port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); } void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c --- a/drivers/usb/serial/usb-serial.c Fri Dec 27 23:57:54 2002 +++ b/drivers/usb/serial/usb-serial.c Fri Dec 27 23:57:54 2002 @@ -841,7 +841,7 @@ serial = kmalloc (sizeof (*serial), GFP_KERNEL); if (!serial) { - err ("%s - out of memory", __FUNCTION__); + dev_err(dev->dev, "%s - out of memory\n", __FUNCTION__); return NULL; } memset (serial, 0, sizeof(*serial)); @@ -899,14 +899,14 @@ serial = create_serial (dev, interface, type); if (!serial) { - err ("%s - out of memory", __FUNCTION__); + dev_err(interface->dev, "%s - out of memory\n", __FUNCTION__); return -ENODEV; } /* if this device type has a probe function, call it */ if (type->probe) { if (!try_module_get(type->owner)) { - err ("module get failed, exiting"); + dev_err(interface->dev, "module get failed, exiting\n"); kfree (serial); return -EIO; } @@ -980,7 +980,7 @@ * properly during a later invocation of usb_serial_probe */ if (num_bulk_in == 0 || num_bulk_out == 0) { - info("PL-2303 hack: descriptors matched but endpoints did not"); + dev_info(interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); kfree (serial); return -ENODEV; } @@ -989,13 +989,13 @@ #endif /* found all that we need */ - info("%s converter detected", type->name); + dev_info(interface->dev, "%s converter detected\n", type->name); #ifdef CONFIG_USB_SERIAL_GENERIC if (type == &usb_serial_generic_device) { num_ports = num_bulk_out; if (num_ports == 0) { - err("Generic device with no bulk out, not allowed."); + dev_err(interface->dev, "Generic device with no bulk out, not allowed.\n"); kfree (serial); return -EIO; } @@ -1005,7 +1005,7 @@ /* if this device type has a calc_num_ports function, call it */ if (type->calc_num_ports) { if (!try_module_get(type->owner)) { - err ("module get failed, exiting"); + dev_err(interface->dev, "module get failed, exiting\n"); kfree (serial); return -EIO; } @@ -1017,7 +1017,7 @@ } if (get_free_serial (serial, num_ports, &minor) == NULL) { - err("No more free serial devices"); + dev_err(interface->dev, "No more free serial devices\n"); kfree (serial); return -ENOMEM; } @@ -1034,14 +1034,14 @@ port = &serial->port[i]; port->read_urb = usb_alloc_urb (0, GFP_KERNEL); if (!port->read_urb) { - err("No free urbs available"); + dev_err(interface->dev, "No free urbs available\n"); goto probe_error; } buffer_size = endpoint->wMaxPacketSize; port->bulk_in_endpointAddress = endpoint->bEndpointAddress; port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL); if (!port->bulk_in_buffer) { - err("Couldn't allocate bulk_in_buffer"); + dev_err(interface->dev, "Couldn't allocate bulk_in_buffer\n"); goto probe_error; } usb_fill_bulk_urb (port->read_urb, dev, @@ -1059,7 +1059,7 @@ port = &serial->port[i]; port->write_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->write_urb) { - err("No free urbs available"); + dev_err(interface->dev, "No free urbs available\n"); goto probe_error; } buffer_size = endpoint->wMaxPacketSize; @@ -1067,7 +1067,7 @@ port->bulk_out_endpointAddress = endpoint->bEndpointAddress; port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL); if (!port->bulk_out_buffer) { - err("Couldn't allocate bulk_out_buffer"); + dev_err(interface->dev, "Couldn't allocate bulk_out_buffer\n"); goto probe_error; } usb_fill_bulk_urb (port->write_urb, dev, @@ -1085,14 +1085,14 @@ port = &serial->port[i]; port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!port->interrupt_in_urb) { - err("No free urbs available"); + dev_err(interface->dev, "No free urbs available\n"); goto probe_error; } buffer_size = endpoint->wMaxPacketSize; port->interrupt_in_endpointAddress = endpoint->bEndpointAddress; port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL); if (!port->interrupt_in_buffer) { - err("Couldn't allocate interrupt_in_buffer"); + dev_err(interface->dev, "Couldn't allocate interrupt_in_buffer\n"); goto probe_error; } usb_fill_int_urb (port->interrupt_in_urb, dev, @@ -1121,7 +1121,7 @@ /* if this device type has an attach function, call it */ if (type->attach) { if (!try_module_get(type->owner)) { - err ("module get failed, exiting"); + dev_err(interface->dev, "module get failed, exiting\n"); goto probe_error; } retval = type->attach (serial); @@ -1190,6 +1190,7 @@ void usb_serial_disconnect(struct usb_interface *interface) { struct usb_serial *serial = dev_get_drvdata (&interface->dev); + struct device *dev = &interface->dev; struct usb_serial_port *port; int i; @@ -1252,8 +1253,7 @@ /* free up any memory that we allocated */ kfree (serial); } - info("device disconnected"); - + dev_info(*dev, "device disconnected\n"); }