Staging: rts5208: Use standard debug features
v5 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 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 (4):
Staging: rts5208: Remove useless traces
Staging: rts5208: Replace custom macro with dev_dbg
Staging: rts5208: Use dev_dbg and %*ph specifier to dump memory
Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
drivers/staging/rts5208/Kconfig | 7 -- drivers/staging/rts5208/debug.h | 43 ------- drivers/staging/rts5208/ms.c | 130 +++++++++------------ drivers/staging/rts5208/rtsx.c | 6 +- drivers/staging/rts5208/rtsx.h | 1 - drivers/staging/rts5208/rtsx_card.c | 73 ++++++------ drivers/staging/rts5208/rtsx_card.h | 1 - drivers/staging/rts5208/rtsx_chip.c | 137 ++++++++++++---------- drivers/staging/rts5208/rtsx_chip.h | 5 + drivers/staging/rts5208/rtsx_scsi.c | 47 ++++---- drivers/staging/rts5208/rtsx_scsi.h | 2 +- drivers/staging/rts5208/rtsx_transport.c | 55 +++++---- drivers/staging/rts5208/sd.c | 194 +++++++++++++++++-------------- drivers/staging/rts5208/spi.c | 7 +- drivers/staging/rts5208/trace.h | 14 +-- drivers/staging/rts5208/xd.c | 104 +++++++++-------- 16 files changed, 398 insertions(+), 428 deletions(-) delete mode 100644 drivers/staging/rts5208/debug.h
Signature · 1 line
2.0.0
PATCH v5 1/4 Staging: rts5208: Remove useless debug prints
Remove all debug printks used just to mark when we enter a function.
--- drivers/staging/rts5208/ms.c | 24 ------------------------ drivers/staging/rts5208/rtsx_scsi.c | 4 ---- 2 files changed, 28 deletions(-)
drivers/staging/rts5208/ms.c +0 -24
@@ -2473,8 +2473,6 @@ void mspro_stop_seq_mode(struct rtsx_chip *chip)struct ms_info *ms_card = &(chip->ms_card);int retval; -RTSX_DEBUGP ("--%s--\n" , __func__); -if (ms_card->seq_mode) { retval =ms_switch_clock (chip);if (retval !=STATUS_SUCCESS )
@@ -2493,8 +2491,6 @@ static inline int ms_auto_tune_clock(struct rtsx_chip *chip)struct ms_info *ms_card = &(chip->ms_card);int retval; -RTSX_DEBUGP ("--%s--\n" , __func__); -if (chip->asic_code) {if (ms_card->ms_clock >30 ) ms_card->ms_clock -=20 ;
@@ -2783,8 +2779,6 @@ int mspro_format(struct scsi_cmnd *srb, struct rtsx_chip *chip,u8 buf[8 ], tmp;u16 para; -RTSX_DEBUGP ("--%s--\n" , __func__); - retval =ms_switch_clock (chip);if (retval !=STATUS_SUCCESS )TRACE_RET (chip,STATUS_FAIL );
@@ -3664,8 +3658,6 @@ static int mg_set_tpc_para_sub(struct rtsx_chip *chip, int type,int retval;u8 buf[6 ]; -RTSX_DEBUGP ("--%s--\n" , __func__); -if (type ==0 ) retval =ms_set_rw_reg_addr (chip,0 ,0 , Pro_TPCParm,1 );else
@@ -3697,8 +3689,6 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 buf1[32 ], buf2[12 ]; -RTSX_DEBUGP ("--%s--\n" , __func__); -if (scsi_bufflen (srb) <12 ) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_INVALID_CMD_FIELD );TRACE_RET (chip,STATUS_FAIL );
@@ -3743,8 +3733,6 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 *buf =NULL ; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -3796,8 +3784,6 @@ int mg_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 buf[32 ]; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -3872,8 +3858,6 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 buf1[32 ], buf2[36 ]; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -3929,8 +3913,6 @@ int mg_rsp(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 buf[32 ]; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -3977,8 +3959,6 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 *buf =NULL ; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -4032,8 +4012,6 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)unsigned int lun =SCSI_LUN (srb);u8 *buf =NULL ; -RTSX_DEBUGP ("--%s--\n" , __func__); -ms_cleanup_work (chip); retval =ms_switch_clock (chip);
@@ -4182,8 +4160,6 @@ int release_ms_card(struct rtsx_chip *chip)struct ms_info *ms_card = &(chip->ms_card);int retval; -RTSX_DEBUGP ("release_ms_card\n" ); -#ifdef MS_DELAY_WRITE ms_card->delay_write.delay_write_flag =0 ;#endif
drivers/staging/rts5208/rtsx_scsi.c +0 -4
@@ -3030,8 +3030,6 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip)int retval;u8 key_format; -RTSX_DEBUGP ("--%s--\n" , __func__); -rtsx_disable_aspm (chip);if (chip->ss_en && (rtsx_get_stat (chip) ==RTSX_STAT_SS )) {
@@ -3131,8 +3129,6 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip)int retval;u8 key_format; -RTSX_DEBUGP ("--%s--\n" , __func__); -rtsx_disable_aspm (chip);if (chip->ss_en && (rtsx_get_stat (chip) ==RTSX_STAT_SS )) {
Signature · 1 line
2.0.0
PATCH v5 2/4 Staging: rts5208: Replace custom macro with dev_dbg
In reply to Fabio FalzoiUse dev_dbg macro to control tracing verbosity through dynamic debug facility.
--- drivers/staging/rts5208/debug.h | 43 ------- drivers/staging/rts5208/ms.c | 102 +++++++++-------- drivers/staging/rts5208/rtsx.c | 6 +- drivers/staging/rts5208/rtsx.h | 1 - drivers/staging/rts5208/rtsx_card.c | 73 ++++++------ drivers/staging/rts5208/rtsx_card.h | 1 - drivers/staging/rts5208/rtsx_chip.c | 133 +++++++++++----------- drivers/staging/rts5208/rtsx_chip.h | 5 + drivers/staging/rts5208/rtsx_scsi.c | 40 +++---- drivers/staging/rts5208/rtsx_scsi.h | 2 +- drivers/staging/rts5208/rtsx_transport.c | 55 +++++---- drivers/staging/rts5208/sd.c | 185 +++++++++++++++++-------------- drivers/staging/rts5208/spi.c | 7 +- drivers/staging/rts5208/trace.h | 10 +- drivers/staging/rts5208/xd.c | 104 +++++++++-------- 15 files changed, 392 insertions(+), 375 deletions(-) delete mode 100644 drivers/staging/rts5208/debug.h
drivers/staging/rts5208/debug.h deleted +0 -43
@@ -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 +55 -47
338 lines not on this page · raw message
drivers/staging/rts5208/rtsx.c +2 -4
@@ -20,8 +20,6 @@* Micky Ching ([email protected]) */ -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/blkdev.h> #include <linux/kthread.h> #include <linux/sched.h>
@@ -478,7 +476,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);rtsx_invoke_transport (chip->srb, chip); }
@@ -864,7 +862,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" ); +dev_dbg (&pci->dev,"Realtek PCI-E card reader detected\n" ); err =pci_enable_device (pci);if (err <0 ) {
drivers/staging/rts5208/rtsx.h +0 -1
@@ -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 +38 -35
240 lines not on this page · raw message
drivers/staging/rts5208/rtsx_card.h +0 -1
@@ -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 +71 -62
386 lines not on this page · raw message
drivers/staging/rts5208/rtsx_chip.h +5 -0
@@ -920,6 +920,11 @@ struct rtsx_chip {u32 sd_ctl; }; +static inline struct device *rtsx_dev (const struct rtsx_chip *chip) +{ +return &chip->rtsx->pci->dev; +} +#define rtsx_set_stat (chip, stat) \ do { \ if ((stat) != RTSX_STAT_IDLE) { \
drivers/staging/rts5208/rtsx_scsi.c +21 -19
@@ -35,8 +35,9 @@#include "ms.h" #include "spi.h" -void scsi_show_command (struct scsi_cmnd *srb) +void scsi_show_command (struct rtsx_chip *chip) { +struct scsi_cmnd *srb = chip->srb;char *what =NULL ;int i, unknown_cmd =0 ;
@@ -314,13 +315,13 @@ void scsi_show_command(struct scsi_cmnd *srb) }if (srb->cmnd[0 ] !=TEST_UNIT_READY ) -RTSX_DEBUGP ("Command %s (%d bytes)\n" , what, srb->cmd_len); +dev_dbg (rtsx_dev (chip),"Command %s (%d bytes)\n" , + what, srb->cmd_len);if (unknown_cmd) { -RTSX_DEBUGP ("" );for (i =0 ; i < srb->cmd_len && i <16 ; i++) -RTSX_DEBUGPN (" %02x" , srb->cmnd[i]); -RTSX_DEBUGPN ("\n" ); +dev_dbg (rtsx_dev (chip)," %02x" , srb->cmnd[i]); +dev_dbg (rtsx_dev (chip),"\n" ); } }
@@ -883,14 +884,14 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip)/* Accessing to any card is forbidden * until the erase procedure of SD is completed */ -RTSX_DEBUGP ("SD card being erased!\n" ); +dev_dbg (rtsx_dev (chip),"SD card being erased!\n" );set_sense_type (chip, lun,SENSE_TYPE_MEDIA_READ_FORBIDDEN );TRACE_RET (chip,TRANSPORT_FAILED ); }if (get_lun_card (chip, lun) ==SD_CARD ) {if (sd_card->sd_lock_status &SD_LOCKED ) { -RTSX_DEBUGP ("SD card locked!\n" ); +dev_dbg (rtsx_dev (chip),"SD card locked!\n" );set_sense_type (chip, lun,SENSE_TYPE_MEDIA_READ_FORBIDDEN );TRACE_RET (chip,TRANSPORT_FAILED );
@@ -935,7 +936,7 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip) }if (chip->rw_fail_cnt[lun] ==3 ) { -RTSX_DEBUGP ("read/write fail three times in succession\n" ); +dev_dbg (rtsx_dev (chip),"read/write fail three times in succession\n" );if (srb->sc_data_direction ==DMA_FROM_DEVICE )set_sense_type (chip, lun,SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR );
@@ -947,7 +948,7 @@ static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip)if (srb->sc_data_direction ==DMA_TO_DEVICE ) {if (check_card_wp (chip, lun)) { -RTSX_DEBUGP ("Write protected card!\n" ); +dev_dbg (rtsx_dev (chip),"Write protected card!\n" );set_sense_type (chip, lun,SENSE_TYPE_MEDIA_WRITE_PROTECT );TRACE_RET (chip,TRANSPORT_FAILED );
@@ -1380,7 +1381,7 @@ static int trace_msg_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip) *(ptr++) = (u8)(msg_cnt >>16 ); *(ptr++) = (u8)(msg_cnt >>8 ); *(ptr++) = (u8 )msg_cnt; -RTSX_DEBUGP ("Trace message count is %d\n" , msg_cnt); +dev_dbg (rtsx_dev (chip),"Trace message count is %d\n" , msg_cnt);for (i =1 ; i <= msg_cnt; i++) {int j, idx;
@@ -1432,7 +1433,7 @@ static int read_host_reg(struct scsi_cmnd *srb, struct rtsx_chip *chip) addr = srb->cmnd[4 ]; val =rtsx_readl (chip, addr); -RTSX_DEBUGP ("Host register (0x%x): 0x%x\n" , addr, val); +dev_dbg (rtsx_dev (chip),"Host register (0x%x): 0x%x\n" , addr, val); buf[0 ] = (u8)(val >>24 ); buf[1 ] = (u8)(val >>16 );
@@ -1595,9 +1596,9 @@ static int dma_access_ring_buffer(struct scsi_cmnd *srb, struct rtsx_chip *chip) len =min_t (u16, len,scsi_bufflen (srb));if (srb->sc_data_direction ==DMA_FROM_DEVICE ) -RTSX_DEBUGP ("Read from device\n" ); +dev_dbg (rtsx_dev (chip),"Read from device\n" );else -RTSX_DEBUGP ("Write to device\n" ); +dev_dbg (rtsx_dev (chip),"Write to device\n" ); retval =rtsx_transfer_data (chip,0 ,scsi_sglist (srb), len,scsi_sg_count (srb), srb->sc_data_direction,1000 );
@@ -1731,7 +1732,7 @@ static int get_dev_status(struct scsi_cmnd *srb, struct rtsx_chip *chip) status[0x17 ] =0x00 ; } -RTSX_DEBUGP ("status[0x17] = 0x%x\n" , status[0x17 ]); +dev_dbg (rtsx_dev (chip),"status[0x17] = 0x%x\n" , status[0x17 ]);#endif status[0x18 ] =0x8A ;
@@ -2312,8 +2313,8 @@ static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) addr = ((u16)(srb->cmnd[4 ]) <<8 ) | srb->cmnd[5 ]; len = ((u16)(srb->cmnd[6 ]) <<8 ) | srb->cmnd[7 ]; -RTSX_DEBUGP ("%s: func = %d, addr = 0x%x, len = %d\n" , __func__, func, - addr, len); +dev_dbg (rtsx_dev (chip),"%s: func = %d, addr = 0x%x, len = %d\n" , + __func__, func, addr, len);if (CHK_SDIO_EXIST (chip) && !CHK_SDIO_IGNORED (chip)) func_max =1 ;
@@ -2366,7 +2367,8 @@ static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip) addr = ((u16)(srb->cmnd[4 ]) <<8 ) | srb->cmnd[5 ]; len = ((u16)(srb->cmnd[6 ]) <<8 ) | srb->cmnd[7 ]; -RTSX_DEBUGP ("%s: func = %d, addr = 0x%x\n" , __func__, func, addr); +dev_dbg (rtsx_dev (chip),"%s: func = %d, addr = 0x%x\n" , + __func__, func, addr);if (CHK_SDIO_EXIST (chip) && !CHK_SDIO_IGNORED (chip)) func_max =1 ;
@@ -3060,7 +3062,7 @@ static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) } key_format = srb->cmnd[10 ] &0x3F ; -RTSX_DEBUGP ("key_format = 0x%x\n" , key_format); +dev_dbg (rtsx_dev (chip),"key_format = 0x%x\n" , key_format);switch (key_format) {case KF_GET_LOC_EKB :
@@ -3163,7 +3165,7 @@ static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip) } key_format = srb->cmnd[10 ] &0x3F ; -RTSX_DEBUGP ("key_format = 0x%x\n" , key_format); +dev_dbg (rtsx_dev (chip),"key_format = 0x%x\n" , key_format);switch (key_format) {case KF_SET_LEAF_ID :
drivers/staging/rts5208/rtsx_scsi.h +1 -1
@@ -133,7 +133,7 @@#define SENSE_TYPE_MEDIA_READ_FORBIDDEN 0x10#endif -void scsi_show_command (struct scsi_cmnd *srb); +void scsi_show_command (struct rtsx_chip *chip);void set_sense_type (struct rtsx_chip *chip,unsigned int lun,int sense_type); void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code, u8 sense_key, u32 info, u8 asc, u8 ascq,
drivers/staging/rts5208/rtsx_transport.c +33 -22
139 lines not on this page · raw message
drivers/staging/rts5208/sd.c +101 -84
535 lines not on this page · raw message
drivers/staging/rts5208/spi.c +4 -3
@@ -409,7 +409,8 @@ 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); +dev_dbg (rtsx_dev (chip),"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 +432,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); +dev_dbg (rtsx_dev (chip),"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 +6 -4
@@ -49,7 +49,8 @@ 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__); \ + dev_dbg(rtsx_dev(chip), "[%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 +66,8 @@ 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__); \ + dev_dbg(rtsx_dev(chip), "[%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 +86,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 +55 -49
334 lines not on this page · raw message
Signature · 1 line
2.0.0
PATCH v5 3/4 Staging: rts5208: Use dev_dbg and %*ph specifier to dump memory
In reply to Fabio FalzoiUse dev_dbg with %*ph format specifier to dump memory instead of relying on custom macro.
--- drivers/staging/rts5208/ms.c | 4 ++-- drivers/staging/rts5208/rtsx_chip.c | 4 ++-- drivers/staging/rts5208/rtsx_scsi.c | 7 +++---- drivers/staging/rts5208/sd.c | 6 +++--- drivers/staging/rts5208/trace.h | 8 -------- 5 files changed, 10 insertions(+), 19 deletions(-)
drivers/staging/rts5208/ms.c +2 -2
@@ -305,7 +305,7 @@ 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); +dev_dbg (rtsx_dev (chip),"%*ph\n" , cnt, ptr); }return STATUS_SUCCESS ;
@@ -1913,7 +1913,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
drivers/staging/rts5208/rtsx_chip.c +2 -2
@@ -1309,8 +1309,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 ); +dev_dbg (rtsx_dev (chip),"%*ph\n" , dw_len *4 , mask); +dev_dbg (rtsx_dev (chip),"%*ph\n" , dw_len *4 , data);for (i =0 ; i < dw_len; i++) { retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
drivers/staging/rts5208/rtsx_scsi.c +3 -4
@@ -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); } }
drivers/staging/rts5208/sd.c +3 -3
@@ -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);
drivers/staging/rts5208/trace.h +0 -8
@@ -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 */
Signature · 1 line
2.0.0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v5 3/4] Staging: rts5208: Use dev_dbg and %*ph specifierto dump memory
Quoted 13 lines · micky
Documentation/printk-formats.txtRaw buffer as a hex string:
%*ph 00 01 02 ... 3f %*phC 00:01:02: ... :3f %*phD 00-01-02- ... -3f %*phN 000102 ... 3f For printing a small buffers (up to 64 bytes long) as a hex string with certain separator. For the larger buffers consider to use print_hex_dump().
Quoted 4 lines
Since we can't make sure the cnt value, it is not good use "%*ph", because it must make cnt <= 64.
dw_len* 4 <= 64 ?
Hi Micky,
I think that in these two cases we can rely on print_hex_dump_bytes that doesn't have the dev_dbg limit on buffer size.
Let me know what you think about it. If you agree, I can send a new version for patches 3/4 and 4/4, since the first two have already been merged in the linux-next tree by Greg.
Regards,
Fabio
Re: [PATCH v5 3/4] Staging: rts5208: Use dev_dbg and %*phspecifiertodump memory
Quoted 17 lines · Fabio Falzoi
Quoted 13 lines · micky
Documentation/printk-formats.txtRaw buffer as a hex string:
%*ph 00 01 02 ... 3f %*phC 00:01:02: ... :3f %*phD 00-01-02- ... -3f %*phN 000102 ... 3f For printing a small buffers (up to 64 bytes long) as a hex string with certain separator. For the larger buffers consider to use print_hex_dump().Quoted 3 lines
Since we can't make sure the cnt value, it is not good use "%*ph", because it must make cnt <= 64.
dw_len* 4 <= 64 ?
Quoted 7 lines
Hi Micky,
I think that in these two cases we can rely on
print_hex_dump_bytesthat doesn't have thedev_dbglimit on buffer size.
Let me know what you think about it. If you agree, I can send a new version for patches 3/4 and 4/4, since the first two have already been merged in the linux-next tree by Greg.
Hi Fabio,
I think it is good, Thanks.
Best Regards,
micky
Quoted 4 lines
Regards,
Fabio
.
PATCH v5 4/4 Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
In reply to Fabio FalzoiCONFIG_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
@@ -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
@@ -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 );
Signature · 1 line
2.0.0