xref: /openbmc/linux/drivers/usb/storage/debug.h (revision 59b4e0cd)
159b4e0cdSNishad Kamdar /* SPDX-License-Identifier: GPL-2.0+ */
2f0183a33SFelipe Balbi /*
3f0183a33SFelipe Balbi  * Driver for USB Mass Storage compliant devices
41da177e4SLinus Torvalds  * Debugging Functions Header File
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * Current development and maintenance by:
71da177e4SLinus Torvalds  *   (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Initial work by:
101da177e4SLinus Torvalds  *   (c) 1999 Michael Gee (michael@linuxspecific.com)
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  * This driver is based on the 'USB Mass Storage Class' document. This
131da177e4SLinus Torvalds  * describes in detail the protocol used to communicate with such
141da177e4SLinus Torvalds  * devices.  Clearly, the designers had SCSI and ATAPI commands in
151da177e4SLinus Torvalds  * mind when they created this document.  The commands are all very
161da177e4SLinus Torvalds  * similar to commands in the SCSI-II and ATAPI specifications.
171da177e4SLinus Torvalds  *
181da177e4SLinus Torvalds  * It is important to note that in a number of cases this class
191da177e4SLinus Torvalds  * exhibits class-specific exemptions from the USB specification.
201da177e4SLinus Torvalds  * Notably the usage of NAK, STALL and ACK differs from the norm, in
211da177e4SLinus Torvalds  * that they are used to communicate wait, failed and OK on commands.
221da177e4SLinus Torvalds  *
231da177e4SLinus Torvalds  * Also, for certain devices, the interrupt endpoint is used to convey
241da177e4SLinus Torvalds  * status of a command.
251da177e4SLinus Torvalds  */
261da177e4SLinus Torvalds 
271da177e4SLinus Torvalds #ifndef _DEBUG_H_
281da177e4SLinus Torvalds #define _DEBUG_H_
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds #include <linux/kernel.h>
311da177e4SLinus Torvalds 
321da177e4SLinus Torvalds #ifdef CONFIG_USB_STORAGE_DEBUG
33191648d0SJoe Perches void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb);
34191648d0SJoe Perches void usb_stor_show_sense(const struct us_data *us, unsigned char key,
351da177e4SLinus Torvalds 			 unsigned char asc, unsigned char ascq);
36e5283626SJoe Perches __printf(2, 3) void usb_stor_dbg(const struct us_data *us,
37191648d0SJoe Perches 				 const char *fmt, ...);
3875b9130eSJoe Perches 
391da177e4SLinus Torvalds #define US_DEBUG(x)		x
401da177e4SLinus Torvalds #else
41191648d0SJoe Perches __printf(2, 3)
_usb_stor_dbg(const struct us_data * us,const char * fmt,...)42e5283626SJoe Perches static inline void _usb_stor_dbg(const struct us_data *us,
43e5283626SJoe Perches 				 const char *fmt, ...)
44e5283626SJoe Perches {
45e5283626SJoe Perches }
46191648d0SJoe Perches #define usb_stor_dbg(us, fmt, ...)				\
47191648d0SJoe Perches 	do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0)
481da177e4SLinus Torvalds #define US_DEBUG(x)
491da177e4SLinus Torvalds #endif
501da177e4SLinus Torvalds 
511da177e4SLinus Torvalds #endif
52