Commit ef976ea3 authored by Victor Dodon's avatar Victor Dodon Committed by Greg Kroah-Hartman

usb: storage: use usb_store_dbg instead of US_DEBUGPX

The US_DEBUGPX macro uses printk without specifying a kernel log level, so
the default kernel log level is used, which may not match LOGLEVEL_DEBUG
used in usb_stor_dbg. Remove the macro and use usb_store_dbg instead.
Signed-off-by: default avatarVictor Dodon <printesoi@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f9cfabce
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
void usb_stor_show_command(const struct us_data *us, 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;
switch (srb->cmnd[0]) { switch (srb->cmnd[0]) {
case TEST_UNIT_READY: what = "TEST_UNIT_READY"; break; case TEST_UNIT_READY: what = "TEST_UNIT_READY"; break;
...@@ -153,10 +152,8 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb) ...@@ -153,10 +152,8 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb)
default: what = "(unknown command)"; break; default: what = "(unknown command)"; break;
} }
usb_stor_dbg(us, "Command %s (%d bytes)\n", what, srb->cmd_len); usb_stor_dbg(us, "Command %s (%d bytes)\n", what, srb->cmd_len);
usb_stor_dbg(us, "bytes: "); usb_stor_dbg(us, "bytes: %*ph\n", min_t(int, srb->cmd_len, 16),
for (i = 0; i < srb->cmd_len && i < 16; i++) (const unsigned char *)srb->cmnd);
US_DEBUGPX(" %02x", srb->cmnd[i]);
US_DEBUGPX("\n");
} }
void usb_stor_show_sense(const struct us_data *us, void usb_stor_show_sense(const struct us_data *us,
...@@ -174,11 +171,10 @@ void usb_stor_show_sense(const struct us_data *us, ...@@ -174,11 +171,10 @@ void usb_stor_show_sense(const struct us_data *us,
if (what == NULL) if (what == NULL)
what = "(unknown ASC/ASCQ)"; what = "(unknown ASC/ASCQ)";
usb_stor_dbg(us, "%s: ", keystr);
if (fmt) if (fmt)
US_DEBUGPX("%s (%s%x)\n", what, fmt, ascq); usb_stor_dbg(us, "%s: %s (%s%x)\n", keystr, what, fmt, ascq);
else else
US_DEBUGPX("%s\n", what); usb_stor_dbg(us, "%s: %s\n", keystr, what);
} }
void usb_stor_dbg(const struct us_data *us, const char *fmt, ...) void usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
......
...@@ -53,7 +53,6 @@ void usb_stor_show_sense(const struct us_data *us, unsigned char key, ...@@ -53,7 +53,6 @@ void usb_stor_show_sense(const struct us_data *us, unsigned char key,
__printf(2, 3) void usb_stor_dbg(const struct us_data *us, __printf(2, 3) void usb_stor_dbg(const struct us_data *us,
const char *fmt, ...); const char *fmt, ...);
#define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__)
#define US_DEBUG(x) x #define US_DEBUG(x) x
#else #else
__printf(2, 3) __printf(2, 3)
...@@ -63,8 +62,6 @@ static inline void _usb_stor_dbg(const struct us_data *us, ...@@ -63,8 +62,6 @@ static inline void _usb_stor_dbg(const struct us_data *us,
} }
#define usb_stor_dbg(us, fmt, ...) \ #define usb_stor_dbg(us, fmt, ...) \
do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0)
#define US_DEBUGPX(fmt, ...) \
do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
#define US_DEBUG(x) #define US_DEBUG(x)
#endif #endif
......
...@@ -1102,24 +1102,24 @@ static int ...@@ -1102,24 +1102,24 @@ static int
sddr09_get_wp(struct us_data *us, struct sddr09_card_info *info) { sddr09_get_wp(struct us_data *us, struct sddr09_card_info *info) {
int result; int result;
unsigned char status; unsigned char status;
const char *wp_fmt;
result = sddr09_read_status(us, &status); result = sddr09_read_status(us, &status);
if (result) { if (result) {
usb_stor_dbg(us, "read_status fails\n"); usb_stor_dbg(us, "read_status fails\n");
return result; return result;
} }
usb_stor_dbg(us, "status 0x%02X", status);
if ((status & 0x80) == 0) { if ((status & 0x80) == 0) {
info->flags |= SDDR09_WP; /* write protected */ info->flags |= SDDR09_WP; /* write protected */
US_DEBUGPX(" WP"); wp_fmt = " WP";
} } else {
if (status & 0x40) wp_fmt = "";
US_DEBUGPX(" Ready"); }
if (status & LUNBITS) usb_stor_dbg(us, "status 0x%02X%s%s%s%s\n", status, wp_fmt,
US_DEBUGPX(" Suspended"); status & 0x40 ? " Ready" : "",
if (status & 0x1) status & LUNBITS ? " Suspended" : "",
US_DEBUGPX(" Error"); status & 0x01 ? " Error" : "");
US_DEBUGPX("\n");
return 0; return 0;
} }
......
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