spi: fsl-espi: remove unneeded variable in fsl_espi_do_trans

Creating a message, adding one transfer, and then iterating over
all transfers in the message doesn't make sense.
We can simply use the original transfer directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Heiner Kallweit 2016-08-25 06:45:55 +02:00 committed by Mark Brown
parent 10ed1e6d32
commit dbd4fefb5b
1 changed files with 8 additions and 15 deletions

View File

@ -258,11 +258,9 @@ static void fsl_espi_do_trans(struct spi_message *m,
struct spi_device *spi = m->spi; struct spi_device *spi = m->spi;
struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master);
struct fsl_espi_transfer *espi_trans = tr; struct fsl_espi_transfer *espi_trans = tr;
struct spi_message message;
struct spi_transfer *t, *first, trans; struct spi_transfer *t, *first, trans;
int status = 0; int status = 0;
spi_message_init(&message);
memset(&trans, 0, sizeof(trans)); memset(&trans, 0, sizeof(trans));
first = list_first_entry(&m->transfers, struct spi_transfer, first = list_first_entry(&m->transfers, struct spi_transfer,
@ -284,23 +282,18 @@ static void fsl_espi_do_trans(struct spi_message *m,
trans.len = espi_trans->len; trans.len = espi_trans->len;
trans.tx_buf = espi_trans->tx_buf; trans.tx_buf = espi_trans->tx_buf;
trans.rx_buf = espi_trans->rx_buf; trans.rx_buf = espi_trans->rx_buf;
spi_message_add_tail(&trans, &message);
list_for_each_entry(t, &message.transfers, transfer_list) { if (trans.bits_per_word || trans.speed_hz)
if (t->bits_per_word || t->speed_hz) fsl_espi_setup_transfer(spi, &trans);
fsl_espi_setup_transfer(spi, t);
if (t->len) if (trans.len)
status = fsl_espi_bufs(spi, t); status = fsl_espi_bufs(spi, &trans);
if (status) { if (status)
status = -EMSGSIZE; status = -EMSGSIZE;
break;
}
if (t->delay_usecs) if (trans.delay_usecs)
udelay(t->delay_usecs); udelay(trans.delay_usecs);
}
espi_trans->status = status; espi_trans->status = status;
fsl_espi_setup_transfer(spi, NULL); fsl_espi_setup_transfer(spi, NULL);