Commit c132f094 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Mark Brown

spi: rspi: Remove casts

Remove useless casts, and do not cast away const.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent fc671a90
...@@ -330,9 +330,7 @@ static int rspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg, ...@@ -330,9 +330,7 @@ static int rspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg,
struct spi_transfer *t) struct spi_transfer *t)
{ {
int remain = t->len; int remain = t->len;
u8 *data; const u8 *data = t->tx_buf;
data = (u8 *)t->tx_buf;
while (remain > 0) { while (remain > 0) {
rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_TXMD, rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_TXMD,
RSPI_SPCR); RSPI_SPCR);
...@@ -358,12 +356,11 @@ static int qspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg, ...@@ -358,12 +356,11 @@ static int qspi_send_pio(struct rspi_data *rspi, struct spi_message *mesg,
struct spi_transfer *t) struct spi_transfer *t)
{ {
int remain = t->len; int remain = t->len;
u8 *data; const u8 *data = t->tx_buf;
rspi_write8(rspi, SPBFCR_TXRST, QSPI_SPBFCR); rspi_write8(rspi, SPBFCR_TXRST, QSPI_SPBFCR);
rspi_write8(rspi, 0x00, QSPI_SPBFCR); rspi_write8(rspi, 0x00, QSPI_SPBFCR);
data = (u8 *)t->tx_buf;
while (remain > 0) { while (remain > 0) {
if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) {
...@@ -399,8 +396,8 @@ static void rspi_dma_complete(void *arg) ...@@ -399,8 +396,8 @@ static void rspi_dma_complete(void *arg)
wake_up_interruptible(&rspi->wait); wake_up_interruptible(&rspi->wait);
} }
static int rspi_dma_map_sg(struct scatterlist *sg, void *buf, unsigned len, static int rspi_dma_map_sg(struct scatterlist *sg, const void *buf,
struct dma_chan *chan, unsigned len, struct dma_chan *chan,
enum dma_transfer_direction dir) enum dma_transfer_direction dir)
{ {
sg_init_table(sg, 1); sg_init_table(sg, 1);
...@@ -440,12 +437,13 @@ static void rspi_memory_from_8bit(void *buf, const void *data, unsigned len) ...@@ -440,12 +437,13 @@ static void rspi_memory_from_8bit(void *buf, const void *data, unsigned len)
static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t)
{ {
struct scatterlist sg; struct scatterlist sg;
void *buf = NULL; const void *buf = NULL;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
unsigned len; unsigned len;
int ret = 0; int ret = 0;
if (rspi->dma_width_16bit) { if (rspi->dma_width_16bit) {
void *tmp;
/* /*
* If DMAC bus width is 16-bit, the driver allocates a dummy * If DMAC bus width is 16-bit, the driver allocates a dummy
* buffer. And, the driver converts original data into the * buffer. And, the driver converts original data into the
...@@ -454,13 +452,14 @@ static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) ...@@ -454,13 +452,14 @@ static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t)
* DMAC data: 1st byte, dummy, 2nd byte, dummy ... * DMAC data: 1st byte, dummy, 2nd byte, dummy ...
*/ */
len = t->len * 2; len = t->len * 2;
buf = kmalloc(len, GFP_KERNEL); tmp = kmalloc(len, GFP_KERNEL);
if (!buf) if (!tmp)
return -ENOMEM; return -ENOMEM;
rspi_memory_to_8bit(buf, t->tx_buf, t->len); rspi_memory_to_8bit(tmp, t->tx_buf, t->len);
buf = tmp;
} else { } else {
len = t->len; len = t->len;
buf = (void *)t->tx_buf; buf = t->tx_buf;
} }
if (!rspi_dma_map_sg(&sg, buf, len, rspi->chan_tx, DMA_TO_DEVICE)) { if (!rspi_dma_map_sg(&sg, buf, len, rspi->chan_tx, DMA_TO_DEVICE)) {
...@@ -528,7 +527,7 @@ static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, ...@@ -528,7 +527,7 @@ static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg,
rspi_receive_init(rspi); rspi_receive_init(rspi);
data = (u8 *)t->rx_buf; data = t->rx_buf;
while (remain > 0) { while (remain > 0) {
rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_TXMD, rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_TXMD,
RSPI_SPCR); RSPI_SPCR);
...@@ -575,7 +574,7 @@ static int qspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, ...@@ -575,7 +574,7 @@ static int qspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg,
qspi_receive_init(rspi); qspi_receive_init(rspi);
data = (u8 *)t->rx_buf; data = t->rx_buf;
while (remain > 0) { while (remain > 0) {
if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) { if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF, SPCR_SPTIE) < 0) {
...@@ -802,7 +801,7 @@ static void rspi_cleanup(struct spi_device *spi) ...@@ -802,7 +801,7 @@ static void rspi_cleanup(struct spi_device *spi)
static irqreturn_t rspi_irq(int irq, void *_sr) static irqreturn_t rspi_irq(int irq, void *_sr)
{ {
struct rspi_data *rspi = (struct rspi_data *)_sr; struct rspi_data *rspi = _sr;
unsigned long spsr; unsigned long spsr;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
unsigned char disable_irq = 0; unsigned char disable_irq = 0;
......
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