Commit c238d7b1 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging: rtsx: remove rtsx_trace() and related code

The driver has rather excessive amount of tracing code, which would be
better done using ftrace. This is obviously not a main feature of the
driver, and it should work just as well without it.

Removing it saves over 1300 lines of code and likely makes the driver
a bit faster by avoiding lots of calls into the timekeeping code.

I came across this while cleaning up the last users of the deprecated
getnstimeofday64() function, of which there is one in the now-removed
get_current_time() function of the rtsx driver that was only used for
tracing.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5c6a5eb3
...@@ -3,4 +3,4 @@ obj-$(CONFIG_RTS5208) := rts5208.o ...@@ -3,4 +3,4 @@ obj-$(CONFIG_RTS5208) := rts5208.o
ccflags-y := -Idrivers/scsi ccflags-y := -Idrivers/scsi
rts5208-y := rtsx.o rtsx_chip.o rtsx_transport.o rtsx_scsi.o \ rts5208-y := rtsx.o rtsx_chip.o rtsx_transport.o rtsx_scsi.o \
rtsx_card.o general.o sd.o xd.o ms.o spi.o trace.o rtsx_card.o general.o sd.o xd.o ms.o spi.o
This diff is collapsed.
...@@ -139,28 +139,6 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host) ...@@ -139,28 +139,6 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host)
return (struct rtsx_dev *)host->hostdata; return (struct rtsx_dev *)host->hostdata;
} }
static inline void get_current_time(u8 *timeval_buf, int buf_len)
{
struct timespec64 ts64;
u32 tv_usec;
if (!timeval_buf || (buf_len < 8))
return;
getnstimeofday64(&ts64);
tv_usec = ts64.tv_nsec / NSEC_PER_USEC;
timeval_buf[0] = (u8)(ts64.tv_sec >> 24);
timeval_buf[1] = (u8)(ts64.tv_sec >> 16);
timeval_buf[2] = (u8)(ts64.tv_sec >> 8);
timeval_buf[3] = (u8)(ts64.tv_sec);
timeval_buf[4] = (u8)(tv_usec >> 24);
timeval_buf[5] = (u8)(tv_usec >> 16);
timeval_buf[6] = (u8)(tv_usec >> 8);
timeval_buf[7] = (u8)(tv_usec);
}
/* /*
* The scsi_lock() and scsi_unlock() macros protect the sm_state and the * The scsi_lock() and scsi_unlock() macros protect the sm_state and the
* single queue element srb for write access * single queue element srb for write access
...@@ -174,9 +152,6 @@ static inline void get_current_time(u8 *timeval_buf, int buf_len) ...@@ -174,9 +152,6 @@ static inline void get_current_time(u8 *timeval_buf, int buf_len)
/* struct scsi_cmnd transfer buffer access utilities */ /* struct scsi_cmnd transfer buffer access utilities */
enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF};
#define _MSG_TRACE
#include "trace.h"
#include "rtsx_chip.h" #include "rtsx_chip.h"
#include "rtsx_transport.h" #include "rtsx_transport.h"
#include "rtsx_scsi.h" #include "rtsx_scsi.h"
......
...@@ -648,7 +648,6 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) ...@@ -648,7 +648,6 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
clk, chip->cur_clk); clk, chip->cur_clk);
if ((clk <= 2) || (n > max_n)) { if ((clk <= 2) || (n > max_n)) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -690,14 +689,12 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) ...@@ -690,14 +689,12 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
retval = rtsx_send_cmd(chip, 0, WAIT_TIME); retval = rtsx_send_cmd(chip, 0, WAIT_TIME);
if (retval < 0) { if (retval < 0) {
rtsx_trace(chip);
return STATUS_ERROR; return STATUS_ERROR;
} }
udelay(10); udelay(10);
retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0); retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -789,38 +786,32 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk) ...@@ -789,38 +786,32 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
default: default:
dev_dbg(rtsx_dev(chip), "Try to switch to an illegal clock (%d)\n", dev_dbg(rtsx_dev(chip), "Try to switch to an illegal clock (%d)\n",
clk); clk);
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ); retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
if (sd_vpclk_phase_reset) { if (sd_vpclk_phase_reset) {
retval = rtsx_write_register(chip, SD_VPCLK0_CTL, retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
PHASE_NOT_RESET, 0); PHASE_NOT_RESET, 0);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
retval = rtsx_write_register(chip, SD_VPCLK1_CTL, retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
PHASE_NOT_RESET, 0); PHASE_NOT_RESET, 0);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
} }
retval = rtsx_write_register(chip, CLK_DIV, 0xFF, retval = rtsx_write_register(chip, CLK_DIV, 0xFF,
(div << 4) | mcu_cnt); (div << 4) | mcu_cnt);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel); retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -829,20 +820,17 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk) ...@@ -829,20 +820,17 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
retval = rtsx_write_register(chip, SD_VPCLK0_CTL, retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
PHASE_NOT_RESET, PHASE_NOT_RESET); PHASE_NOT_RESET, PHASE_NOT_RESET);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
retval = rtsx_write_register(chip, SD_VPCLK1_CTL, retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
PHASE_NOT_RESET, PHASE_NOT_RESET); PHASE_NOT_RESET, PHASE_NOT_RESET);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
udelay(200); udelay(200);
} }
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0); retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -891,7 +879,6 @@ int enable_card_clock(struct rtsx_chip *chip, u8 card) ...@@ -891,7 +879,6 @@ int enable_card_clock(struct rtsx_chip *chip, u8 card)
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, clk_en); retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, clk_en);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -912,7 +899,6 @@ int disable_card_clock(struct rtsx_chip *chip, u8 card) ...@@ -912,7 +899,6 @@ int disable_card_clock(struct rtsx_chip *chip, u8 card)
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, 0); retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, 0);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -939,7 +925,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card) ...@@ -939,7 +925,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
retval = rtsx_send_cmd(chip, 0, 100); retval = rtsx_send_cmd(chip, 0, 100);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -950,7 +935,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card) ...@@ -950,7 +935,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
retval = rtsx_send_cmd(chip, 0, 100); retval = rtsx_send_cmd(chip, 0, 100);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -972,7 +956,6 @@ int card_power_off(struct rtsx_chip *chip, u8 card) ...@@ -972,7 +956,6 @@ int card_power_off(struct rtsx_chip *chip, u8 card)
retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val); retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -987,7 +970,6 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, ...@@ -987,7 +970,6 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
int i; int i;
if (!chip->rw_card[lun]) { if (!chip->rw_card[lun]) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -998,12 +980,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, ...@@ -998,12 +980,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
if (rtsx_check_chip_exist(chip) != STATUS_SUCCESS) { if (rtsx_check_chip_exist(chip) != STATUS_SUCCESS) {
rtsx_release_chip(chip); rtsx_release_chip(chip);
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
if (detect_card_cd(chip, chip->cur_card) != if (detect_card_cd(chip, chip->cur_card) !=
STATUS_SUCCESS) { STATUS_SUCCESS) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -1036,7 +1016,6 @@ int card_share_mode(struct rtsx_chip *chip, int card) ...@@ -1036,7 +1016,6 @@ int card_share_mode(struct rtsx_chip *chip, int card)
} else if (card == XD_CARD) { } else if (card == XD_CARD) {
value = CARD_SHARE_48_XD; value = CARD_SHARE_48_XD;
} else { } else {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
...@@ -1049,18 +1028,15 @@ int card_share_mode(struct rtsx_chip *chip, int card) ...@@ -1049,18 +1028,15 @@ int card_share_mode(struct rtsx_chip *chip, int card)
} else if (card == XD_CARD) { } else if (card == XD_CARD) {
value = CARD_SHARE_BAROSSA_XD; value = CARD_SHARE_BAROSSA_XD;
} else { } else {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
} else { } else {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
retval = rtsx_write_register(chip, CARD_SHARE_MODE, mask, value); retval = rtsx_write_register(chip, CARD_SHARE_MODE, mask, value);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
...@@ -1083,20 +1059,17 @@ int select_card(struct rtsx_chip *chip, int card) ...@@ -1083,20 +1059,17 @@ int select_card(struct rtsx_chip *chip, int card)
} else if (card == SPI_CARD) { } else if (card == SPI_CARD) {
mod = SPI_MOD_SEL; mod = SPI_MOD_SEL;
} else { } else {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
retval = rtsx_write_register(chip, CARD_SELECT, 0x07, mod); retval = rtsx_write_register(chip, CARD_SELECT, 0x07, mod);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
chip->cur_card = card; chip->cur_card = card;
retval = card_share_mode(chip, card); retval = card_share_mode(chip, card);
if (retval != STATUS_SUCCESS) { if (retval != STATUS_SUCCESS) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
} }
...@@ -1143,13 +1116,11 @@ int detect_card_cd(struct rtsx_chip *chip, int card) ...@@ -1143,13 +1116,11 @@ int detect_card_cd(struct rtsx_chip *chip, int card)
card_cd = XD_EXIST; card_cd = XD_EXIST;
} else { } else {
dev_dbg(rtsx_dev(chip), "Wrong card type: 0x%x\n", card); dev_dbg(rtsx_dev(chip), "Wrong card type: 0x%x\n", card);
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
status = rtsx_readl(chip, RTSX_BIPR); status = rtsx_readl(chip, RTSX_BIPR);
if (!(status & card_cd)) { if (!(status & card_cd)) {
rtsx_trace(chip);
return STATUS_FAIL; return STATUS_FAIL;
} }
......
...@@ -1063,7 +1063,6 @@ static inline int card_power_off_all(struct rtsx_chip *chip) ...@@ -1063,7 +1063,6 @@ static inline int card_power_off_all(struct rtsx_chip *chip)
retval = rtsx_write_register(chip, CARD_PWR_CTL, 0x0F, 0x0F); retval = rtsx_write_register(chip, CARD_PWR_CTL, 0x0F, 0x0F);
if (retval) { if (retval) {
rtsx_trace(chip);
return retval; return retval;
} }
......
This diff is collapsed.
...@@ -644,19 +644,6 @@ struct spi_info { ...@@ -644,19 +644,6 @@ struct spi_info {
int spi_clock; int spi_clock;
}; };
#ifdef _MSG_TRACE
struct trace_msg_t {
u16 line;
#define MSG_FUNC_LEN 64
char func[MSG_FUNC_LEN];
#define MSG_FILE_LEN 32
char file[MSG_FILE_LEN];
#define TIME_VAL_LEN 16
u8 timeval_buf[TIME_VAL_LEN];
u8 valid;
};
#endif
/************/ /************/
/* LUN mode */ /* LUN mode */
/************/ /************/
...@@ -798,11 +785,6 @@ struct rtsx_chip { ...@@ -798,11 +785,6 @@ struct rtsx_chip {
struct spi_info spi; struct spi_info spi;
#ifdef _MSG_TRACE
struct trace_msg_t trace_msg[TRACE_ITEM_CNT];
int msg_idx;
#endif
int auto_delink_cnt; int auto_delink_cnt;
int auto_delink_allowed; int auto_delink_allowed;
......
This diff is collapsed.
...@@ -275,7 +275,6 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout) ...@@ -275,7 +275,6 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout)
dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n", dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n",
chip->int_reg); chip->int_reg);
err = -ETIMEDOUT; err = -ETIMEDOUT;
rtsx_trace(chip);
goto finish_send_cmd; goto finish_send_cmd;
} }
......
This diff is collapsed.
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/string.h>
#include "rtsx.h"
#ifdef _MSG_TRACE
void _rtsx_trace(struct rtsx_chip *chip, const char *file, const char *func,
int line)
{
struct trace_msg_t *msg = &chip->trace_msg[chip->msg_idx];
file = kbasename(file);
dev_dbg(rtsx_dev(chip), "[%s][%s]:[%d]\n", file, func, line);
strncpy(msg->file, file, MSG_FILE_LEN - 1);
strncpy(msg->func, func, MSG_FUNC_LEN - 1);
msg->line = (u16)line;
get_current_time(msg->timeval_buf, TIME_VAL_LEN);
msg->valid = 1;
chip->msg_idx++;
if (chip->msg_idx >= TRACE_ITEM_CNT)
chip->msg_idx = 0;
}
#endif
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment