Skip to contentSkip to conversation

Staging: rts5208: Use standard debug features

PATCH Superseded Fabio Falzoi 3 participants 9 messages Jul 8, 2014 – Jul 9, 2014 Staging

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover Staging: rts5208: Use standard debug features

Use standard debug features instead of relying on the custom configuration option CONFIG_RTS5208_DEBUG and a series of home grown macros.

Changes in v3:
* defined rtsx_hex_dump as a static inline function to avoid checkpatch errors

Changes in v2:
* defined rtsx_hex_dump macro to produce output only if DEBUG is defined

Fabio Falzoi (4):
Staging: rts5208: Replace custom macro with pr_debug
Staging: rts5208: Replace custom macro with print_hex_dump_bytes
Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
Staging: rts5208: Fix a format specifier for dev_err

 drivers/staging/rts5208/Kconfig          |   7 --
 drivers/staging/rts5208/debug.h          |  43 -------
 drivers/staging/rts5208/ms.c             | 144 ++++++++++++------------
 drivers/staging/rts5208/rtsx.c           |   8 +-
 drivers/staging/rts5208/rtsx.h           |   1 -
 drivers/staging/rts5208/rtsx_card.c      |  72 ++++++------
 drivers/staging/rts5208/rtsx_card.h      |   1 -
 drivers/staging/rts5208/rtsx_chip.c      | 134 +++++++++++-----------
 drivers/staging/rts5208/rtsx_scsi.c      |  45 ++++----
 drivers/staging/rts5208/rtsx_transport.c |  45 ++++----
 drivers/staging/rts5208/sd.c             | 186 +++++++++++++++----------------
 drivers/staging/rts5208/spi.c            |   8 +-
 drivers/staging/rts5208/trace.h          |  15 ++-
 drivers/staging/rts5208/xd.c             | 121 ++++++++++----------
 14 files changed, 393 insertions(+), 437 deletions(-)
 delete mode 100644 drivers/staging/rts5208/debug.h
Signature · 1 line
2.0.0
#1 lore raw

PATCH v3 1/4 Staging: rts5208: Replace custom macro with pr_debug

Use pr_debug macro to control tracing verbosity through dynamic debug facility.

---
 drivers/staging/rts5208/debug.h          |  43 --------
 drivers/staging/rts5208/ms.c             | 140 ++++++++++++------------
 drivers/staging/rts5208/rtsx.c           |   4 +-
 drivers/staging/rts5208/rtsx.h           |   1 -
 drivers/staging/rts5208/rtsx_card.c      |  72 +++++++------
 drivers/staging/rts5208/rtsx_card.h      |   1 -
 drivers/staging/rts5208/rtsx_chip.c      | 130 +++++++++++------------
 drivers/staging/rts5208/rtsx_scsi.c      |  42 ++++----
 drivers/staging/rts5208/rtsx_transport.c |  45 ++++----
 drivers/staging/rts5208/sd.c             | 177 ++++++++++++++++---------------
 drivers/staging/rts5208/spi.c            |   8 +-
 drivers/staging/rts5208/trace.h          |   8 +-
 drivers/staging/rts5208/xd.c             | 121 ++++++++++-----------
 13 files changed, 380 insertions(+), 412 deletions(-)
 delete mode 100644 drivers/staging/rts5208/debug.h
drivers/staging/rts5208/debug.h deleted +0 -43
deleted file mode 100644
index 5ba8a3a..0000000
@@ -1,43 +0,0 @@
-/* Driver for Realtek PCI-Express card reader
- * Header file
- *
- * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Author:
- *   Wei WANG ([email protected])
- *   Micky Ching ([email protected])
- */
-
-#ifndef __REALTEK_RTSX_DEBUG_H
-#define __REALTEK_RTSX_DEBUG_H
-
-#include <linux/kernel.h>
-
-#define RTSX_STOR "rts5208: "
-
-#ifdef CONFIG_RTS5208_DEBUG
-#define RTSX_DEBUGP(x...) pr_debug(RTSX_STOR x)
-#define RTSX_DEBUGPN(x...) pr_debug(x)
-#define RTSX_DEBUGPX(x...) printk(x)
-#define RTSX_DEBUG(x) x
-#else
-#define RTSX_DEBUGP(x...)
-#define RTSX_DEBUGPN(x...)
-#define RTSX_DEBUGPX(x...)
-#define RTSX_DEBUG(x)
-#endif
-
-#endif   /* __REALTEK_RTSX_DEBUG_H */
drivers/staging/rts5208/ms.c +71 -69

