diff options
author | Joe Perches <joe@perches.com> | 2013-04-19 14:44:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 14:46:50 -0400 |
commit | 191648d03d20229523d9a75b8abef56421298d28 (patch) | |
tree | 2de4891a95fe1d2ee4b8326bb9834033b763d37e /drivers/usb/storage/datafab.c | |
parent | f1175daa5312dd1b3f5940413c7c41ed195066f7 (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/datafab.c')
-rw-r--r-- | drivers/usb/storage/datafab.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 494fee5af41d..7b17c2169812 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c | |||
@@ -123,7 +123,7 @@ datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) { | |||
123 | if (len == 0) | 123 | if (len == 0) |
124 | return USB_STOR_XFER_GOOD; | 124 | return USB_STOR_XFER_GOOD; |
125 | 125 | ||
126 | US_DEBUGP("datafab_bulk_read: len = %d\n", len); | 126 | usb_stor_dbg(us, "len = %d\n", len); |
127 | return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, | 127 | return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, |
128 | data, len, NULL); | 128 | data, len, NULL); |
129 | } | 129 | } |
@@ -134,7 +134,7 @@ datafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) { | |||
134 | if (len == 0) | 134 | if (len == 0) |
135 | return USB_STOR_XFER_GOOD; | 135 | return USB_STOR_XFER_GOOD; |
136 | 136 | ||
137 | US_DEBUGP("datafab_bulk_write: len = %d\n", len); | 137 | usb_stor_dbg(us, "len = %d\n", len); |
138 | return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, | 138 | return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, |
139 | data, len, NULL); | 139 | data, len, NULL); |
140 | } | 140 | } |
@@ -300,9 +300,8 @@ static int datafab_write_data(struct us_data *us, | |||
300 | goto leave; | 300 | goto leave; |
301 | 301 | ||
302 | if (reply[0] != 0x50 && reply[1] != 0) { | 302 | if (reply[0] != 0x50 && reply[1] != 0) { |
303 | US_DEBUGP("datafab_write_data: Gah! " | 303 | usb_stor_dbg(us, "Gah! write return code: %02x %02x\n", |
304 | "write return code: %02x %02x\n", | 304 | reply[0], reply[1]); |
305 | reply[0], reply[1]); | ||
306 | result = USB_STOR_TRANSPORT_ERROR; | 305 | result = USB_STOR_TRANSPORT_ERROR; |
307 | goto leave; | 306 | goto leave; |
308 | } | 307 | } |
@@ -342,7 +341,7 @@ static int datafab_determine_lun(struct us_data *us, | |||
342 | if (!buf) | 341 | if (!buf) |
343 | return USB_STOR_TRANSPORT_ERROR; | 342 | return USB_STOR_TRANSPORT_ERROR; |
344 | 343 | ||
345 | US_DEBUGP("datafab_determine_lun: locating...\n"); | 344 | usb_stor_dbg(us, "locating...\n"); |
346 | 345 | ||
347 | // we'll try 3 times before giving up... | 346 | // we'll try 3 times before giving up... |
348 | // | 347 | // |
@@ -474,16 +473,16 @@ static int datafab_handle_mode_sense(struct us_data *us, | |||
474 | 473 | ||
475 | switch (pc) { | 474 | switch (pc) { |
476 | case 0x0: | 475 | case 0x0: |
477 | US_DEBUGP("datafab_handle_mode_sense: Current values\n"); | 476 | usb_stor_dbg(us, "Current values\n"); |
478 | break; | 477 | break; |
479 | case 0x1: | 478 | case 0x1: |
480 | US_DEBUGP("datafab_handle_mode_sense: Changeable values\n"); | 479 | usb_stor_dbg(us, "Changeable values\n"); |
481 | break; | 480 | break; |
482 | case 0x2: | 481 | case 0x2: |
483 | US_DEBUGP("datafab_handle_mode_sense: Default values\n"); | 482 | usb_stor_dbg(us, "Default values\n"); |
484 | break; | 483 | break; |
485 | case 0x3: | 484 | case 0x3: |
486 | US_DEBUGP("datafab_handle_mode_sense: Saves values\n"); | 485 | usb_stor_dbg(us, "Saves values\n"); |
487 | break; | 486 | break; |
488 | } | 487 | } |
489 | 488 | ||
@@ -566,11 +565,9 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
566 | 565 | ||
567 | if (!us->extra) { | 566 | if (!us->extra) { |
568 | us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO); | 567 | us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO); |
569 | if (!us->extra) { | 568 | if (!us->extra) |
570 | US_DEBUGP("datafab_transport: Gah! " | ||
571 | "Can't allocate storage for Datafab info struct!\n"); | ||
572 | return USB_STOR_TRANSPORT_ERROR; | 569 | return USB_STOR_TRANSPORT_ERROR; |
573 | } | 570 | |
574 | us->extra_destructor = datafab_info_destructor; | 571 | us->extra_destructor = datafab_info_destructor; |
575 | ((struct datafab_info *)us->extra)->lun = -1; | 572 | ((struct datafab_info *)us->extra)->lun = -1; |
576 | } | 573 | } |
@@ -578,7 +575,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
578 | info = (struct datafab_info *) (us->extra); | 575 | info = (struct datafab_info *) (us->extra); |
579 | 576 | ||
580 | if (srb->cmnd[0] == INQUIRY) { | 577 | if (srb->cmnd[0] == INQUIRY) { |
581 | US_DEBUGP("datafab_transport: INQUIRY. Returning bogus response"); | 578 | usb_stor_dbg(us, "INQUIRY - Returning bogus response\n"); |
582 | memcpy(ptr, inquiry_reply, sizeof(inquiry_reply)); | 579 | memcpy(ptr, inquiry_reply, sizeof(inquiry_reply)); |
583 | fill_inquiry_response(us, ptr, 36); | 580 | fill_inquiry_response(us, ptr, 36); |
584 | return USB_STOR_TRANSPORT_GOOD; | 581 | return USB_STOR_TRANSPORT_GOOD; |
@@ -590,8 +587,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
590 | if (rc != USB_STOR_TRANSPORT_GOOD) | 587 | if (rc != USB_STOR_TRANSPORT_GOOD) |
591 | return rc; | 588 | return rc; |
592 | 589 | ||
593 | US_DEBUGP("datafab_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", | 590 | usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n", |
594 | info->sectors, info->ssize); | 591 | info->sectors, info->ssize); |
595 | 592 | ||
596 | // build the reply | 593 | // build the reply |
597 | // we need the last sector, not the number of sectors | 594 | // we need the last sector, not the number of sectors |
@@ -603,7 +600,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
603 | } | 600 | } |
604 | 601 | ||
605 | if (srb->cmnd[0] == MODE_SELECT_10) { | 602 | if (srb->cmnd[0] == MODE_SELECT_10) { |
606 | US_DEBUGP("datafab_transport: Gah! MODE_SELECT_10.\n"); | 603 | usb_stor_dbg(us, "Gah! MODE_SELECT_10\n"); |
607 | return USB_STOR_TRANSPORT_ERROR; | 604 | return USB_STOR_TRANSPORT_ERROR; |
608 | } | 605 | } |
609 | 606 | ||
@@ -615,7 +612,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
615 | 612 | ||
616 | blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); | 613 | blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); |
617 | 614 | ||
618 | US_DEBUGP("datafab_transport: READ_10: read block 0x%04lx count %ld\n", block, blocks); | 615 | usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n", |
616 | block, blocks); | ||
619 | return datafab_read_data(us, info, block, blocks); | 617 | return datafab_read_data(us, info, block, blocks); |
620 | } | 618 | } |
621 | 619 | ||
@@ -628,7 +626,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
628 | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | | 626 | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | |
629 | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); | 627 | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); |
630 | 628 | ||
631 | US_DEBUGP("datafab_transport: READ_12: read block 0x%04lx count %ld\n", block, blocks); | 629 | usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n", |
630 | block, blocks); | ||
632 | return datafab_read_data(us, info, block, blocks); | 631 | return datafab_read_data(us, info, block, blocks); |
633 | } | 632 | } |
634 | 633 | ||
@@ -638,7 +637,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
638 | 637 | ||
639 | blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); | 638 | blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); |
640 | 639 | ||
641 | US_DEBUGP("datafab_transport: WRITE_10: write block 0x%04lx count %ld\n", block, blocks); | 640 | usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n", |
641 | block, blocks); | ||
642 | return datafab_write_data(us, info, block, blocks); | 642 | return datafab_write_data(us, info, block, blocks); |
643 | } | 643 | } |
644 | 644 | ||
@@ -651,17 +651,18 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
651 | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | | 651 | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | |
652 | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); | 652 | ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); |
653 | 653 | ||
654 | US_DEBUGP("datafab_transport: WRITE_12: write block 0x%04lx count %ld\n", block, blocks); | 654 | usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n", |
655 | block, blocks); | ||
655 | return datafab_write_data(us, info, block, blocks); | 656 | return datafab_write_data(us, info, block, blocks); |
656 | } | 657 | } |
657 | 658 | ||
658 | if (srb->cmnd[0] == TEST_UNIT_READY) { | 659 | if (srb->cmnd[0] == TEST_UNIT_READY) { |
659 | US_DEBUGP("datafab_transport: TEST_UNIT_READY.\n"); | 660 | usb_stor_dbg(us, "TEST_UNIT_READY\n"); |
660 | return datafab_id_device(us, info); | 661 | return datafab_id_device(us, info); |
661 | } | 662 | } |
662 | 663 | ||
663 | if (srb->cmnd[0] == REQUEST_SENSE) { | 664 | if (srb->cmnd[0] == REQUEST_SENSE) { |
664 | US_DEBUGP("datafab_transport: REQUEST_SENSE. Returning faked response\n"); | 665 | usb_stor_dbg(us, "REQUEST_SENSE - Returning faked response\n"); |
665 | 666 | ||
666 | // this response is pretty bogus right now. eventually if necessary | 667 | // this response is pretty bogus right now. eventually if necessary |
667 | // we can set the correct sense data. so far though it hasn't been | 668 | // we can set the correct sense data. so far though it hasn't been |
@@ -679,12 +680,12 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
679 | } | 680 | } |
680 | 681 | ||
681 | if (srb->cmnd[0] == MODE_SENSE) { | 682 | if (srb->cmnd[0] == MODE_SENSE) { |
682 | US_DEBUGP("datafab_transport: MODE_SENSE_6 detected\n"); | 683 | usb_stor_dbg(us, "MODE_SENSE_6 detected\n"); |
683 | return datafab_handle_mode_sense(us, srb, 1); | 684 | return datafab_handle_mode_sense(us, srb, 1); |
684 | } | 685 | } |
685 | 686 | ||
686 | if (srb->cmnd[0] == MODE_SENSE_10) { | 687 | if (srb->cmnd[0] == MODE_SENSE_10) { |
687 | US_DEBUGP("datafab_transport: MODE_SENSE_10 detected\n"); | 688 | usb_stor_dbg(us, "MODE_SENSE_10 detected\n"); |
688 | return datafab_handle_mode_sense(us, srb, 0); | 689 | return datafab_handle_mode_sense(us, srb, 0); |
689 | } | 690 | } |
690 | 691 | ||
@@ -698,7 +699,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
698 | if (srb->cmnd[0] == START_STOP) { | 699 | if (srb->cmnd[0] == START_STOP) { |
699 | /* this is used by sd.c'check_scsidisk_media_change to detect | 700 | /* this is used by sd.c'check_scsidisk_media_change to detect |
700 | media change */ | 701 | media change */ |
701 | US_DEBUGP("datafab_transport: START_STOP.\n"); | 702 | usb_stor_dbg(us, "START_STOP\n"); |
702 | /* the first datafab_id_device after a media change returns | 703 | /* the first datafab_id_device after a media change returns |
703 | an error (determined experimentally) */ | 704 | an error (determined experimentally) */ |
704 | rc = datafab_id_device(us, info); | 705 | rc = datafab_id_device(us, info); |
@@ -712,8 +713,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
712 | return rc; | 713 | return rc; |
713 | } | 714 | } |
714 | 715 | ||
715 | US_DEBUGP("datafab_transport: Gah! Unknown command: %d (0x%x)\n", | 716 | usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n", |
716 | srb->cmnd[0], srb->cmnd[0]); | 717 | srb->cmnd[0], srb->cmnd[0]); |
717 | info->sense_key = 0x05; | 718 | info->sense_key = 0x05; |
718 | info->sense_asc = 0x20; | 719 | info->sense_asc = 0x20; |
719 | info->sense_ascq = 0x00; | 720 | info->sense_ascq = 0x00; |