mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
i3c: master: svc: rename read_len as actual_len
I3C transfer (SDR), target can early terminate read transfer. I3C transfer (HDR), target can end write transfer. I2C transfer, target can NACK write transfer. 'actual_len' is better name than 'read_len'. Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20231201222532.2431484-5-Frank.Li@nxp.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
e5e3df06ac
commit
6fb61734a7
@ -137,7 +137,7 @@ struct svc_i3c_cmd {
|
||||
u8 *in;
|
||||
const void *out;
|
||||
unsigned int len;
|
||||
unsigned int read_len;
|
||||
unsigned int actual_len;
|
||||
bool continued;
|
||||
};
|
||||
|
||||
@ -1039,7 +1039,7 @@ static int svc_i3c_master_write(struct svc_i3c_master *master,
|
||||
static int svc_i3c_master_xfer(struct svc_i3c_master *master,
|
||||
bool rnw, unsigned int xfer_type, u8 addr,
|
||||
u8 *in, const u8 *out, unsigned int xfer_len,
|
||||
unsigned int *read_len, bool continued)
|
||||
unsigned int *actual_len, bool continued)
|
||||
{
|
||||
u32 reg;
|
||||
int ret;
|
||||
@ -1052,7 +1052,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
|
||||
SVC_I3C_MCTRL_IBIRESP_NACK |
|
||||
SVC_I3C_MCTRL_DIR(rnw) |
|
||||
SVC_I3C_MCTRL_ADDR(addr) |
|
||||
SVC_I3C_MCTRL_RDTERM(*read_len),
|
||||
SVC_I3C_MCTRL_RDTERM(*actual_len),
|
||||
master->regs + SVC_I3C_MCTRL);
|
||||
|
||||
ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
|
||||
@ -1090,7 +1090,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
|
||||
goto emit_stop;
|
||||
|
||||
if (rnw)
|
||||
*read_len = ret;
|
||||
*actual_len = ret;
|
||||
|
||||
ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
|
||||
SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000);
|
||||
@ -1172,7 +1172,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
|
||||
|
||||
ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type,
|
||||
cmd->addr, cmd->in, cmd->out,
|
||||
cmd->len, &cmd->read_len,
|
||||
cmd->len, &cmd->actual_len,
|
||||
cmd->continued);
|
||||
if (ret)
|
||||
break;
|
||||
@ -1258,7 +1258,7 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master,
|
||||
cmd->in = NULL;
|
||||
cmd->out = buf;
|
||||
cmd->len = xfer_len;
|
||||
cmd->read_len = 0;
|
||||
cmd->actual_len = 0;
|
||||
cmd->continued = false;
|
||||
|
||||
mutex_lock(&master->lock);
|
||||
@ -1278,7 +1278,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
|
||||
struct i3c_ccc_cmd *ccc)
|
||||
{
|
||||
unsigned int xfer_len = ccc->dests[0].payload.len;
|
||||
unsigned int read_len = ccc->rnw ? xfer_len : 0;
|
||||
unsigned int actual_len = ccc->rnw ? xfer_len : 0;
|
||||
struct svc_i3c_xfer *xfer;
|
||||
struct svc_i3c_cmd *cmd;
|
||||
int ret;
|
||||
@ -1296,7 +1296,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
|
||||
cmd->in = NULL;
|
||||
cmd->out = &ccc->id;
|
||||
cmd->len = 1;
|
||||
cmd->read_len = 0;
|
||||
cmd->actual_len = 0;
|
||||
cmd->continued = true;
|
||||
|
||||
/* Directed message */
|
||||
@ -1306,7 +1306,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
|
||||
cmd->in = ccc->rnw ? ccc->dests[0].payload.data : NULL;
|
||||
cmd->out = ccc->rnw ? NULL : ccc->dests[0].payload.data,
|
||||
cmd->len = xfer_len;
|
||||
cmd->read_len = read_len;
|
||||
cmd->actual_len = actual_len;
|
||||
cmd->continued = false;
|
||||
|
||||
mutex_lock(&master->lock);
|
||||
@ -1315,8 +1315,8 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
|
||||
svc_i3c_master_dequeue_xfer(master, xfer);
|
||||
mutex_unlock(&master->lock);
|
||||
|
||||
if (cmd->read_len != xfer_len)
|
||||
ccc->dests[0].payload.len = cmd->read_len;
|
||||
if (cmd->actual_len != xfer_len)
|
||||
ccc->dests[0].payload.len = cmd->actual_len;
|
||||
|
||||
ret = xfer->ret;
|
||||
svc_i3c_master_free_xfer(xfer);
|
||||
@ -1366,7 +1366,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
|
||||
cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL;
|
||||
cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out;
|
||||
cmd->len = xfers[i].len;
|
||||
cmd->read_len = xfers[i].rnw ? xfers[i].len : 0;
|
||||
cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0;
|
||||
cmd->continued = (i + 1) < nxfers;
|
||||
}
|
||||
|
||||
@ -1406,7 +1406,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
|
||||
cmd->in = cmd->rnw ? xfers[i].buf : NULL;
|
||||
cmd->out = cmd->rnw ? NULL : xfers[i].buf;
|
||||
cmd->len = xfers[i].len;
|
||||
cmd->read_len = cmd->rnw ? xfers[i].len : 0;
|
||||
cmd->actual_len = cmd->rnw ? xfers[i].len : 0;
|
||||
cmd->continued = (i + 1 < nxfers);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user