spi: pxa2xx_spi "sparse" fixes

Various cleanups to pxa2xx_spi suggested by "sparse": make sure that
register addresess are "void __iomem *", and make a few functions properly
static.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Ned Forrester <nforrester@whoi.edu>
Cc: Stephen Street <stephen@streetfiresound.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
David Brownell 2008-04-28 02:14:17 -07:00 committed by Linus Torvalds
parent 79d8c7a8c8
commit cf43369d55
1 changed files with 28 additions and 24 deletions

View File

@ -67,8 +67,11 @@ MODULE_ALIAS("platform:pxa2xx-spi");
| SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
#define DEFINE_SSP_REG(reg, off) \ #define DEFINE_SSP_REG(reg, off) \
static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ static inline u32 read_##reg(void const __iomem *p) \
static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); } { return __raw_readl(p + (off)); } \
\
static inline void write_##reg(u32 v, void __iomem *p) \
{ __raw_writel(v, p + (off)); }
DEFINE_SSP_REG(SSCR0, 0x00) DEFINE_SSP_REG(SSCR0, 0x00)
DEFINE_SSP_REG(SSCR1, 0x04) DEFINE_SSP_REG(SSCR1, 0x04)
@ -106,7 +109,7 @@ struct driver_data {
u32 *null_dma_buf; u32 *null_dma_buf;
/* SSP register addresses */ /* SSP register addresses */
void *ioaddr; void __iomem *ioaddr;
u32 ssdr_physical; u32 ssdr_physical;
/* SSP masks*/ /* SSP masks*/
@ -173,7 +176,7 @@ static int flush(struct driver_data *drv_data)
{ {
unsigned long limit = loops_per_jiffy << 1; unsigned long limit = loops_per_jiffy << 1;
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
do { do {
while (read_SSSR(reg) & SSSR_RNE) { while (read_SSSR(reg) & SSSR_RNE) {
@ -191,7 +194,7 @@ static void null_cs_control(u32 command)
static int null_writer(struct driver_data *drv_data) static int null_writer(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
u8 n_bytes = drv_data->n_bytes; u8 n_bytes = drv_data->n_bytes;
if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
@ -206,7 +209,7 @@ static int null_writer(struct driver_data *drv_data)
static int null_reader(struct driver_data *drv_data) static int null_reader(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
u8 n_bytes = drv_data->n_bytes; u8 n_bytes = drv_data->n_bytes;
while ((read_SSSR(reg) & SSSR_RNE) while ((read_SSSR(reg) & SSSR_RNE)
@ -220,7 +223,7 @@ static int null_reader(struct driver_data *drv_data)
static int u8_writer(struct driver_data *drv_data) static int u8_writer(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
|| (drv_data->tx == drv_data->tx_end)) || (drv_data->tx == drv_data->tx_end))
@ -234,7 +237,7 @@ static int u8_writer(struct driver_data *drv_data)
static int u8_reader(struct driver_data *drv_data) static int u8_reader(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
while ((read_SSSR(reg) & SSSR_RNE) while ((read_SSSR(reg) & SSSR_RNE)
&& (drv_data->rx < drv_data->rx_end)) { && (drv_data->rx < drv_data->rx_end)) {
@ -247,7 +250,7 @@ static int u8_reader(struct driver_data *drv_data)
static int u16_writer(struct driver_data *drv_data) static int u16_writer(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
|| (drv_data->tx == drv_data->tx_end)) || (drv_data->tx == drv_data->tx_end))
@ -261,7 +264,7 @@ static int u16_writer(struct driver_data *drv_data)
static int u16_reader(struct driver_data *drv_data) static int u16_reader(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
while ((read_SSSR(reg) & SSSR_RNE) while ((read_SSSR(reg) & SSSR_RNE)
&& (drv_data->rx < drv_data->rx_end)) { && (drv_data->rx < drv_data->rx_end)) {
@ -274,7 +277,7 @@ static int u16_reader(struct driver_data *drv_data)
static int u32_writer(struct driver_data *drv_data) static int u32_writer(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
|| (drv_data->tx == drv_data->tx_end)) || (drv_data->tx == drv_data->tx_end))
@ -288,7 +291,7 @@ static int u32_writer(struct driver_data *drv_data)
static int u32_reader(struct driver_data *drv_data) static int u32_reader(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
while ((read_SSSR(reg) & SSSR_RNE) while ((read_SSSR(reg) & SSSR_RNE)
&& (drv_data->rx < drv_data->rx_end)) { && (drv_data->rx < drv_data->rx_end)) {
@ -412,7 +415,7 @@ static void giveback(struct driver_data *drv_data)
msg->complete(msg->context); msg->complete(msg->context);
} }
static int wait_ssp_rx_stall(void *ioaddr) static int wait_ssp_rx_stall(void const __iomem *ioaddr)
{ {
unsigned long limit = loops_per_jiffy << 1; unsigned long limit = loops_per_jiffy << 1;
@ -432,9 +435,9 @@ static int wait_dma_channel_stop(int channel)
return limit; return limit;
} }
void dma_error_stop(struct driver_data *drv_data, const char *msg) static void dma_error_stop(struct driver_data *drv_data, const char *msg)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
/* Stop and reset */ /* Stop and reset */
DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
@ -456,7 +459,7 @@ void dma_error_stop(struct driver_data *drv_data, const char *msg)
static void dma_transfer_complete(struct driver_data *drv_data) static void dma_transfer_complete(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
struct spi_message *msg = drv_data->cur_msg; struct spi_message *msg = drv_data->cur_msg;
/* Clear and disable interrupts on SSP and DMA channels*/ /* Clear and disable interrupts on SSP and DMA channels*/
@ -536,7 +539,7 @@ static void dma_handler(int channel, void *data)
static irqreturn_t dma_transfer(struct driver_data *drv_data) static irqreturn_t dma_transfer(struct driver_data *drv_data)
{ {
u32 irq_status; u32 irq_status;
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
irq_status = read_SSSR(reg) & drv_data->mask_sr; irq_status = read_SSSR(reg) & drv_data->mask_sr;
if (irq_status & SSSR_ROR) { if (irq_status & SSSR_ROR) {
@ -570,7 +573,7 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data)
static void int_error_stop(struct driver_data *drv_data, const char* msg) static void int_error_stop(struct driver_data *drv_data, const char* msg)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
/* Stop and reset SSP */ /* Stop and reset SSP */
write_SSSR(drv_data->clear_sr, reg); write_SSSR(drv_data->clear_sr, reg);
@ -588,7 +591,7 @@ static void int_error_stop(struct driver_data *drv_data, const char* msg)
static void int_transfer_complete(struct driver_data *drv_data) static void int_transfer_complete(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
/* Stop SSP */ /* Stop SSP */
write_SSSR(drv_data->clear_sr, reg); write_SSSR(drv_data->clear_sr, reg);
@ -614,7 +617,7 @@ static void int_transfer_complete(struct driver_data *drv_data)
static irqreturn_t interrupt_transfer(struct driver_data *drv_data) static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
{ {
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ?
drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS;
@ -675,7 +678,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
static irqreturn_t ssp_int(int irq, void *dev_id) static irqreturn_t ssp_int(int irq, void *dev_id)
{ {
struct driver_data *drv_data = dev_id; struct driver_data *drv_data = dev_id;
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
if (!drv_data->cur_msg) { if (!drv_data->cur_msg) {
@ -695,7 +698,8 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
return drv_data->transfer_handler(drv_data); return drv_data->transfer_handler(drv_data);
} }
int set_dma_burst_and_threshold(struct chip_data *chip, struct spi_device *spi, static int set_dma_burst_and_threshold(struct chip_data *chip,
struct spi_device *spi,
u8 bits_per_word, u32 *burst_code, u8 bits_per_word, u32 *burst_code,
u32 *threshold) u32 *threshold)
{ {
@ -809,7 +813,7 @@ static void pump_transfers(unsigned long data)
struct spi_transfer *previous = NULL; struct spi_transfer *previous = NULL;
struct chip_data *chip = NULL; struct chip_data *chip = NULL;
struct ssp_device *ssp = drv_data->ssp; struct ssp_device *ssp = drv_data->ssp;
void *reg = drv_data->ioaddr; void __iomem *reg = drv_data->ioaddr;
u32 clk_div = 0; u32 clk_div = 0;
u8 bits = 0; u8 bits = 0;
u32 speed = 0; u32 speed = 0;
@ -1338,7 +1342,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct pxa2xx_spi_master *platform_info; struct pxa2xx_spi_master *platform_info;
struct spi_master *master; struct spi_master *master;
struct driver_data *drv_data = 0; struct driver_data *drv_data = NULL;
struct ssp_device *ssp; struct ssp_device *ssp;
int status = 0; int status = 0;