diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-11-24 19:18:31 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-12-08 20:48:15 -0500 |
commit | 937041e21634ffecc92d05cf693423a2c95b7252 (patch) | |
tree | e7d13370617ec2262daeae98eb391d2921f51319 | |
parent | 771669349e6cec0e29a18dc0b5a108e81b85d58c (diff) |
spi/mpc52xx-spi: minor cleanups
- drop own, obsolete include-file
- drop IRQF_SAMPLE_RANDOM (deprecated feature)
- drop 'if' above kfree()
- typos, braces & whitespaces
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r-- | drivers/spi/mpc52xx_spi.c | 26 | ||||
-rw-r--r-- | include/linux/spi/mpc52xx_spi.h | 10 |
2 files changed, 11 insertions, 25 deletions
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 97beba2895e7..45bfe6458173 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/spi/mpc52xx_spi.h> | ||
22 | #include <linux/of_spi.h> | 21 | #include <linux/of_spi.h> |
23 | #include <linux/io.h> | 22 | #include <linux/io.h> |
24 | #include <linux/of_gpio.h> | 23 | #include <linux/of_gpio.h> |
@@ -54,7 +53,7 @@ MODULE_LICENSE("GPL"); | |||
54 | /* FSM state return values */ | 53 | /* FSM state return values */ |
55 | #define FSM_STOP 0 /* Nothing more for the state machine to */ | 54 | #define FSM_STOP 0 /* Nothing more for the state machine to */ |
56 | /* do. If something interesting happens */ | 55 | /* do. If something interesting happens */ |
57 | /* then and IRQ will be received */ | 56 | /* then an IRQ will be received */ |
58 | #define FSM_POLL 1 /* need to poll for completion, an IRQ is */ | 57 | #define FSM_POLL 1 /* need to poll for completion, an IRQ is */ |
59 | /* not expected */ | 58 | /* not expected */ |
60 | #define FSM_CONTINUE 2 /* Keep iterating the state machine */ | 59 | #define FSM_CONTINUE 2 /* Keep iterating the state machine */ |
@@ -62,13 +61,12 @@ MODULE_LICENSE("GPL"); | |||
62 | /* Driver internal data */ | 61 | /* Driver internal data */ |
63 | struct mpc52xx_spi { | 62 | struct mpc52xx_spi { |
64 | struct spi_master *master; | 63 | struct spi_master *master; |
65 | u32 sysclk; | ||
66 | void __iomem *regs; | 64 | void __iomem *regs; |
67 | int irq0; /* MODF irq */ | 65 | int irq0; /* MODF irq */ |
68 | int irq1; /* SPIF irq */ | 66 | int irq1; /* SPIF irq */ |
69 | int ipb_freq; | 67 | unsigned int ipb_freq; |
70 | 68 | ||
71 | /* Statistics */ | 69 | /* Statistics; not used now, but will be reintroduced for debugfs */ |
72 | int msg_count; | 70 | int msg_count; |
73 | int wcol_count; | 71 | int wcol_count; |
74 | int wcol_ticks; | 72 | int wcol_ticks; |
@@ -229,7 +227,7 @@ static int mpc52xx_spi_fsmstate_transfer(int irq, struct mpc52xx_spi *ms, | |||
229 | ms->wcol_tx_timestamp = get_tbl(); | 227 | ms->wcol_tx_timestamp = get_tbl(); |
230 | data = 0; | 228 | data = 0; |
231 | if (ms->tx_buf) | 229 | if (ms->tx_buf) |
232 | data = *(ms->tx_buf-1); | 230 | data = *(ms->tx_buf - 1); |
233 | out_8(ms->regs + SPI_DATA, data); /* try again */ | 231 | out_8(ms->regs + SPI_DATA, data); /* try again */ |
234 | return FSM_CONTINUE; | 232 | return FSM_CONTINUE; |
235 | } else if (status & SPI_STATUS_MODF) { | 233 | } else if (status & SPI_STATUS_MODF) { |
@@ -481,8 +479,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, | |||
481 | gpio_direction_output(gpio_cs, 1); | 479 | gpio_direction_output(gpio_cs, 1); |
482 | ms->gpio_cs[i] = gpio_cs; | 480 | ms->gpio_cs[i] = gpio_cs; |
483 | } | 481 | } |
484 | } else | 482 | } else { |
485 | master->num_chipselect = 1; | 483 | master->num_chipselect = 1; |
484 | } | ||
486 | 485 | ||
487 | spin_lock_init(&ms->lock); | 486 | spin_lock_init(&ms->lock); |
488 | INIT_LIST_HEAD(&ms->queue); | 487 | INIT_LIST_HEAD(&ms->queue); |
@@ -490,10 +489,10 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, | |||
490 | 489 | ||
491 | /* Decide if interrupts can be used */ | 490 | /* Decide if interrupts can be used */ |
492 | if (ms->irq0 && ms->irq1) { | 491 | if (ms->irq0 && ms->irq1) { |
493 | rc = request_irq(ms->irq0, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, | 492 | rc = request_irq(ms->irq0, mpc52xx_spi_irq, 0, |
494 | "mpc5200-spi-modf", ms); | 493 | "mpc5200-spi-modf", ms); |
495 | rc |= request_irq(ms->irq1, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, | 494 | rc |= request_irq(ms->irq1, mpc52xx_spi_irq, 0, |
496 | "mpc5200-spi-spiF", ms); | 495 | "mpc5200-spi-spif", ms); |
497 | if (rc) { | 496 | if (rc) { |
498 | free_irq(ms->irq0, ms); | 497 | free_irq(ms->irq0, ms); |
499 | free_irq(ms->irq1, ms); | 498 | free_irq(ms->irq1, ms); |
@@ -524,8 +523,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, | |||
524 | while (i-- > 0) | 523 | while (i-- > 0) |
525 | gpio_free(ms->gpio_cs[i]); | 524 | gpio_free(ms->gpio_cs[i]); |
526 | 525 | ||
527 | if (ms->gpio_cs != NULL) | 526 | kfree(ms->gpio_cs); |
528 | kfree(ms->gpio_cs); | ||
529 | err_alloc: | 527 | err_alloc: |
530 | err_init: | 528 | err_init: |
531 | iounmap(regs); | 529 | iounmap(regs); |
@@ -544,9 +542,7 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op) | |||
544 | for (i = 0; i < ms->gpio_cs_count; i++) | 542 | for (i = 0; i < ms->gpio_cs_count; i++) |
545 | gpio_free(ms->gpio_cs[i]); | 543 | gpio_free(ms->gpio_cs[i]); |
546 | 544 | ||
547 | if (ms->gpio_cs != NULL) | 545 | kfree(ms->gpio_cs); |
548 | kfree(ms->gpio_cs); | ||
549 | |||
550 | spi_unregister_master(master); | 546 | spi_unregister_master(master); |
551 | spi_master_put(master); | 547 | spi_master_put(master); |
552 | iounmap(ms->regs); | 548 | iounmap(ms->regs); |
diff --git a/include/linux/spi/mpc52xx_spi.h b/include/linux/spi/mpc52xx_spi.h deleted file mode 100644 index d1004cf09241..000000000000 --- a/include/linux/spi/mpc52xx_spi.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | |||
2 | #ifndef INCLUDE_MPC5200_SPI_H | ||
3 | #define INCLUDE_MPC5200_SPI_H | ||
4 | |||
5 | extern void mpc52xx_spi_set_premessage_hook(struct spi_master *master, | ||
6 | void (*hook)(struct spi_message *m, | ||
7 | void *context), | ||
8 | void *hook_context); | ||
9 | |||
10 | #endif | ||