* [PATCH v6 0/2] Staging: rts5208: Use standard debug features
@ 2014-08-05 21:24 Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 1/2] Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 2/2] Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option Fabio Falzoi
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Falzoi @ 2014-08-05 21:24 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, micky_ching, wei_wang, joe, Fabio Falzoi
Use standard debug features instead of relying on the custom
configuration option CONFIG_RTS5208_DEBUG and a series of home grown
macros.
This new version contains the remaining two chunks of the v5 patchset:
the first two chunks have already been merged.
Changes in v6:
* Use print_hex_dump_bytes in place of dev_dbg to dump buffer potentially
larger than 64 bytes.
Changes in v5:
* remove useless prints used just to mark when entering a function
(we should prefer ftrace for that)
Changes in v4:
* use dev_dbg instead of pr_debug
* use dev_dbg with %*ph modifier instead of print_hex_dump_bytes
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 (2):
Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory
Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
drivers/staging/rts5208/Kconfig | 7 -------
drivers/staging/rts5208/ms.c | 5 +++--
drivers/staging/rts5208/rtsx_chip.c | 6 ++++--
drivers/staging/rts5208/rtsx_scsi.c | 7 +++----
drivers/staging/rts5208/sd.c | 11 ++++-------
drivers/staging/rts5208/trace.h | 8 --------
6 files changed, 14 insertions(+), 30 deletions(-)
--
2.0.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v6 1/2] Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory
2014-08-05 21:24 [PATCH v6 0/2] Staging: rts5208: Use standard debug features Fabio Falzoi
@ 2014-08-05 21:24 ` Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 2/2] Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option Fabio Falzoi
1 sibling, 0 replies; 3+ messages in thread
From: Fabio Falzoi @ 2014-08-05 21:24 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, micky_ching, wei_wang, joe, Fabio Falzoi
Use dev_dbg with %*ph format specifier and print_hex_dump_bytes to dump memory
instead of relying on custom macro.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5208/ms.c | 5 +++--
drivers/staging/rts5208/rtsx_chip.c | 6 ++++--
drivers/staging/rts5208/rtsx_scsi.c | 7 +++----
drivers/staging/rts5208/sd.c | 6 +++---
drivers/staging/rts5208/trace.h | 8 --------
5 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 390b1f8..db8e221 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -305,7 +305,8 @@ static int ms_read_bytes(struct rtsx_chip *chip,
if ((tpc == PRO_READ_SHORT_DATA) && (data_len == 8)) {
dev_dbg(rtsx_dev(chip), "Read format progress:\n");
- RTSX_DUMP(ptr, cnt);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, ptr,
+ cnt);
}
return STATUS_SUCCESS;
@@ -1913,7 +1914,7 @@ RE_SEARCH:
ptr = rtsx_get_cmd_data(chip);
dev_dbg(rtsx_dev(chip), "Boot block data:\n");
- RTSX_DUMP(ptr, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 16, ptr);
/* Block ID error
* HEADER_ID0, HEADER_ID1
diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index fe98309..1db534a 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -1309,8 +1309,10 @@ 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);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, mask,
+ dw_len * 4);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, data,
+ dw_len * 4);
for (i = 0; i < dw_len; i++) {
retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
index 5f5f512..7e6c7c04 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -39,7 +39,7 @@ void scsi_show_command(struct rtsx_chip *chip)
{
struct scsi_cmnd *srb = chip->srb;
char *what = NULL;
- int i, unknown_cmd = 0;
+ int unknown_cmd = 0, len;
switch (srb->cmnd[0]) {
case TEST_UNIT_READY:
@@ -319,9 +319,8 @@ void scsi_show_command(struct rtsx_chip *chip)
what, srb->cmd_len);
if (unknown_cmd) {
- for (i = 0; i < srb->cmd_len && i < 16; i++)
- dev_dbg(rtsx_dev(chip), " %02x", srb->cmnd[i]);
- dev_dbg(rtsx_dev(chip), "\n");
+ len = min_t(unsigned short, srb->cmd_len, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", len, srb->cmnd);
}
}
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index c79bea8..06c96d5 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -427,7 +427,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp)
memcpy(sd_card->raw_csd, rsp + 1, 15);
dev_dbg(rtsx_dev(chip), "CSD Response:\n");
- RTSX_DUMP(sd_card->raw_csd, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 16, sd_card->raw_csd);
csd_ver = (rsp[1] & 0xc0) >> 6;
dev_dbg(rtsx_dev(chip), "csd_ver = %d\n", csd_ver);
@@ -1060,7 +1060,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode,
TRACE_RET(chip, STATUS_FAIL);
}
- RTSX_DUMP(buf, 64);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf);
if (func_group == NO_ARGUMENT) {
sd_card->func_group1_mask = buf[0x0D];
@@ -2119,7 +2119,7 @@ static int sd_check_wp_state(struct rtsx_chip *chip)
}
dev_dbg(rtsx_dev(chip), "ACMD13:\n");
- RTSX_DUMP(buf, 64);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf);
sd_card_type = ((u16)buf[2] << 8) | buf[3];
dev_dbg(rtsx_dev(chip), "sd_card_type = 0x%04x\n", sd_card_type);
diff --git a/drivers/staging/rts5208/trace.h b/drivers/staging/rts5208/trace.h
index fbb304a..a9ab407 100644
--- a/drivers/staging/rts5208/trace.h
+++ b/drivers/staging/rts5208/trace.h
@@ -84,12 +84,4 @@ 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)
-#endif
-
#endif /* __REALTEK_RTSX_TRACE_H */
--
2.0.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v6 2/2] Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
2014-08-05 21:24 [PATCH v6 0/2] Staging: rts5208: Use standard debug features Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 1/2] Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory Fabio Falzoi
@ 2014-08-05 21:24 ` Fabio Falzoi
1 sibling, 0 replies; 3+ messages in thread
From: Fabio Falzoi @ 2014-08-05 21:24 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, devel, micky_ching, wei_wang, joe, Fabio Falzoi
CONFIG_RTS5208_DEBUG is no more needed, we rely on dynamic debug config options
instead.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5208/Kconfig | 7 -------
drivers/staging/rts5208/sd.c | 5 +----
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/staging/rts5208/Kconfig b/drivers/staging/rts5208/Kconfig
index 055655c..05c990f 100644
--- a/drivers/staging/rts5208/Kconfig
+++ b/drivers/staging/rts5208/Kconfig
@@ -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.
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index 06c96d5..21c3b3c 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -812,12 +812,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);
dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val);
-#endif
if (ddr_rx) {
RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE,
@@ -863,12 +861,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);
dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
dev_dbg(rtsx_dev(chip), "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);
--
2.0.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-05 21:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 21:24 [PATCH v6 0/2] Staging: rts5208: Use standard debug features Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 1/2] Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory Fabio Falzoi
2014-08-05 21:24 ` [PATCH v6 2/2] Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option Fabio Falzoi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®