ChangeSet 1.946.3.9, 2002/12/26 13:57:41-08:00, greg@kroah.com [PATCH] USB: convert io_edgeport driver to use dev_err() and dev_info() macros diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c --- a/drivers/usb/serial/io_edgeport.c Fri Dec 27 23:57:43 2002 +++ b/drivers/usb/serial/io_edgeport.c Fri Dec 27 23:57:43 2002 @@ -572,7 +572,7 @@ record = (struct edge_firmware_image_record *)firmware; response = rom_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); if (response < 0) { - err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len); + dev_err(edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len); break; } firmware += sizeof (struct edge_firmware_image_record) + record->Len; @@ -840,7 +840,7 @@ exit: result = usb_submit_urb (urb, GFP_ATOMIC); if (result) { - err("%s - Error %d submitting control urb", __FUNCTION__, result); + dev_err(urb->dev->dev, "%s - Error %d submitting control urb\n", __FUNCTION__, result); } } @@ -889,7 +889,7 @@ edge_serial->read_urb->dev = edge_serial->serial->dev; status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); if (status) { - err("%s - usb_submit_urb(read bulk) failed, status = %d", __FUNCTION__, status); + dev_err(urb->dev->dev, "%s - usb_submit_urb(read bulk) failed, status = %d\n", __FUNCTION__, status); } } } @@ -1057,7 +1057,7 @@ * this interrupt will continue as long as the edgeport is connected */ response = usb_submit_urb (edge_serial->interrupt_read_urb, GFP_KERNEL); if (response) { - err("%s - Error %d submitting control urb", __FUNCTION__, response); + dev_err(port->dev, "%s - Error %d submitting control urb\n", __FUNCTION__, response); } } @@ -1081,7 +1081,7 @@ response = send_iosp_ext_cmd (edge_port, IOSP_CMD_OPEN_PORT, 0); if (response < 0) { - err("%s - error sending open port command", __FUNCTION__); + dev_err(port->dev, "%s - error sending open port command\n", __FUNCTION__); edge_port->openPending = FALSE; return -ENODEV; } @@ -1450,7 +1450,7 @@ count = fifo->count; buffer = kmalloc (count+2, GFP_ATOMIC); if (buffer == NULL) { - err("%s - no more kernel memory...", __FUNCTION__); + dev_err(edge_serial->serial->dev->dev, "%s - no more kernel memory...\n", __FUNCTION__); edge_port->write_in_progress = FALSE; return; } @@ -2143,7 +2143,7 @@ } edge_port = (struct edgeport_port *)port->private; if (edge_port == NULL) { - err("%s - edge_port == NULL for port %d", __FUNCTION__, edge_serial->rxPort); + dev_err(edge_serial->serial->dev->dev, "%s - edge_port == NULL for port %d\n", __FUNCTION__, edge_serial->rxPort); return; } @@ -2330,7 +2330,7 @@ transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - err("%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); return -ENOMEM; } @@ -2375,7 +2375,7 @@ transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - err("%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); return -ENOMEM; } @@ -2420,7 +2420,7 @@ transfer_buffer = kmalloc (64, GFP_KERNEL); if (!transfer_buffer) { - err("%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); + dev_err(serial->dev->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 64); return -ENOMEM; } @@ -2463,7 +2463,7 @@ buffer = kmalloc (10, GFP_ATOMIC); if (!buffer) { - err("%s - kmalloc(%d) failed.\n", __FUNCTION__, 10); + dev_err(edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 10); return -ENOMEM; } @@ -2554,14 +2554,14 @@ status = calc_baud_rate_divisor (baudRate, &divisor); if (status) { - err("%s - bad baud rate", __FUNCTION__); + dev_err(edge_port->port->dev, "%s - bad baud rate\n", __FUNCTION__); return status; } // Alloc memory for the string of commands. cmdBuffer = kmalloc (0x100, GFP_ATOMIC); if (!cmdBuffer) { - err("%s - kmalloc(%d) failed.\n", __FUNCTION__, 0x100); + dev_err(edge_port->port->dev, "%s - kmalloc(%d) failed.\n", __FUNCTION__, 0x100); return -ENOMEM; } currCmd = cmdBuffer; @@ -2838,7 +2838,7 @@ (__u8 *)(&edge_serial->manuf_descriptor)); if (response < 1) { - err("error in getting manufacturer descriptor"); + dev_err(edge_serial->serial->dev->dev, "error in getting manufacturer descriptor\n"); } else { char string[30]; dbg("**Manufacturer Descriptor"); @@ -2877,7 +2877,7 @@ (__u8 *)(&edge_serial->boot_descriptor)); if (response < 1) { - err("error in getting boot descriptor"); + dev_err(edge_serial->serial->dev->dev, "error in getting boot descriptor\n"); } else { dbg("**Boot Descriptor:"); dbg(" BootCodeLength: %d", edge_serial->boot_descriptor.BootCodeLength); @@ -2938,7 +2938,7 @@ record = (struct edge_firmware_image_record *)firmware; response = sram_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); if (response < 0) { - err("sram_write failed (%x, %x, %d)", record->ExtAddr, record->Addr, record->Len); + dev_err(edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len); break; } firmware += sizeof (struct edge_firmware_image_record) + record->Len; @@ -2974,7 +2974,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", __FUNCTION__); return -ENOMEM; } memset (edge_serial, 0, sizeof(struct edgeport_serial)); @@ -2988,7 +2988,7 @@ get_string(dev, dev->descriptor.iProduct, &edge_serial->name[i]); - info("%s detected", edge_serial->name); + dev_info(serial->dev->dev, "%s detected\n", edge_serial->name); /* get the manufacturing descriptor for this device */ get_manufacturing_desc (edge_serial); @@ -3030,7 +3030,9 @@ 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", __FUNCTION__); + serial->private = NULL; + kfree(edge_serial); return -ENOMEM; } memset (edge_port, 0, sizeof(struct edgeport_port));