diff options
author | Joe Perches <joe@perches.com> | 2013-04-19 22:44:00 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 22:46:50 +0400 |
commit | 191648d03d20229523d9a75b8abef56421298d28 (patch) | |
tree | 2de4891a95fe1d2ee4b8326bb9834033b763d37e /drivers/usb/storage/shuttle_usbat.c | |
parent | f1175daa5312dd1b3f5940413c7c41ed195066f7 (diff) | |
download | linux-191648d03d20229523d9a75b8abef56421298d28.tar.xz |
usb: storage: Convert US_DEBUGP to usb_stor_dbg
Use a more current logging style with dev_printk
where possible.
o Convert uses of US_DEBUGP to usb_stor_dbg
o Add "struct us_data *" to usb_stor_dbg uses
o usb_stor_dbg now uses struct device */dev_vprint_emit
o Removed embedded function names
o Coalesce formats
o Remove trailing whitespace
o Remove useless OOM messages
o Remove useless function entry/exit logging
o Convert some US_DEBUGP uses to dev_info and dev_dbg
Object size is slightly reduced when debugging
is enabled, slightly increased with no debugging
because some initialization and removal messages
are now always emitted.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage/shuttle_usbat.c')
-rw-r--r-- | drivers/usb/storage/shuttle_usbat.c | 119 |
1 files changed, 62 insertions, 57 deletions
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index daf2fc58ae02..4ef2a80728f7 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c @@ -271,7 +271,7 @@ static int usbat_bulk_read(struct us_data *us, if (len == 0) return USB_STOR_XFER_GOOD; - US_DEBUGP("usbat_bulk_read: len = %d\n", len); + usb_stor_dbg(us, "len = %d\n", len); return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, buf, len, use_sg, NULL); } @@ -286,7 +286,7 @@ static int usbat_bulk_write(struct us_data *us, if (len == 0) return USB_STOR_XFER_GOOD; - US_DEBUGP("usbat_bulk_write: len = %d\n", len); + usb_stor_dbg(us, "len = %d\n", len); return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, buf, len, use_sg, NULL); } @@ -312,7 +312,7 @@ static int usbat_get_status(struct us_data *us, unsigned char *status) int rc; rc = usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status); - US_DEBUGP("usbat_get_status: 0x%02X\n", (unsigned short) (*status)); + usb_stor_dbg(us, "0x%02X\n", *status); return rc; } @@ -425,7 +425,7 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes) return USB_STOR_TRANSPORT_FAILED; if ((*status & 0x80)==0x00) { /* not busy */ - US_DEBUGP("Waited not busy for %d steps\n", i); + usb_stor_dbg(us, "Waited not busy for %d steps\n", i); return USB_STOR_TRANSPORT_GOOD; } @@ -439,8 +439,8 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes) msleep(1000); /* X minutes */ } - US_DEBUGP("Waited not busy for %d minutes, timing out.\n", - minutes); + usb_stor_dbg(us, "Waited not busy for %d minutes, timing out\n", + minutes); return USB_STOR_TRANSPORT_FAILED; } @@ -657,8 +657,9 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us, if (*status & 0x20) /* device fault */ return USB_STOR_TRANSPORT_FAILED; - US_DEBUGP("Redoing %s\n", - direction==DMA_TO_DEVICE ? "write" : "read"); + usb_stor_dbg(us, "Redoing %s\n", + direction == DMA_TO_DEVICE + ? "write" : "read"); } else if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; @@ -667,8 +668,8 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us, } - US_DEBUGP("Bummer! %s bulk data 20 times failed.\n", - direction==DMA_TO_DEVICE ? "Writing" : "Reading"); + usb_stor_dbg(us, "Bummer! %s bulk data 20 times failed\n", + direction == DMA_TO_DEVICE ? "Writing" : "Reading"); return USB_STOR_TRANSPORT_FAILED; } @@ -827,7 +828,7 @@ static int usbat_read_user_io(struct us_data *us, unsigned char *data_flags) data_flags, USBAT_UIO_READ); - US_DEBUGP("usbat_read_user_io: UIO register reads %02X\n", (unsigned short) (*data_flags)); + usb_stor_dbg(us, "UIO register reads %02X\n", *data_flags); return result; } @@ -900,10 +901,11 @@ static int usbat_device_enable_cdt(struct us_data *us) /* * Determine if media is present. */ -static int usbat_flash_check_media_present(unsigned char *uio) +static int usbat_flash_check_media_present(struct us_data *us, + unsigned char *uio) { if (*uio & USBAT_UIO_UI0) { - US_DEBUGP("usbat_flash_check_media_present: no media detected\n"); + usb_stor_dbg(us, "no media detected\n"); return USBAT_FLASH_MEDIA_NONE; } @@ -913,10 +915,11 @@ static int usbat_flash_check_media_present(unsigned char *uio) /* * Determine if media has changed since last operation */ -static int usbat_flash_check_media_changed(unsigned char *uio) +static int usbat_flash_check_media_changed(struct us_data *us, + unsigned char *uio) { if (*uio & USBAT_UIO_0) { - US_DEBUGP("usbat_flash_check_media_changed: media change detected\n"); + usb_stor_dbg(us, "media change detected\n"); return USBAT_FLASH_MEDIA_CHANGED; } @@ -937,7 +940,7 @@ static int usbat_flash_check_media(struct us_data *us, return USB_STOR_TRANSPORT_ERROR; /* Check for media existence */ - rc = usbat_flash_check_media_present(uio); + rc = usbat_flash_check_media_present(us, uio); if (rc == USBAT_FLASH_MEDIA_NONE) { info->sense_key = 0x02; info->sense_asc = 0x3A; @@ -946,7 +949,7 @@ static int usbat_flash_check_media(struct us_data *us, } /* Check for media change */ - rc = usbat_flash_check_media_changed(uio); + rc = usbat_flash_check_media_changed(us, uio); if (rc == USBAT_FLASH_MEDIA_CHANGED) { /* Reset and re-enable card detect */ @@ -1008,11 +1011,11 @@ static int usbat_identify_device(struct us_data *us, /* Check for error bit, or if the command 'fell through' */ if (status == 0xA1 || !(status & 0x01)) { /* Device is HP 8200 */ - US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n"); + usb_stor_dbg(us, "Detected HP8200 CDRW\n"); info->devicetype = USBAT_DEV_HP8200; } else { /* Device is a CompactFlash reader/writer */ - US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n"); + usb_stor_dbg(us, "Detected Flash reader/writer\n"); info->devicetype = USBAT_DEV_FLASH; } @@ -1075,7 +1078,7 @@ static int usbat_flash_get_sector_count(struct us_data *us, /* ATA command : IDENTIFY DEVICE */ rc = usbat_multiple_write(us, registers, command, 3); if (rc != USB_STOR_XFER_GOOD) { - US_DEBUGP("usbat_flash_get_sector_count: Gah! identify_device failed\n"); + usb_stor_dbg(us, "Gah! identify_device failed\n"); rc = USB_STOR_TRANSPORT_ERROR; goto leave; } @@ -1178,7 +1181,7 @@ static int usbat_flash_read_data(struct us_data *us, if (result != USB_STOR_TRANSPORT_GOOD) goto leave; - US_DEBUGP("usbat_flash_read_data: %d bytes\n", len); + usb_stor_dbg(us, "%d bytes\n", len); /* Store the data in the transfer buffer */ usb_stor_access_xfer_buf(buffer, len, us->srb, @@ -1301,8 +1304,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, unsigned int sg_offset = 0; struct scatterlist *sg = NULL; - US_DEBUGP("handle_read10: transfersize %d\n", - srb->transfersize); + usb_stor_dbg(us, "transfersize %d\n", srb->transfersize); if (scsi_bufflen(srb) < 0x10000) { @@ -1329,14 +1331,14 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, len = short_pack(data[7+9], data[7+8]); len <<= 16; len |= data[7+7]; - US_DEBUGP("handle_read10: GPCMD_READ_CD: len %d\n", len); + usb_stor_dbg(us, "GPCMD_READ_CD: len %d\n", len); srb->transfersize = scsi_bufflen(srb)/len; } if (!srb->transfersize) { srb->transfersize = 2048; /* A guess */ - US_DEBUGP("handle_read10: transfersize 0, forcing %d\n", - srb->transfersize); + usb_stor_dbg(us, "transfersize 0, forcing %d\n", + srb->transfersize); } /* @@ -1346,7 +1348,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us, */ len = (65535/srb->transfersize) * srb->transfersize; - US_DEBUGP("Max read is %d bytes\n", len); + usb_stor_dbg(us, "Max read is %d bytes\n", len); len = min(len, scsi_bufflen(srb)); buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) /* bloody hell! */ @@ -1460,10 +1462,9 @@ static int init_usbat(struct us_data *us, int devicetype) unsigned char *status = us->iobuf; us->extra = kzalloc(sizeof(struct usbat_info), GFP_NOIO); - if (!us->extra) { - US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n"); + if (!us->extra) return 1; - } + info = (struct usbat_info *) (us->extra); /* Enable peripheral control signals */ @@ -1473,7 +1474,7 @@ static int init_usbat(struct us_data *us, int devicetype) if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 1\n"); + usb_stor_dbg(us, "INIT 1\n"); msleep(2000); @@ -1481,7 +1482,7 @@ static int init_usbat(struct us_data *us, int devicetype) if (rc != USB_STOR_TRANSPORT_GOOD) return rc; - US_DEBUGP("INIT 2\n"); + usb_stor_dbg(us, "INIT 2\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) @@ -1491,32 +1492,32 @@ static int init_usbat(struct us_data *us, int devicetype) if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 3\n"); + usb_stor_dbg(us, "INIT 3\n"); rc = usbat_select_and_test_registers(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; - US_DEBUGP("INIT 4\n"); + usb_stor_dbg(us, "INIT 4\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 5\n"); + usb_stor_dbg(us, "INIT 5\n"); /* Enable peripheral control signals and card detect */ rc = usbat_device_enable_cdt(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; - US_DEBUGP("INIT 6\n"); + usb_stor_dbg(us, "INIT 6\n"); rc = usbat_read_user_io(us, status); if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 7\n"); + usb_stor_dbg(us, "INIT 7\n"); msleep(1400); @@ -1524,19 +1525,19 @@ static int init_usbat(struct us_data *us, int devicetype) if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 8\n"); + usb_stor_dbg(us, "INIT 8\n"); rc = usbat_select_and_test_registers(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; - US_DEBUGP("INIT 9\n"); + usb_stor_dbg(us, "INIT 9\n"); /* At this point, we need to detect which device we are using */ if (usbat_set_transport(us, info, devicetype)) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 10\n"); + usb_stor_dbg(us, "INIT 10\n"); if (usbat_get_device_type(us) == USBAT_DEV_FLASH) { subcountH = 0x02; @@ -1547,7 +1548,7 @@ static int init_usbat(struct us_data *us, int devicetype) if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - US_DEBUGP("INIT 11\n"); + usb_stor_dbg(us, "INIT 11\n"); return USB_STOR_TRANSPORT_GOOD; } @@ -1592,7 +1593,7 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) } result = usbat_get_status(us, status); - US_DEBUGP("Status = %02X\n", *status); + usb_stor_dbg(us, "Status = %02X\n", *status); if (result != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; if (srb->cmnd[0] == TEST_UNIT_READY) @@ -1610,7 +1611,7 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) if (result == USB_STOR_TRANSPORT_GOOD) { transferred += len; - US_DEBUGP("Wrote %08X bytes\n", transferred); + usb_stor_dbg(us, "Wrote %08X bytes\n", transferred); } return result; @@ -1623,8 +1624,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us) } if (len > 0xFFFF) { - US_DEBUGP("Error: len = %08X... what do I do now?\n", - len); + usb_stor_dbg(us, "Error: len = %08X... what do I do now?\n", + len); return USB_STOR_TRANSPORT_ERROR; } @@ -1693,7 +1694,7 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) }; if (srb->cmnd[0] == INQUIRY) { - US_DEBUGP("usbat_flash_transport: INQUIRY. Returning bogus response.\n"); + usb_stor_dbg(us, "INQUIRY - Returning bogus response\n"); memcpy(ptr, inquiry_response, sizeof(inquiry_response)); fill_inquiry_response(us, ptr, 36); return USB_STOR_TRANSPORT_GOOD; @@ -1710,8 +1711,8 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) /* hard coded 512 byte sectors as per ATA spec */ info->ssize = 0x200; - US_DEBUGP("usbat_flash_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", - info->sectors, info->ssize); + usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n", + info->sectors, info->ssize); /* * build the reply @@ -1726,7 +1727,7 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) } if (srb->cmnd[0] == MODE_SELECT_10) { - US_DEBUGP("usbat_flash_transport: Gah! MODE_SELECT_10.\n"); + usb_stor_dbg(us, "Gah! MODE_SELECT_10\n"); return USB_STOR_TRANSPORT_ERROR; } @@ -1736,7 +1737,8 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); - US_DEBUGP("usbat_flash_transport: READ_10: read block 0x%04lx count %ld\n", block, blocks); + usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n", + block, blocks); return usbat_flash_read_data(us, info, block, blocks); } @@ -1750,7 +1752,8 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); - US_DEBUGP("usbat_flash_transport: READ_12: read block 0x%04lx count %ld\n", block, blocks); + usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n", + block, blocks); return usbat_flash_read_data(us, info, block, blocks); } @@ -1760,7 +1763,8 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); - US_DEBUGP("usbat_flash_transport: WRITE_10: write block 0x%04lx count %ld\n", block, blocks); + usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n", + block, blocks); return usbat_flash_write_data(us, info, block, blocks); } @@ -1774,13 +1778,14 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); - US_DEBUGP("usbat_flash_transport: WRITE_12: write block 0x%04lx count %ld\n", block, blocks); + usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n", + block, blocks); return usbat_flash_write_data(us, info, block, blocks); } if (srb->cmnd[0] == TEST_UNIT_READY) { - US_DEBUGP("usbat_flash_transport: TEST_UNIT_READY.\n"); + usb_stor_dbg(us, "TEST_UNIT_READY\n"); rc = usbat_flash_check_media(us, info); if (rc != USB_STOR_TRANSPORT_GOOD) @@ -1790,7 +1795,7 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) } if (srb->cmnd[0] == REQUEST_SENSE) { - US_DEBUGP("usbat_flash_transport: REQUEST_SENSE.\n"); + usb_stor_dbg(us, "REQUEST_SENSE\n"); memset(ptr, 0, 18); ptr[0] = 0xF0; @@ -1811,8 +1816,8 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) return USB_STOR_TRANSPORT_GOOD; } - US_DEBUGP("usbat_flash_transport: Gah! Unknown command: %d (0x%x)\n", - srb->cmnd[0], srb->cmnd[0]); + usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n", + srb->cmnd[0], srb->cmnd[0]); info->sense_key = 0x05; info->sense_asc = 0x20; info->sense_ascq = 0x00; |