Skip to content

Commit 21f4c44

Browse files
krzkvinodkoul
authored andcommitted
soundwire: stream: constify sdw_port_config when adding devices
sdw_stream_add_master() and sdw_stream_add_slave() do not modify contents of passed sdw_port_config, so it can be made const for code safety and as documentation of expected usage. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 5bdc61e commit 21f4c44

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/soundwire/stream.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static struct sdw_port_runtime *sdw_port_alloc(struct list_head *port_list)
897897
}
898898

899899
static int sdw_port_config(struct sdw_port_runtime *p_rt,
900-
struct sdw_port_config *port_config,
900+
const struct sdw_port_config *port_config,
901901
int port_index)
902902
{
903903
p_rt->ch_mask = port_config[port_index].ch_mask;
@@ -970,7 +970,7 @@ static int sdw_slave_port_is_valid_range(struct device *dev, int num)
970970

971971
static int sdw_slave_port_config(struct sdw_slave *slave,
972972
struct sdw_slave_runtime *s_rt,
973-
struct sdw_port_config *port_config)
973+
const struct sdw_port_config *port_config)
974974
{
975975
struct sdw_port_runtime *p_rt;
976976
int ret;
@@ -1026,7 +1026,7 @@ static int sdw_master_port_alloc(struct sdw_master_runtime *m_rt,
10261026
}
10271027

10281028
static int sdw_master_port_config(struct sdw_master_runtime *m_rt,
1029-
struct sdw_port_config *port_config)
1029+
const struct sdw_port_config *port_config)
10301030
{
10311031
struct sdw_port_runtime *p_rt;
10321032
int ret;
@@ -1861,7 +1861,7 @@ EXPORT_SYMBOL(sdw_release_stream);
18611861
*/
18621862
int sdw_stream_add_master(struct sdw_bus *bus,
18631863
struct sdw_stream_config *stream_config,
1864-
struct sdw_port_config *port_config,
1864+
const struct sdw_port_config *port_config,
18651865
unsigned int num_ports,
18661866
struct sdw_stream_runtime *stream)
18671867
{
@@ -1981,7 +1981,7 @@ EXPORT_SYMBOL(sdw_stream_remove_master);
19811981
*/
19821982
int sdw_stream_add_slave(struct sdw_slave *slave,
19831983
struct sdw_stream_config *stream_config,
1984-
struct sdw_port_config *port_config,
1984+
const struct sdw_port_config *port_config,
19851985
unsigned int num_ports,
19861986
struct sdw_stream_runtime *stream)
19871987
{

include/linux/soundwire/sdw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ int sdw_compute_params(struct sdw_bus *bus);
10401040

10411041
int sdw_stream_add_master(struct sdw_bus *bus,
10421042
struct sdw_stream_config *stream_config,
1043-
struct sdw_port_config *port_config,
1043+
const struct sdw_port_config *port_config,
10441044
unsigned int num_ports,
10451045
struct sdw_stream_runtime *stream);
10461046
int sdw_stream_remove_master(struct sdw_bus *bus,
@@ -1062,7 +1062,7 @@ void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id
10621062

10631063
int sdw_stream_add_slave(struct sdw_slave *slave,
10641064
struct sdw_stream_config *stream_config,
1065-
struct sdw_port_config *port_config,
1065+
const struct sdw_port_config *port_config,
10661066
unsigned int num_ports,
10671067
struct sdw_stream_runtime *stream);
10681068
int sdw_stream_remove_slave(struct sdw_slave *slave,
@@ -1084,7 +1084,7 @@ int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
10841084

10851085
static inline int sdw_stream_add_slave(struct sdw_slave *slave,
10861086
struct sdw_stream_config *stream_config,
1087-
struct sdw_port_config *port_config,
1087+
const struct sdw_port_config *port_config,
10881088
unsigned int num_ports,
10891089
struct sdw_stream_runtime *stream)
10901090
{

0 commit comments

Comments
 (0)