spi: use new spi_transfer_delay_exec helper where straightforward

For many places in the spi drivers, using the new `spi_transfer_delay`
helper is straightforward.
It's just replacing:
```
  if (t->delay_usecs)
     udelay(t->delay_usecs);
```
with `spi_transfer_delay(t)` which handles both `delay_usecs` and the new
`delay` field.

This change replaces in all places (in the spi drivers)  where this change
is simple.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20190926105147.7839-10-alexandru.ardelean@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Alexandru Ardelean 2019-09-26 13:51:37 +03:00 committed by Mark Brown
parent acc7720de3
commit e74dc5c763
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
15 changed files with 25 additions and 46 deletions

View File

@ -1366,8 +1366,7 @@ static int atmel_spi_one_transfer(struct spi_master *master,
&& as->use_pdc) && as->use_pdc)
atmel_spi_dma_unmap_xfer(master, xfer); atmel_spi_dma_unmap_xfer(master, xfer);
if (xfer->delay_usecs) spi_transfer_delay_exec(xfer);
udelay(xfer->delay_usecs);
if (xfer->cs_change) { if (xfer->cs_change) {
if (list_is_last(&xfer->transfer_list, if (list_is_last(&xfer->transfer_list,

View File

@ -291,8 +291,7 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,
msg->actual_length += t->len; msg->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (t->cs_change) if (t->cs_change)
bcm63xx_hsspi_set_cs(bs, spi->chip_select, false); bcm63xx_hsspi_set_cs(bs, spi->chip_select, false);

View File

@ -119,8 +119,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
*rx_buf++ = (u8)v; *rx_buf++ = (u8)v;
} }
if (xfer->delay_usecs) spi_transfer_delay_exec(xfer);
udelay(xfer->delay_usecs);
return xfer->len; return xfer->len;
} }

View File

@ -827,8 +827,7 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,
dev_err(&dspi->pdev->dev, dev_err(&dspi->pdev->dev,
"Waiting for transfer to complete failed!\n"); "Waiting for transfer to complete failed!\n");
if (transfer->delay_usecs) spi_transfer_delay_exec(transfer);
udelay(transfer->delay_usecs);
} }
out: out:

View File

@ -427,8 +427,7 @@ static int fsl_espi_trans(struct spi_message *m, struct spi_transfer *trans)
ret = fsl_espi_bufs(spi, trans); ret = fsl_espi_bufs(spi, trans);
if (trans->delay_usecs) spi_transfer_delay_exec(trans);
udelay(trans->delay_usecs);
return ret; return ret;
} }

View File

@ -416,8 +416,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master,
} }
m->actual_length += t->len; m->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (cs_change) { if (cs_change) {
ndelay(nsecs); ndelay(nsecs);

View File

@ -311,8 +311,7 @@ static int mpc512x_psc_spi_msg_xfer(struct spi_master *master,
break; break;
m->actual_length += t->len; m->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (cs_change) if (cs_change)
mpc512x_psc_spi_deactivate_cs(spi); mpc512x_psc_spi_deactivate_cs(spi);

View File

@ -234,8 +234,7 @@ static void mpc52xx_psc_spi_work(struct work_struct *work)
break; break;
m->actual_length += t->len; m->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (cs_change) if (cs_change)
mpc52xx_psc_spi_deactivate_cs(spi); mpc52xx_psc_spi_deactivate_cs(spi);

View File

@ -321,8 +321,7 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master,
} }
} }
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
/* ignore the "leave it on after last xfer" hint */ /* ignore the "leave it on after last xfer" hint */

View File

@ -485,12 +485,11 @@ static void giveback(struct pl022 *pl022)
struct spi_transfer, transfer_list); struct spi_transfer, transfer_list);
/* Delay if requested before any change in chip select */ /* Delay if requested before any change in chip select */
if (last_transfer->delay_usecs)
/* /*
* FIXME: This runs in interrupt context. * FIXME: This runs in interrupt context.
* Is this really smart? * Is this really smart?
*/ */
udelay(last_transfer->delay_usecs); spi_transfer_delay_exec(last_transfer);
if (!last_transfer->cs_change) { if (!last_transfer->cs_change) {
struct spi_message *next_msg; struct spi_message *next_msg;
@ -1401,12 +1400,11 @@ static void pump_transfers(unsigned long data)
previous = list_entry(transfer->transfer_list.prev, previous = list_entry(transfer->transfer_list.prev,
struct spi_transfer, struct spi_transfer,
transfer_list); transfer_list);
if (previous->delay_usecs)
/* /*
* FIXME: This runs in interrupt context. * FIXME: This runs in interrupt context.
* Is this really smart? * Is this really smart?
*/ */
udelay(previous->delay_usecs); spi_transfer_delay_exec(previous);
/* Reselect chip select only if cs_change was requested */ /* Reselect chip select only if cs_change was requested */
if (previous->cs_change) if (previous->cs_change)
@ -1520,8 +1518,7 @@ static void do_polling_transfer(struct pl022 *pl022)
previous = previous =
list_entry(transfer->transfer_list.prev, list_entry(transfer->transfer_list.prev,
struct spi_transfer, transfer_list); struct spi_transfer, transfer_list);
if (previous->delay_usecs) spi_transfer_delay_exec(previous);
udelay(previous->delay_usecs);
if (previous->cs_change) if (previous->cs_change)
pl022_cs_control(pl022, SSP_CHIP_SELECT); pl022_cs_control(pl022, SSP_CHIP_SELECT);
} else { } else {

View File

@ -211,8 +211,7 @@ static int sc18is602_transfer_one(struct spi_master *master,
} }
status = 0; status = 0;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
} }
m->status = status; m->status = status;
spi_finalize_current_message(master); spi_finalize_current_message(master);

View File

@ -190,8 +190,7 @@ static int hspi_transfer_one_message(struct spi_controller *ctlr,
msg->actual_length += t->len; msg->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (cs_change) { if (cs_change) {
ndelay(nsecs); ndelay(nsecs);

View File

@ -1229,12 +1229,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
"%s:data->current_msg->actual_length=%d\n", "%s:data->current_msg->actual_length=%d\n",
__func__, data->current_msg->actual_length); __func__, data->current_msg->actual_length);
/* check for delay */ spi_transfer_delay_exec(data->cur_trans);
if (data->cur_trans->delay_usecs) {
dev_dbg(&data->master->dev, "%s:delay in usec=%d\n",
__func__, data->cur_trans->delay_usecs);
udelay(data->cur_trans->delay_usecs);
}
spin_lock(&data->lock); spin_lock(&data->lock);

View File

@ -248,8 +248,7 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m)
len -= count * wsize; len -= count * wsize;
} }
m->actual_length += t->len; m->actual_length += t->len;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
if (!cs_change) if (!cs_change)
continue; continue;

View File

@ -188,8 +188,7 @@ static int spi_xcomm_transfer_one(struct spi_master *master,
} }
status = 0; status = 0;
if (t->delay_usecs) spi_transfer_delay_exec(t);
udelay(t->delay_usecs);
is_first = false; is_first = false;
} }