diff options
Diffstat (limited to 'drivers/usb/storage/debug.c')
| -rw-r--r-- | drivers/usb/storage/debug.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c index e08f64780e30..dda610f689b7 100644 --- a/drivers/usb/storage/debug.c +++ b/drivers/usb/storage/debug.c @@ -1,4 +1,6 @@ -/* Driver for USB Mass Storage compliant devices +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for USB Mass Storage compliant devices * Debugging Functions Source Code File * * Current development and maintenance by: @@ -23,23 +25,6 @@ * * Also, for certain devices, the interrupt endpoint is used to convey * status of a command. - * - * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more - * information about this driver. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/device.h> @@ -51,13 +36,11 @@ #include "usb.h" #include "debug.h" -#include "scsi.h" void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb) { char *what = NULL; - int i; switch (srb->cmnd[0]) { case TEST_UNIT_READY: what = "TEST_UNIT_READY"; break; @@ -75,8 +58,8 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb) case INQUIRY: what = "INQUIRY"; break; case RECOVER_BUFFERED_DATA: what = "RECOVER_BUFFERED_DATA"; break; case MODE_SELECT: what = "MODE_SELECT"; break; - case RESERVE: what = "RESERVE"; break; - case RELEASE: what = "RELEASE"; break; + case RESERVE_6: what = "RESERVE"; break; + case RELEASE_6: what = "RELEASE"; break; case COPY: what = "COPY"; break; case ERASE: what = "ERASE"; break; case MODE_SENSE: what = "MODE_SENSE"; break; @@ -153,10 +136,8 @@ void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb) default: what = "(unknown command)"; break; } usb_stor_dbg(us, "Command %s (%d bytes)\n", what, srb->cmd_len); - usb_stor_dbg(us, "bytes: "); - for (i = 0; i < srb->cmd_len && i < 16; i++) - US_DEBUGPX(" %02x", srb->cmnd[i]); - US_DEBUGPX("\n"); + usb_stor_dbg(us, "bytes: %*ph\n", min_t(int, srb->cmd_len, 16), + (const unsigned char *)srb->cmnd); } void usb_stor_show_sense(const struct us_data *us, @@ -164,32 +145,30 @@ void usb_stor_show_sense(const struct us_data *us, unsigned char asc, unsigned char ascq) { - const char *what, *keystr; + const char *what, *keystr, *fmt; keystr = scsi_sense_key_string(key); - what = scsi_extd_sense_format(asc, ascq); + what = scsi_extd_sense_format(asc, ascq, &fmt); if (keystr == NULL) keystr = "(Unknown Key)"; if (what == NULL) what = "(unknown ASC/ASCQ)"; - usb_stor_dbg(us, "%s: ", keystr); - US_DEBUGPX(what, ascq); - US_DEBUGPX("\n"); + if (fmt) + usb_stor_dbg(us, "%s: %s (%s%x)\n", keystr, what, fmt, ascq); + else + usb_stor_dbg(us, "%s: %s\n", keystr, what); } -int usb_stor_dbg(const struct us_data *us, const char *fmt, ...) +void usb_stor_dbg(const struct us_data *us, const char *fmt, ...) { va_list args; - int r; va_start(args, fmt); - r = dev_vprintk_emit(7, &us->pusb_dev->dev, fmt, args); + dev_vprintk_emit(LOGLEVEL_DEBUG, &us->pusb_dev->dev, fmt, args); va_end(args); - - return r; } EXPORT_SYMBOL_GPL(usb_stor_dbg); |
