Skip to content

Commit 8e8c0df

Browse files
bardliaovinodkoul
authored andcommitted
soundwire: generic_bandwidth_allocation: change port_bo parameter to pointer
Currently, we do port_bo += bps * ch in both inside and outside sdw_compute_master_ports(). We can pass port_bo as a pointer and only calculate port_bo in sdw_compute_master_ports(). Besides, different port could use different lanes and we can't just add port_bo based on total channels in a manager. Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b96f16b commit 8e8c0df

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ EXPORT_SYMBOL(sdw_compute_slave_ports);
8383

8484
static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
8585
struct sdw_group_params *params,
86-
int port_bo, int hstop)
86+
int *port_bo, int hstop)
8787
{
8888
struct sdw_transport_data t_data = {0};
8989
struct sdw_port_runtime *p_rt;
@@ -108,7 +108,7 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
108108

109109
sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
110110
false, SDW_BLK_GRP_CNT_1, sample_int,
111-
port_bo, port_bo >> 8, hstart, hstop,
111+
*port_bo, (*port_bo) >> 8, hstart, hstop,
112112
SDW_BLK_PKG_PER_PORT, 0x0);
113113

114114
sdw_fill_port_params(&p_rt->port_params,
@@ -120,15 +120,15 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
120120
if (!(p_rt == list_first_entry(&m_rt->port_list,
121121
struct sdw_port_runtime,
122122
port_node))) {
123-
port_bo += bps * ch;
123+
(*port_bo) += bps * ch;
124124
continue;
125125
}
126126

127127
t_data.hstart = hstart;
128128
t_data.hstop = hstop;
129-
t_data.block_offset = port_bo;
129+
t_data.block_offset = *port_bo;
130130
t_data.sub_block_offset = 0;
131-
port_bo += bps * ch;
131+
(*port_bo) += bps * ch;
132132
}
133133

134134
sdw_compute_slave_ports(m_rt, &t_data);
@@ -146,9 +146,7 @@ static void _sdw_compute_port_params(struct sdw_bus *bus,
146146
port_bo = 1;
147147

148148
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
149-
sdw_compute_master_ports(m_rt, &params[i], port_bo, hstop);
150-
151-
port_bo += m_rt->ch_count * m_rt->stream->params.bps;
149+
sdw_compute_master_ports(m_rt, &params[i], &port_bo, hstop);
152150
}
153151

154152
hstop = hstop - params[i].hwidth;

0 commit comments

Comments
 (0)