lkml.org 
[lkml]   [2016]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] usb: storage: remove the US_DEBUG macro
Get rid of the US_DEBUG macro and use instead empty inline function definitions
when CONFIG_USB_STORAGE_DEBUG is not defined

Signed-off-by: Victor Dodon <dodonvictor@gmail.com>
---
drivers/usb/storage/debug.h | 18 +++++++++++++++---
drivers/usb/storage/ene_ub6250.c | 1 -
drivers/usb/storage/freecom.c | 12 ++++++++----
drivers/usb/storage/transport.c | 2 --
drivers/usb/storage/usb.c | 2 +-
5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h
index 6b365ce..50070f0 100644
--- a/drivers/usb/storage/debug.h
+++ b/drivers/usb/storage/debug.h
@@ -52,9 +52,22 @@ void usb_stor_show_sense(const struct us_data *us, unsigned char key,
unsigned char asc, unsigned char ascq);
__printf(2, 3) void usb_stor_dbg(const struct us_data *us,
const char *fmt, ...);
-
-#define US_DEBUG(x) x
#else
+static inline void _usb_stor_show_command(const struct us_data *us,
+ struct scsi_cmnd *srb)
+{
+}
+#define usb_stor_show_command(us, srb) \
+ do { if (0) _usb_stor_show_command(us, srb); } while (0)
+
+static inline void _usb_stor_show_sense(const struct us_data *us,
+ unsigned char key, unsigned char asc,
+ unsigned char ascq)
+{
+}
+#define usb_stor_show_sense(us, key, asc, ascq) \
+ do { if (0) _usb_stor_show_sense(us, key, asc, ascq); } while 0
+
__printf(2, 3)
static inline void _usb_stor_dbg(const struct us_data *us,
const char *fmt, ...)
@@ -62,7 +75,6 @@ static inline void _usb_stor_dbg(const struct us_data *us,
}
#define usb_stor_dbg(us, fmt, ...) \
do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0)
-#define US_DEBUG(x)
#endif

#endif
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index f3cf4ce..73cfd84 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -2296,7 +2296,6 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us)
int result = 0;
struct ene_ub6250_info *info = (struct ene_ub6250_info *)(us->extra);

- /*US_DEBUG(usb_stor_show_command(us, srb)); */
scsi_set_resid(srb, 0);
if (unlikely(!(info->SD_Status.Ready || info->MS_Status.Ready))) {
result = ene_init(us);
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 3f2b089..9c37175 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -44,6 +44,10 @@ MODULE_LICENSE("GPL");

#ifdef CONFIG_USB_STORAGE_DEBUG
static void pdump(struct us_data *us, void *ibuffer, int length);
+#else
+static inline void pdump(struct us_data *us, void *ibuffer, int length)
+{
+}
#endif

/* Bits of HD_STATUS */
@@ -245,7 +249,7 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
memcpy (fcb->Atapi, srb->cmnd, 12);
memset (fcb->Filler, 0, sizeof (fcb->Filler));

- US_DEBUG(pdump(us, srb->cmnd, 12));
+ pdump(us, srb->cmnd, 12);

/* Send it out. */
result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
@@ -267,7 +271,7 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

- US_DEBUG(pdump(us, (void *)fst, partial));
+ pdump(us, (void *)fst, partial);

/* The firmware will time-out commands after 20 seconds. Some commands
* can legitimately take longer than this, so we use a different
@@ -308,7 +312,7 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

- US_DEBUG(pdump(us, (void *)fst, partial));
+ pdump(us, (void *)fst, partial);
}

if (partial != 4)
@@ -365,7 +369,7 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
usb_stor_dbg(us, "Waiting for status\n");
result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial);
- US_DEBUG(pdump(us, (void *)fst, partial));
+ pdump(us, (void *)fst, partial);

if (partial != 4 || result > USB_STOR_XFER_SHORT)
return USB_STOR_TRANSPORT_ERROR;
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 5e67f63..2f883a8 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -784,9 +784,7 @@ Retry_Sense:
usb_stor_dbg(us, "-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n",
sshdr.response_code, sshdr.sense_key,
sshdr.asc, sshdr.ascq);
-#ifdef CONFIG_USB_STORAGE_DEBUG
usb_stor_show_sense(us, sshdr.sense_key, sshdr.asc, sshdr.ascq);
-#endif

/* set the result so the higher layers expect this data */
srb->result = SAM_STAT_CHECK_CONDITION;
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 43576ed..f0d0a90 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -377,7 +377,7 @@ static int usb_stor_control_thread(void * __us)

/* we've got a command, let's do it! */
else {
- US_DEBUG(usb_stor_show_command(us, us->srb));
+ usb_stor_show_command(us, us->srb);
us->proto_handler(us->srb, us);
usb_mark_last_busy(us->pusb_dev);
}
--
1.9.1
\
 
 \ /
  Last update: 2016-02-18 09:41    [W:0.151 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site