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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@ obj-$(CONFIG_RTS5208) := rts5208.o
ccflags-y := -Idrivers/scsi

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
+0 −337

File changed.

Preview size limit exceeded, changes collapsed.

+0 −25
Original line number Diff line number Diff line
@@ -139,28 +139,6 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host)
	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
 * single queue element srb for write access
@@ -174,9 +152,6 @@ static inline void get_current_time(u8 *timeval_buf, int buf_len)
/* struct scsi_cmnd transfer buffer access utilities */
enum xfer_buf_dir	{TO_XFER_BUF, FROM_XFER_BUF};

#define _MSG_TRACE

#include "trace.h"
#include "rtsx_chip.h"
#include "rtsx_transport.h"
#include "rtsx_scsi.h"
+0 −29
Original line number Diff line number Diff line
@@ -648,7 +648,6 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
		clk, chip->cur_clk);

	if ((clk <= 2) || (n > max_n)) {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

@@ -690,14 +689,12 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)

	retval = rtsx_send_cmd(chip, 0, WAIT_TIME);
	if (retval < 0) {
		rtsx_trace(chip);
		return STATUS_ERROR;
	}

	udelay(10);
	retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -789,38 +786,32 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
	default:
		dev_dbg(rtsx_dev(chip), "Try to switch to an illegal clock (%d)\n",
			clk);
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

	retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}
	if (sd_vpclk_phase_reset) {
		retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
					     PHASE_NOT_RESET, 0);
		if (retval) {
			rtsx_trace(chip);
			return retval;
		}
		retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
					     PHASE_NOT_RESET, 0);
		if (retval) {
			rtsx_trace(chip);
			return retval;
		}
	}
	retval = rtsx_write_register(chip, CLK_DIV, 0xFF,
				     (div << 4) | mcu_cnt);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}
	retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -829,20 +820,17 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
		retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
					     PHASE_NOT_RESET, PHASE_NOT_RESET);
		if (retval) {
			rtsx_trace(chip);
			return retval;
		}
		retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
					     PHASE_NOT_RESET, PHASE_NOT_RESET);
		if (retval) {
			rtsx_trace(chip);
			return retval;
		}
		udelay(200);
	}
	retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -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);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -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);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -939,7 +925,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card)

	retval = rtsx_send_cmd(chip, 0, 100);
	if (retval != STATUS_SUCCESS) {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

@@ -950,7 +935,6 @@ int card_power_on(struct rtsx_chip *chip, u8 card)

	retval = rtsx_send_cmd(chip, 0, 100);
	if (retval != STATUS_SUCCESS) {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

@@ -972,7 +956,6 @@ int card_power_off(struct rtsx_chip *chip, u8 card)

	retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -987,7 +970,6 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
	int i;

	if (!chip->rw_card[lun]) {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

@@ -998,12 +980,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
		if (retval != STATUS_SUCCESS) {
			if (rtsx_check_chip_exist(chip) != STATUS_SUCCESS) {
				rtsx_release_chip(chip);
				rtsx_trace(chip);
				return STATUS_FAIL;
			}
			if (detect_card_cd(chip, chip->cur_card) !=
							STATUS_SUCCESS) {
				rtsx_trace(chip);
				return STATUS_FAIL;
			}

@@ -1036,7 +1016,6 @@ int card_share_mode(struct rtsx_chip *chip, int card)
		} else if (card == XD_CARD) {
			value = CARD_SHARE_48_XD;
		} else {
			rtsx_trace(chip);
			return STATUS_FAIL;
		}

@@ -1049,18 +1028,15 @@ int card_share_mode(struct rtsx_chip *chip, int card)
		} else if (card == XD_CARD) {
			value = CARD_SHARE_BAROSSA_XD;
		} else {
			rtsx_trace(chip);
			return STATUS_FAIL;
		}

	} else {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

	retval = rtsx_write_register(chip, CARD_SHARE_MODE, mask, value);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

@@ -1083,20 +1059,17 @@ int select_card(struct rtsx_chip *chip, int card)
		} else if (card == SPI_CARD) {
			mod = SPI_MOD_SEL;
		} else {
			rtsx_trace(chip);
			return STATUS_FAIL;
		}

		retval = rtsx_write_register(chip, CARD_SELECT, 0x07, mod);
		if (retval) {
			rtsx_trace(chip);
			return retval;
		}
		chip->cur_card = card;

		retval =  card_share_mode(chip, card);
		if (retval != STATUS_SUCCESS) {
			rtsx_trace(chip);
			return STATUS_FAIL;
		}
	}
@@ -1143,13 +1116,11 @@ int detect_card_cd(struct rtsx_chip *chip, int card)
		card_cd = XD_EXIST;
	} else {
		dev_dbg(rtsx_dev(chip), "Wrong card type: 0x%x\n", card);
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

	status = rtsx_readl(chip, RTSX_BIPR);
	if (!(status & card_cd)) {
		rtsx_trace(chip);
		return STATUS_FAIL;
	}

+0 −1
Original line number Diff line number Diff line
@@ -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);
	if (retval) {
		rtsx_trace(chip);
		return retval;
	}

Loading