ChangeSet 1.889.26.17, 2003/01/12 23:01:58-08:00, mdharm-usb@one-eyed-alien.net [PATCH] USB storage: clean up debugging This patch makes the debug system only print out the valid bytes of a command. Greg, please apply. Andries suggested this... while some would think that seeing the extra bytes might be good, it is kinda noisy. diff -Nru a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c --- a/drivers/usb/storage/debug.c Mon Jan 13 14:24:33 2003 +++ b/drivers/usb/storage/debug.c Mon Jan 13 14:24:33 2003 @@ -49,6 +49,7 @@ void usb_stor_show_command(Scsi_Cmnd *srb) { char *what = NULL; + int i; switch (srb->cmnd[0]) { case TEST_UNIT_READY: what = "TEST_UNIT_READY"; break; @@ -143,29 +144,25 @@ default: what = "(unknown command)"; break; } US_DEBUGP("Command %s (%d bytes)\n", what, srb->cmd_len); - US_DEBUGP("%02x %02x %02x %02x " - "%02x %02x %02x %02x " - "%02x %02x %02x %02x\n", - srb->cmnd[0], srb->cmnd[1], srb->cmnd[2], srb->cmnd[3], - srb->cmnd[4], srb->cmnd[5], srb->cmnd[6], srb->cmnd[7], - srb->cmnd[8], srb->cmnd[9], srb->cmnd[10], - srb->cmnd[11]); + US_DEBUGP(""); + for (i = 0; i < srb->cmd_len && i < 16; i++) + US_DEBUGPX(" %02x", srb->cmnd[i]); + US_DEBUGPX("\n"); } -void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd ) +void usb_stor_print_Scsi_Cmnd(Scsi_Cmnd *cmd) { int i=0, bufferSize = cmd->request_bufflen; - u8* buffer = cmd->request_buffer; - struct scatterlist* sg = (struct scatterlist*)cmd->request_buffer; + u8 *buffer = cmd->request_buffer; + struct scatterlist *sg = (struct scatterlist*)cmd->request_buffer; - US_DEBUGP("Dumping information about %p.\n", cmd ); - US_DEBUGP("cmd->cmnd[0] value is %d.\n", cmd->cmnd[0] ); + US_DEBUGP("Dumping information about %p.\n", cmd); + US_DEBUGP("cmd->cmnd[0] value is %d.\n", cmd->cmnd[0]); US_DEBUGP("(MODE_SENSE is %d and MODE_SENSE_10 is %d)\n", - MODE_SENSE, MODE_SENSE_10 ); + MODE_SENSE, MODE_SENSE_10); - US_DEBUGP("buffer is %p with length %d.\n", buffer, bufferSize ); - for ( i=0; iuse_sg ); - for ( i=0; iuse_sg; i++ ) - { + for (i=0; iuse_sg; i++) { char *adr = sg_address(sg[i]); US_DEBUGP("Length of scatterlist %d is %d.\n",i,sg[i].length);