summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-fsl-espi.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-09-07 23:52:06 +0300
committerMark Brown <broonie@kernel.org>2016-09-12 21:58:45 +0300
commitfaceef390702bad8bdf9c93554a3364253d9d943 (patch)
treeaee736ce5d06587585d1548387e88f02671a7870 /drivers/spi/spi-fsl-espi.c
parent5cd7b8be6b7b4c4fb9e2bfbfba596d27357cc359 (diff)
downloadlinux-faceef390702bad8bdf9c93554a3364253d9d943.tar.xz
spi: fsl-espi: eliminate struct fsl_espi_transfer
The remaining elements of struct fsl_espi_transfer are part of struct spi_transfer anyway. So we can get rid of struct fsl_espi_transfer and use a struct spi_transfer only. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-fsl-espi.c')
-rw-r--r--drivers/spi/spi-fsl-espi.c56
1 files changed, 20 insertions, 36 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 726d5fdca3b6..8554f18e4cf6 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -37,12 +37,6 @@ struct fsl_espi_reg {
__be32 csmode[4]; /* 0x020 - 0x02c eSPI cs mode register */
};
-struct fsl_espi_transfer {
- const void *tx_buf;
- void *rx_buf;
- unsigned len;
-};
-
/* eSPI Controller mode register definitions */
#define SPMODE_ENABLE (1 << 31)
#define SPMODE_LOOP (1 << 30)
@@ -267,17 +261,13 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t)
return mpc8xxx_spi->count;
}
-static int fsl_espi_do_trans(struct spi_message *m,
- struct fsl_espi_transfer *tr)
+static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans)
{
struct spi_device *spi = m->spi;
struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master);
- struct fsl_espi_transfer *espi_trans = tr;
- struct spi_transfer *t, *first, trans;
+ struct spi_transfer *t, *first;
int ret = 0;
- memset(&trans, 0, sizeof(trans));
-
first = list_first_entry(&m->transfers, struct spi_transfer,
transfer_list);
list_for_each_entry(t, &m->transfers, transfer_list) {
@@ -288,25 +278,21 @@ static int fsl_espi_do_trans(struct spi_message *m,
return -EINVAL;
}
- trans.speed_hz = t->speed_hz;
- trans.bits_per_word = t->bits_per_word;
- trans.delay_usecs = max(first->delay_usecs, t->delay_usecs);
+ trans->speed_hz = t->speed_hz;
+ trans->bits_per_word = t->bits_per_word;
+ trans->delay_usecs = max(first->delay_usecs, t->delay_usecs);
}
- trans.len = espi_trans->len;
- trans.tx_buf = espi_trans->tx_buf;
- trans.rx_buf = espi_trans->rx_buf;
-
- fsl_espi_setup_transfer(spi, &trans);
+ fsl_espi_setup_transfer(spi, trans);
- if (trans.len)
- ret = fsl_espi_bufs(spi, &trans);
+ if (trans->len)
+ ret = fsl_espi_bufs(spi, trans);
if (ret)
ret = -EMSGSIZE;
- if (trans.delay_usecs)
- udelay(trans.delay_usecs);
+ if (trans->delay_usecs)
+ udelay(trans->delay_usecs);
fsl_espi_setup_transfer(spi, NULL);
@@ -314,23 +300,22 @@ static int fsl_espi_do_trans(struct spi_message *m,
}
static int fsl_espi_cmd_trans(struct spi_message *m,
- struct fsl_espi_transfer *trans, u8 *rx_buff)
+ struct spi_transfer *trans, u8 *rx_buff)
{
struct mpc8xxx_spi *mspi = spi_master_get_devdata(m->spi->master);
- struct fsl_espi_transfer *espi_trans = trans;
int ret;
fsl_espi_copy_to_buf(m, mspi);
- espi_trans->tx_buf = mspi->local_buf;
- espi_trans->rx_buf = mspi->local_buf;
- ret = fsl_espi_do_trans(m, espi_trans);
+ trans->tx_buf = mspi->local_buf;
+ trans->rx_buf = mspi->local_buf;
+ ret = fsl_espi_do_trans(m, trans);
return ret;
}
static int fsl_espi_rw_trans(struct spi_message *m,
- struct fsl_espi_transfer *trans, u8 *rx_buff)
+ struct spi_transfer *trans, u8 *rx_buff)
{
struct mpc8xxx_spi *mspi = spi_master_get_devdata(m->spi->master);
unsigned int tx_only;
@@ -355,10 +340,9 @@ static int fsl_espi_rw_trans(struct spi_message *m,
static int fsl_espi_do_one_msg(struct spi_master *master,
struct spi_message *m)
{
- struct spi_transfer *t;
u8 *rx_buf = NULL;
unsigned int xfer_len = 0;
- struct fsl_espi_transfer espi_trans;
+ struct spi_transfer *t, trans = {};
int ret;
list_for_each_entry(t, &m->transfers, transfer_list) {
@@ -368,14 +352,14 @@ static int fsl_espi_do_one_msg(struct spi_master *master,
xfer_len += t->len;
}
- espi_trans.len = xfer_len;
+ trans.len = xfer_len;
if (!rx_buf)
- ret = fsl_espi_cmd_trans(m, &espi_trans, NULL);
+ ret = fsl_espi_cmd_trans(m, &trans, NULL);
else
- ret = fsl_espi_rw_trans(m, &espi_trans, rx_buf);
+ ret = fsl_espi_rw_trans(m, &trans, rx_buf);
- m->actual_length = ret ? 0 : espi_trans.len;
+ m->actual_length = ret ? 0 : trans.len;
if (m->status == -EINPROGRESS)
m->status = ret;