aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/jumpshot.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-04-19 14:44:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-19 14:46:50 -0400
commit191648d03d20229523d9a75b8abef56421298d28 (patch)
tree2de4891a95fe1d2ee4b8326bb9834033b763d37e /drivers/usb/storage/jumpshot.c
parentf1175daa5312dd1b3f5940413c7c41ed195066f7 (diff)
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/jumpshot.c')
-rw-r--r--drivers/usb/storage/jumpshot.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index ddc78780b1ad..563078be6547 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -118,7 +118,7 @@ static inline int jumpshot_bulk_read(struct us_data *us,
118 if (len == 0) 118 if (len == 0)
119 return USB_STOR_XFER_GOOD; 119 return USB_STOR_XFER_GOOD;
120 120
121 US_DEBUGP("jumpshot_bulk_read: len = %d\n", len); 121 usb_stor_dbg(us, "len = %d\n", len);
122 return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 122 return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
123 data, len, NULL); 123 data, len, NULL);
124} 124}
@@ -131,7 +131,7 @@ static inline int jumpshot_bulk_write(struct us_data *us,
131 if (len == 0) 131 if (len == 0)
132 return USB_STOR_XFER_GOOD; 132 return USB_STOR_XFER_GOOD;
133 133
134 US_DEBUGP("jumpshot_bulk_write: len = %d\n", len); 134 usb_stor_dbg(us, "len = %d\n", len);
135 return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 135 return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
136 data, len, NULL); 136 data, len, NULL);
137} 137}
@@ -152,8 +152,7 @@ static int jumpshot_get_status(struct us_data *us)
152 return USB_STOR_TRANSPORT_ERROR; 152 return USB_STOR_TRANSPORT_ERROR;
153 153
154 if (us->iobuf[0] != 0x50) { 154 if (us->iobuf[0] != 0x50) {
155 US_DEBUGP("jumpshot_get_status: 0x%2x\n", 155 usb_stor_dbg(us, "0x%2x\n", us->iobuf[0]);
156 us->iobuf[0]);
157 return USB_STOR_TRANSPORT_ERROR; 156 return USB_STOR_TRANSPORT_ERROR;
158 } 157 }
159 158
@@ -218,7 +217,7 @@ static int jumpshot_read_data(struct us_data *us,
218 if (result != USB_STOR_XFER_GOOD) 217 if (result != USB_STOR_XFER_GOOD)
219 goto leave; 218 goto leave;
220 219
221 US_DEBUGP("jumpshot_read_data: %d bytes\n", len); 220 usb_stor_dbg(us, "%d bytes\n", len);
222 221
223 // Store the data in the transfer buffer 222 // Store the data in the transfer buffer
224 usb_stor_access_xfer_buf(buffer, len, us->srb, 223 usb_stor_access_xfer_buf(buffer, len, us->srb,
@@ -314,7 +313,7 @@ static int jumpshot_write_data(struct us_data *us,
314 } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10)); 313 } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
315 314
316 if (result != USB_STOR_TRANSPORT_GOOD) 315 if (result != USB_STOR_TRANSPORT_GOOD)
317 US_DEBUGP("jumpshot_write_data: Gah! Waitcount = 10. Bad write!?\n"); 316 usb_stor_dbg(us, "Gah! Waitcount = 10. Bad write!?\n");
318 317
319 sector += thistime; 318 sector += thistime;
320 totallen -= len; 319 totallen -= len;
@@ -349,8 +348,7 @@ static int jumpshot_id_device(struct us_data *us,
349 0, 0x20, 0, 6, command, 2); 348 0, 0x20, 0, 6, command, 2);
350 349
351 if (rc != USB_STOR_XFER_GOOD) { 350 if (rc != USB_STOR_XFER_GOOD) {
352 US_DEBUGP("jumpshot_id_device: Gah! " 351 usb_stor_dbg(us, "Gah! send_control for read_capacity failed\n");
353 "send_control for read_capacity failed\n");
354 rc = USB_STOR_TRANSPORT_ERROR; 352 rc = USB_STOR_TRANSPORT_ERROR;
355 goto leave; 353 goto leave;
356 } 354 }
@@ -400,17 +398,17 @@ static int jumpshot_handle_mode_sense(struct us_data *us,
400 398
401 switch (pc) { 399 switch (pc) {
402 case 0x0: 400 case 0x0:
403 US_DEBUGP("jumpshot_handle_mode_sense: Current values\n"); 401 usb_stor_dbg(us, "Current values\n");
404 break; 402 break;
405 case 0x1: 403 case 0x1:
406 US_DEBUGP("jumpshot_handle_mode_sense: Changeable values\n"); 404 usb_stor_dbg(us, "Changeable values\n");
407 break; 405 break;
408 case 0x2: 406 case 0x2:
409 US_DEBUGP("jumpshot_handle_mode_sense: Default values\n"); 407 usb_stor_dbg(us, "Default values\n");
410 break; 408 break;
411 case 0x3: 409 case 0x3:
412 US_DEBUGP("jumpshot_handle_mode_sense: Saves values\n"); 410 usb_stor_dbg(us, "Saves values\n");
413 break; 411 break;
414 } 412 }
415 413
416 memset(ptr, 0, 8); 414 memset(ptr, 0, 8);
@@ -494,17 +492,16 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
494 492
495 if (!us->extra) { 493 if (!us->extra) {
496 us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO); 494 us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
497 if (!us->extra) { 495 if (!us->extra)
498 US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n");
499 return USB_STOR_TRANSPORT_ERROR; 496 return USB_STOR_TRANSPORT_ERROR;
500 } 497
501 us->extra_destructor = jumpshot_info_destructor; 498 us->extra_destructor = jumpshot_info_destructor;
502 } 499 }
503 500
504 info = (struct jumpshot_info *) (us->extra); 501 info = (struct jumpshot_info *) (us->extra);
505 502
506 if (srb->cmnd[0] == INQUIRY) { 503 if (srb->cmnd[0] == INQUIRY) {
507 US_DEBUGP("jumpshot_transport: INQUIRY. Returning bogus response.\n"); 504 usb_stor_dbg(us, "INQUIRY - Returning bogus response\n");
508 memcpy(ptr, inquiry_response, sizeof(inquiry_response)); 505 memcpy(ptr, inquiry_response, sizeof(inquiry_response));
509 fill_inquiry_response(us, ptr, 36); 506 fill_inquiry_response(us, ptr, 36);
510 return USB_STOR_TRANSPORT_GOOD; 507 return USB_STOR_TRANSPORT_GOOD;
@@ -521,8 +518,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
521 if (rc != USB_STOR_TRANSPORT_GOOD) 518 if (rc != USB_STOR_TRANSPORT_GOOD)
522 return rc; 519 return rc;
523 520
524 US_DEBUGP("jumpshot_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", 521 usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
525 info->sectors, info->ssize); 522 info->sectors, info->ssize);
526 523
527 // build the reply 524 // build the reply
528 // 525 //
@@ -534,7 +531,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
534 } 531 }
535 532
536 if (srb->cmnd[0] == MODE_SELECT_10) { 533 if (srb->cmnd[0] == MODE_SELECT_10) {
537 US_DEBUGP("jumpshot_transport: Gah! MODE_SELECT_10.\n"); 534 usb_stor_dbg(us, "Gah! MODE_SELECT_10\n");
538 return USB_STOR_TRANSPORT_ERROR; 535 return USB_STOR_TRANSPORT_ERROR;
539 } 536 }
540 537
@@ -544,7 +541,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
544 541
545 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); 542 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
546 543
547 US_DEBUGP("jumpshot_transport: READ_10: read block 0x%04lx count %ld\n", block, blocks); 544 usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n",
545 block, blocks);
548 return jumpshot_read_data(us, info, block, blocks); 546 return jumpshot_read_data(us, info, block, blocks);
549 } 547 }
550 548
@@ -557,7 +555,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
557 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | 555 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
558 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); 556 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
559 557
560 US_DEBUGP("jumpshot_transport: READ_12: read block 0x%04lx count %ld\n", block, blocks); 558 usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n",
559 block, blocks);
561 return jumpshot_read_data(us, info, block, blocks); 560 return jumpshot_read_data(us, info, block, blocks);
562 } 561 }
563 562
@@ -567,7 +566,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
567 566
568 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); 567 blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
569 568
570 US_DEBUGP("jumpshot_transport: WRITE_10: write block 0x%04lx count %ld\n", block, blocks); 569 usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n",
570 block, blocks);
571 return jumpshot_write_data(us, info, block, blocks); 571 return jumpshot_write_data(us, info, block, blocks);
572 } 572 }
573 573
@@ -580,18 +580,19 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
580 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | 580 blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
581 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); 581 ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
582 582
583 US_DEBUGP("jumpshot_transport: WRITE_12: write block 0x%04lx count %ld\n", block, blocks); 583 usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n",
584 block, blocks);
584 return jumpshot_write_data(us, info, block, blocks); 585 return jumpshot_write_data(us, info, block, blocks);
585 } 586 }
586 587
587 588
588 if (srb->cmnd[0] == TEST_UNIT_READY) { 589 if (srb->cmnd[0] == TEST_UNIT_READY) {
589 US_DEBUGP("jumpshot_transport: TEST_UNIT_READY.\n"); 590 usb_stor_dbg(us, "TEST_UNIT_READY\n");
590 return jumpshot_get_status(us); 591 return jumpshot_get_status(us);
591 } 592 }
592 593
593 if (srb->cmnd[0] == REQUEST_SENSE) { 594 if (srb->cmnd[0] == REQUEST_SENSE) {
594 US_DEBUGP("jumpshot_transport: REQUEST_SENSE.\n"); 595 usb_stor_dbg(us, "REQUEST_SENSE\n");
595 596
596 memset(ptr, 0, 18); 597 memset(ptr, 0, 18);
597 ptr[0] = 0xF0; 598 ptr[0] = 0xF0;
@@ -605,12 +606,12 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
605 } 606 }
606 607
607 if (srb->cmnd[0] == MODE_SENSE) { 608 if (srb->cmnd[0] == MODE_SENSE) {
608 US_DEBUGP("jumpshot_transport: MODE_SENSE_6 detected\n"); 609 usb_stor_dbg(us, "MODE_SENSE_6 detected\n");
609 return jumpshot_handle_mode_sense(us, srb, 1); 610 return jumpshot_handle_mode_sense(us, srb, 1);
610 } 611 }
611 612
612 if (srb->cmnd[0] == MODE_SENSE_10) { 613 if (srb->cmnd[0] == MODE_SENSE_10) {
613 US_DEBUGP("jumpshot_transport: MODE_SENSE_10 detected\n"); 614 usb_stor_dbg(us, "MODE_SENSE_10 detected\n");
614 return jumpshot_handle_mode_sense(us, srb, 0); 615 return jumpshot_handle_mode_sense(us, srb, 0);
615 } 616 }
616 617
@@ -624,7 +625,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
624 if (srb->cmnd[0] == START_STOP) { 625 if (srb->cmnd[0] == START_STOP) {
625 /* this is used by sd.c'check_scsidisk_media_change to detect 626 /* this is used by sd.c'check_scsidisk_media_change to detect
626 media change */ 627 media change */
627 US_DEBUGP("jumpshot_transport: START_STOP.\n"); 628 usb_stor_dbg(us, "START_STOP\n");
628 /* the first jumpshot_id_device after a media change returns 629 /* the first jumpshot_id_device after a media change returns
629 an error (determined experimentally) */ 630 an error (determined experimentally) */
630 rc = jumpshot_id_device(us, info); 631 rc = jumpshot_id_device(us, info);
@@ -638,8 +639,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
638 return rc; 639 return rc;
639 } 640 }
640 641
641 US_DEBUGP("jumpshot_transport: Gah! Unknown command: %d (0x%x)\n", 642 usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n",
642 srb->cmnd[0], srb->cmnd[0]); 643 srb->cmnd[0], srb->cmnd[0]);
643 info->sense_key = 0x05; 644 info->sense_key = 0x05;
644 info->sense_asc = 0x20; 645 info->sense_asc = 0x20;
645 info->sense_ascq = 0x00; 646 info->sense_ascq = 0x00;