26 Jul
2018
26 Jul
'18
4:02 p.m.
The series looks pretty good now, I just found one possible improvement below Thanks!
-static int sdw_bank_switch(struct sdw_bus *bus) +static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) { int col_index, row_index;
- bool multi_link; struct sdw_msg *wr_msg; u8 *wbuf = NULL; int ret = 0;
@@ -638,6 +639,8 @@ static int sdw_bank_switch(struct sdw_bus *bus) if (!wr_msg) return -ENOMEM;
- bus->defer_msg.msg = wr_msg;
- wbuf = kzalloc(sizeof(*wbuf), GFP_KERNEL); if (!wbuf) { ret = -ENOMEM;
@@ -658,17 +661,29 @@ static int sdw_bank_switch(struct sdw_bus *bus) SDW_MSG_FLAG_WRITE, wbuf); wr_msg->ssp_sync = true;
- ret = sdw_transfer(bus, wr_msg);
- /*
* Set the multi_link flag only when both the hardware supports
* and there is a stream handled by multiple masters
*/
- multi_link = bus->multi_link && (m_rt_count > 1);
- if (multi_link)
ret = sdw_transfer_defer(bus, wr_msg, &bus->defer_msg);
- else
ret = sdw_transfer(bus, wr_msg);
- if (ret < 0) { dev_err(bus->dev, "Slave frame_ctrl reg write failed"); goto error; }
- kfree(wr_msg);
- kfree(wbuf);
- bus->defer_msg.msg = NULL;
- bus->params.curr_bank = !bus->params.curr_bank;
- bus->params.next_bank = !bus->params.next_bank;
- if (!bus->multi_link) {
kfree(wr_msg);
kfree(wbuf);
bus->defer_msg.msg = NULL;
bus->params.curr_bank = !bus->params.curr_bank;
bus->params.next_bank = !bus->params.next_bank;
- }
Should this test be extended to the case where the bus can support multi-link but m_rt_count ==1 should it be if (!multi_link) ?