ChangeSet 1.946.3.10, 2002/12/26 13:58:03-08:00, greg@kroah.com [PATCH] USB: convert io_ti driver to use dev_err() and dev_info() macros diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c --- a/drivers/usb/serial/io_ti.c Fri Dec 27 23:57:38 2002 +++ b/drivers/usb/serial/io_ti.c Fri Dec 27 23:57:38 2002 @@ -473,7 +473,7 @@ oedb = kmalloc (sizeof (* oedb), GFP_KERNEL); if (!oedb) { - err ("%s - out of memory", __FUNCTION__); + dev_err (port->port->dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } @@ -592,7 +592,7 @@ dbg ("%s - MAX Power = %d", __FUNCTION__, dev->config->desc.bMaxPower*2); 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; } @@ -684,6 +684,7 @@ /* Make sure that the I2C image is good */ static int TiValidateI2cImage (struct edgeport_serial *serial) { + struct device *dev = &serial->serial->dev->dev; int status = 0; struct ti_i2c_desc *rom_desc; int start_address = 2; @@ -691,12 +692,12 @@ rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - err ("%s - out of memory", __FUNCTION__); + dev_err (*dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } buffer = kmalloc (TI_MAX_I2C_SIZE, GFP_KERNEL); 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); return -ENOMEM; } @@ -707,7 +708,7 @@ goto ExitTiValidateI2cImage; if (*buffer != 0x52) { - err ("%s - invalid buffer signature", __FUNCTION__); + dev_err (*dev, "%s - invalid buffer signature\n", __FUNCTION__); status = -ENODEV; goto ExitTiValidateI2cImage; } @@ -765,7 +766,7 @@ rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - err ("%s - out of memory", __FUNCTION__); + dev_err (serial->serial->dev->dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_ION, rom_desc); @@ -800,7 +801,7 @@ } /* Build firmware header used for firmware update */ -static int BuildI2CFirmwareHeader (__u8 *header) +static int BuildI2CFirmwareHeader (__u8 *header, struct device *dev) { __u8 *buffer; int buffer_size; @@ -822,7 +823,7 @@ buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - err ("%s - out of memory", __FUNCTION__); + dev_err (*dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } @@ -960,6 +961,7 @@ */ static int TIDownloadFirmware (struct edgeport_serial *serial) { + struct device *dev = &serial->serial->dev->dev; int status = 0; int start_address; struct edge_ti_manuf_descriptor *ti_manuf_desc; @@ -982,7 +984,7 @@ interface = &serial->serial->dev->config->interface->altsetting->desc; if (!interface) { - err ("%s - no interface set, error!", __FUNCTION__); + dev_err (serial->serial->dev->dev, "%s - no interface set, error!", __FUNCTION__); return -ENODEV; } @@ -1019,7 +1021,7 @@ */ ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); if (!ti_manuf_desc) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); return -ENOMEM; } status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); @@ -1038,7 +1040,7 @@ rom_desc = kmalloc (sizeof (*rom_desc), GFP_KERNEL); if (!rom_desc) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); kfree (ti_manuf_desc); return -ENOMEM; } @@ -1052,7 +1054,7 @@ firmware_version = kmalloc (sizeof (*firmware_version), GFP_KERNEL); if (!firmware_version) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); kfree (rom_desc); kfree (ti_manuf_desc); return -ENOMEM; @@ -1129,7 +1131,7 @@ } 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 (rom_desc); kfree (ti_manuf_desc); @@ -1160,7 +1162,7 @@ header = kmalloc (HEADER_SIZE, GFP_KERNEL); if (!header) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); kfree (rom_desc); kfree (ti_manuf_desc); return -ENOMEM; @@ -1168,7 +1170,7 @@ vheader = kmalloc (HEADER_SIZE, GFP_KERNEL); if (!vheader) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); kfree (header); kfree (rom_desc); kfree (ti_manuf_desc); @@ -1183,7 +1185,7 @@ // 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 record type from 0xf2 to 0x02. - status = BuildI2CFirmwareHeader(header); + status = BuildI2CFirmwareHeader(header, dev); if (status) { kfree (vheader); kfree (header); @@ -1300,7 +1302,7 @@ */ ti_manuf_desc = kmalloc (sizeof (*ti_manuf_desc), GFP_KERNEL); if (!ti_manuf_desc) { - err ("%s - out of memory.", __FUNCTION__); + dev_err (*dev, "%s - out of memory.\n", __FUNCTION__); return -ENOMEM; } status = TIReadManufDescriptor (serial, (__u8 *)ti_manuf_desc); @@ -1335,7 +1337,7 @@ buffer_size = (((1024 * 16) - 512) + sizeof(struct ti_i2c_image_header)); buffer = kmalloc (buffer_size, GFP_KERNEL); if (!buffer) { - err ("%s - out of memory", __FUNCTION__); + dev_err (*dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } @@ -1616,7 +1618,7 @@ 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 edgeport_port *edge_port; unsigned char *data = urb->transfer_buffer; @@ -1700,8 +1702,8 @@ break; default: - err ("%s - Unknown Interrupt code from UMP %x\n", - __FUNCTION__, data[1]); + dev_err (urb->dev->dev, "%s - Unknown Interrupt code from UMP %x\n", + __FUNCTION__, data[1]); break; } @@ -1709,8 +1711,8 @@ exit: status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, status); + dev_err (urb->dev->dev, "%s - usb_submit_urb failed with result %d\n", + __FUNCTION__, status); } static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs) @@ -1777,8 +1779,8 @@ /* continue always trying to read */ status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, status); + dev_err (urb->dev->dev, "%s - usb_submit_urb failed with result %d\n", + __FUNCTION__, status); } static void edge_bulk_out_callback (struct urb *urb, struct pt_regs *regs) @@ -1853,7 +1855,7 @@ edge_port->dma_address = UMPD_OEDB2_ADDRESS; break; default: - err ("Unknown port number!!!"); + dev_err (port->dev, "Unknown port number!!!\n"); return -ENODEV; } @@ -1929,7 +1931,7 @@ /* we are the first port to be opened, let's post the interrupt urb */ urb = edge_serial->serial->port[0].interrupt_in_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; } urb->complete = edge_interrupt_callback; @@ -1937,7 +1939,7 @@ urb->dev = dev; status = usb_submit_urb (urb, GFP_KERNEL); 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; } } @@ -1952,7 +1954,7 @@ /* start up our bulk read urb */ urb = port->read_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; } urb->complete = edge_bulk_in_callback; @@ -1960,7 +1962,7 @@ urb->dev = dev; status = usb_submit_urb (urb, GFP_KERNEL); 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; } @@ -2070,7 +2072,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; @@ -2189,7 +2191,7 @@ port->read_urb->dev = port->serial->dev; status = usb_submit_urb (port->read_urb, GFP_ATOMIC); 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 @@ config = kmalloc (sizeof (*config), GFP_KERNEL); if (!config) { - err ("%s - out of memory", __FUNCTION__); + dev_err (edge_port->port->dev, "%s - out of memory\n", __FUNCTION__); return; } @@ -2588,7 +2590,7 @@ /* create our private serial structure */ edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL); if (edge_serial == NULL) { - err("%s - Out of memory", __FUNCTION__); + dev_err(serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); return -ENOMEM; } memset (edge_serial, 0, sizeof(struct edgeport_serial)); @@ -2605,7 +2607,7 @@ for (i = 0; i < serial->num_ports; ++i) { edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL); if (edge_port == NULL) { - err("%s - Out of memory", __FUNCTION__); + dev_err(serial->dev->dev, "%s - Out of memory\n", __FUNCTION__); return -ENOMEM; } memset (edge_port, 0, sizeof(struct edgeport_port));