Skip to content

Commit 6726b47

Browse files
charleskeepaxvinodkoul
authored andcommitted
soundwire: Provide build stubs for common functions
Provide stub functions when CONFIG_SOUNDWIRE is not set for functions that are quite likely to be used from common code on devices supporting multiple control buses. Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 62dc9f3 commit 6726b47

File tree

1 file changed

+95
-10
lines changed
  • include/linux/soundwire

1 file changed

+95
-10
lines changed

include/linux/soundwire/sdw.h

Lines changed: 95 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#ifndef __SOUNDWIRE_H
55
#define __SOUNDWIRE_H
66

7+
#include <linux/bug.h>
78
#include <linux/mod_devicetable.h>
89
#include <linux/bitfield.h>
910

@@ -1023,15 +1024,8 @@ int sdw_stream_add_master(struct sdw_bus *bus,
10231024
struct sdw_port_config *port_config,
10241025
unsigned int num_ports,
10251026
struct sdw_stream_runtime *stream);
1026-
int sdw_stream_add_slave(struct sdw_slave *slave,
1027-
struct sdw_stream_config *stream_config,
1028-
struct sdw_port_config *port_config,
1029-
unsigned int num_ports,
1030-
struct sdw_stream_runtime *stream);
10311027
int sdw_stream_remove_master(struct sdw_bus *bus,
10321028
struct sdw_stream_runtime *stream);
1033-
int sdw_stream_remove_slave(struct sdw_slave *slave,
1034-
struct sdw_stream_runtime *stream);
10351029
int sdw_startup_stream(void *sdw_substream);
10361030
int sdw_prepare_stream(struct sdw_stream_runtime *stream);
10371031
int sdw_enable_stream(struct sdw_stream_runtime *stream);
@@ -1042,8 +1036,20 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus);
10421036
int sdw_bus_clk_stop(struct sdw_bus *bus);
10431037
int sdw_bus_exit_clk_stop(struct sdw_bus *bus);
10441038

1045-
/* messaging and data APIs */
1039+
int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id);
1040+
void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id);
10461041

1042+
#if IS_ENABLED(CONFIG_SOUNDWIRE)
1043+
1044+
int sdw_stream_add_slave(struct sdw_slave *slave,
1045+
struct sdw_stream_config *stream_config,
1046+
struct sdw_port_config *port_config,
1047+
unsigned int num_ports,
1048+
struct sdw_stream_runtime *stream);
1049+
int sdw_stream_remove_slave(struct sdw_slave *slave,
1050+
struct sdw_stream_runtime *stream);
1051+
1052+
/* messaging and data APIs */
10471053
int sdw_read(struct sdw_slave *slave, u32 addr);
10481054
int sdw_write(struct sdw_slave *slave, u32 addr, u8 value);
10491055
int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value);
@@ -1055,7 +1061,86 @@ int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *
10551061
int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
10561062
int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
10571063

1058-
int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id);
1059-
void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id);
1064+
#else
1065+
1066+
static inline int sdw_stream_add_slave(struct sdw_slave *slave,
1067+
struct sdw_stream_config *stream_config,
1068+
struct sdw_port_config *port_config,
1069+
unsigned int num_ports,
1070+
struct sdw_stream_runtime *stream)
1071+
{
1072+
WARN_ONCE(1, "SoundWire API is disabled");
1073+
return -EINVAL;
1074+
}
1075+
1076+
static inline int sdw_stream_remove_slave(struct sdw_slave *slave,
1077+
struct sdw_stream_runtime *stream)
1078+
{
1079+
WARN_ONCE(1, "SoundWire API is disabled");
1080+
return -EINVAL;
1081+
}
1082+
1083+
/* messaging and data APIs */
1084+
static inline int sdw_read(struct sdw_slave *slave, u32 addr)
1085+
{
1086+
WARN_ONCE(1, "SoundWire API is disabled");
1087+
return -EINVAL;
1088+
}
1089+
1090+
static inline int sdw_write(struct sdw_slave *slave, u32 addr, u8 value)
1091+
{
1092+
WARN_ONCE(1, "SoundWire API is disabled");
1093+
return -EINVAL;
1094+
}
1095+
1096+
static inline int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
1097+
{
1098+
WARN_ONCE(1, "SoundWire API is disabled");
1099+
return -EINVAL;
1100+
}
1101+
1102+
static inline int sdw_read_no_pm(struct sdw_slave *slave, u32 addr)
1103+
{
1104+
WARN_ONCE(1, "SoundWire API is disabled");
1105+
return -EINVAL;
1106+
}
1107+
1108+
static inline int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
1109+
{
1110+
WARN_ONCE(1, "SoundWire API is disabled");
1111+
return -EINVAL;
1112+
}
1113+
1114+
static inline int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
1115+
{
1116+
WARN_ONCE(1, "SoundWire API is disabled");
1117+
return -EINVAL;
1118+
}
1119+
1120+
static inline int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
1121+
{
1122+
WARN_ONCE(1, "SoundWire API is disabled");
1123+
return -EINVAL;
1124+
}
1125+
1126+
static inline int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
1127+
{
1128+
WARN_ONCE(1, "SoundWire API is disabled");
1129+
return -EINVAL;
1130+
}
1131+
1132+
static inline int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
1133+
{
1134+
WARN_ONCE(1, "SoundWire API is disabled");
1135+
return -EINVAL;
1136+
}
1137+
1138+
static inline int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
1139+
{
1140+
WARN_ONCE(1, "SoundWire API is disabled");
1141+
return -EINVAL;
1142+
}
1143+
1144+
#endif /* CONFIG_SOUNDWIRE */
10601145

10611146
#endif /* __SOUNDWIRE_H */

0 commit comments

Comments
 (0)