Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i3c: master: svc: Replace bool rnw with union for HDR support

Replace the bool rnw field with a union in preparation for adding HDR
support. HDR uses a cmd field instead of the rnw bit to indicate read or
write direction.

Add helper function svc_cmd_is_read() to check transfer direction.

Add a local variable 'rnw' in svc_i3c_master_priv_xfers() to avoid
repeatedly accessing xfers[i].rnw.

No functional change.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20251106-i3c_ddr-v11-3-33a6a66ed095@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Frank Li and committed by
Alexandre Belloni
108420fe 9280b6eb

+18 -7
+18 -7
drivers/i3c/master/svc-i3c-master.c
··· 165 165 166 166 struct svc_i3c_cmd { 167 167 u8 addr; 168 - bool rnw; 168 + union { 169 + bool rnw; 170 + u8 cmd; 171 + u32 rnw_cmd; 172 + }; 169 173 u8 *in; 170 174 const void *out; 171 175 unsigned int len; ··· 385 381 return NULL; 386 382 387 383 return master->descs[i]; 384 + } 385 + 386 + static bool svc_cmd_is_read(u32 rnw_cmd, u32 type) 387 + { 388 + return rnw_cmd; 388 389 } 389 390 390 391 static void svc_i3c_master_emit_stop(struct svc_i3c_master *master) ··· 1308 1299 } 1309 1300 1310 1301 static int svc_i3c_master_xfer(struct svc_i3c_master *master, 1311 - bool rnw, unsigned int xfer_type, u8 addr, 1302 + u32 rnw_cmd, unsigned int xfer_type, u8 addr, 1312 1303 u8 *in, const u8 *out, unsigned int xfer_len, 1313 1304 unsigned int *actual_len, bool continued, bool repeat_start) 1314 1305 { 1306 + bool rnw = svc_cmd_is_read(rnw_cmd, xfer_type); 1315 1307 int retry = repeat_start ? 1 : 2; 1316 1308 u32 reg; 1317 1309 int ret; ··· 1500 1490 for (i = 0; i < xfer->ncmds; i++) { 1501 1491 struct svc_i3c_cmd *cmd = &xfer->cmds[i]; 1502 1492 1503 - ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type, 1493 + ret = svc_i3c_master_xfer(master, cmd->rnw_cmd, xfer->type, 1504 1494 cmd->addr, cmd->in, cmd->out, 1505 1495 cmd->len, &cmd->actual_len, 1506 1496 cmd->continued, i > 0); ··· 1693 1683 1694 1684 for (i = 0; i < nxfers; i++) { 1695 1685 struct svc_i3c_cmd *cmd = &xfer->cmds[i]; 1686 + bool rnw = xfers[i].rnw; 1696 1687 1697 1688 cmd->xfer = &xfers[i]; 1698 1689 cmd->addr = master->addrs[data->index]; 1699 - cmd->rnw = xfers[i].rnw; 1700 - cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; 1701 - cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out; 1690 + cmd->rnw = rnw; 1691 + cmd->in = rnw ? xfers[i].data.in : NULL; 1692 + cmd->out = rnw ? NULL : xfers[i].data.out; 1702 1693 cmd->len = xfers[i].len; 1703 - cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0; 1694 + cmd->actual_len = rnw ? xfers[i].len : 0; 1704 1695 cmd->continued = (i + 1) < nxfers; 1705 1696 } 1706 1697