xref: /linux-6.15/drivers/usb/storage/debug.h (revision 75b9130e)
11da177e4SLinus Torvalds /* Driver for USB Mass Storage compliant devices
21da177e4SLinus Torvalds  * Debugging Functions Header File
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Current development and maintenance by:
51da177e4SLinus Torvalds  *   (c) 1999-2002 Matthew Dharm ([email protected])
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * Initial work by:
81da177e4SLinus Torvalds  *   (c) 1999 Michael Gee ([email protected])
91da177e4SLinus Torvalds  *
101da177e4SLinus Torvalds  * This driver is based on the 'USB Mass Storage Class' document. This
111da177e4SLinus Torvalds  * describes in detail the protocol used to communicate with such
121da177e4SLinus Torvalds  * devices.  Clearly, the designers had SCSI and ATAPI commands in
131da177e4SLinus Torvalds  * mind when they created this document.  The commands are all very
141da177e4SLinus Torvalds  * similar to commands in the SCSI-II and ATAPI specifications.
151da177e4SLinus Torvalds  *
161da177e4SLinus Torvalds  * It is important to note that in a number of cases this class
171da177e4SLinus Torvalds  * exhibits class-specific exemptions from the USB specification.
181da177e4SLinus Torvalds  * Notably the usage of NAK, STALL and ACK differs from the norm, in
191da177e4SLinus Torvalds  * that they are used to communicate wait, failed and OK on commands.
201da177e4SLinus Torvalds  *
211da177e4SLinus Torvalds  * Also, for certain devices, the interrupt endpoint is used to convey
221da177e4SLinus Torvalds  * status of a command.
231da177e4SLinus Torvalds  *
241da177e4SLinus Torvalds  * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more
251da177e4SLinus Torvalds  * information about this driver.
261da177e4SLinus Torvalds  *
271da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify it
281da177e4SLinus Torvalds  * under the terms of the GNU General Public License as published by the
291da177e4SLinus Torvalds  * Free Software Foundation; either version 2, or (at your option) any
301da177e4SLinus Torvalds  * later version.
311da177e4SLinus Torvalds  *
321da177e4SLinus Torvalds  * This program is distributed in the hope that it will be useful, but
331da177e4SLinus Torvalds  * WITHOUT ANY WARRANTY; without even the implied warranty of
341da177e4SLinus Torvalds  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
351da177e4SLinus Torvalds  * General Public License for more details.
361da177e4SLinus Torvalds  *
371da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License along
381da177e4SLinus Torvalds  * with this program; if not, write to the Free Software Foundation, Inc.,
391da177e4SLinus Torvalds  * 675 Mass Ave, Cambridge, MA 02139, USA.
401da177e4SLinus Torvalds  */
411da177e4SLinus Torvalds 
421da177e4SLinus Torvalds #ifndef _DEBUG_H_
431da177e4SLinus Torvalds #define _DEBUG_H_
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #include <linux/kernel.h>
461da177e4SLinus Torvalds 
471da177e4SLinus Torvalds #define USB_STORAGE "usb-storage: "
481da177e4SLinus Torvalds 
491da177e4SLinus Torvalds #ifdef CONFIG_USB_STORAGE_DEBUG
501da177e4SLinus Torvalds void usb_stor_show_command(struct scsi_cmnd *srb);
511da177e4SLinus Torvalds void usb_stor_show_sense( unsigned char key,
521da177e4SLinus Torvalds 		unsigned char asc, unsigned char ascq );
53*75b9130eSJoe Perches __printf(1, 2) int usb_stor_dbg(const char *fmt, ...);
54*75b9130eSJoe Perches 
55*75b9130eSJoe Perches #define US_DEBUGP(fmt, ...)	usb_stor_dbg(fmt, ##__VA_ARGS__)
56*75b9130eSJoe Perches #define US_DEBUGPX(fmt, ...)	printk(fmt, ##__VA_ARGS__)
571da177e4SLinus Torvalds #define US_DEBUG(x)		x
581da177e4SLinus Torvalds #else
59*75b9130eSJoe Perches #define US_DEBUGP(fmt, ...)					\
60*75b9130eSJoe Perches 	do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
61*75b9130eSJoe Perches #define US_DEBUGPX(fmt, ...)					\
62*75b9130eSJoe Perches 	do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
631da177e4SLinus Torvalds #define US_DEBUG(x)
641da177e4SLinus Torvalds #endif
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds #endif
67