Commit 937041e2 authored by Wolfram Sang's avatar Wolfram Sang Committed by Grant Likely

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: default avatarWolfram Sang <w.sang@pengutronix.de>
Acked-by: default avatarLuotao Fu <l.fu@pengutronix.de>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 77166934
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/mpc52xx_spi.h>
#include <linux/of_spi.h> #include <linux/of_spi.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
...@@ -54,7 +53,7 @@ MODULE_LICENSE("GPL"); ...@@ -54,7 +53,7 @@ MODULE_LICENSE("GPL");
/* FSM state return values */ /* FSM state return values */
#define FSM_STOP 0 /* Nothing more for the state machine to */ #define FSM_STOP 0 /* Nothing more for the state machine to */
/* do. If something interesting happens */ /* do. If something interesting happens */
/* then and IRQ will be received */ /* then an IRQ will be received */
#define FSM_POLL 1 /* need to poll for completion, an IRQ is */ #define FSM_POLL 1 /* need to poll for completion, an IRQ is */
/* not expected */ /* not expected */
#define FSM_CONTINUE 2 /* Keep iterating the state machine */ #define FSM_CONTINUE 2 /* Keep iterating the state machine */
...@@ -62,13 +61,12 @@ MODULE_LICENSE("GPL"); ...@@ -62,13 +61,12 @@ MODULE_LICENSE("GPL");
/* Driver internal data */ /* Driver internal data */
struct mpc52xx_spi { struct mpc52xx_spi {
struct spi_master *master; struct spi_master *master;
u32 sysclk;
void __iomem *regs; void __iomem *regs;
int irq0; /* MODF irq */ int irq0; /* MODF irq */
int irq1; /* SPIF irq */ int irq1; /* SPIF irq */
int ipb_freq; unsigned int ipb_freq;
/* Statistics */ /* Statistics; not used now, but will be reintroduced for debugfs */
int msg_count; int msg_count;
int wcol_count; int wcol_count;
int wcol_ticks; int wcol_ticks;
...@@ -229,7 +227,7 @@ static int mpc52xx_spi_fsmstate_transfer(int irq, struct mpc52xx_spi *ms, ...@@ -229,7 +227,7 @@ static int mpc52xx_spi_fsmstate_transfer(int irq, struct mpc52xx_spi *ms,
ms->wcol_tx_timestamp = get_tbl(); ms->wcol_tx_timestamp = get_tbl();
data = 0; data = 0;
if (ms->tx_buf) if (ms->tx_buf)
data = *(ms->tx_buf-1); data = *(ms->tx_buf - 1);
out_8(ms->regs + SPI_DATA, data); /* try again */ out_8(ms->regs + SPI_DATA, data); /* try again */
return FSM_CONTINUE; return FSM_CONTINUE;
} else if (status & SPI_STATUS_MODF) { } else if (status & SPI_STATUS_MODF) {
...@@ -481,8 +479,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, ...@@ -481,8 +479,9 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
gpio_direction_output(gpio_cs, 1); gpio_direction_output(gpio_cs, 1);
ms->gpio_cs[i] = gpio_cs; ms->gpio_cs[i] = gpio_cs;
} }
} else } else {
master->num_chipselect = 1; master->num_chipselect = 1;
}
spin_lock_init(&ms->lock); spin_lock_init(&ms->lock);
INIT_LIST_HEAD(&ms->queue); INIT_LIST_HEAD(&ms->queue);
...@@ -490,10 +489,10 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, ...@@ -490,10 +489,10 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
/* Decide if interrupts can be used */ /* Decide if interrupts can be used */
if (ms->irq0 && ms->irq1) { if (ms->irq0 && ms->irq1) {
rc = request_irq(ms->irq0, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, rc = request_irq(ms->irq0, mpc52xx_spi_irq, 0,
"mpc5200-spi-modf", ms); "mpc5200-spi-modf", ms);
rc |= request_irq(ms->irq1, mpc52xx_spi_irq, IRQF_SAMPLE_RANDOM, rc |= request_irq(ms->irq1, mpc52xx_spi_irq, 0,
"mpc5200-spi-spiF", ms); "mpc5200-spi-spif", ms);
if (rc) { if (rc) {
free_irq(ms->irq0, ms); free_irq(ms->irq0, ms);
free_irq(ms->irq1, ms); free_irq(ms->irq1, ms);
...@@ -524,8 +523,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, ...@@ -524,8 +523,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op,
while (i-- > 0) while (i-- > 0)
gpio_free(ms->gpio_cs[i]); gpio_free(ms->gpio_cs[i]);
if (ms->gpio_cs != NULL) kfree(ms->gpio_cs);
kfree(ms->gpio_cs);
err_alloc: err_alloc:
err_init: err_init:
iounmap(regs); iounmap(regs);
...@@ -544,9 +542,7 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op) ...@@ -544,9 +542,7 @@ static int __devexit mpc52xx_spi_remove(struct of_device *op)
for (i = 0; i < ms->gpio_cs_count; i++) for (i = 0; i < ms->gpio_cs_count; i++)
gpio_free(ms->gpio_cs[i]); gpio_free(ms->gpio_cs[i]);
if (ms->gpio_cs != NULL) kfree(ms->gpio_cs);
kfree(ms->gpio_cs);
spi_unregister_master(master); spi_unregister_master(master);
spi_master_put(master); spi_master_put(master);
iounmap(ms->regs); iounmap(ms->regs);
......
#ifndef INCLUDE_MPC5200_SPI_H
#define INCLUDE_MPC5200_SPI_H
extern void mpc52xx_spi_set_premessage_hook(struct spi_master *master,
void (*hook)(struct spi_message *m,
void *context),
void *hook_context);
#endif
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