Commit 031366ea authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros

Remove these flow hiding macros.

Miscellanea:

o Add a macro and function to replace a large inline
o Simplify #includes
o Add trace.c and update Makefile
o Remove static inline filename function and use kbasename instead

This reduces object size quite a lot: ~350KB (x86-64 allyesconfig)

$ size drivers/staging/rts5208/built-in.o*
   text	   data	    bss	    dec	    hex	filename
 248385	  36728	  77888	 363001	  589f9	drivers/staging/rts5208/built-in.o.new
 506691	  83352	 115896	 705939	  ac593	drivers/staging/rts5208/built-in.o.old

Done via coccinelle script and some typing.

@@
expression chip;
expression ret;
@@

-	TRACE_RET(chip, ret);
+	rtsx_trace(chip);
+	return ret;

@@
expression chip;
identifier label;
@@

-	TRACE_GOTO(chip, label);
+	rtsx_trace(chip);
+	goto label;
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent da3c8dee
...@@ -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 rtsx_card.o general.o sd.o xd.o ms.o spi.o trace.o
This diff is collapsed.
...@@ -26,12 +26,6 @@ ...@@ -26,12 +26,6 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "rtsx.h" #include "rtsx.h"
#include "rtsx_chip.h"
#include "rtsx_transport.h"
#include "rtsx_scsi.h"
#include "rtsx_card.h"
#include "general.h"
#include "ms.h" #include "ms.h"
#include "sd.h" #include "sd.h"
#include "xd.h" #include "xd.h"
......
...@@ -46,9 +46,6 @@ ...@@ -46,9 +46,6 @@
#include <scsi/scsi_eh.h> #include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include "trace.h"
#include "general.h"
#define CR_DRIVER_NAME "rts5208" #define CR_DRIVER_NAME "rts5208"
#define pci_get_bus_and_slot(bus, devfn) \ #define pci_get_bus_and_slot(bus, devfn) \
...@@ -181,4 +178,14 @@ enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; ...@@ -181,4 +178,14 @@ enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF};
int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val); int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val);
#define _MSG_TRACE
#include "trace.h"
#include "rtsx_chip.h"
#include "rtsx_transport.h"
#include "rtsx_scsi.h"
#include "rtsx_card.h"
#include "rtsx_sys.h"
#include "general.h"
#endif /* __REALTEK_RTSX_H */ #endif /* __REALTEK_RTSX_H */
...@@ -27,13 +27,6 @@ ...@@ -27,13 +27,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include "rtsx.h" #include "rtsx.h"
#include "rtsx_transport.h"
#include "rtsx_scsi.h"
#include "rtsx_card.h"
#include "rtsx_sys.h"
#include "general.h"
#include "sd.h" #include "sd.h"
#include "xd.h" #include "xd.h"
#include "ms.h" #include "ms.h"
...@@ -657,8 +650,10 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) ...@@ -657,8 +650,10 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
dev_dbg(rtsx_dev(chip), "Switch SSC clock to %dMHz (cur_clk = %d)\n", dev_dbg(rtsx_dev(chip), "Switch SSC clock to %dMHz (cur_clk = %d)\n",
clk, chip->cur_clk); clk, chip->cur_clk);
if ((clk <= 2) || (N > max_N)) if ((clk <= 2) || (N > max_N)) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
mcu_cnt = (u8)(125/clk + 3); mcu_cnt = (u8)(125/clk + 3);
if (mcu_cnt > 7) if (mcu_cnt > 7)
...@@ -697,8 +692,10 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk) ...@@ -697,8 +692,10 @@ 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) {
TRACE_RET(chip, STATUS_ERROR); rtsx_trace(chip);
return STATUS_ERROR;
}
udelay(10); udelay(10);
RTSX_WRITE_REG(chip, CLK_CTL, CLK_LOW_FREQ, 0); RTSX_WRITE_REG(chip, CLK_CTL, CLK_LOW_FREQ, 0);
...@@ -790,7 +787,8 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk) ...@@ -790,7 +787,8 @@ 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);
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
} }
RTSX_WRITE_REG(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ); RTSX_WRITE_REG(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ);
...@@ -893,8 +891,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card) ...@@ -893,8 +891,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val1); rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val1);
retval = rtsx_send_cmd(chip, 0, 100); retval = rtsx_send_cmd(chip, 0, 100);
if (retval != STATUS_SUCCESS) if (retval != STATUS_SUCCESS) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
udelay(chip->pmos_pwr_on_interval); udelay(chip->pmos_pwr_on_interval);
...@@ -902,8 +902,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card) ...@@ -902,8 +902,10 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val2); rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val2);
retval = rtsx_send_cmd(chip, 0, 100); retval = rtsx_send_cmd(chip, 0, 100);
if (retval != STATUS_SUCCESS) if (retval != STATUS_SUCCESS) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -932,8 +934,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, ...@@ -932,8 +934,10 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
unsigned int lun = SCSI_LUN(srb); unsigned int lun = SCSI_LUN(srb);
int i; int i;
if (chip->rw_card[lun] == NULL) if (chip->rw_card[lun] == NULL) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
chip->rw_need_retry = 0; chip->rw_need_retry = 0;
...@@ -942,11 +946,14 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip, ...@@ -942,11 +946,14 @@ 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);
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
} }
if (detect_card_cd(chip, chip->cur_card) != if (detect_card_cd(chip, chip->cur_card) !=
STATUS_SUCCESS) STATUS_SUCCESS) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
if (!chip->rw_need_retry) { if (!chip->rw_need_retry) {
dev_dbg(rtsx_dev(chip), "RW fail, but no need to retry\n"); dev_dbg(rtsx_dev(chip), "RW fail, but no need to retry\n");
...@@ -975,8 +982,10 @@ int card_share_mode(struct rtsx_chip *chip, int card) ...@@ -975,8 +982,10 @@ int card_share_mode(struct rtsx_chip *chip, int card)
value = CARD_SHARE_48_MS; value = CARD_SHARE_48_MS;
else if (card == XD_CARD) else if (card == XD_CARD)
value = CARD_SHARE_48_XD; value = CARD_SHARE_48_XD;
else else {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
} else if (CHECK_PID(chip, 0x5288)) { } else if (CHECK_PID(chip, 0x5288)) {
mask = 0x03; mask = 0x03;
...@@ -986,11 +995,14 @@ int card_share_mode(struct rtsx_chip *chip, int card) ...@@ -986,11 +995,14 @@ int card_share_mode(struct rtsx_chip *chip, int card)
value = CARD_SHARE_BAROSSA_MS; value = CARD_SHARE_BAROSSA_MS;
else if (card == XD_CARD) else if (card == XD_CARD)
value = CARD_SHARE_BAROSSA_XD; value = CARD_SHARE_BAROSSA_XD;
else else {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
} else { } else {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
} }
RTSX_WRITE_REG(chip, CARD_SHARE_MODE, mask, value); RTSX_WRITE_REG(chip, CARD_SHARE_MODE, mask, value);
...@@ -1014,15 +1026,19 @@ int select_card(struct rtsx_chip *chip, int card) ...@@ -1014,15 +1026,19 @@ int select_card(struct rtsx_chip *chip, int card)
mod = XD_MOD_SEL; mod = XD_MOD_SEL;
else if (card == SPI_CARD) else if (card == SPI_CARD)
mod = SPI_MOD_SEL; mod = SPI_MOD_SEL;
else else {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
RTSX_WRITE_REG(chip, CARD_SELECT, 0x07, mod); RTSX_WRITE_REG(chip, CARD_SELECT, 0x07, mod);
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) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
...@@ -1067,12 +1083,15 @@ int detect_card_cd(struct rtsx_chip *chip, int card) ...@@ -1067,12 +1083,15 @@ 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);
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
} }
status = rtsx_readl(chip, RTSX_BIPR); status = rtsx_readl(chip, RTSX_BIPR);
if (!(status & card_cd)) if (!(status & card_cd)) {
TRACE_RET(chip, STATUS_FAIL); rtsx_trace(chip);
return STATUS_FAIL;
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
This diff is collapsed.
...@@ -989,19 +989,21 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len); ...@@ -989,19 +989,21 @@ int rtsx_write_ppbuf(struct rtsx_chip *chip, u8 *buf, int buf_len);
int rtsx_check_chip_exist(struct rtsx_chip *chip); int rtsx_check_chip_exist(struct rtsx_chip *chip);
#define RTSX_WRITE_REG(chip, addr, mask, data) \ #define RTSX_WRITE_REG(chip, addr, mask, data) \
do { \ do { \
int retval = rtsx_write_register((chip), (addr), (mask), (data)); \ int retval = rtsx_write_register(chip, addr, mask, data); \
if (retval != STATUS_SUCCESS) { \ if (retval != STATUS_SUCCESS) { \
TRACE_RET((chip), retval); \ rtsx_trace(chip); \
} \ return retval; \
} while (0) } \
} while (0)
#define RTSX_READ_REG(chip, addr, data) \ #define RTSX_READ_REG(chip, addr, data) \
do { \ do { \
int retval = rtsx_read_register((chip), (addr), (data)); \ int retval = rtsx_read_register(chip, addr, data); \
if (retval != STATUS_SUCCESS) { \ if (retval != STATUS_SUCCESS) { \
TRACE_RET((chip), retval); \ rtsx_trace(chip); \
} \ return retval; \
} while (0) } \
} while (0)
#endif /* __REALTEK_RTSX_CHIP_H */ #endif /* __REALTEK_RTSX_CHIP_H */
This diff is collapsed.
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
#include <linux/sched.h> #include <linux/sched.h>
#include "rtsx.h" #include "rtsx.h"
#include "rtsx_scsi.h"
#include "rtsx_transport.h"
#include "rtsx_chip.h"
#include "rtsx_card.h"
/*********************************************************************** /***********************************************************************
* Scatter-gather transfer buffer access routines * Scatter-gather transfer buffer access routines
...@@ -276,7 +272,8 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout) ...@@ -276,7 +272,8 @@ 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;
TRACE_GOTO(chip, finish_send_cmd); rtsx_trace(chip);
goto finish_send_cmd;
} }
spin_lock_irq(&rtsx->reg_lock); spin_lock_irq(&rtsx->reg_lock);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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