Commit 31164daa authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Vojtech Pavlik

[PATCH] USB: convert usbserial core to use dev_err() and dev_info() macros

parent 9bcac5a8
...@@ -66,7 +66,7 @@ static int usb_serial_device_probe (struct device *dev) ...@@ -66,7 +66,7 @@ static int usb_serial_device_probe (struct device *dev)
driver = port->serial->type; driver = port->serial->type;
if (driver->port_probe) { if (driver->port_probe) {
if (!try_module_get(driver->owner)) { if (!try_module_get(driver->owner)) {
err ("module get failed, exiting"); dev_err(*dev, "module get failed, exiting\n");
retval = -EIO; retval = -EIO;
goto exit; goto exit;
} }
...@@ -79,7 +79,7 @@ static int usb_serial_device_probe (struct device *dev) ...@@ -79,7 +79,7 @@ static int usb_serial_device_probe (struct device *dev)
minor = port->number; minor = port->number;
tty_register_devfs (&usb_serial_tty_driver, 0, minor); tty_register_devfs (&usb_serial_tty_driver, 0, minor);
info("%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)", dev_info(*dev, "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
driver->name, minor, minor); driver->name, minor, minor);
exit: exit:
...@@ -101,7 +101,7 @@ static int usb_serial_device_remove (struct device *dev) ...@@ -101,7 +101,7 @@ static int usb_serial_device_remove (struct device *dev)
driver = port->serial->type; driver = port->serial->type;
if (driver->port_remove) { if (driver->port_remove) {
if (!try_module_get(driver->owner)) { if (!try_module_get(driver->owner)) {
err ("module get failed, exiting"); dev_err(*dev, "module get failed, exiting\n");
retval = -EIO; retval = -EIO;
goto exit; goto exit;
} }
...@@ -111,7 +111,7 @@ static int usb_serial_device_remove (struct device *dev) ...@@ -111,7 +111,7 @@ static int usb_serial_device_remove (struct device *dev)
exit: exit:
minor = port->number; minor = port->number;
tty_unregister_devfs (&usb_serial_tty_driver, minor); tty_unregister_devfs (&usb_serial_tty_driver, minor);
info("%s converter now disconnected from ttyUSB%d", dev_info(*dev, "%s converter now disconnected from ttyUSB%d\n",
driver->name, minor); driver->name, minor);
return retval; return retval;
......
...@@ -41,7 +41,7 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da ...@@ -41,7 +41,7 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da
transfer_buffer = kmalloc (length, GFP_KERNEL); transfer_buffer = kmalloc (length, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer) {
err("%s - kmalloc(%d) failed.", __FUNCTION__, length); dev_err(serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, length);
return -ENOMEM; return -ENOMEM;
} }
memcpy (transfer_buffer, data, length); memcpy (transfer_buffer, data, length);
...@@ -56,7 +56,7 @@ int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit) ...@@ -56,7 +56,7 @@ int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit)
dbg("%s - %d", __FUNCTION__, reset_bit); dbg("%s - %d", __FUNCTION__, reset_bit);
response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0); response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0);
if (response < 0) { if (response < 0) {
err("%s- %d failed", __FUNCTION__, reset_bit); dev_err(serial->dev->dev, "%s- %d failed\n", __FUNCTION__, reset_bit);
} }
return response; return response;
} }
......
...@@ -106,7 +106,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) ...@@ -106,7 +106,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp)
port); port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result) 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; return result;
...@@ -176,7 +176,7 @@ int usb_serial_generic_write (struct usb_serial_port *port, int from_user, const ...@@ -176,7 +176,7 @@ int usb_serial_generic_write (struct usb_serial_port *port, int from_user, const
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) 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 else
result = count; result = count;
...@@ -266,7 +266,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg ...@@ -266,7 +266,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg
usb_serial_generic_read_bulk_callback), port); usb_serial_generic_read_bulk_callback), port);
result = usb_submit_urb(port->read_urb, GFP_ATOMIC); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) 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) void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
......
...@@ -841,7 +841,7 @@ static struct usb_serial * create_serial (struct usb_device *dev, ...@@ -841,7 +841,7 @@ static struct usb_serial * create_serial (struct usb_device *dev,
serial = kmalloc (sizeof (*serial), GFP_KERNEL); serial = kmalloc (sizeof (*serial), GFP_KERNEL);
if (!serial) { if (!serial) {
err ("%s - out of memory", __FUNCTION__); dev_err(dev->dev, "%s - out of memory\n", __FUNCTION__);
return NULL; return NULL;
} }
memset (serial, 0, sizeof(*serial)); memset (serial, 0, sizeof(*serial));
...@@ -899,14 +899,14 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -899,14 +899,14 @@ int usb_serial_probe(struct usb_interface *interface,
serial = create_serial (dev, interface, type); serial = create_serial (dev, interface, type);
if (!serial) { if (!serial) {
err ("%s - out of memory", __FUNCTION__); dev_err(interface->dev, "%s - out of memory\n", __FUNCTION__);
return -ENODEV; return -ENODEV;
} }
/* if this device type has a probe function, call it */ /* if this device type has a probe function, call it */
if (type->probe) { if (type->probe) {
if (!try_module_get(type->owner)) { if (!try_module_get(type->owner)) {
err ("module get failed, exiting"); dev_err(interface->dev, "module get failed, exiting\n");
kfree (serial); kfree (serial);
return -EIO; return -EIO;
} }
...@@ -980,7 +980,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -980,7 +980,7 @@ int usb_serial_probe(struct usb_interface *interface,
* properly during a later invocation of usb_serial_probe * properly during a later invocation of usb_serial_probe
*/ */
if (num_bulk_in == 0 || num_bulk_out == 0) { 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); kfree (serial);
return -ENODEV; return -ENODEV;
} }
...@@ -989,13 +989,13 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -989,13 +989,13 @@ int usb_serial_probe(struct usb_interface *interface,
#endif #endif
/* found all that we need */ /* 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 #ifdef CONFIG_USB_SERIAL_GENERIC
if (type == &usb_serial_generic_device) { if (type == &usb_serial_generic_device) {
num_ports = num_bulk_out; num_ports = num_bulk_out;
if (num_ports == 0) { 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); kfree (serial);
return -EIO; return -EIO;
} }
...@@ -1005,7 +1005,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1005,7 +1005,7 @@ int usb_serial_probe(struct usb_interface *interface,
/* if this device type has a calc_num_ports function, call it */ /* if this device type has a calc_num_ports function, call it */
if (type->calc_num_ports) { if (type->calc_num_ports) {
if (!try_module_get(type->owner)) { if (!try_module_get(type->owner)) {
err ("module get failed, exiting"); dev_err(interface->dev, "module get failed, exiting\n");
kfree (serial); kfree (serial);
return -EIO; return -EIO;
} }
...@@ -1017,7 +1017,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1017,7 +1017,7 @@ int usb_serial_probe(struct usb_interface *interface,
} }
if (get_free_serial (serial, num_ports, &minor) == NULL) { 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); kfree (serial);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1034,14 +1034,14 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1034,14 +1034,14 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i]; port = &serial->port[i];
port->read_urb = usb_alloc_urb (0, GFP_KERNEL); port->read_urb = usb_alloc_urb (0, GFP_KERNEL);
if (!port->read_urb) { if (!port->read_urb) {
err("No free urbs available"); dev_err(interface->dev, "No free urbs available\n");
goto probe_error; goto probe_error;
} }
buffer_size = endpoint->wMaxPacketSize; buffer_size = endpoint->wMaxPacketSize;
port->bulk_in_endpointAddress = endpoint->bEndpointAddress; port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL); port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->bulk_in_buffer) { 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; goto probe_error;
} }
usb_fill_bulk_urb (port->read_urb, dev, usb_fill_bulk_urb (port->read_urb, dev,
...@@ -1059,7 +1059,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1059,7 +1059,7 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i]; port = &serial->port[i];
port->write_urb = usb_alloc_urb(0, GFP_KERNEL); port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!port->write_urb) { if (!port->write_urb) {
err("No free urbs available"); dev_err(interface->dev, "No free urbs available\n");
goto probe_error; goto probe_error;
} }
buffer_size = endpoint->wMaxPacketSize; buffer_size = endpoint->wMaxPacketSize;
...@@ -1067,7 +1067,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1067,7 +1067,7 @@ int usb_serial_probe(struct usb_interface *interface,
port->bulk_out_endpointAddress = endpoint->bEndpointAddress; port->bulk_out_endpointAddress = endpoint->bEndpointAddress;
port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL); port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->bulk_out_buffer) { 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; goto probe_error;
} }
usb_fill_bulk_urb (port->write_urb, dev, usb_fill_bulk_urb (port->write_urb, dev,
...@@ -1085,14 +1085,14 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1085,14 +1085,14 @@ int usb_serial_probe(struct usb_interface *interface,
port = &serial->port[i]; port = &serial->port[i];
port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!port->interrupt_in_urb) { if (!port->interrupt_in_urb) {
err("No free urbs available"); dev_err(interface->dev, "No free urbs available\n");
goto probe_error; goto probe_error;
} }
buffer_size = endpoint->wMaxPacketSize; buffer_size = endpoint->wMaxPacketSize;
port->interrupt_in_endpointAddress = endpoint->bEndpointAddress; port->interrupt_in_endpointAddress = endpoint->bEndpointAddress;
port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL); port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!port->interrupt_in_buffer) { 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; goto probe_error;
} }
usb_fill_int_urb (port->interrupt_in_urb, dev, usb_fill_int_urb (port->interrupt_in_urb, dev,
...@@ -1121,7 +1121,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1121,7 +1121,7 @@ int usb_serial_probe(struct usb_interface *interface,
/* if this device type has an attach function, call it */ /* if this device type has an attach function, call it */
if (type->attach) { if (type->attach) {
if (!try_module_get(type->owner)) { if (!try_module_get(type->owner)) {
err ("module get failed, exiting"); dev_err(interface->dev, "module get failed, exiting\n");
goto probe_error; goto probe_error;
} }
retval = type->attach (serial); retval = type->attach (serial);
...@@ -1190,6 +1190,7 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1190,6 +1190,7 @@ int usb_serial_probe(struct usb_interface *interface,
void usb_serial_disconnect(struct usb_interface *interface) void usb_serial_disconnect(struct usb_interface *interface)
{ {
struct usb_serial *serial = dev_get_drvdata (&interface->dev); struct usb_serial *serial = dev_get_drvdata (&interface->dev);
struct device *dev = &interface->dev;
struct usb_serial_port *port; struct usb_serial_port *port;
int i; int i;
...@@ -1252,8 +1253,7 @@ void usb_serial_disconnect(struct usb_interface *interface) ...@@ -1252,8 +1253,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
/* free up any memory that we allocated */ /* free up any memory that we allocated */
kfree (serial); kfree (serial);
} }
info("device disconnected"); dev_info(*dev, "device disconnected\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment