summaryrefslogtreecommitdiffstats
path: root/drivers/soundwire
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2021-06-16 16:59:01 +0200
committerVinod Koul <vkoul@kernel.org>2021-06-20 13:16:14 +0200
commit031e668bc1ad7ccdbfb2b67b838bb6b7cc44ecf3 (patch)
treeeccf1efb750b9d906302484dc9adac8f01fc354c /drivers/soundwire
parentsoundwire: intel: move to auxiliary bus (diff)
downloadlinux-031e668bc1ad7ccdbfb2b67b838bb6b7cc44ecf3.tar.xz
linux-031e668bc1ad7ccdbfb2b67b838bb6b7cc44ecf3.zip
soundwire: bus: Make sdw_nwrite() data pointer argument const
Idiomatically, write functions should take const pointers to the data buffer, as they don't change the data. They are also likely to be called from functions that receive a const data pointer. Internally the pointer is passed to function/structs shared with the read functions, requiring a cast, but this is an implementation detail that should be hidden by the public API. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210616145901.29402-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/bus.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 85bcf60f9697..adcbf3969110 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -394,13 +394,13 @@ sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
}
static int
-sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
+sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
{
struct sdw_msg msg;
int ret;
ret = sdw_fill_msg(&msg, slave, addr, count,
- slave->dev_num, SDW_MSG_FLAG_WRITE, val);
+ slave->dev_num, SDW_MSG_FLAG_WRITE, (u8 *)val);
if (ret < 0)
return ret;
@@ -535,9 +535,9 @@ EXPORT_SYMBOL(sdw_nread);
* @slave: SDW Slave
* @addr: Register address
* @count: length
- * @val: Buffer for values to be read
+ * @val: Buffer for values to be written
*/
-int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
+int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
{
int ret;