aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2008-04-28 05:14:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:31 -0400
commitcf43369d55a30a0d8f9ef4700c798c72dbd3afb7 (patch)
treecd380715706ad6d7462663a0ac6360604581f4f4 /drivers/spi
parent79d8c7a8c888a7c2ab9dd4249495b24575b3f9a6 (diff)
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/pxa2xx_spi.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 147e26a78d64..654bb58be630 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -67,8 +67,11 @@ MODULE_ALIAS("platform:pxa2xx-spi");
67 | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) 67 | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
68 68
69#define DEFINE_SSP_REG(reg, off) \ 69#define DEFINE_SSP_REG(reg, off) \
70static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \ 70static inline u32 read_##reg(void const __iomem *p) \
71static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); } 71{ return __raw_readl(p + (off)); } \
72\
73static inline void write_##reg(u32 v, void __iomem *p) \
74{ __raw_writel(v, p + (off)); }
72 75
73DEFINE_SSP_REG(SSCR0, 0x00) 76DEFINE_SSP_REG(SSCR0, 0x00)
74DEFINE_SSP_REG(SSCR1, 0x04) 77DEFINE_SSP_REG(SSCR1, 0x04)
@@ -106,7 +109,7 @@ struct driver_data {
106 u32 *null_dma_buf; 109 u32 *null_dma_buf;
107 110
108 /* SSP register addresses */ 111 /* SSP register addresses */
109 void *ioaddr; 112 void __iomem *ioaddr;
110 u32 ssdr_physical; 113 u32 ssdr_physical;
111 114
112 /* SSP masks*/ 115 /* SSP masks*/
@@ -173,7 +176,7 @@ static int flush(struct driver_data *drv_data)
173{ 176{
174 unsigned long limit = loops_per_jiffy << 1; 177 unsigned long limit = loops_per_jiffy << 1;
175 178
176 void *reg = drv_data->ioaddr; 179 void __iomem *reg = drv_data->ioaddr;
177 180
178 do { 181 do {
179 while (read_SSSR(reg) & SSSR_RNE) { 182 while (read_SSSR(reg) & SSSR_RNE) {
@@ -191,7 +194,7 @@ static void null_cs_control(u32 command)
191 194
192static int null_writer(struct driver_data *drv_data) 195static int null_writer(struct driver_data *drv_data)
193{ 196{
194 void *reg = drv_data->ioaddr; 197 void __iomem *reg = drv_data->ioaddr;
195 u8 n_bytes = drv_data->n_bytes; 198 u8 n_bytes = drv_data->n_bytes;
196 199
197 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) 200 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
@@ -206,7 +209,7 @@ static int null_writer(struct driver_data *drv_data)
206 209
207static int null_reader(struct driver_data *drv_data) 210static int null_reader(struct driver_data *drv_data)
208{ 211{
209 void *reg = drv_data->ioaddr; 212 void __iomem *reg = drv_data->ioaddr;
210 u8 n_bytes = drv_data->n_bytes; 213 u8 n_bytes = drv_data->n_bytes;
211 214
212 while ((read_SSSR(reg) & SSSR_RNE) 215 while ((read_SSSR(reg) & SSSR_RNE)
@@ -220,7 +223,7 @@ static int null_reader(struct driver_data *drv_data)
220 223
221static int u8_writer(struct driver_data *drv_data) 224static int u8_writer(struct driver_data *drv_data)
222{ 225{
223 void *reg = drv_data->ioaddr; 226 void __iomem *reg = drv_data->ioaddr;
224 227
225 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) 228 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
226 || (drv_data->tx == drv_data->tx_end)) 229 || (drv_data->tx == drv_data->tx_end))
@@ -234,7 +237,7 @@ static int u8_writer(struct driver_data *drv_data)
234 237
235static int u8_reader(struct driver_data *drv_data) 238static int u8_reader(struct driver_data *drv_data)
236{ 239{
237 void *reg = drv_data->ioaddr; 240 void __iomem *reg = drv_data->ioaddr;
238 241
239 while ((read_SSSR(reg) & SSSR_RNE) 242 while ((read_SSSR(reg) & SSSR_RNE)
240 && (drv_data->rx < drv_data->rx_end)) { 243 && (drv_data->rx < drv_data->rx_end)) {
@@ -247,7 +250,7 @@ static int u8_reader(struct driver_data *drv_data)
247 250
248static int u16_writer(struct driver_data *drv_data) 251static int u16_writer(struct driver_data *drv_data)
249{ 252{
250 void *reg = drv_data->ioaddr; 253 void __iomem *reg = drv_data->ioaddr;
251 254
252 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) 255 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
253 || (drv_data->tx == drv_data->tx_end)) 256 || (drv_data->tx == drv_data->tx_end))
@@ -261,7 +264,7 @@ static int u16_writer(struct driver_data *drv_data)
261 264
262static int u16_reader(struct driver_data *drv_data) 265static int u16_reader(struct driver_data *drv_data)
263{ 266{
264 void *reg = drv_data->ioaddr; 267 void __iomem *reg = drv_data->ioaddr;
265 268
266 while ((read_SSSR(reg) & SSSR_RNE) 269 while ((read_SSSR(reg) & SSSR_RNE)
267 && (drv_data->rx < drv_data->rx_end)) { 270 && (drv_data->rx < drv_data->rx_end)) {
@@ -274,7 +277,7 @@ static int u16_reader(struct driver_data *drv_data)
274 277
275static int u32_writer(struct driver_data *drv_data) 278static int u32_writer(struct driver_data *drv_data)
276{ 279{
277 void *reg = drv_data->ioaddr; 280 void __iomem *reg = drv_data->ioaddr;
278 281
279 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00) 282 if (((read_SSSR(reg) & 0x00000f00) == 0x00000f00)
280 || (drv_data->tx == drv_data->tx_end)) 283 || (drv_data->tx == drv_data->tx_end))
@@ -288,7 +291,7 @@ static int u32_writer(struct driver_data *drv_data)
288 291
289static int u32_reader(struct driver_data *drv_data) 292static int u32_reader(struct driver_data *drv_data)
290{ 293{
291 void *reg = drv_data->ioaddr; 294 void __iomem *reg = drv_data->ioaddr;
292 295
293 while ((read_SSSR(reg) & SSSR_RNE) 296 while ((read_SSSR(reg) & SSSR_RNE)
294 && (drv_data->rx < drv_data->rx_end)) { 297 && (drv_data->rx < drv_data->rx_end)) {
@@ -412,7 +415,7 @@ static void giveback(struct driver_data *drv_data)
412 msg->complete(msg->context); 415 msg->complete(msg->context);
413} 416}
414 417
415static int wait_ssp_rx_stall(void *ioaddr) 418static int wait_ssp_rx_stall(void const __iomem *ioaddr)
416{ 419{
417 unsigned long limit = loops_per_jiffy << 1; 420 unsigned long limit = loops_per_jiffy << 1;
418 421
@@ -432,9 +435,9 @@ static int wait_dma_channel_stop(int channel)
432 return limit; 435 return limit;
433} 436}
434 437
435void dma_error_stop(struct driver_data *drv_data, const char *msg) 438static void dma_error_stop(struct driver_data *drv_data, const char *msg)
436{ 439{
437 void *reg = drv_data->ioaddr; 440 void __iomem *reg = drv_data->ioaddr;
438 441
439 /* Stop and reset */ 442 /* Stop and reset */
440 DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL; 443 DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
@@ -456,7 +459,7 @@ void dma_error_stop(struct driver_data *drv_data, const char *msg)
456 459
457static void dma_transfer_complete(struct driver_data *drv_data) 460static void dma_transfer_complete(struct driver_data *drv_data)
458{ 461{
459 void *reg = drv_data->ioaddr; 462 void __iomem *reg = drv_data->ioaddr;
460 struct spi_message *msg = drv_data->cur_msg; 463 struct spi_message *msg = drv_data->cur_msg;
461 464
462 /* Clear and disable interrupts on SSP and DMA channels*/ 465 /* Clear and disable interrupts on SSP and DMA channels*/
@@ -536,7 +539,7 @@ static void dma_handler(int channel, void *data)
536static irqreturn_t dma_transfer(struct driver_data *drv_data) 539static irqreturn_t dma_transfer(struct driver_data *drv_data)
537{ 540{
538 u32 irq_status; 541 u32 irq_status;
539 void *reg = drv_data->ioaddr; 542 void __iomem *reg = drv_data->ioaddr;
540 543
541 irq_status = read_SSSR(reg) & drv_data->mask_sr; 544 irq_status = read_SSSR(reg) & drv_data->mask_sr;
542 if (irq_status & SSSR_ROR) { 545 if (irq_status & SSSR_ROR) {
@@ -570,7 +573,7 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data)
570 573
571static void int_error_stop(struct driver_data *drv_data, const char* msg) 574static void int_error_stop(struct driver_data *drv_data, const char* msg)
572{ 575{
573 void *reg = drv_data->ioaddr; 576 void __iomem *reg = drv_data->ioaddr;
574 577
575 /* Stop and reset SSP */ 578 /* Stop and reset SSP */
576 write_SSSR(drv_data->clear_sr, reg); 579 write_SSSR(drv_data->clear_sr, reg);
@@ -588,7 +591,7 @@ static void int_error_stop(struct driver_data *drv_data, const char* msg)
588 591
589static void int_transfer_complete(struct driver_data *drv_data) 592static void int_transfer_complete(struct driver_data *drv_data)
590{ 593{
591 void *reg = drv_data->ioaddr; 594 void __iomem *reg = drv_data->ioaddr;
592 595
593 /* Stop SSP */ 596 /* Stop SSP */
594 write_SSSR(drv_data->clear_sr, reg); 597 write_SSSR(drv_data->clear_sr, reg);
@@ -614,7 +617,7 @@ static void int_transfer_complete(struct driver_data *drv_data)
614 617
615static irqreturn_t interrupt_transfer(struct driver_data *drv_data) 618static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
616{ 619{
617 void *reg = drv_data->ioaddr; 620 void __iomem *reg = drv_data->ioaddr;
618 621
619 u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ? 622 u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ?
620 drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS; 623 drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS;
@@ -675,7 +678,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
675static irqreturn_t ssp_int(int irq, void *dev_id) 678static irqreturn_t ssp_int(int irq, void *dev_id)
676{ 679{
677 struct driver_data *drv_data = dev_id; 680 struct driver_data *drv_data = dev_id;
678 void *reg = drv_data->ioaddr; 681 void __iomem *reg = drv_data->ioaddr;
679 682
680 if (!drv_data->cur_msg) { 683 if (!drv_data->cur_msg) {
681 684
@@ -695,7 +698,8 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
695 return drv_data->transfer_handler(drv_data); 698 return drv_data->transfer_handler(drv_data);
696} 699}
697 700
698int set_dma_burst_and_threshold(struct chip_data *chip, struct spi_device *spi, 701static int set_dma_burst_and_threshold(struct chip_data *chip,
702 struct spi_device *spi,
699 u8 bits_per_word, u32 *burst_code, 703 u8 bits_per_word, u32 *burst_code,
700 u32 *threshold) 704 u32 *threshold)
701{ 705{
@@ -809,7 +813,7 @@ static void pump_transfers(unsigned long data)
809 struct spi_transfer *previous = NULL; 813 struct spi_transfer *previous = NULL;
810 struct chip_data *chip = NULL; 814 struct chip_data *chip = NULL;
811 struct ssp_device *ssp = drv_data->ssp; 815 struct ssp_device *ssp = drv_data->ssp;
812 void *reg = drv_data->ioaddr; 816 void __iomem *reg = drv_data->ioaddr;
813 u32 clk_div = 0; 817 u32 clk_div = 0;
814 u8 bits = 0; 818 u8 bits = 0;
815 u32 speed = 0; 819 u32 speed = 0;
@@ -1338,7 +1342,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
1338 struct device *dev = &pdev->dev; 1342 struct device *dev = &pdev->dev;
1339 struct pxa2xx_spi_master *platform_info; 1343 struct pxa2xx_spi_master *platform_info;
1340 struct spi_master *master; 1344 struct spi_master *master;
1341 struct driver_data *drv_data = 0; 1345 struct driver_data *drv_data = NULL;
1342 struct ssp_device *ssp; 1346 struct ssp_device *ssp;
1343 int status = 0; 1347 int status = 0;
1344 1348