Commit 191648d0 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f1175daa
This diff is collapsed.
...@@ -159,7 +159,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) ...@@ -159,7 +159,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
if (srb->result == SAM_STAT_CHECK_CONDITION && if (srb->result == SAM_STAT_CHECK_CONDITION &&
memcmp(srb->sense_buffer, usb_stor_sense_invalidCDB, memcmp(srb->sense_buffer, usb_stor_sense_invalidCDB,
sizeof(usb_stor_sense_invalidCDB)) == 0) { sizeof(usb_stor_sense_invalidCDB)) == 0) {
US_DEBUGP("cypress atacb not supported ???\n"); usb_stor_dbg(us, "cypress atacb not supported ???\n");
goto end; goto end;
} }
......
...@@ -123,7 +123,7 @@ datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) { ...@@ -123,7 +123,7 @@ datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) {
if (len == 0) if (len == 0)
return USB_STOR_XFER_GOOD; return USB_STOR_XFER_GOOD;
US_DEBUGP("datafab_bulk_read: len = %d\n", len); usb_stor_dbg(us, "len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
data, len, NULL); data, len, NULL);
} }
...@@ -134,7 +134,7 @@ datafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) { ...@@ -134,7 +134,7 @@ datafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) {
if (len == 0) if (len == 0)
return USB_STOR_XFER_GOOD; return USB_STOR_XFER_GOOD;
US_DEBUGP("datafab_bulk_write: len = %d\n", len); usb_stor_dbg(us, "len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
data, len, NULL); data, len, NULL);
} }
...@@ -300,8 +300,7 @@ static int datafab_write_data(struct us_data *us, ...@@ -300,8 +300,7 @@ static int datafab_write_data(struct us_data *us,
goto leave; goto leave;
if (reply[0] != 0x50 && reply[1] != 0) { if (reply[0] != 0x50 && reply[1] != 0) {
US_DEBUGP("datafab_write_data: Gah! " usb_stor_dbg(us, "Gah! write return code: %02x %02x\n",
"write return code: %02x %02x\n",
reply[0], reply[1]); reply[0], reply[1]);
result = USB_STOR_TRANSPORT_ERROR; result = USB_STOR_TRANSPORT_ERROR;
goto leave; goto leave;
...@@ -342,7 +341,7 @@ static int datafab_determine_lun(struct us_data *us, ...@@ -342,7 +341,7 @@ static int datafab_determine_lun(struct us_data *us,
if (!buf) if (!buf)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
US_DEBUGP("datafab_determine_lun: locating...\n"); usb_stor_dbg(us, "locating...\n");
// we'll try 3 times before giving up... // we'll try 3 times before giving up...
// //
...@@ -474,16 +473,16 @@ static int datafab_handle_mode_sense(struct us_data *us, ...@@ -474,16 +473,16 @@ static int datafab_handle_mode_sense(struct us_data *us,
switch (pc) { switch (pc) {
case 0x0: case 0x0:
US_DEBUGP("datafab_handle_mode_sense: Current values\n"); usb_stor_dbg(us, "Current values\n");
break; break;
case 0x1: case 0x1:
US_DEBUGP("datafab_handle_mode_sense: Changeable values\n"); usb_stor_dbg(us, "Changeable values\n");
break; break;
case 0x2: case 0x2:
US_DEBUGP("datafab_handle_mode_sense: Default values\n"); usb_stor_dbg(us, "Default values\n");
break; break;
case 0x3: case 0x3:
US_DEBUGP("datafab_handle_mode_sense: Saves values\n"); usb_stor_dbg(us, "Saves values\n");
break; break;
} }
...@@ -566,11 +565,9 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -566,11 +565,9 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
if (!us->extra) { if (!us->extra) {
us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO); us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO);
if (!us->extra) { if (!us->extra)
US_DEBUGP("datafab_transport: Gah! "
"Can't allocate storage for Datafab info struct!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
}
us->extra_destructor = datafab_info_destructor; us->extra_destructor = datafab_info_destructor;
((struct datafab_info *)us->extra)->lun = -1; ((struct datafab_info *)us->extra)->lun = -1;
} }
...@@ -578,7 +575,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -578,7 +575,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
info = (struct datafab_info *) (us->extra); info = (struct datafab_info *) (us->extra);
if (srb->cmnd[0] == INQUIRY) { if (srb->cmnd[0] == INQUIRY) {
US_DEBUGP("datafab_transport: INQUIRY. Returning bogus response"); usb_stor_dbg(us, "INQUIRY - Returning bogus response\n");
memcpy(ptr, inquiry_reply, sizeof(inquiry_reply)); memcpy(ptr, inquiry_reply, sizeof(inquiry_reply));
fill_inquiry_response(us, ptr, 36); fill_inquiry_response(us, ptr, 36);
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
...@@ -590,7 +587,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -590,7 +587,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
if (rc != USB_STOR_TRANSPORT_GOOD) if (rc != USB_STOR_TRANSPORT_GOOD)
return rc; return rc;
US_DEBUGP("datafab_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
info->sectors, info->ssize); info->sectors, info->ssize);
// build the reply // build the reply
...@@ -603,7 +600,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -603,7 +600,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
} }
if (srb->cmnd[0] == MODE_SELECT_10) { if (srb->cmnd[0] == MODE_SELECT_10) {
US_DEBUGP("datafab_transport: Gah! MODE_SELECT_10.\n"); usb_stor_dbg(us, "Gah! MODE_SELECT_10\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -615,7 +612,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -615,7 +612,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
US_DEBUGP("datafab_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 datafab_read_data(us, info, block, blocks); return datafab_read_data(us, info, block, blocks);
} }
...@@ -628,7 +626,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -628,7 +626,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
US_DEBUGP("datafab_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 datafab_read_data(us, info, block, blocks); return datafab_read_data(us, info, block, blocks);
} }
...@@ -638,7 +637,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -638,7 +637,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
US_DEBUGP("datafab_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 datafab_write_data(us, info, block, blocks); return datafab_write_data(us, info, block, blocks);
} }
...@@ -651,17 +651,18 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -651,17 +651,18 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
US_DEBUGP("datafab_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 datafab_write_data(us, info, block, blocks); return datafab_write_data(us, info, block, blocks);
} }
if (srb->cmnd[0] == TEST_UNIT_READY) { if (srb->cmnd[0] == TEST_UNIT_READY) {
US_DEBUGP("datafab_transport: TEST_UNIT_READY.\n"); usb_stor_dbg(us, "TEST_UNIT_READY\n");
return datafab_id_device(us, info); return datafab_id_device(us, info);
} }
if (srb->cmnd[0] == REQUEST_SENSE) { if (srb->cmnd[0] == REQUEST_SENSE) {
US_DEBUGP("datafab_transport: REQUEST_SENSE. Returning faked response\n"); usb_stor_dbg(us, "REQUEST_SENSE - Returning faked response\n");
// this response is pretty bogus right now. eventually if necessary // this response is pretty bogus right now. eventually if necessary
// we can set the correct sense data. so far though it hasn't been // 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,12 +680,12 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
} }
if (srb->cmnd[0] == MODE_SENSE) { if (srb->cmnd[0] == MODE_SENSE) {
US_DEBUGP("datafab_transport: MODE_SENSE_6 detected\n"); usb_stor_dbg(us, "MODE_SENSE_6 detected\n");
return datafab_handle_mode_sense(us, srb, 1); return datafab_handle_mode_sense(us, srb, 1);
} }
if (srb->cmnd[0] == MODE_SENSE_10) { if (srb->cmnd[0] == MODE_SENSE_10) {
US_DEBUGP("datafab_transport: MODE_SENSE_10 detected\n"); usb_stor_dbg(us, "MODE_SENSE_10 detected\n");
return datafab_handle_mode_sense(us, srb, 0); return datafab_handle_mode_sense(us, srb, 0);
} }
...@@ -698,7 +699,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -698,7 +699,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
if (srb->cmnd[0] == START_STOP) { if (srb->cmnd[0] == START_STOP) {
/* this is used by sd.c'check_scsidisk_media_change to detect /* this is used by sd.c'check_scsidisk_media_change to detect
media change */ media change */
US_DEBUGP("datafab_transport: START_STOP.\n"); usb_stor_dbg(us, "START_STOP\n");
/* the first datafab_id_device after a media change returns /* the first datafab_id_device after a media change returns
an error (determined experimentally) */ an error (determined experimentally) */
rc = datafab_id_device(us, info); rc = datafab_id_device(us, info);
...@@ -712,7 +713,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -712,7 +713,7 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
return rc; return rc;
} }
US_DEBUGP("datafab_transport: Gah! Unknown command: %d (0x%x)\n", usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n",
srb->cmnd[0], srb->cmnd[0]); srb->cmnd[0], srb->cmnd[0]);
info->sense_key = 0x05; info->sense_key = 0x05;
info->sense_asc = 0x20; info->sense_asc = 0x20;
......
...@@ -42,17 +42,19 @@ ...@@ -42,17 +42,19 @@
* 675 Mass Ave, Cambridge, MA 02139, USA. * 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/device.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/export.h> #include <linux/export.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h> #include <scsi/scsi_dbg.h>
#include "usb.h"
#include "debug.h" #include "debug.h"
#include "scsi.h" #include "scsi.h"
void usb_stor_show_command(struct scsi_cmnd *srb) void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb)
{ {
char *what = NULL; char *what = NULL;
int i; int i;
...@@ -150,18 +152,18 @@ void usb_stor_show_command(struct scsi_cmnd *srb) ...@@ -150,18 +152,18 @@ void usb_stor_show_command(struct scsi_cmnd *srb)
case WRITE_LONG_2: what = "WRITE_LONG_2"; break; case WRITE_LONG_2: what = "WRITE_LONG_2"; break;
default: what = "(unknown command)"; break; default: what = "(unknown command)"; break;
} }
US_DEBUGP("Command %s (%d bytes)\n", what, srb->cmd_len); usb_stor_dbg(us, "Command %s (%d bytes)\n", what, srb->cmd_len);
US_DEBUGP("bytes: "); usb_stor_dbg(us, "bytes: ");
for (i = 0; i < srb->cmd_len && i < 16; i++) for (i = 0; i < srb->cmd_len && i < 16; i++)
US_DEBUGPX(" %02x", srb->cmnd[i]); US_DEBUGPX(" %02x", srb->cmnd[i]);
US_DEBUGPX("\n"); US_DEBUGPX("\n");
} }
void usb_stor_show_sense( void usb_stor_show_sense(const struct us_data *us,
unsigned char key, unsigned char key,
unsigned char asc, unsigned char asc,
unsigned char ascq) { unsigned char ascq)
{
const char *what, *keystr; const char *what, *keystr;
keystr = scsi_sense_key_string(key); keystr = scsi_sense_key_string(key);
...@@ -172,23 +174,19 @@ void usb_stor_show_sense( ...@@ -172,23 +174,19 @@ void usb_stor_show_sense(
if (what == NULL) if (what == NULL)
what = "(unknown ASC/ASCQ)"; what = "(unknown ASC/ASCQ)";
US_DEBUGP("%s: ", keystr); usb_stor_dbg(us, "%s: ", keystr);
US_DEBUGPX(what, ascq); US_DEBUGPX(what, ascq);
US_DEBUGPX("\n"); US_DEBUGPX("\n");
} }
int usb_stor_dbg(const char *fmt, ...) int usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
{ {
struct va_format vaf;
va_list args; va_list args;
int r; int r;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; r = dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args);
vaf.va = &args;
r = printk(KERN_DEBUG USB_STORAGE "%pV", &vaf);
va_end(args); va_end(args);
......
...@@ -47,17 +47,20 @@ ...@@ -47,17 +47,20 @@
#define USB_STORAGE "usb-storage: " #define USB_STORAGE "usb-storage: "
#ifdef CONFIG_USB_STORAGE_DEBUG #ifdef CONFIG_USB_STORAGE_DEBUG
void usb_stor_show_command(struct scsi_cmnd *srb); void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb);
void usb_stor_show_sense( unsigned char key, void usb_stor_show_sense(const struct us_data *us, unsigned char key,
unsigned char asc, unsigned char ascq ); unsigned char asc, unsigned char ascq);
__printf(1, 2) int usb_stor_dbg(const char *fmt, ...); __printf(2, 3) int usb_stor_dbg(const struct us_data *us,
const char *fmt, ...);
#define US_DEBUGP(fmt, ...) usb_stor_dbg(fmt, ##__VA_ARGS__)
#define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__) #define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__)
#define US_DEBUG(x) x #define US_DEBUG(x) x
#else #else
#define US_DEBUGP(fmt, ...) \ __printf(2, 3)
do { if (0) printk(fmt, ##__VA_ARGS__); } while (0) static inline int _usb_stor_dbg(const struct us_data *us,
const char *fmt, ...) {return 1;}
#define usb_stor_dbg(us, fmt, ...) \
do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0)
#define US_DEBUGPX(fmt, ...) \ #define US_DEBUGPX(fmt, ...) \
do { if (0) printk(fmt, ##__VA_ARGS__); } while (0) do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
#define US_DEBUG(x) #define US_DEBUG(x)
......
...@@ -504,12 +504,12 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) ...@@ -504,12 +504,12 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg)
unsigned int cswlen = 0, partial = 0; unsigned int cswlen = 0, partial = 0;
unsigned int transfer_length = bcb->DataTransferLength; unsigned int transfer_length = bcb->DataTransferLength;
/* US_DEBUGP("transport --- ene_send_scsi_cmd\n"); */ /* usb_stor_dbg(us, "transport --- ene_send_scsi_cmd\n"); */
/* send cmd to out endpoint */ /* send cmd to out endpoint */
result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
bcb, US_BULK_CB_WRAP_LEN, NULL); bcb, US_BULK_CB_WRAP_LEN, NULL);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("send cmd to out endpoint fail ---\n"); usb_stor_dbg(us, "send cmd to out endpoint fail ---\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -529,7 +529,7 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) ...@@ -529,7 +529,7 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg)
transfer_length, 0, &partial); transfer_length, 0, &partial);
} }
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("data transfer fail ---\n"); usb_stor_dbg(us, "data transfer fail ---\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
} }
...@@ -539,14 +539,14 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg) ...@@ -539,14 +539,14 @@ static int ene_send_scsi_cmd(struct us_data *us, u8 fDir, void *buf, int use_sg)
US_BULK_CS_WRAP_LEN, &cswlen); US_BULK_CS_WRAP_LEN, &cswlen);
if (result == USB_STOR_XFER_SHORT && cswlen == 0) { if (result == USB_STOR_XFER_SHORT && cswlen == 0) {
US_DEBUGP("Received 0-length CSW; retrying...\n"); usb_stor_dbg(us, "Received 0-length CSW; retrying...\n");
result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
bcs, US_BULK_CS_WRAP_LEN, &cswlen); bcs, US_BULK_CS_WRAP_LEN, &cswlen);
} }
if (result == USB_STOR_XFER_STALLED) { if (result == USB_STOR_XFER_STALLED) {
/* get the status again */ /* get the status again */
US_DEBUGP("Attempting to get CSW (2nd try)...\n"); usb_stor_dbg(us, "Attempting to get CSW (2nd try)...\n");
result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
bcs, US_BULK_CS_WRAP_LEN, NULL); bcs, US_BULK_CS_WRAP_LEN, NULL);
} }
...@@ -626,7 +626,7 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) ...@@ -626,7 +626,7 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb)
struct scatterlist *sg = NULL; struct scatterlist *sg = NULL;
struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra;
US_DEBUGP("sd_scsi_read_capacity\n"); usb_stor_dbg(us, "sd_scsi_read_capacity\n");
if (info->SD_Status.HiCapacity) { if (info->SD_Status.HiCapacity) {
bl_len = 0x200; bl_len = 0x200;
if (info->SD_Status.IsMMC) if (info->SD_Status.IsMMC)
...@@ -639,8 +639,8 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) ...@@ -639,8 +639,8 @@ static int sd_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb)
* (1 << (info->SD_C_SIZE_MULT + 2)) - 1; * (1 << (info->SD_C_SIZE_MULT + 2)) - 1;
} }
info->bl_num = bl_num; info->bl_num = bl_num;
US_DEBUGP("bl_len = %x\n", bl_len); usb_stor_dbg(us, "bl_len = %x\n", bl_len);
US_DEBUGP("bl_num = %x\n", bl_num); usb_stor_dbg(us, "bl_num = %x\n", bl_num);
/*srb->request_bufflen = 8; */ /*srb->request_bufflen = 8; */
buf[0] = (bl_num >> 24) & 0xff; buf[0] = (bl_num >> 24) & 0xff;
...@@ -675,7 +675,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb) ...@@ -675,7 +675,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
result = ene_load_bincode(us, SD_RW_PATTERN); result = ene_load_bincode(us, SD_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Load SD RW pattern Fail !!\n"); usb_stor_dbg(us, "Load SD RW pattern Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -715,7 +715,7 @@ static int sd_scsi_write(struct us_data *us, struct scsi_cmnd *srb) ...@@ -715,7 +715,7 @@ static int sd_scsi_write(struct us_data *us, struct scsi_cmnd *srb)
result = ene_load_bincode(us, SD_RW_PATTERN); result = ene_load_bincode(us, SD_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Load SD RW pattern Fail !!\n"); usb_stor_dbg(us, "Load SD RW pattern Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -1493,7 +1493,7 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) ...@@ -1493,7 +1493,7 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb)
struct scatterlist *sg = NULL; struct scatterlist *sg = NULL;
struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra;
US_DEBUGP("ms_scsi_read_capacity\n"); usb_stor_dbg(us, "ms_scsi_read_capacity\n");
bl_len = 0x200; bl_len = 0x200;
if (info->MS_Status.IsMSPro) if (info->MS_Status.IsMSPro)
bl_num = info->MSP_TotalBlock - 1; bl_num = info->MSP_TotalBlock - 1;
...@@ -1501,8 +1501,8 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb) ...@@ -1501,8 +1501,8 @@ static int ms_scsi_read_capacity(struct us_data *us, struct scsi_cmnd *srb)
bl_num = info->MS_Lib.NumberOfLogBlock * info->MS_Lib.blockSize * 2 - 1; bl_num = info->MS_Lib.NumberOfLogBlock * info->MS_Lib.blockSize * 2 - 1;
info->bl_num = bl_num; info->bl_num = bl_num;
US_DEBUGP("bl_len = %x\n", bl_len); usb_stor_dbg(us, "bl_len = %x\n", bl_len);
US_DEBUGP("bl_num = %x\n", bl_num); usb_stor_dbg(us, "bl_num = %x\n", bl_num);
/*srb->request_bufflen = 8; */ /*srb->request_bufflen = 8; */
buf[0] = (bl_num >> 24) & 0xff; buf[0] = (bl_num >> 24) & 0xff;
...@@ -1654,7 +1654,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb) ...@@ -1654,7 +1654,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
if (info->MS_Status.IsMSPro) { if (info->MS_Status.IsMSPro) {
result = ene_load_bincode(us, MSP_RW_PATTERN); result = ene_load_bincode(us, MSP_RW_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Load MPS RW pattern Fail !!\n"); usb_stor_dbg(us, "Load MPS RW pattern Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -1854,7 +1854,7 @@ static int ene_get_card_status(struct us_data *us, u8 *buf) ...@@ -1854,7 +1854,7 @@ static int ene_get_card_status(struct us_data *us, u8 *buf)
u32 reg4b; u32 reg4b;
struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra;
/*US_DEBUGP("transport --- ENE_ReadSDReg\n");*/ /*usb_stor_dbg(us, "transport --- ENE_ReadSDReg\n");*/
reg4b = *(u32 *)&buf[0x18]; reg4b = *(u32 *)&buf[0x18];
info->SD_READ_BL_LEN = (u8)((reg4b >> 8) & 0x0f); info->SD_READ_BL_LEN = (u8)((reg4b >> 8) & 0x0f);
...@@ -1894,45 +1894,44 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag) ...@@ -1894,45 +1894,44 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
switch (flag) { switch (flag) {
/* For SD */ /* For SD */
case SD_INIT1_PATTERN: case SD_INIT1_PATTERN:
US_DEBUGP("SD_INIT1_PATTERN\n"); usb_stor_dbg(us, "SD_INIT1_PATTERN\n");
fw_name = SD_INIT1_FIRMWARE; fw_name = SD_INIT1_FIRMWARE;
break; break;
case SD_INIT2_PATTERN: case SD_INIT2_PATTERN:
US_DEBUGP("SD_INIT2_PATTERN\n"); usb_stor_dbg(us, "SD_INIT2_PATTERN\n");
fw_name = SD_INIT2_FIRMWARE; fw_name = SD_INIT2_FIRMWARE;
break; break;
case SD_RW_PATTERN: case SD_RW_PATTERN:
US_DEBUGP("SD_RW_PATTERN\n"); usb_stor_dbg(us, "SD_RW_PATTERN\n");
fw_name = SD_RW_FIRMWARE; fw_name = SD_RW_FIRMWARE;
break; break;
/* For MS */ /* For MS */
case MS_INIT_PATTERN: case MS_INIT_PATTERN:
US_DEBUGP("MS_INIT_PATTERN\n"); usb_stor_dbg(us, "MS_INIT_PATTERN\n");
fw_name = MS_INIT_FIRMWARE; fw_name = MS_INIT_FIRMWARE;
break; break;
case MSP_RW_PATTERN: case MSP_RW_PATTERN:
US_DEBUGP("MSP_RW_PATTERN\n"); usb_stor_dbg(us, "MSP_RW_PATTERN\n");
fw_name = MSP_RW_FIRMWARE; fw_name = MSP_RW_FIRMWARE;
break; break;
case MS_RW_PATTERN: case MS_RW_PATTERN:
US_DEBUGP("MS_RW_PATTERN\n"); usb_stor_dbg(us, "MS_RW_PATTERN\n");
fw_name = MS_RW_FIRMWARE; fw_name = MS_RW_FIRMWARE;
break; break;
default: default:
US_DEBUGP("----------- Unknown PATTERN ----------\n"); usb_stor_dbg(us, "----------- Unknown PATTERN ----------\n");
goto nofw; goto nofw;
} }
err = request_firmware(&sd_fw, fw_name, &us->pusb_dev->dev); err = request_firmware(&sd_fw, fw_name, &us->pusb_dev->dev);
if (err) { if (err) {
US_DEBUGP("load firmware %s failed\n", fw_name); usb_stor_dbg(us, "load firmware %s failed\n", fw_name);
goto nofw; goto nofw;
} }
buf = kmalloc(sd_fw->size, GFP_KERNEL); buf = kmalloc(sd_fw->size, GFP_KERNEL);
if (buf == NULL) { if (buf == NULL)
US_DEBUGP("Malloc memory for fireware failed!\n");
goto nofw; goto nofw;
}
memcpy(buf, sd_fw->data, sd_fw->size); memcpy(buf, sd_fw->data, sd_fw->size);
memset(bcb, 0, sizeof(struct bulk_cb_wrap)); memset(bcb, 0, sizeof(struct bulk_cb_wrap));
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
...@@ -2116,9 +2115,9 @@ static int ene_ms_init(struct us_data *us) ...@@ -2116,9 +2115,9 @@ static int ene_ms_init(struct us_data *us)
} else { } else {
ms_card_init(us); /* Card is MS (to ms.c)*/ ms_card_init(us); /* Card is MS (to ms.c)*/
} }
US_DEBUGP("MS Init Code OK !!\n"); usb_stor_dbg(us, "MS Init Code OK !!\n");
} else { } else {
US_DEBUGP("MS Card Not Ready --- %x\n", buf[0]); usb_stor_dbg(us, "MS Card Not Ready --- %x\n", buf[0]);
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -2132,11 +2131,11 @@ static int ene_sd_init(struct us_data *us) ...@@ -2132,11 +2131,11 @@ static int ene_sd_init(struct us_data *us)
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra; struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra;
US_DEBUGP("transport --- ENE_SDInit\n"); usb_stor_dbg(us, "transport --- ENE_SDInit\n");
/* SD Init Part-1 */ /* SD Init Part-1 */
result = ene_load_bincode(us, SD_INIT1_PATTERN); result = ene_load_bincode(us, SD_INIT1_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Load SD Init Code Part-1 Fail !!\n"); usb_stor_dbg(us, "Load SD Init Code Part-1 Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -2147,14 +2146,14 @@ static int ene_sd_init(struct us_data *us) ...@@ -2147,14 +2146,14 @@ static int ene_sd_init(struct us_data *us)
result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Execution SD Init Code Fail !!\n"); usb_stor_dbg(us, "Execution SD Init Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
/* SD Init Part-2 */ /* SD Init Part-2 */
result = ene_load_bincode(us, SD_INIT2_PATTERN); result = ene_load_bincode(us, SD_INIT2_PATTERN);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Load SD Init Code Part-2 Fail !!\n"); usb_stor_dbg(us, "Load SD Init Code Part-2 Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -2166,21 +2165,23 @@ static int ene_sd_init(struct us_data *us) ...@@ -2166,21 +2165,23 @@ static int ene_sd_init(struct us_data *us)
result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Execution SD Init Code Fail !!\n"); usb_stor_dbg(us, "Execution SD Init Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
info->SD_Status = *(struct SD_STATUS *)&buf[0]; info->SD_Status = *(struct SD_STATUS *)&buf[0];
if (info->SD_Status.Insert && info->SD_Status.Ready) { if (info->SD_Status.Insert && info->SD_Status.Ready) {
struct SD_STATUS *s = &info->SD_Status;
ene_get_card_status(us, (unsigned char *)&buf); ene_get_card_status(us, (unsigned char *)&buf);
US_DEBUGP("Insert = %x\n", info->SD_Status.Insert); usb_stor_dbg(us, "Insert = %x\n", s->Insert);
US_DEBUGP("Ready = %x\n", info->SD_Status.Ready); usb_stor_dbg(us, "Ready = %x\n", s->Ready);
US_DEBUGP("IsMMC = %x\n", info->SD_Status.IsMMC); usb_stor_dbg(us, "IsMMC = %x\n", s->IsMMC);
US_DEBUGP("HiCapacity = %x\n", info->SD_Status.HiCapacity); usb_stor_dbg(us, "HiCapacity = %x\n", s->HiCapacity);
US_DEBUGP("HiSpeed = %x\n", info->SD_Status.HiSpeed); usb_stor_dbg(us, "HiSpeed = %x\n", s->HiSpeed);
US_DEBUGP("WtP = %x\n", info->SD_Status.WtP); usb_stor_dbg(us, "WtP = %x\n", s->WtP);
} else { } else {
US_DEBUGP("SD Card Not Ready --- %x\n", buf[0]); usb_stor_dbg(us, "SD Card Not Ready --- %x\n", buf[0]);
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
...@@ -2293,7 +2294,7 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -2293,7 +2294,7 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us)
int result = 0; int result = 0;
struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra);
/*US_DEBUG(usb_stor_show_command(srb)); */ /*US_DEBUG(usb_stor_show_command(us, srb)); */
scsi_set_resid(srb, 0); scsi_set_resid(srb, 0);
if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) { if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) {
result = ene_init(us); result = ene_init(us);
...@@ -2362,7 +2363,6 @@ static int ene_ub6250_resume(struct usb_interface *iface) ...@@ -2362,7 +2363,6 @@ static int ene_ub6250_resume(struct usb_interface *iface)
mutex_lock(&us->dev_mutex); mutex_lock(&us->dev_mutex);
US_DEBUGP("%s\n", __func__);
if (us->suspend_resume_hook) if (us->suspend_resume_hook)
(us->suspend_resume_hook)(us, US_RESUME); (us->suspend_resume_hook)(us, US_RESUME);
...@@ -2382,7 +2382,7 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface) ...@@ -2382,7 +2382,7 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface)
u8 tmp = 0; u8 tmp = 0;
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra); struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra);
US_DEBUGP("%s\n", __func__);
/* Report the reset to the SCSI core */ /* Report the reset to the SCSI core */
usb_stor_reset_resume(iface); usb_stor_reset_resume(iface);
......
This diff is collapsed.
...@@ -48,12 +48,12 @@ int usb_stor_euscsi_init(struct us_data *us) ...@@ -48,12 +48,12 @@ int usb_stor_euscsi_init(struct us_data *us)
{ {
int result; int result;
US_DEBUGP("Attempting to init eUSCSI bridge...\n"); usb_stor_dbg(us, "Attempting to init eUSCSI bridge...\n");
us->iobuf[0] = 0x1; us->iobuf[0] = 0x1;
result = usb_stor_control_msg(us, us->send_ctrl_pipe, result = usb_stor_control_msg(us, us->send_ctrl_pipe,
0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR,
0x01, 0x0, us->iobuf, 0x1, 5000); 0x01, 0x0, us->iobuf, 0x1, 5000);
US_DEBUGP("-- result is %d\n", result); usb_stor_dbg(us, "-- result is %d\n", result);
return 0; return 0;
} }
...@@ -68,7 +68,7 @@ int usb_stor_ucr61s2b_init(struct us_data *us) ...@@ -68,7 +68,7 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
unsigned int partial; unsigned int partial;
static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS"; static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS";
US_DEBUGP("Sending UCR-61S2B initialization packet...\n"); usb_stor_dbg(us, "Sending UCR-61S2B initialization packet...\n");
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->Tag = 0; bcb->Tag = 0;
...@@ -83,7 +83,7 @@ int usb_stor_ucr61s2b_init(struct us_data *us) ...@@ -83,7 +83,7 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
if (res) if (res)
return -EIO; return -EIO;
US_DEBUGP("Getting status packet...\n"); usb_stor_dbg(us, "Getting status packet...\n");
res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs, res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs,
US_BULK_CS_WRAP_LEN, &partial); US_BULK_CS_WRAP_LEN, &partial);
if (res) if (res)
...@@ -101,6 +101,6 @@ int usb_stor_huawei_e220_init(struct us_data *us) ...@@ -101,6 +101,6 @@ int usb_stor_huawei_e220_init(struct us_data *us)
USB_REQ_SET_FEATURE, USB_REQ_SET_FEATURE,
USB_TYPE_STANDARD | USB_RECIP_DEVICE, USB_TYPE_STANDARD | USB_RECIP_DEVICE,
0x01, 0x0, NULL, 0x0, 1000); 0x01, 0x0, NULL, 0x0, 1000);
US_DEBUGP("Huawei mode set result is %d\n", result); usb_stor_dbg(us, "Huawei mode set result is %d\n", result);
return 0; return 0;
} }
This diff is collapsed.
...@@ -118,7 +118,7 @@ static inline int jumpshot_bulk_read(struct us_data *us, ...@@ -118,7 +118,7 @@ static inline int jumpshot_bulk_read(struct us_data *us,
if (len == 0) if (len == 0)
return USB_STOR_XFER_GOOD; return USB_STOR_XFER_GOOD;
US_DEBUGP("jumpshot_bulk_read: len = %d\n", len); usb_stor_dbg(us, "len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
data, len, NULL); data, len, NULL);
} }
...@@ -131,7 +131,7 @@ static inline int jumpshot_bulk_write(struct us_data *us, ...@@ -131,7 +131,7 @@ static inline int jumpshot_bulk_write(struct us_data *us,
if (len == 0) if (len == 0)
return USB_STOR_XFER_GOOD; return USB_STOR_XFER_GOOD;
US_DEBUGP("jumpshot_bulk_write: len = %d\n", len); usb_stor_dbg(us, "len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
data, len, NULL); data, len, NULL);
} }
...@@ -152,8 +152,7 @@ static int jumpshot_get_status(struct us_data *us) ...@@ -152,8 +152,7 @@ static int jumpshot_get_status(struct us_data *us)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
if (us->iobuf[0] != 0x50) { if (us->iobuf[0] != 0x50) {
US_DEBUGP("jumpshot_get_status: 0x%2x\n", usb_stor_dbg(us, "0x%2x\n", us->iobuf[0]);
us->iobuf[0]);
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -218,7 +217,7 @@ static int jumpshot_read_data(struct us_data *us, ...@@ -218,7 +217,7 @@ static int jumpshot_read_data(struct us_data *us,
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
goto leave; goto leave;
US_DEBUGP("jumpshot_read_data: %d bytes\n", len); usb_stor_dbg(us, "%d bytes\n", len);
// Store the data in the transfer buffer // Store the data in the transfer buffer
usb_stor_access_xfer_buf(buffer, len, us->srb, usb_stor_access_xfer_buf(buffer, len, us->srb,
...@@ -314,7 +313,7 @@ static int jumpshot_write_data(struct us_data *us, ...@@ -314,7 +313,7 @@ static int jumpshot_write_data(struct us_data *us,
} while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10)); } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
if (result != USB_STOR_TRANSPORT_GOOD) if (result != USB_STOR_TRANSPORT_GOOD)
US_DEBUGP("jumpshot_write_data: Gah! Waitcount = 10. Bad write!?\n"); usb_stor_dbg(us, "Gah! Waitcount = 10. Bad write!?\n");
sector += thistime; sector += thistime;
totallen -= len; totallen -= len;
...@@ -349,8 +348,7 @@ static int jumpshot_id_device(struct us_data *us, ...@@ -349,8 +348,7 @@ static int jumpshot_id_device(struct us_data *us,
0, 0x20, 0, 6, command, 2); 0, 0x20, 0, 6, command, 2);
if (rc != USB_STOR_XFER_GOOD) { if (rc != USB_STOR_XFER_GOOD) {
US_DEBUGP("jumpshot_id_device: Gah! " usb_stor_dbg(us, "Gah! send_control for read_capacity failed\n");
"send_control for read_capacity failed\n");
rc = USB_STOR_TRANSPORT_ERROR; rc = USB_STOR_TRANSPORT_ERROR;
goto leave; goto leave;
} }
...@@ -400,16 +398,16 @@ static int jumpshot_handle_mode_sense(struct us_data *us, ...@@ -400,16 +398,16 @@ static int jumpshot_handle_mode_sense(struct us_data *us,
switch (pc) { switch (pc) {
case 0x0: case 0x0:
US_DEBUGP("jumpshot_handle_mode_sense: Current values\n"); usb_stor_dbg(us, "Current values\n");
break; break;
case 0x1: case 0x1:
US_DEBUGP("jumpshot_handle_mode_sense: Changeable values\n"); usb_stor_dbg(us, "Changeable values\n");
break; break;
case 0x2: case 0x2:
US_DEBUGP("jumpshot_handle_mode_sense: Default values\n"); usb_stor_dbg(us, "Default values\n");
break; break;
case 0x3: case 0x3:
US_DEBUGP("jumpshot_handle_mode_sense: Saves values\n"); usb_stor_dbg(us, "Saves values\n");
break; break;
} }
...@@ -494,17 +492,16 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -494,17 +492,16 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
if (!us->extra) { if (!us->extra) {
us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO); us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
if (!us->extra) { if (!us->extra)
US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
}
us->extra_destructor = jumpshot_info_destructor; us->extra_destructor = jumpshot_info_destructor;
} }
info = (struct jumpshot_info *) (us->extra); info = (struct jumpshot_info *) (us->extra);
if (srb->cmnd[0] == INQUIRY) { if (srb->cmnd[0] == INQUIRY) {
US_DEBUGP("jumpshot_transport: INQUIRY. Returning bogus response.\n"); usb_stor_dbg(us, "INQUIRY - Returning bogus response\n");
memcpy(ptr, inquiry_response, sizeof(inquiry_response)); memcpy(ptr, inquiry_response, sizeof(inquiry_response));
fill_inquiry_response(us, ptr, 36); fill_inquiry_response(us, ptr, 36);
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
...@@ -521,7 +518,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -521,7 +518,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
if (rc != USB_STOR_TRANSPORT_GOOD) if (rc != USB_STOR_TRANSPORT_GOOD)
return rc; return rc;
US_DEBUGP("jumpshot_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n", usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
info->sectors, info->ssize); info->sectors, info->ssize);
// build the reply // build the reply
...@@ -534,7 +531,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -534,7 +531,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
} }
if (srb->cmnd[0] == MODE_SELECT_10) { if (srb->cmnd[0] == MODE_SELECT_10) {
US_DEBUGP("jumpshot_transport: Gah! MODE_SELECT_10.\n"); usb_stor_dbg(us, "Gah! MODE_SELECT_10\n");
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -544,7 +541,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -544,7 +541,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
US_DEBUGP("jumpshot_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 jumpshot_read_data(us, info, block, blocks); return jumpshot_read_data(us, info, block, blocks);
} }
...@@ -557,7 +555,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -557,7 +555,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
US_DEBUGP("jumpshot_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 jumpshot_read_data(us, info, block, blocks); return jumpshot_read_data(us, info, block, blocks);
} }
...@@ -567,7 +566,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -567,7 +566,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8])); blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
US_DEBUGP("jumpshot_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 jumpshot_write_data(us, info, block, blocks); return jumpshot_write_data(us, info, block, blocks);
} }
...@@ -580,18 +580,19 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -580,18 +580,19 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) | blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9])); ((u32)(srb->cmnd[8]) << 8) | ((u32)(srb->cmnd[9]));
US_DEBUGP("jumpshot_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 jumpshot_write_data(us, info, block, blocks); return jumpshot_write_data(us, info, block, blocks);
} }
if (srb->cmnd[0] == TEST_UNIT_READY) { if (srb->cmnd[0] == TEST_UNIT_READY) {
US_DEBUGP("jumpshot_transport: TEST_UNIT_READY.\n"); usb_stor_dbg(us, "TEST_UNIT_READY\n");
return jumpshot_get_status(us); return jumpshot_get_status(us);
} }
if (srb->cmnd[0] == REQUEST_SENSE) { if (srb->cmnd[0] == REQUEST_SENSE) {
US_DEBUGP("jumpshot_transport: REQUEST_SENSE.\n"); usb_stor_dbg(us, "REQUEST_SENSE\n");
memset(ptr, 0, 18); memset(ptr, 0, 18);
ptr[0] = 0xF0; ptr[0] = 0xF0;
...@@ -605,12 +606,12 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -605,12 +606,12 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
} }
if (srb->cmnd[0] == MODE_SENSE) { if (srb->cmnd[0] == MODE_SENSE) {
US_DEBUGP("jumpshot_transport: MODE_SENSE_6 detected\n"); usb_stor_dbg(us, "MODE_SENSE_6 detected\n");
return jumpshot_handle_mode_sense(us, srb, 1); return jumpshot_handle_mode_sense(us, srb, 1);
} }
if (srb->cmnd[0] == MODE_SENSE_10) { if (srb->cmnd[0] == MODE_SENSE_10) {
US_DEBUGP("jumpshot_transport: MODE_SENSE_10 detected\n"); usb_stor_dbg(us, "MODE_SENSE_10 detected\n");
return jumpshot_handle_mode_sense(us, srb, 0); return jumpshot_handle_mode_sense(us, srb, 0);
} }
...@@ -624,7 +625,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -624,7 +625,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
if (srb->cmnd[0] == START_STOP) { if (srb->cmnd[0] == START_STOP) {
/* this is used by sd.c'check_scsidisk_media_change to detect /* this is used by sd.c'check_scsidisk_media_change to detect
media change */ media change */
US_DEBUGP("jumpshot_transport: START_STOP.\n"); usb_stor_dbg(us, "START_STOP\n");
/* the first jumpshot_id_device after a media change returns /* the first jumpshot_id_device after a media change returns
an error (determined experimentally) */ an error (determined experimentally) */
rc = jumpshot_id_device(us, info); rc = jumpshot_id_device(us, info);
...@@ -638,7 +639,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -638,7 +639,7 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
return rc; return rc;
} }
US_DEBUGP("jumpshot_transport: Gah! Unknown command: %d (0x%x)\n", usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n",
srb->cmnd[0], srb->cmnd[0]); srb->cmnd[0], srb->cmnd[0]);
info->sense_key = 0x05; info->sense_key = 0x05;
info->sense_asc = 0x20; info->sense_asc = 0x20;
......
...@@ -106,7 +106,7 @@ static int rio_karma_send_command(char cmd, struct us_data *us) ...@@ -106,7 +106,7 @@ static int rio_karma_send_command(char cmd, struct us_data *us)
static unsigned char seq = 1; static unsigned char seq = 1;
struct karma_data *data = (struct karma_data *) us->extra; struct karma_data *data = (struct karma_data *) us->extra;
US_DEBUGP("karma: sending command %04x\n", cmd); usb_stor_dbg(us, "sending command %04x\n", cmd);
memset(us->iobuf, 0, RIO_SEND_LEN); memset(us->iobuf, 0, RIO_SEND_LEN);
memcpy(us->iobuf, RIO_PREFIX, RIO_PREFIX_LEN); memcpy(us->iobuf, RIO_PREFIX, RIO_PREFIX_LEN);
us->iobuf[5] = cmd; us->iobuf[5] = cmd;
...@@ -139,10 +139,10 @@ static int rio_karma_send_command(char cmd, struct us_data *us) ...@@ -139,10 +139,10 @@ static int rio_karma_send_command(char cmd, struct us_data *us)
if (seq == 0) if (seq == 0)
seq = 1; seq = 1;
US_DEBUGP("karma: sent command %04x\n", cmd); usb_stor_dbg(us, "sent command %04x\n", cmd);
return 0; return 0;
err: err:
US_DEBUGP("karma: command %04x failed\n", cmd); usb_stor_dbg(us, "command %04x failed\n", cmd);
return USB_STOR_TRANSPORT_FAILED; return USB_STOR_TRANSPORT_FAILED;
} }
......
...@@ -50,7 +50,7 @@ static int option_rezero(struct us_data *us) ...@@ -50,7 +50,7 @@ static int option_rezero(struct us_data *us)
char *buffer; char *buffer;
int result; int result;
US_DEBUGP("Option MS: %s", "DEVICE MODE SWITCH\n"); usb_stor_dbg(us, "Option MS: %s\n", "DEVICE MODE SWITCH");
buffer = kzalloc(RESPONSE_LEN, GFP_KERNEL); buffer = kzalloc(RESPONSE_LEN, GFP_KERNEL);
if (buffer == NULL) if (buffer == NULL)
...@@ -95,7 +95,7 @@ static int option_inquiry(struct us_data *us) ...@@ -95,7 +95,7 @@ static int option_inquiry(struct us_data *us)
char *buffer; char *buffer;
int result; int result;
US_DEBUGP("Option MS: %s", "device inquiry for vendor name\n"); usb_stor_dbg(us, "Option MS: %s\n", "device inquiry for vendor name");
buffer = kzalloc(0x24, GFP_KERNEL); buffer = kzalloc(0x24, GFP_KERNEL);
if (buffer == NULL) if (buffer == NULL)
...@@ -138,31 +138,32 @@ int option_ms_init(struct us_data *us) ...@@ -138,31 +138,32 @@ int option_ms_init(struct us_data *us)
{ {
int result; int result;
US_DEBUGP("Option MS: option_ms_init called\n"); usb_stor_dbg(us, "Option MS: %s\n", "option_ms_init called");
/* Additional test for vendor information via INQUIRY, /* Additional test for vendor information via INQUIRY,
* because some vendor/product IDs are ambiguous * because some vendor/product IDs are ambiguous
*/ */
result = option_inquiry(us); result = option_inquiry(us);
if (result != 0) { if (result != 0) {
US_DEBUGP("Option MS: vendor is not Option or not determinable," usb_stor_dbg(us, "Option MS: %s\n",
" no action taken\n"); "vendor is not Option or not determinable, no action taken");
return 0; return 0;
} else } else
US_DEBUGP("Option MS: this is a genuine Option device," usb_stor_dbg(us, "Option MS: %s\n",
" proceeding\n"); "this is a genuine Option device, proceeding");
/* Force Modem mode */ /* Force Modem mode */
if (option_zero_cd == ZCD_FORCE_MODEM) { if (option_zero_cd == ZCD_FORCE_MODEM) {
US_DEBUGP("Option MS: %s", "Forcing Modem Mode\n"); usb_stor_dbg(us, "Option MS: %s\n", "Forcing Modem Mode");
result = option_rezero(us); result = option_rezero(us);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
US_DEBUGP("Option MS: Failed to switch to modem mode.\n"); usb_stor_dbg(us, "Option MS: %s\n",
"Failed to switch to modem mode");
return -EIO; return -EIO;
} else if (option_zero_cd == ZCD_ALLOW_MS) { } else if (option_zero_cd == ZCD_ALLOW_MS) {
/* Allow Mass Storage mode (keep CD-Rom) */ /* Allow Mass Storage mode (keep CD-Rom) */
US_DEBUGP("Option MS: %s", "Allowing Mass Storage Mode if device" usb_stor_dbg(us, "Option MS: %s\n",
" requests it\n"); "Allowing Mass Storage Mode if device requests it");
} }
return 0; return 0;
......
This diff is collapsed.
...@@ -313,8 +313,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb, ...@@ -313,8 +313,6 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
{ {
struct us_data *us = host_to_us(srb->device->host); struct us_data *us = host_to_us(srb->device->host);
US_DEBUGP("%s called\n", __func__);
/* check for state-transition errors */ /* check for state-transition errors */
if (us->srb != NULL) { if (us->srb != NULL) {
printk(KERN_ERR USB_STORAGE "Error in %s: us->srb = %p\n", printk(KERN_ERR USB_STORAGE "Error in %s: us->srb = %p\n",
...@@ -324,7 +322,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb, ...@@ -324,7 +322,7 @@ static int queuecommand_lck(struct scsi_cmnd *srb,
/* fail the command if we are disconnecting */ /* fail the command if we are disconnecting */
if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
US_DEBUGP("Fail command during disconnect\n"); usb_stor_dbg(us, "Fail command during disconnect\n");
srb->result = DID_NO_CONNECT << 16; srb->result = DID_NO_CONNECT << 16;
done(srb); done(srb);
return 0; return 0;
...@@ -349,7 +347,7 @@ static int command_abort(struct scsi_cmnd *srb) ...@@ -349,7 +347,7 @@ static int command_abort(struct scsi_cmnd *srb)
{ {
struct us_data *us = host_to_us(srb->device->host); struct us_data *us = host_to_us(srb->device->host);
US_DEBUGP("%s called\n", __func__); usb_stor_dbg(us, "%s called\n", __func__);
/* us->srb together with the TIMED_OUT, RESETTING, and ABORTING /* us->srb together with the TIMED_OUT, RESETTING, and ABORTING
* bits are protected by the host lock. */ * bits are protected by the host lock. */
...@@ -358,7 +356,7 @@ static int command_abort(struct scsi_cmnd *srb) ...@@ -358,7 +356,7 @@ static int command_abort(struct scsi_cmnd *srb)
/* Is this command still active? */ /* Is this command still active? */
if (us->srb != srb) { if (us->srb != srb) {
scsi_unlock(us_to_host(us)); scsi_unlock(us_to_host(us));
US_DEBUGP ("-- nothing to abort\n"); usb_stor_dbg(us, "-- nothing to abort\n");
return FAILED; return FAILED;
} }
...@@ -386,7 +384,7 @@ static int device_reset(struct scsi_cmnd *srb) ...@@ -386,7 +384,7 @@ static int device_reset(struct scsi_cmnd *srb)
struct us_data *us = host_to_us(srb->device->host); struct us_data *us = host_to_us(srb->device->host);
int result; int result;
US_DEBUGP("%s called\n", __func__); usb_stor_dbg(us, "%s called\n", __func__);
/* lock the device pointers and do the reset */ /* lock the device pointers and do the reset */
mutex_lock(&(us->dev_mutex)); mutex_lock(&(us->dev_mutex));
...@@ -402,7 +400,8 @@ static int bus_reset(struct scsi_cmnd *srb) ...@@ -402,7 +400,8 @@ static int bus_reset(struct scsi_cmnd *srb)
struct us_data *us = host_to_us(srb->device->host); struct us_data *us = host_to_us(srb->device->host);
int result; int result;
US_DEBUGP("%s called\n", __func__); usb_stor_dbg(us, "%s called\n", __func__);
result = usb_stor_port_reset(us); result = usb_stor_port_reset(us);
return result < 0 ? FAILED : SUCCESS; return result < 0 ? FAILED : SUCCESS;
} }
......
This diff is collapsed.
...@@ -145,8 +145,7 @@ static int sddr55_status(struct us_data *us) ...@@ -145,8 +145,7 @@ static int sddr55_status(struct us_data *us)
result = sddr55_bulk_transport(us, result = sddr55_bulk_transport(us,
DMA_TO_DEVICE, command, 8); DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in status %d\n", usb_stor_dbg(us, "Result for send_command in status %d\n", result);
result);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
set_sense_info (4, 0, 0); /* hardware error */ set_sense_info (4, 0, 0); /* hardware error */
...@@ -236,8 +235,7 @@ static int sddr55_read_data(struct us_data *us, ...@@ -236,8 +235,7 @@ static int sddr55_read_data(struct us_data *us,
info->blocksize - page); info->blocksize - page);
len = pages << info->pageshift; len = pages << info->pageshift;
US_DEBUGP("Read %02X pages, from PBA %04X" usb_stor_dbg(us, "Read %02X pages, from PBA %04X (LBA %04X) page %02X\n",
" (LBA %04X) page %02X\n",
pages, pba, lba, page); pages, pba, lba, page);
if (pba == NOT_ALLOCATED) { if (pba == NOT_ALLOCATED) {
...@@ -261,7 +259,7 @@ static int sddr55_read_data(struct us_data *us, ...@@ -261,7 +259,7 @@ static int sddr55_read_data(struct us_data *us,
result = sddr55_bulk_transport(us, result = sddr55_bulk_transport(us,
DMA_TO_DEVICE, command, 8); DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in read_data %d\n", usb_stor_dbg(us, "Result for send_command in read_data %d\n",
result); result);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
...@@ -368,8 +366,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -368,8 +366,7 @@ static int sddr55_write_data(struct us_data *us,
usb_stor_access_xfer_buf(buffer, len, us->srb, usb_stor_access_xfer_buf(buffer, len, us->srb,
&sg, &offset, FROM_XFER_BUF); &sg, &offset, FROM_XFER_BUF);
US_DEBUGP("Write %02X pages, to PBA %04X" usb_stor_dbg(us, "Write %02X pages, to PBA %04X (LBA %04X) page %02X\n",
" (LBA %04X) page %02X\n",
pages, pba, lba, page); pages, pba, lba, page);
command[4] = 0; command[4] = 0;
...@@ -384,7 +381,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -384,7 +381,7 @@ static int sddr55_write_data(struct us_data *us,
/* set pba to first block in zone lba is in */ /* set pba to first block in zone lba is in */
pba = (lba / 1000) * 1024; pba = (lba / 1000) * 1024;
US_DEBUGP("No PBA for LBA %04X\n",lba); usb_stor_dbg(us, "No PBA for LBA %04X\n", lba);
if (max_pba > 1024) if (max_pba > 1024)
max_pba = 1024; max_pba = 1024;
...@@ -407,14 +404,15 @@ static int sddr55_write_data(struct us_data *us, ...@@ -407,14 +404,15 @@ static int sddr55_write_data(struct us_data *us,
if (pba == -1) { if (pba == -1) {
/* oh dear */ /* oh dear */
US_DEBUGP("Couldn't find unallocated block\n"); usb_stor_dbg(us, "Couldn't find unallocated block\n");
set_sense_info (3, 0x31, 0); /* medium error */ set_sense_info (3, 0x31, 0); /* medium error */
result = USB_STOR_TRANSPORT_FAILED; result = USB_STOR_TRANSPORT_FAILED;
goto leave; goto leave;
} }
US_DEBUGP("Allocating PBA %04X for LBA %04X\n", pba, lba); usb_stor_dbg(us, "Allocating PBA %04X for LBA %04X\n",
pba, lba);
/* set writing to unallocated block flag */ /* set writing to unallocated block flag */
command[4] = 0x40; command[4] = 0x40;
...@@ -439,7 +437,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -439,7 +437,7 @@ static int sddr55_write_data(struct us_data *us,
DMA_TO_DEVICE, command, 8); DMA_TO_DEVICE, command, 8);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_command in write_data %d\n", usb_stor_dbg(us, "Result for send_command in write_data %d\n",
result); result);
/* set_sense_info is superfluous here? */ /* set_sense_info is superfluous here? */
...@@ -453,7 +451,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -453,7 +451,7 @@ static int sddr55_write_data(struct us_data *us,
DMA_TO_DEVICE, buffer, len); DMA_TO_DEVICE, buffer, len);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_data in write_data %d\n", usb_stor_dbg(us, "Result for send_data in write_data %d\n",
result); result);
/* set_sense_info is superfluous here? */ /* set_sense_info is superfluous here? */
...@@ -466,7 +464,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -466,7 +464,7 @@ static int sddr55_write_data(struct us_data *us,
result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, status, 6); result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, status, 6);
if (result != USB_STOR_XFER_GOOD) { if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for get_status in write_data %d\n", usb_stor_dbg(us, "Result for get_status in write_data %d\n",
result); result);
/* set_sense_info is superfluous here? */ /* set_sense_info is superfluous here? */
...@@ -487,7 +485,7 @@ static int sddr55_write_data(struct us_data *us, ...@@ -487,7 +485,7 @@ static int sddr55_write_data(struct us_data *us,
goto leave; goto leave;
} }
US_DEBUGP("Updating maps for LBA %04X: old PBA %04X, new PBA %04X\n", usb_stor_dbg(us, "Updating maps for LBA %04X: old PBA %04X, new PBA %04X\n",
lba, pba, new_pba); lba, pba, new_pba);
/* update the lba<->pba maps, note new_pba might be the same as pba */ /* update the lba<->pba maps, note new_pba might be the same as pba */
...@@ -531,7 +529,7 @@ static int sddr55_read_deviceID(struct us_data *us, ...@@ -531,7 +529,7 @@ static int sddr55_read_deviceID(struct us_data *us,
command[7] = 0x84; command[7] = 0x84;
result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8); result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result of send_control for device ID is %d\n", usb_stor_dbg(us, "Result of send_control for device ID is %d\n",
result); result);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
...@@ -568,20 +566,19 @@ static unsigned long sddr55_get_capacity(struct us_data *us) { ...@@ -568,20 +566,19 @@ static unsigned long sddr55_get_capacity(struct us_data *us) {
int result; int result;
struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra; struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
US_DEBUGP("Reading capacity...\n"); usb_stor_dbg(us, "Reading capacity...\n");
result = sddr55_read_deviceID(us, result = sddr55_read_deviceID(us,
&manufacturerID, &manufacturerID,
&deviceID); &deviceID);
US_DEBUGP("Result of read_deviceID is %d\n", usb_stor_dbg(us, "Result of read_deviceID is %d\n", result);
result);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return 0; return 0;
US_DEBUGP("Device ID = %02X\n", deviceID); usb_stor_dbg(us, "Device ID = %02X\n", deviceID);
US_DEBUGP("Manuf ID = %02X\n", manufacturerID); usb_stor_dbg(us, "Manuf ID = %02X\n", manufacturerID);
info->pageshift = 9; info->pageshift = 9;
info->smallpageshift = 0; info->smallpageshift = 0;
...@@ -753,7 +750,7 @@ static int sddr55_read_map(struct us_data *us) { ...@@ -753,7 +750,7 @@ static int sddr55_read_map(struct us_data *us) {
} }
if (lba<0x10 || (lba>=0x3E0 && lba<0x3EF)) if (lba<0x10 || (lba>=0x3E0 && lba<0x3EF))
US_DEBUGP("LBA %04X <-> PBA %04X\n", lba, i); usb_stor_dbg(us, "LBA %04X <-> PBA %04X\n", lba, i);
info->lba_to_pba[lba + zone * 1000] = i; info->lba_to_pba[lba + zone * 1000] = i;
} }
...@@ -808,7 +805,10 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -808,7 +805,10 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
info = (struct sddr55_card_info *)(us->extra); info = (struct sddr55_card_info *)(us->extra);
if (srb->cmnd[0] == REQUEST_SENSE) { if (srb->cmnd[0] == REQUEST_SENSE) {
US_DEBUGP("SDDR55: request sense %02x/%02x/%02x\n", info->sense_data[2], info->sense_data[12], info->sense_data[13]); usb_stor_dbg(us, "request sense %02x/%02x/%02x\n",
info->sense_data[2],
info->sense_data[12],
info->sense_data[13]);
memcpy (ptr, info->sense_data, sizeof info->sense_data); memcpy (ptr, info->sense_data, sizeof info->sense_data);
ptr[0] = 0x70; ptr[0] = 0x70;
...@@ -892,13 +892,11 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -892,13 +892,11 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
usb_stor_set_xfer_buf(ptr, sizeof(mode_page_01), srb); usb_stor_set_xfer_buf(ptr, sizeof(mode_page_01), srb);
if ( (srb->cmnd[2] & 0x3F) == 0x01 ) { if ( (srb->cmnd[2] & 0x3F) == 0x01 ) {
US_DEBUGP( usb_stor_dbg(us, "Dummy up request for mode page 1\n");
"SDDR55: Dummy up request for mode page 1\n");
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} else if ( (srb->cmnd[2] & 0x3F) == 0x3F ) { } else if ( (srb->cmnd[2] & 0x3F) == 0x3F ) {
US_DEBUGP( usb_stor_dbg(us, "Dummy up request for all mode pages\n");
"SDDR55: Dummy up request for all mode pages\n");
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
} }
...@@ -908,9 +906,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -908,9 +906,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
US_DEBUGP( usb_stor_dbg(us, "%s medium removal. Not that I can do anything about it...\n",
"SDDR55: %s medium removal. Not that I can do"
" anything about it...\n",
(srb->cmnd[4]&0x03) ? "Prevent" : "Allow"); (srb->cmnd[4]&0x03) ? "Prevent" : "Allow");
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
...@@ -935,8 +931,8 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -935,8 +931,8 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
if (lba >= info->max_log_blks) { if (lba >= info->max_log_blks) {
US_DEBUGP("Error: Requested LBA %04X exceeds maximum " usb_stor_dbg(us, "Error: Requested LBA %04X exceeds maximum block %04X\n",
"block %04X\n", lba, info->max_log_blks-1); lba, info->max_log_blks - 1);
set_sense_info (5, 0x24, 0); /* invalid field in command */ set_sense_info (5, 0x24, 0); /* invalid field in command */
...@@ -946,14 +942,12 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -946,14 +942,12 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
pba = info->lba_to_pba[lba]; pba = info->lba_to_pba[lba];
if (srb->cmnd[0] == WRITE_10) { if (srb->cmnd[0] == WRITE_10) {
US_DEBUGP("WRITE_10: write block %04X (LBA %04X) page %01X" usb_stor_dbg(us, "WRITE_10: write block %04X (LBA %04X) page %01X pages %d\n",
" pages %d\n",
pba, lba, page, pages); pba, lba, page, pages);
return sddr55_write_data(us, lba, page, pages); return sddr55_write_data(us, lba, page, pages);
} else { } else {
US_DEBUGP("READ_10: read block %04X (LBA %04X) page %01X" usb_stor_dbg(us, "READ_10: read block %04X (LBA %04X) page %01X pages %d\n",
" pages %d\n",
pba, lba, page, pages); pba, lba, page, pages);
return sddr55_read_data(us, lba, page, pages); return sddr55_read_data(us, lba, page, pages);
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ static bool containsFullLinuxPackage(struct swoc_info *swocInfo) ...@@ -47,7 +47,7 @@ static bool containsFullLinuxPackage(struct swoc_info *swocInfo)
static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode) static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSWocMode)
{ {
int result; int result;
US_DEBUGP("SWIMS: %s", "DEVICE MODE SWITCH\n"); dev_dbg(&udev->dev, "SWIMS: %s", "DEVICE MODE SWITCH\n");
result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
SWIMS_USB_REQUEST_SetSwocMode, /* __u8 request */ SWIMS_USB_REQUEST_SetSwocMode, /* __u8 request */
USB_TYPE_VENDOR | USB_DIR_OUT, /* __u8 request type */ USB_TYPE_VENDOR | USB_DIR_OUT, /* __u8 request type */
...@@ -65,7 +65,7 @@ static int sierra_get_swoc_info(struct usb_device *udev, ...@@ -65,7 +65,7 @@ static int sierra_get_swoc_info(struct usb_device *udev,
{ {
int result; int result;
US_DEBUGP("SWIMS: Attempting to get TRU-Install info.\n"); dev_dbg(&udev->dev, "SWIMS: Attempting to get TRU-Install info\n");
result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
SWIMS_USB_REQUEST_GetSwocInfo, /* __u8 request */ SWIMS_USB_REQUEST_GetSwocInfo, /* __u8 request */
...@@ -81,11 +81,11 @@ static int sierra_get_swoc_info(struct usb_device *udev, ...@@ -81,11 +81,11 @@ static int sierra_get_swoc_info(struct usb_device *udev,
return result; return result;
} }
static void debug_swoc(struct swoc_info *swocInfo) static void debug_swoc(const struct device *dev, struct swoc_info *swocInfo)
{ {
US_DEBUGP("SWIMS: SWoC Rev: %02d \n", swocInfo->rev); dev_dbg(dev, "SWIMS: SWoC Rev: %02d\n", swocInfo->rev);
US_DEBUGP("SWIMS: Linux SKU: %04X \n", swocInfo->LinuxSKU); dev_dbg(dev, "SWIMS: Linux SKU: %04X\n", swocInfo->LinuxSKU);
US_DEBUGP("SWIMS: Linux Version: %04X \n", swocInfo->LinuxVer); dev_dbg(dev, "SWIMS: Linux Version: %04X\n", swocInfo->LinuxVer);
} }
...@@ -101,18 +101,17 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, ...@@ -101,18 +101,17 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr,
} else { } else {
swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL); swocInfo = kmalloc(sizeof(struct swoc_info), GFP_KERNEL);
if (!swocInfo) { if (!swocInfo) {
US_DEBUGP("SWIMS: Allocation failure\n");
snprintf(buf, PAGE_SIZE, "Error\n"); snprintf(buf, PAGE_SIZE, "Error\n");
return -ENOMEM; return -ENOMEM;
} }
result = sierra_get_swoc_info(udev, swocInfo); result = sierra_get_swoc_info(udev, swocInfo);
if (result < 0) { if (result < 0) {
US_DEBUGP("SWIMS: failed SWoC query\n"); dev_dbg(dev, "SWIMS: failed SWoC query\n");
kfree(swocInfo); kfree(swocInfo);
snprintf(buf, PAGE_SIZE, "Error\n"); snprintf(buf, PAGE_SIZE, "Error\n");
return -EIO; return -EIO;
} }
debug_swoc(swocInfo); debug_swoc(dev, swocInfo);
result = snprintf(buf, PAGE_SIZE, result = snprintf(buf, PAGE_SIZE,
"REV=%02d SKU=%04X VER=%04X\n", "REV=%02d SKU=%04X VER=%04X\n",
swocInfo->rev, swocInfo->rev,
...@@ -138,61 +137,55 @@ int sierra_ms_init(struct us_data *us) ...@@ -138,61 +137,55 @@ int sierra_ms_init(struct us_data *us)
sh = us_to_host(us); sh = us_to_host(us);
scsi_get_host_dev(sh); scsi_get_host_dev(sh);
US_DEBUGP("SWIMS: sierra_ms_init called\n");
/* Force Modem mode */ /* Force Modem mode */
if (swi_tru_install == TRU_FORCE_MODEM) { if (swi_tru_install == TRU_FORCE_MODEM) {
US_DEBUGP("SWIMS: %s", "Forcing Modem Mode\n"); usb_stor_dbg(us, "SWIMS: Forcing Modem Mode\n");
result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem); result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
if (result < 0) if (result < 0)
US_DEBUGP("SWIMS: Failed to switch to modem mode.\n"); usb_stor_dbg(us, "SWIMS: Failed to switch to modem mode\n");
return -EIO; return -EIO;
} }
/* Force Mass Storage mode (keep CD-Rom) */ /* Force Mass Storage mode (keep CD-Rom) */
else if (swi_tru_install == TRU_FORCE_MS) { else if (swi_tru_install == TRU_FORCE_MS) {
US_DEBUGP("SWIMS: %s", "Forcing Mass Storage Mode\n"); usb_stor_dbg(us, "SWIMS: Forcing Mass Storage Mode\n");
goto complete; goto complete;
} }
/* Normal TRU-Install Logic */ /* Normal TRU-Install Logic */
else { else {
US_DEBUGP("SWIMS: %s", "Normal SWoC Logic\n"); usb_stor_dbg(us, "SWIMS: Normal SWoC Logic\n");
swocInfo = kmalloc(sizeof(struct swoc_info), swocInfo = kmalloc(sizeof(struct swoc_info),
GFP_KERNEL); GFP_KERNEL);
if (!swocInfo) { if (!swocInfo)
US_DEBUGP("SWIMS: %s", "Allocation failure\n");
return -ENOMEM; return -ENOMEM;
}
retries = 3; retries = 3;
do { do {
retries--; retries--;
result = sierra_get_swoc_info(udev, swocInfo); result = sierra_get_swoc_info(udev, swocInfo);
if (result < 0) { if (result < 0) {
US_DEBUGP("SWIMS: %s", "Failed SWoC query\n"); usb_stor_dbg(us, "SWIMS: Failed SWoC query\n");
schedule_timeout_uninterruptible(2*HZ); schedule_timeout_uninterruptible(2*HZ);
} }
} while (retries && result < 0); } while (retries && result < 0);
if (result < 0) { if (result < 0) {
US_DEBUGP("SWIMS: %s", usb_stor_dbg(us, "SWIMS: Completely failed SWoC query\n");
"Completely failed SWoC query\n");
kfree(swocInfo); kfree(swocInfo);
return -EIO; return -EIO;
} }
debug_swoc(swocInfo); debug_swoc(&us->pusb_dev->dev, swocInfo);
/* If there is not Linux software on the TRU-Install device /* If there is not Linux software on the TRU-Install device
* then switch to modem mode * then switch to modem mode
*/ */
if (!containsFullLinuxPackage(swocInfo)) { if (!containsFullLinuxPackage(swocInfo)) {
US_DEBUGP("SWIMS: %s", usb_stor_dbg(us, "SWIMS: Switching to Modem Mode\n");
"Switching to Modem Mode\n");
result = sierra_set_ms_mode(udev, result = sierra_set_ms_mode(udev,
SWIMS_SET_MODE_Modem); SWIMS_SET_MODE_Modem);
if (result < 0) if (result < 0)
US_DEBUGP("SWIMS: Failed to switch modem\n"); usb_stor_dbg(us, "SWIMS: Failed to switch modem\n");
kfree(swocInfo); kfree(swocInfo);
return -EIO; return -EIO;
} }
......
This diff is collapsed.
...@@ -183,7 +183,6 @@ int usb_stor_suspend(struct usb_interface *iface, pm_message_t message) ...@@ -183,7 +183,6 @@ int usb_stor_suspend(struct usb_interface *iface, pm_message_t message)
/* Wait until no command is running */ /* Wait until no command is running */
mutex_lock(&us->dev_mutex); mutex_lock(&us->dev_mutex);
US_DEBUGP("%s\n", __func__);
if (us->suspend_resume_hook) if (us->suspend_resume_hook)
(us->suspend_resume_hook)(us, US_SUSPEND); (us->suspend_resume_hook)(us, US_SUSPEND);
...@@ -201,7 +200,6 @@ int usb_stor_resume(struct usb_interface *iface) ...@@ -201,7 +200,6 @@ int usb_stor_resume(struct usb_interface *iface)
mutex_lock(&us->dev_mutex); mutex_lock(&us->dev_mutex);
US_DEBUGP("%s\n", __func__);
if (us->suspend_resume_hook) if (us->suspend_resume_hook)
(us->suspend_resume_hook)(us, US_RESUME); (us->suspend_resume_hook)(us, US_RESUME);
...@@ -214,8 +212,6 @@ int usb_stor_reset_resume(struct usb_interface *iface) ...@@ -214,8 +212,6 @@ int usb_stor_reset_resume(struct usb_interface *iface)
{ {
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
US_DEBUGP("%s\n", __func__);
/* Report the reset to the SCSI core */ /* Report the reset to the SCSI core */
usb_stor_report_bus_reset(us); usb_stor_report_bus_reset(us);
...@@ -236,8 +232,6 @@ int usb_stor_pre_reset(struct usb_interface *iface) ...@@ -236,8 +232,6 @@ int usb_stor_pre_reset(struct usb_interface *iface)
{ {
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
US_DEBUGP("%s\n", __func__);
/* Make sure no command runs during the reset */ /* Make sure no command runs during the reset */
mutex_lock(&us->dev_mutex); mutex_lock(&us->dev_mutex);
return 0; return 0;
...@@ -248,8 +242,6 @@ int usb_stor_post_reset(struct usb_interface *iface) ...@@ -248,8 +242,6 @@ int usb_stor_post_reset(struct usb_interface *iface)
{ {
struct us_data *us = usb_get_intfdata(iface); struct us_data *us = usb_get_intfdata(iface);
US_DEBUGP("%s\n", __func__);
/* Report the reset to the SCSI core */ /* Report the reset to the SCSI core */
usb_stor_report_bus_reset(us); usb_stor_report_bus_reset(us);
...@@ -311,11 +303,11 @@ static int usb_stor_control_thread(void * __us) ...@@ -311,11 +303,11 @@ static int usb_stor_control_thread(void * __us)
struct Scsi_Host *host = us_to_host(us); struct Scsi_Host *host = us_to_host(us);
for (;;) { for (;;) {
US_DEBUGP("*** thread sleeping.\n"); usb_stor_dbg(us, "*** thread sleeping\n");
if (wait_for_completion_interruptible(&us->cmnd_ready)) if (wait_for_completion_interruptible(&us->cmnd_ready))
break; break;
US_DEBUGP("*** thread awakened.\n"); usb_stor_dbg(us, "*** thread awakened\n");
/* lock the device pointers */ /* lock the device pointers */
mutex_lock(&(us->dev_mutex)); mutex_lock(&(us->dev_mutex));
...@@ -327,7 +319,7 @@ static int usb_stor_control_thread(void * __us) ...@@ -327,7 +319,7 @@ static int usb_stor_control_thread(void * __us)
if (us->srb == NULL) { if (us->srb == NULL) {
scsi_unlock(host); scsi_unlock(host);
mutex_unlock(&us->dev_mutex); mutex_unlock(&us->dev_mutex);
US_DEBUGP("-- exiting\n"); usb_stor_dbg(us, "-- exiting\n");
break; break;
} }
...@@ -343,7 +335,7 @@ static int usb_stor_control_thread(void * __us) ...@@ -343,7 +335,7 @@ static int usb_stor_control_thread(void * __us)
* is UNKNOWN * is UNKNOWN
*/ */
if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) { if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) {
US_DEBUGP("UNKNOWN data direction\n"); usb_stor_dbg(us, "UNKNOWN data direction\n");
us->srb->result = DID_ERROR << 16; us->srb->result = DID_ERROR << 16;
} }
...@@ -352,13 +344,13 @@ static int usb_stor_control_thread(void * __us) ...@@ -352,13 +344,13 @@ static int usb_stor_control_thread(void * __us)
*/ */
else if (us->srb->device->id && else if (us->srb->device->id &&
!(us->fflags & US_FL_SCM_MULT_TARG)) { !(us->fflags & US_FL_SCM_MULT_TARG)) {
US_DEBUGP("Bad target number (%d:%d)\n", usb_stor_dbg(us, "Bad target number (%d:%d)\n",
us->srb->device->id, us->srb->device->lun); us->srb->device->id, us->srb->device->lun);
us->srb->result = DID_BAD_TARGET << 16; us->srb->result = DID_BAD_TARGET << 16;
} }
else if (us->srb->device->lun > us->max_lun) { else if (us->srb->device->lun > us->max_lun) {
US_DEBUGP("Bad LUN (%d:%d)\n", usb_stor_dbg(us, "Bad LUN (%d:%d)\n",
us->srb->device->id, us->srb->device->lun); us->srb->device->id, us->srb->device->lun);
us->srb->result = DID_BAD_TARGET << 16; us->srb->result = DID_BAD_TARGET << 16;
} }
...@@ -371,14 +363,14 @@ static int usb_stor_control_thread(void * __us) ...@@ -371,14 +363,14 @@ static int usb_stor_control_thread(void * __us)
0x00, 0x80, 0x02, 0x02, 0x00, 0x80, 0x02, 0x02,
0x1F, 0x00, 0x00, 0x00}; 0x1F, 0x00, 0x00, 0x00};
US_DEBUGP("Faking INQUIRY command\n"); usb_stor_dbg(us, "Faking INQUIRY command\n");
fill_inquiry_response(us, data_ptr, 36); fill_inquiry_response(us, data_ptr, 36);
us->srb->result = SAM_STAT_GOOD; us->srb->result = SAM_STAT_GOOD;
} }
/* we've got a command, let's do it! */ /* we've got a command, let's do it! */
else { else {
US_DEBUG(usb_stor_show_command(us->srb)); US_DEBUG(usb_stor_show_command(us, us->srb));
us->proto_handler(us->srb, us); us->proto_handler(us->srb, us);
usb_mark_last_busy(us->pusb_dev); usb_mark_last_busy(us->pusb_dev);
} }
...@@ -388,12 +380,12 @@ static int usb_stor_control_thread(void * __us) ...@@ -388,12 +380,12 @@ static int usb_stor_control_thread(void * __us)
/* indicate that the command is done */ /* indicate that the command is done */
if (us->srb->result != DID_ABORT << 16) { if (us->srb->result != DID_ABORT << 16) {
US_DEBUGP("scsi cmd done, result=0x%x\n", usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
us->srb->result); us->srb->result);
us->srb->scsi_done(us->srb); us->srb->scsi_done(us->srb);
} else { } else {
SkipForAbort: SkipForAbort:
US_DEBUGP("scsi command aborted\n"); usb_stor_dbg(us, "scsi command aborted\n");
} }
/* If an abort request was received we need to signal that /* If an abort request was received we need to signal that
...@@ -435,17 +427,15 @@ static int usb_stor_control_thread(void * __us) ...@@ -435,17 +427,15 @@ static int usb_stor_control_thread(void * __us)
/* Associate our private data with the USB device */ /* Associate our private data with the USB device */
static int associate_dev(struct us_data *us, struct usb_interface *intf) static int associate_dev(struct us_data *us, struct usb_interface *intf)
{ {
US_DEBUGP("-- %s\n", __func__);
/* Fill in the device-related fields */ /* Fill in the device-related fields */
us->pusb_dev = interface_to_usbdev(intf); us->pusb_dev = interface_to_usbdev(intf);
us->pusb_intf = intf; us->pusb_intf = intf;
us->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; us->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
US_DEBUGP("Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n", usb_stor_dbg(us, "Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n",
le16_to_cpu(us->pusb_dev->descriptor.idVendor), le16_to_cpu(us->pusb_dev->descriptor.idVendor),
le16_to_cpu(us->pusb_dev->descriptor.idProduct), le16_to_cpu(us->pusb_dev->descriptor.idProduct),
le16_to_cpu(us->pusb_dev->descriptor.bcdDevice)); le16_to_cpu(us->pusb_dev->descriptor.bcdDevice));
US_DEBUGP("Interface Subclass: 0x%02x, Protocol: 0x%02x\n", usb_stor_dbg(us, "Interface Subclass: 0x%02x, Protocol: 0x%02x\n",
intf->cur_altsetting->desc.bInterfaceSubClass, intf->cur_altsetting->desc.bInterfaceSubClass,
intf->cur_altsetting->desc.bInterfaceProtocol); intf->cur_altsetting->desc.bInterfaceProtocol);
...@@ -454,15 +444,13 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) ...@@ -454,15 +444,13 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
/* Allocate the control/setup and DMA-mapped buffers */ /* Allocate the control/setup and DMA-mapped buffers */
us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL); us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL);
if (!us->cr) { if (!us->cr)
US_DEBUGP("usb_ctrlrequest allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE,
GFP_KERNEL, &us->iobuf_dma); GFP_KERNEL, &us->iobuf_dma);
if (!us->iobuf) { if (!us->iobuf) {
US_DEBUGP("I/O buffer allocation failed\n"); usb_stor_dbg(us, "I/O buffer allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
...@@ -738,7 +726,7 @@ static int get_pipes(struct us_data *us) ...@@ -738,7 +726,7 @@ static int get_pipes(struct us_data *us)
} }
if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) { if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) {
US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n"); usb_stor_dbg(us, "Endpoint sanity check failed! Rejecting dev.\n");
return -EIO; return -EIO;
} }
...@@ -765,7 +753,7 @@ static int usb_stor_acquire_resources(struct us_data *us) ...@@ -765,7 +753,7 @@ static int usb_stor_acquire_resources(struct us_data *us)
us->current_urb = usb_alloc_urb(0, GFP_KERNEL); us->current_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!us->current_urb) { if (!us->current_urb) {
US_DEBUGP("URB allocation failed\n"); usb_stor_dbg(us, "URB allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -792,20 +780,18 @@ static int usb_stor_acquire_resources(struct us_data *us) ...@@ -792,20 +780,18 @@ static int usb_stor_acquire_resources(struct us_data *us)
/* Release all our dynamic resources */ /* Release all our dynamic resources */
static void usb_stor_release_resources(struct us_data *us) static void usb_stor_release_resources(struct us_data *us)
{ {
US_DEBUGP("-- %s\n", __func__);
/* Tell the control thread to exit. The SCSI host must /* Tell the control thread to exit. The SCSI host must
* already have been removed and the DISCONNECTING flag set * already have been removed and the DISCONNECTING flag set
* so that we won't accept any more commands. * so that we won't accept any more commands.
*/ */
US_DEBUGP("-- sending exit command to thread\n"); usb_stor_dbg(us, "-- sending exit command to thread\n");
complete(&us->cmnd_ready); complete(&us->cmnd_ready);
if (us->ctl_thread) if (us->ctl_thread)
kthread_stop(us->ctl_thread); kthread_stop(us->ctl_thread);
/* Call the destructor routine, if it exists */ /* Call the destructor routine, if it exists */
if (us->extra_destructor) { if (us->extra_destructor) {
US_DEBUGP("-- calling extra_destructor()\n"); usb_stor_dbg(us, "-- calling extra_destructor()\n");
us->extra_destructor(us->extra); us->extra_destructor(us->extra);
} }
...@@ -817,8 +803,6 @@ static void usb_stor_release_resources(struct us_data *us) ...@@ -817,8 +803,6 @@ static void usb_stor_release_resources(struct us_data *us)
/* Dissociate from the USB device */ /* Dissociate from the USB device */
static void dissociate_dev(struct us_data *us) static void dissociate_dev(struct us_data *us)
{ {
US_DEBUGP("-- %s\n", __func__);
/* Free the buffers */ /* Free the buffers */
kfree(us->cr); kfree(us->cr);
usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma); usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma);
...@@ -918,7 +902,7 @@ int usb_stor_probe1(struct us_data **pus, ...@@ -918,7 +902,7 @@ int usb_stor_probe1(struct us_data **pus,
struct us_data *us; struct us_data *us;
int result; int result;
US_DEBUGP("USB Mass Storage device detected\n"); dev_info(&intf->dev, "USB Mass Storage device detected\n");
/* /*
* Ask the SCSI layer to allocate a host structure, with extra * Ask the SCSI layer to allocate a host structure, with extra
...@@ -926,8 +910,7 @@ int usb_stor_probe1(struct us_data **pus, ...@@ -926,8 +910,7 @@ int usb_stor_probe1(struct us_data **pus,
*/ */
host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us));
if (!host) { if (!host) {
dev_warn(&intf->dev, dev_warn(&intf->dev, "Unable to allocate the scsi host\n");
"Unable to allocate the scsi host\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -964,7 +947,7 @@ int usb_stor_probe1(struct us_data **pus, ...@@ -964,7 +947,7 @@ int usb_stor_probe1(struct us_data **pus,
return 0; return 0;
BadDevice: BadDevice:
US_DEBUGP("storage_probe() failed\n"); usb_stor_dbg(us, "storage_probe() failed\n");
release_everything(us); release_everything(us);
return result; return result;
} }
...@@ -981,8 +964,8 @@ int usb_stor_probe2(struct us_data *us) ...@@ -981,8 +964,8 @@ int usb_stor_probe2(struct us_data *us)
result = -ENXIO; result = -ENXIO;
goto BadDevice; goto BadDevice;
} }
US_DEBUGP("Transport: %s\n", us->transport_name); usb_stor_dbg(us, "Transport: %s\n", us->transport_name);
US_DEBUGP("Protocol: %s\n", us->protocol_name); usb_stor_dbg(us, "Protocol: %s\n", us->protocol_name);
/* fix for single-lun devices */ /* fix for single-lun devices */
if (us->fflags & US_FL_SINGLE_LUN) if (us->fflags & US_FL_SINGLE_LUN)
...@@ -1028,7 +1011,7 @@ int usb_stor_probe2(struct us_data *us) ...@@ -1028,7 +1011,7 @@ int usb_stor_probe2(struct us_data *us)
/* We come here if there are any problems */ /* We come here if there are any problems */
BadDevice: BadDevice:
US_DEBUGP("storage_probe() failed\n"); usb_stor_dbg(us, "storage_probe() failed\n");
release_everything(us); release_everything(us);
return result; return result;
} }
...@@ -1039,7 +1022,6 @@ void usb_stor_disconnect(struct usb_interface *intf) ...@@ -1039,7 +1022,6 @@ void usb_stor_disconnect(struct usb_interface *intf)
{ {
struct us_data *us = usb_get_intfdata(intf); struct us_data *us = usb_get_intfdata(intf);
US_DEBUGP("storage_disconnect() called\n");
quiesce_and_remove_host(us); quiesce_and_remove_host(us);
release_everything(us); release_everything(us);
} }
...@@ -1075,8 +1057,7 @@ static int storage_probe(struct usb_interface *intf, ...@@ -1075,8 +1057,7 @@ static int storage_probe(struct usb_interface *intf,
} else { } else {
unusual_dev = &for_dynamic_ids; unusual_dev = &for_dynamic_ids;
US_DEBUGP("%s %s 0x%04x 0x%04x\n", "Use Bulk-Only transport", dev_dbg(&intf->dev, "Use Bulk-Only transport with the Transparent SCSI protocol for dynamic id: 0x%04x 0x%04x\n",
"with the Transparent SCSI protocol for dynamic id:",
id->idVendor, id->idProduct); id->idVendor, id->idProduct);
} }
...@@ -1117,20 +1098,18 @@ static int __init usb_stor_init(void) ...@@ -1117,20 +1098,18 @@ static int __init usb_stor_init(void)
/* register the driver, return usb_register return code if error */ /* register the driver, return usb_register return code if error */
retval = usb_register(&usb_storage_driver); retval = usb_register(&usb_storage_driver);
if (retval == 0) if (retval == 0)
pr_info("USB Mass Storage support registered.\n"); pr_info("USB Mass Storage support registered\n");
return retval; return retval;
} }
static void __exit usb_stor_exit(void) static void __exit usb_stor_exit(void)
{ {
US_DEBUGP("usb_stor_exit() called\n");
/* Deregister the driver /* Deregister the driver
* This will cause disconnect() to be called for each * This will cause disconnect() to be called for each
* attached unit * attached unit
*/ */
US_DEBUGP("-- calling usb_deregister()\n"); pr_info("Deregistering USB Mass Storage driver...\n");
usb_deregister(&usb_storage_driver) ; usb_deregister(&usb_storage_driver);
} }
module_init(usb_stor_init); module_init(usb_stor_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment