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

[PATCH] USB: convert io_ti driver to use dev_err() and dev_info() macros

parent d407f7f3
...@@ -473,7 +473,7 @@ static int TIIsTxActive (struct edgeport_port *port) ...@@ -473,7 +473,7 @@ static int TIIsTxActive (struct edgeport_port *port)
oedb = kmalloc (sizeof (* oedb), GFP_KERNEL); oedb = kmalloc (sizeof (* oedb), GFP_KERNEL);
if (!oedb) { if (!oedb) {
err ("%s - out of memory", __FUNCTION__); dev_err (port->port->dev, "%s - out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -592,7 +592,7 @@ static int TIChooseConfiguration (struct usb_device *dev) ...@@ -592,7 +592,7 @@ static int TIChooseConfiguration (struct usb_device *dev)
dbg ("%s - MAX Power = %d", __FUNCTION__, dev->config->desc.bMaxPower*2); dbg ("%s - MAX Power = %d", __FUNCTION__, dev->config->desc.bMaxPower*2);
if (dev->config->desc.bNumInterfaces != 1) { if (dev->config->desc.bNumInterfaces != 1) {
err ("%s - bNumInterfaces is not 1, ERROR!", __FUNCTION__); dev_err (dev->dev, "%s - bNumInterfaces is not 1, ERROR!\n", __FUNCTION__);
return -ENODEV; return -ENODEV;
} }
...@@ -684,6 +684,7 @@ static int ValidChecksum(struct ti_i2c_desc *rom_desc, __u8 *buffer) ...@@ -684,6 +684,7 @@ static int ValidChecksum(struct ti_i2c_desc *rom_desc, __u8 *buffer)
/* Make sure that the I2C image is good */ /* Make sure that the I2C image is good */
static int TiValidateI2cImage (struct edgeport_serial *serial) static int TiValidateI2cImage (struct edgeport_serial *serial)
{ {
struct device *dev = &serial->serial->dev->dev;
int status = 0; int status = 0;
struct ti_i2c_desc *rom_desc; struct ti_i2c_desc *rom_desc;
int start_address = 2; int start_address = 2;
...@@ -691,12 +692,12 @@ static int TiValidateI2cImage (struct edgeport_serial *serial) ...@@ -691,12 +692,12 @@ static int TiValidateI2cImage (struct edgeport_serial *serial)
rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc) {
err ("%s - out of memory", __FUNCTION__); dev_err (*dev, "%s - out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
buffer = kmalloc (TI_MAX_I2C_SIZE, GFP_KERNEL); buffer = kmalloc (TI_MAX_I2C_SIZE, GFP_KERNEL);
if (!buffer) { if (!buffer) {
err ("%s - out of memory when allocating buffer", __FUNCTION__); dev_err (*dev, "%s - out of memory when allocating buffer\n", __FUNCTION__);
kfree (rom_desc); kfree (rom_desc);
return -ENOMEM; return -ENOMEM;
} }
...@@ -707,7 +708,7 @@ static int TiValidateI2cImage (struct edgeport_serial *serial) ...@@ -707,7 +708,7 @@ static int TiValidateI2cImage (struct edgeport_serial *serial)
goto ExitTiValidateI2cImage; goto ExitTiValidateI2cImage;
if (*buffer != 0x52) { if (*buffer != 0x52) {
err ("%s - invalid buffer signature", __FUNCTION__); dev_err (*dev, "%s - invalid buffer signature\n", __FUNCTION__);
status = -ENODEV; status = -ENODEV;
goto ExitTiValidateI2cImage; goto ExitTiValidateI2cImage;
} }
...@@ -765,7 +766,7 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer) ...@@ -765,7 +766,7 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer)
rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc) {
err ("%s - out of memory", __FUNCTION__); dev_err (serial->serial->dev->dev, "%s - out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_ION, rom_desc); start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_ION, rom_desc);
...@@ -800,7 +801,7 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer) ...@@ -800,7 +801,7 @@ static int TIReadManufDescriptor (struct edgeport_serial *serial, __u8 *buffer)
} }
/* Build firmware header used for firmware update */ /* Build firmware header used for firmware update */
static int BuildI2CFirmwareHeader (__u8 *header) static int BuildI2CFirmwareHeader (__u8 *header, struct device *dev)
{ {
__u8 *buffer; __u8 *buffer;
int buffer_size; int buffer_size;
...@@ -822,7 +823,7 @@ static int BuildI2CFirmwareHeader (__u8 *header) ...@@ -822,7 +823,7 @@ static int BuildI2CFirmwareHeader (__u8 *header)
buffer = kmalloc (buffer_size, GFP_KERNEL); buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!buffer) { if (!buffer) {
err ("%s - out of memory", __FUNCTION__); dev_err (*dev, "%s - out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -960,6 +961,7 @@ static int TIConfigureBootDevice (struct usb_device *dev) ...@@ -960,6 +961,7 @@ static int TIConfigureBootDevice (struct usb_device *dev)
*/ */
static int TIDownloadFirmware (struct edgeport_serial *serial) static int TIDownloadFirmware (struct edgeport_serial *serial)
{ {
struct device *dev = &serial->serial->dev->dev;
int status = 0; int status = 0;
int start_address; int start_address;
struct edge_ti_manuf_descriptor *ti_manuf_desc; struct edge_ti_manuf_descriptor *ti_manuf_desc;
...@@ -982,7 +984,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -982,7 +984,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
interface = &serial->serial->dev->config->interface->altsetting->desc; interface = &serial->serial->dev->config->interface->altsetting->desc;
if (!interface) { if (!interface) {
err ("%s - no interface set, error!", __FUNCTION__); dev_err (serial->serial->dev->dev, "%s - no interface set, error!", __FUNCTION__);
return -ENODEV; return -ENODEV;
} }
...@@ -1019,7 +1021,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1019,7 +1021,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
*/ */
ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL);
if (!ti_manuf_desc) { if (!ti_manuf_desc) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc);
...@@ -1038,7 +1040,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1038,7 +1040,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL);
if (!rom_desc) { if (!rom_desc) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
kfree (ti_manuf_desc); kfree (ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1052,7 +1054,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1052,7 +1054,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
firmware_version = kmalloc (sizeof (*firmware_version), GFP_KERNEL); firmware_version = kmalloc (sizeof (*firmware_version), GFP_KERNEL);
if (!firmware_version) { if (!firmware_version) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
kfree (rom_desc); kfree (rom_desc);
kfree (ti_manuf_desc); kfree (ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
...@@ -1129,7 +1131,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1129,7 +1131,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
} }
if (record != I2C_DESC_TYPE_FIRMWARE_BLANK) { if (record != I2C_DESC_TYPE_FIRMWARE_BLANK) {
err ("%s - error resetting device", __FUNCTION__); dev_err (*dev, "%s - error resetting device\n", __FUNCTION__);
kfree (firmware_version); kfree (firmware_version);
kfree (rom_desc); kfree (rom_desc);
kfree (ti_manuf_desc); kfree (ti_manuf_desc);
...@@ -1160,7 +1162,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1160,7 +1162,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
header = kmalloc (HEADER_SIZE, GFP_KERNEL); header = kmalloc (HEADER_SIZE, GFP_KERNEL);
if (!header) { if (!header) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
kfree (rom_desc); kfree (rom_desc);
kfree (ti_manuf_desc); kfree (ti_manuf_desc);
return -ENOMEM; return -ENOMEM;
...@@ -1168,7 +1170,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1168,7 +1170,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
vheader = kmalloc (HEADER_SIZE, GFP_KERNEL); vheader = kmalloc (HEADER_SIZE, GFP_KERNEL);
if (!vheader) { if (!vheader) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
kfree (header); kfree (header);
kfree (rom_desc); kfree (rom_desc);
kfree (ti_manuf_desc); kfree (ti_manuf_desc);
...@@ -1183,7 +1185,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1183,7 +1185,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
// And finally when the device comes back up in download mode the driver will cause // And finally when the device comes back up in download mode the driver will cause
// the new firmware to be copied from the UMP Ram to I2C and the firmware will update // the new firmware to be copied from the UMP Ram to I2C and the firmware will update
// the record type from 0xf2 to 0x02. // the record type from 0xf2 to 0x02.
status = BuildI2CFirmwareHeader(header); status = BuildI2CFirmwareHeader(header, dev);
if (status) { if (status) {
kfree (vheader); kfree (vheader);
kfree (header); kfree (header);
...@@ -1300,7 +1302,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1300,7 +1302,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
*/ */
ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL);
if (!ti_manuf_desc) { if (!ti_manuf_desc) {
err ("%s - out of memory.", __FUNCTION__); dev_err (*dev, "%s - out of memory.\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc);
...@@ -1335,7 +1337,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1335,7 +1337,7 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
buffer_size = (((1024 * 16) - 512) + sizeof(struct ti_i2c_image_header)); buffer_size = (((1024 * 16) - 512) + sizeof(struct ti_i2c_image_header));
buffer = kmalloc (buffer_size, GFP_KERNEL); buffer = kmalloc (buffer_size, GFP_KERNEL);
if (!buffer) { if (!buffer) {
err ("%s - out of memory", __FUNCTION__); dev_err (*dev, "%s - out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1616,7 +1618,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, int lsr_data, __u8 ...@@ -1616,7 +1618,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, int lsr_data, __u8
static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
{ {
struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context; struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context;
struct usb_serial_port *port; struct usb_serial_port *port;
struct edgeport_port *edge_port; struct edgeport_port *edge_port;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
...@@ -1700,8 +1702,8 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) ...@@ -1700,8 +1702,8 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
break; break;
default: default:
err ("%s - Unknown Interrupt code from UMP %x\n", dev_err (urb->dev->dev, "%s - Unknown Interrupt code from UMP %x\n",
__FUNCTION__, data[1]); __FUNCTION__, data[1]);
break; break;
} }
...@@ -1709,8 +1711,8 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs) ...@@ -1709,8 +1711,8 @@ static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
exit: exit:
status = usb_submit_urb (urb, GFP_ATOMIC); status = usb_submit_urb (urb, GFP_ATOMIC);
if (status) if (status)
err ("%s - usb_submit_urb failed with result %d", dev_err (urb->dev->dev, "%s - usb_submit_urb failed with result %d\n",
__FUNCTION__, status); __FUNCTION__, status);
} }
static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
...@@ -1777,8 +1779,8 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) ...@@ -1777,8 +1779,8 @@ static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
/* continue always trying to read */ /* continue always trying to read */
status = usb_submit_urb (urb, GFP_ATOMIC); status = usb_submit_urb (urb, GFP_ATOMIC);
if (status) if (status)
err ("%s - usb_submit_urb failed with result %d", dev_err (urb->dev->dev, "%s - usb_submit_urb failed with result %d\n",
__FUNCTION__, status); __FUNCTION__, status);
} }
static void edge_bulk_out_callback (struct urb *urb, struct pt_regs *regs) static void edge_bulk_out_callback (struct urb *urb, struct pt_regs *regs)
...@@ -1853,7 +1855,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1853,7 +1855,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
edge_port->dma_address = UMPD_OEDB2_ADDRESS; edge_port->dma_address = UMPD_OEDB2_ADDRESS;
break; break;
default: default:
err ("Unknown port number!!!"); dev_err (port->dev, "Unknown port number!!!\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1929,7 +1931,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1929,7 +1931,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
/* we are the first port to be opened, let's post the interrupt urb */ /* we are the first port to be opened, let's post the interrupt urb */
urb = edge_serial->serial->port[0].interrupt_in_urb; urb = edge_serial->serial->port[0].interrupt_in_urb;
if (!urb) { if (!urb) {
err ("%s - no interrupt urb present, exiting", __FUNCTION__); dev_err (port->dev, "%s - no interrupt urb present, exiting\n", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
urb->complete = edge_interrupt_callback; urb->complete = edge_interrupt_callback;
...@@ -1937,7 +1939,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1937,7 +1939,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
urb->dev = dev; urb->dev = dev;
status = usb_submit_urb (urb, GFP_KERNEL); status = usb_submit_urb (urb, GFP_KERNEL);
if (status) { if (status) {
err ("%s - usb_submit_urb failed with value %d", __FUNCTION__, status); dev_err (port->dev, "%s - usb_submit_urb failed with value %d\n", __FUNCTION__, status);
return status; return status;
} }
} }
...@@ -1952,7 +1954,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1952,7 +1954,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
/* start up our bulk read urb */ /* start up our bulk read urb */
urb = port->read_urb; urb = port->read_urb;
if (!urb) { if (!urb) {
err ("%s - no read urb present, exiting", __FUNCTION__); dev_err (port->dev, "%s - no read urb present, exiting\n", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
urb->complete = edge_bulk_in_callback; urb->complete = edge_bulk_in_callback;
...@@ -1960,7 +1962,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1960,7 +1962,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
urb->dev = dev; urb->dev = dev;
status = usb_submit_urb (urb, GFP_KERNEL); status = usb_submit_urb (urb, GFP_KERNEL);
if (status) { if (status) {
err ("%s - read bulk usb_submit_urb failed with value %d", __FUNCTION__, status); dev_err (port->dev, "%s - read bulk usb_submit_urb failed with value %d\n", __FUNCTION__, status);
return status; return status;
} }
...@@ -2070,7 +2072,7 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign ...@@ -2070,7 +2072,7 @@ static int edge_write (struct usb_serial_port *port, int from_user, const unsign
/* 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;
...@@ -2189,7 +2191,7 @@ static void edge_unthrottle (struct usb_serial_port *port) ...@@ -2189,7 +2191,7 @@ static void edge_unthrottle (struct usb_serial_port *port)
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
status = usb_submit_urb (port->read_urb, GFP_ATOMIC); status = usb_submit_urb (port->read_urb, GFP_ATOMIC);
if (status) { if (status) {
err ("%s - usb_submit_urb failed with value %d", __FUNCTION__, status); dev_err (port->dev, "%s - usb_submit_urb failed with value %d\n", __FUNCTION__, status);
} }
} }
...@@ -2215,7 +2217,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio ...@@ -2215,7 +2217,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
config = kmalloc (sizeof (*config), GFP_KERNEL); config = kmalloc (sizeof (*config), GFP_KERNEL);
if (!config) { if (!config) {
err ("%s - out of memory", __FUNCTION__); dev_err (edge_port->port->dev, "%s - out of memory\n", __FUNCTION__);
return; return;
} }
...@@ -2588,7 +2590,7 @@ static int edge_startup (struct usb_serial *serial) ...@@ -2588,7 +2590,7 @@ static int edge_startup (struct usb_serial *serial)
/* create our private serial structure */ /* create our private serial structure */
edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL);
if (edge_serial == NULL) { if (edge_serial == NULL) {
err("%s - Out of memory", __FUNCTION__); dev_err(serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
memset (edge_serial, 0, sizeof(struct edgeport_serial)); memset (edge_serial, 0, sizeof(struct edgeport_serial));
...@@ -2605,7 +2607,7 @@ static int edge_startup (struct usb_serial *serial) ...@@ -2605,7 +2607,7 @@ static int edge_startup (struct usb_serial *serial)
for (i = 0; i < serial->num_ports; ++i) { for (i = 0; i < serial->num_ports; ++i) {
edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL);
if (edge_port == NULL) { if (edge_port == NULL) {
err("%s - Out of memory", __FUNCTION__); dev_err(serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
memset (edge_port, 0, sizeof(struct edgeport_port)); memset (edge_port, 0, sizeof(struct edgeport_port));
......
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