451 lines not on this page · raw message

drivers/staging/rts5208/rtsx.c +2 -2
index c0a0e60..4f5f7a3 100644
@@ -478,7 +478,7 @@ static int rtsx_control_thread(void *__dev)
 
 		/* we've got a command, let's do it! */
 		else {
-			RTSX_DEBUG(scsi_show_command(chip->srb));
+			scsi_show_command(chip->srb);
 			rtsx_invoke_transport(chip->srb, chip);
 		}
 
@@ -864,7 +864,7 @@ static int rtsx_probe(struct pci_dev *pci,
 	int err = 0;
 	struct task_struct *th;
 
-	RTSX_DEBUGP("Realtek PCI-E card reader detected\n");
+	pr_debug("Realtek PCI-E card reader detected\n");
 
 	err = pci_enable_device(pci);
 	if (err < 0) {
drivers/staging/rts5208/rtsx.h +0 -1
index 37eab56..9e6ecb7 100644
@@ -46,7 +46,6 @@
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_host.h>
 
-#include "debug.h"
 #include "trace.h"
 #include "general.h"
 
drivers/staging/rts5208/rtsx_card.c +37 -35

245 lines not on this page · raw message

drivers/staging/rts5208/rtsx_card.h +0 -1
index 4528b61..b19239e 100644
@@ -24,7 +24,6 @@
 #ifndef __REALTEK_RTSX_CARD_H
 #define __REALTEK_RTSX_CARD_H
 
-#include "debug.h"
 #include "rtsx.h"
 #include "rtsx_chip.h"
 #include "rtsx_transport.h"
drivers/staging/rts5208/rtsx_chip.c +65 -65

389 lines not on this page · raw message

drivers/staging/rts5208/rtsx_scsi.c +22 -20

142 lines not on this page · raw message

drivers/staging/rts5208/rtsx_transport.c +23 -22

135 lines not on this page · raw message

drivers/staging/rts5208/sd.c +89 -88

532 lines not on this page · raw message

drivers/staging/rts5208/spi.c +5 -3
index 312b9f9..7876dc0 100644
@@ -20,6 +20,8 @@
  *   Micky Ching ([email protected])
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/blkdev.h>
 #include <linux/kthread.h>
 #include <linux/sched.h>
@@ -409,7 +411,7 @@ int spi_get_status(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 {
 	struct spi_info *spi = &(chip->spi);
 
-	RTSX_DEBUGP("spi_get_status: err_code = 0x%x\n", spi->err_code);
+	pr_debug("spi_get_status: err_code = 0x%x\n", spi->err_code);
 	rtsx_stor_set_xfer_buf(&(spi->err_code),
 			min_t(int, scsi_bufflen(srb), 1), srb);
 	scsi_set_resid(srb, scsi_bufflen(srb) - 1);
@@ -431,8 +433,8 @@ int spi_set_parameter(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	spi->clk_div = ((u16)(srb->cmnd[4]) << 8) | srb->cmnd[5];
 	spi->write_en = srb->cmnd[6];
 
-	RTSX_DEBUGP("spi_set_parameter: spi_clock = %d, clk_div = %d, write_en = %d\n",
-		     spi->spi_clock, spi->clk_div, spi->write_en);
+	pr_debug("spi_set_parameter: spi_clock = %d, clk_div = %d, write_en = %d\n",
+		 spi->spi_clock, spi->clk_div, spi->write_en);
 
 	return STATUS_SUCCESS;
 }
drivers/staging/rts5208/trace.h +4 -4
index 0f177fb..7fcb459 100644
@@ -49,7 +49,7 @@ static inline char *filename(char *path)
 #define TRACE_RET(chip, ret)						\
 	do {								\
 		char *_file = filename(__FILE__);			\
-		RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
+		pr_debug("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
 		(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
 		strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \
 		strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \
@@ -65,7 +65,7 @@ static inline char *filename(char *path)
 #define TRACE_GOTO(chip, label)						\
 	do {								\
 		char *_file = filename(__FILE__);			\
-		RTSX_DEBUGP("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
+		pr_debug("[%s][%s]:[%d]\n", _file, __func__, __LINE__); \
 		(chip)->trace_msg[(chip)->msg_idx].line = (u16)(__LINE__); \
 		strncpy((chip)->trace_msg[(chip)->msg_idx].func, __func__, MSG_FUNC_LEN-1); \
 		strncpy((chip)->trace_msg[(chip)->msg_idx].file, _file, MSG_FILE_LEN-1); \
@@ -84,8 +84,8 @@ static inline char *filename(char *path)
 
 #ifdef CONFIG_RTS5208_DEBUG
 #define RTSX_DUMP(buf, buf_len)					\
-	print_hex_dump(KERN_DEBUG, RTSX_STOR, DUMP_PREFIX_NONE,	\
-				16, 1, (buf), (buf_len), false)
+	print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": ",		\
+		       DUMP_PREFIX_NONE, 16, 1, (buf), (buf_len), false)
 #else
 #define RTSX_DUMP(buf, buf_len)
 #endif
drivers/staging/rts5208/xd.c +62 -59

353 lines not on this page · raw message

Signature · 1 line
2.0.0
maintainer
#2 lore raw

Re: [PATCH v3 1/4] Staging: rts5208: Replace custom macro with pr_debug

Quoted 1 line · Fabio Falzoi

Use pr_debug macro to control tracing verbosity through dynamic debug facility.

For almost all of these, you should use dev_dbg() instead, as you have access to a struct device (well, you should have, you might have to dig for it...)

thanks,

greg k-h

#3 lore raw

PATCH v3 2/4 Staging: rts5208: Replace custom macro with print_hex_dump_bytes

In reply to Fabio Falzoi

Use print_hex_dump_bytes to have memory properly dumped only when DEBUG is defined.

---
 drivers/staging/rts5208/ms.c        |  4 ++--
 drivers/staging/rts5208/rtsx_chip.c |  4 ++--
 drivers/staging/rts5208/rtsx_scsi.c |  9 ++++-----
 drivers/staging/rts5208/sd.c        |  6 +++---
 drivers/staging/rts5208/trace.h     | 11 +++++------
 5 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/rts5208/ms.c +2 -2
index 2476d22..0a33043 100644
@@ -307,7 +307,7 @@ static int ms_read_bytes(struct rtsx_chip *chip,
 
 	if ((tpc == PRO_READ_SHORT_DATA) && (data_len == 8)) {
 		pr_debug("Read format progress:\n");
-		RTSX_DUMP(ptr, cnt);
+		rtsx_hex_dump(ptr, cnt);
 	}
 
 	return STATUS_SUCCESS;
@@ -1910,7 +1910,7 @@ RE_SEARCH:
 	ptr = rtsx_get_cmd_data(chip);
 
 	pr_debug("Boot block data:\n");
-	RTSX_DUMP(ptr, 16);
+	rtsx_hex_dump(ptr, 16);
 
 	/* Block ID error
 	 * HEADER_ID0, HEADER_ID1
drivers/staging/rts5208/rtsx_chip.c +2 -2
index 8f447ef..761e83c 100644
@@ -1299,8 +1299,8 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
 		}
 	}
 
-	RTSX_DUMP(mask, dw_len * 4);
-	RTSX_DUMP(data, dw_len * 4);
+	rtsx_hex_dump(mask, dw_len * 4);
+	rtsx_hex_dump(data, dw_len * 4);
 
 	for (i = 0; i < dw_len; i++) {
 		retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
drivers/staging/rts5208/rtsx_scsi.c +4 -5
index fd3c2e7..8269a02 100644
@@ -40,7 +40,8 @@
 void scsi_show_command(struct scsi_cmnd *srb)
 {
 	char *what = NULL;
-	int i, unknown_cmd = 0;
+	int unknown_cmd = 0;
+	size_t len;
 
 	switch (srb->cmnd[0]) {
 	case TEST_UNIT_READY:
@@ -319,10 +320,8 @@ void scsi_show_command(struct scsi_cmnd *srb)
 		pr_debug("Command %s (%d bytes)\n", what, srb->cmd_len);
 
 	if (unknown_cmd) {
-		pr_debug("");
-		for (i = 0; i < srb->cmd_len && i < 16; i++)
-			pr_debug(" %02x", srb->cmnd[i]);
-		pr_debug("\n");
+		len = min_t(size_t, srb->cmd_len, 16);
+		rtsx_hex_dump(srb->cmnd, len);
 	}
 }
 
drivers/staging/rts5208/sd.c +3 -3
index 96acd39..2f50f9c 100644
@@ -426,7 +426,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp)
 	memcpy(sd_card->raw_csd, rsp + 1, 15);
 
 	pr_debug("CSD Response:\n");
-	RTSX_DUMP(sd_card->raw_csd, 16);
+	rtsx_hex_dump(sd_card->raw_csd, 16);
 
 	csd_ver = (rsp[1] & 0xc0) >> 6;
 	pr_debug("csd_ver = %d\n", csd_ver);
@@ -1059,7 +1059,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode,
 		TRACE_RET(chip, STATUS_FAIL);
 	}
 
-	RTSX_DUMP(buf, 64);
+	rtsx_hex_dump(buf, 64);
 
 	if (func_group == NO_ARGUMENT) {
 		sd_card->func_group1_mask = buf[0x0D];
@@ -2107,7 +2107,7 @@ static int sd_check_wp_state(struct rtsx_chip *chip)
 	}
 
 	pr_debug("ACMD13:\n");
-	RTSX_DUMP(buf, 64);
+	rtsx_hex_dump(buf, 64);
 
 	sd_card_type = ((u16)buf[2] << 8) | buf[3];
 	pr_debug("sd_card_type = 0x%04x\n", sd_card_type);
drivers/staging/rts5208/trace.h +5 -6
index 7fcb459..6a85415 100644
@@ -82,12 +82,11 @@ static inline char *filename(char *path)
 #define TRACE_GOTO(chip, label)	goto label
 #endif
 
-#ifdef CONFIG_RTS5208_DEBUG
-#define RTSX_DUMP(buf, buf_len)					\
-	print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": ",		\
-		       DUMP_PREFIX_NONE, 16, 1, (buf), (buf_len), false)
-#else
-#define RTSX_DUMP(buf, buf_len)
+static inline void rtsx_hex_dump(const void *buf, size_t len)
+{
+#ifdef DEBUG
+	print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, buf, len);
 #endif
+}
 
 #endif  /* __REALTEK_RTSX_TRACE_H */
Signature · 1 line
2.0.0
maintainer
#4 lore raw

Re: [PATCH v3 2/4] Staging: rts5208: Replace custom macro with print_hex_dump_bytes

Quoted 117 lines · Fabio Falzoi

Use print_hex_dump_bytes to have memory properly dumped only when DEBUG is defined.

---
 drivers/staging/rts5208/ms.c        |  4 ++--
 drivers/staging/rts5208/rtsx_chip.c |  4 ++--
 drivers/staging/rts5208/rtsx_scsi.c |  9 ++++-----
 drivers/staging/rts5208/sd.c        |  6 +++---
 drivers/staging/rts5208/trace.h     | 11 +++++------
 5 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/rts5208/ms.c +2 -2
index 2476d22..0a33043 100644
@@ -307,7 +307,7 @@ static int ms_read_bytes(struct rtsx_chip *chip,
 
 	if ((tpc == PRO_READ_SHORT_DATA) && (data_len == 8)) {
 		pr_debug("Read format progress:\n");
-		RTSX_DUMP(ptr, cnt);
+		rtsx_hex_dump(ptr, cnt);
 	}
 
 	return STATUS_SUCCESS;
@@ -1910,7 +1910,7 @@ RE_SEARCH:
 	ptr = rtsx_get_cmd_data(chip);
 
 	pr_debug("Boot block data:\n");
-	RTSX_DUMP(ptr, 16);
+	rtsx_hex_dump(ptr, 16);
 
 	/* Block ID error
 	 * HEADER_ID0, HEADER_ID1
drivers/staging/rts5208/rtsx_chip.c +2 -2
index 8f447ef..761e83c 100644
@@ -1299,8 +1299,8 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
 		}
 	}
 
-	RTSX_DUMP(mask, dw_len * 4);
-	RTSX_DUMP(data, dw_len * 4);
+	rtsx_hex_dump(mask, dw_len * 4);
+	rtsx_hex_dump(data, dw_len * 4);
 
 	for (i = 0; i < dw_len; i++) {
 		retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
drivers/staging/rts5208/rtsx_scsi.c +4 -5
index fd3c2e7..8269a02 100644
@@ -40,7 +40,8 @@
 void scsi_show_command(struct scsi_cmnd *srb)
 {
 	char *what = NULL;
-	int i, unknown_cmd = 0;
+	int unknown_cmd = 0;
+	size_t len;
 
 	switch (srb->cmnd[0]) {
 	case TEST_UNIT_READY:
@@ -319,10 +320,8 @@ void scsi_show_command(struct scsi_cmnd *srb)
 		pr_debug("Command %s (%d bytes)\n", what, srb->cmd_len);
 
 	if (unknown_cmd) {
-		pr_debug("");
-		for (i = 0; i < srb->cmd_len && i < 16; i++)
-			pr_debug(" %02x", srb->cmnd[i]);
-		pr_debug("\n");
+		len = min_t(size_t, srb->cmd_len, 16);
+		rtsx_hex_dump(srb->cmnd, len);
 	}
 }
 
drivers/staging/rts5208/sd.c +3 -3
index 96acd39..2f50f9c 100644
@@ -426,7 +426,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp)
 	memcpy(sd_card->raw_csd, rsp + 1, 15);
 
 	pr_debug("CSD Response:\n");
-	RTSX_DUMP(sd_card->raw_csd, 16);
+	rtsx_hex_dump(sd_card->raw_csd, 16);
 
 	csd_ver = (rsp[1] & 0xc0) >> 6;
 	pr_debug("csd_ver = %d\n", csd_ver);
@@ -1059,7 +1059,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode,
 		TRACE_RET(chip, STATUS_FAIL);
 	}
 
-	RTSX_DUMP(buf, 64);
+	rtsx_hex_dump(buf, 64);
 
 	if (func_group == NO_ARGUMENT) {
 		sd_card->func_group1_mask = buf[0x0D];
@@ -2107,7 +2107,7 @@ static int sd_check_wp_state(struct rtsx_chip *chip)
 	}
 
 	pr_debug("ACMD13:\n");
-	RTSX_DUMP(buf, 64);
+	rtsx_hex_dump(buf, 64);
 
 	sd_card_type = ((u16)buf[2] << 8) | buf[3];
 	pr_debug("sd_card_type = 0x%04x\n", sd_card_type);
drivers/staging/rts5208/trace.h +0 -2
index 7fcb459..6a85415 100644
@@ -82,12 +82,11 @@ static inline char *filename(char *path)
 #define TRACE_GOTO(chip, label)	goto label
 #endif
 
-#ifdef CONFIG_RTS5208_DEBUG
-#define RTSX_DUMP(buf, buf_len)					\

drivers/staging/rts5208/trace.h static inline char *filename(char *path) · line 90

Quoted 10 lines
drivers/staging/rts5208/trace.h +5 -4
-	print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": ",		\
-		       DUMP_PREFIX_NONE, 16, 1, (buf), (buf_len), false)
-#else
-#define RTSX_DUMP(buf, buf_len)
+static inline void rtsx_hex_dump(const void *buf, size_t len)
+{
+#ifdef DEBUG
+	print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, buf, len);
 #endif
+}

What a mess. What's wrong with just using the %*ph modifier in dev_dbg() like other drivers do?

thanks,

greg k-h

#5 lore raw

Re: [PATCH v3 2/4] Staging: rts5208: Replace custom macro with print_hex_dump_bytes

Quoted 3 lines · Greg KH
Quoted 2 lines · Fabio Falzoi

Use print_hex_dump_bytes to have memory properly dumped only when DEBUG is defined.

[]

Quoted 1 line

drivers/staging/rts5208/trace.h

Quoted 1 line
drivers/staging/rts5208/trace.h +0 -0

[]

Quoted 1 line

drivers/staging/rts5208/trace.h static inline char *filename(char *path)

Quoted 1 line
drivers/staging/rts5208/trace.h +0 -0
@@ -82,12 +82,11 @@ static inline char *filename(char *path)

[]

Quoted 9 lines

drivers/staging/rts5208/trace.h static inline char *filename(char *path) · line 90

Quoted 6 lines
drivers/staging/rts5208/trace.h +5 -0
+static inline void rtsx_hex_dump(const void *buf, size_t len)
+{
+#ifdef DEBUG
+	print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, buf, len);
 #endif
+}

What a mess. What's wrong with just using the %*ph modifier in dev_dbg() like other drivers do?

Dunno.
Is it ever desired to emit more than 64 bytes of buf?

maintainer
#6 lore raw

Re: [PATCH v3 2/4] Staging: rts5208: Replace custom macro with print_hex_dump_bytes

Quoted 19 lines · Joe Perches
Quoted 3 lines · Greg KH
Quoted 2 lines · Fabio Falzoi

Use print_hex_dump_bytes to have memory properly dumped only when DEBUG is defined.

[]

Quoted 1 line

drivers/staging/rts5208/trace.h

Quoted 1 line
drivers/staging/rts5208/trace.h +0 -0

[]

Quoted 1 line

drivers/staging/rts5208/trace.h static inline char *filename(char *path)

Quoted 1 line
drivers/staging/rts5208/trace.h +0 -0
@@ -82,12 +82,11 @@ static inline char *filename(char *path)

[]

Quoted 9 lines

drivers/staging/rts5208/trace.h static inline char *filename(char *path) · line 90

Quoted 6 lines
drivers/staging/rts5208/trace.h +5 -0
+static inline void rtsx_hex_dump(const void *buf, size_t len)
+{
+#ifdef DEBUG
+	print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, buf, len);
 #endif
+}

What a mess. What's wrong with just using the %*ph modifier in dev_dbg() like other drivers do?

Quoted 2 lines

Dunno.
Is it ever desired to emit more than 64 bytes of buf?

I doubt it really matters :)

#7 lore raw

PATCH v3 3/4 Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option

In reply to Fabio Falzoi

CONFIG_RTS5208_DEBUG is no more needed, we rely on dynamic debug config options instead.

---
 drivers/staging/rts5208/Kconfig | 7 -------
 drivers/staging/rts5208/sd.c    | 5 +----
 2 files changed, 1 insertion(+), 11 deletions(-)
drivers/staging/rts5208/Kconfig +0 -7
index 055655c..05c990f 100644
@@ -6,10 +6,3 @@ config RTS5208
 	  PCI-E card reader rts5208/rts5288.
 
 	  If this driver is compiled as a module, it will be named rts5208.
-
-config RTS5208_DEBUG
-	bool "Realtek PCI-E Card Reader RTS5208/5288 verbose debug"
-	depends on RTS5208
-	help
-	  Say Y here in order to have the rts5208 code generate
-	  verbose debugging messages.
drivers/staging/rts5208/sd.c +1 -4
index 2f50f9c..4b51ee4 100644
@@ -811,12 +811,10 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
 			PHASE_NOT_RESET);
 		RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0);
 	} else {
-#ifdef CONFIG_RTS5208_DEBUG
 		rtsx_read_register(chip, SD_VP_CTL, &val);
 		pr_debug("SD_VP_CTL: 0x%x\n", val);
 		rtsx_read_register(chip, SD_DCMPS_CTL, &val);
 		pr_debug("SD_DCMPS_CTL: 0x%x\n", val);
-#endif
 
 		if (ddr_rx) {
 			RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE,
@@ -862,12 +860,11 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
 	return STATUS_SUCCESS;
 
 Fail:
-#ifdef CONFIG_RTS5208_DEBUG
 	rtsx_read_register(chip, SD_VP_CTL, &val);
 	pr_debug("SD_VP_CTL: 0x%x\n", val);
 	rtsx_read_register(chip, SD_DCMPS_CTL, &val);
 	pr_debug("SD_DCMPS_CTL: 0x%x\n", val);
-#endif
+
 	rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0);
 	rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0);
 	wait_timeout(10);
Signature · 1 line
2.0.0
#8 lore raw

PATCH v3 4/4 Staging: rts5208: Fix a format specifier for dev_err

In reply to Fabio Falzoi

Fix an incorrect use of the %d format specifier in dev_err that caused a warning.

---
 drivers/staging/rts5208/rtsx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/rtsx.c +2 -2
index 4f5f7a3..9aae7ac 100644
@@ -463,14 +463,14 @@ static int rtsx_control_thread(void *__dev)
 		 * the maximum known LUN
 		 */
 		else if (chip->srb->device->id) {
-			dev_err(&dev->pci->dev, "Bad target number (%d:%d)\n",
+			dev_err(&dev->pci->dev, "Bad target number (%d:%llu)\n",
 				chip->srb->device->id,
 				chip->srb->device->lun);
 			chip->srb->result = DID_BAD_TARGET << 16;
 		}
 
 		else if (chip->srb->device->lun > chip->max_lun) {
-			dev_err(&dev->pci->dev, "Bad LUN (%d:%d)\n",
+			dev_err(&dev->pci->dev, "Bad LUN (%d:%llu)\n",
 				chip->srb->device->id,
 				chip->srb->device->lun);
 			chip->srb->result = DID_BAD_TARGET << 16;
Signature · 1 line
2.0.0