Skip to content

Commit 07e73fb

Browse files
broonieSamuel Ortiz
authored andcommitted
mfd: Constify WM8994 write path
Allow const buffers to be passed in without type safety issues. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent 4277163 commit 07e73fb

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/mfd/wm8994-core.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
9797
EXPORT_SYMBOL_GPL(wm8994_bulk_read);
9898

9999
static int wm8994_write(struct wm8994 *wm8994, unsigned short reg,
100-
int bytes, void *src)
100+
int bytes, const void *src)
101101
{
102-
u16 *buf = src;
102+
const u16 *buf = src;
103103
int i;
104104

105105
BUG_ON(bytes % 2);
@@ -146,7 +146,7 @@ EXPORT_SYMBOL_GPL(wm8994_reg_write);
146146
* @buf: Buffer to write from. Data must be big-endian formatted.
147147
*/
148148
int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
149-
int count, u16 *buf)
149+
int count, const u16 *buf)
150150
{
151151
int ret;
152152

@@ -583,7 +583,7 @@ static int wm8994_i2c_read_device(struct wm8994 *wm8994, unsigned short reg,
583583
}
584584

585585
static int wm8994_i2c_write_device(struct wm8994 *wm8994, unsigned short reg,
586-
int bytes, void *src)
586+
int bytes, const void *src)
587587
{
588588
struct i2c_client *i2c = wm8994->control_data;
589589
struct i2c_msg xfer[2];

‎include/linux/mfd/wm8994/core.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct wm8994 {
5959
int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
6060
int bytes, void *dest);
6161
int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
62-
int bytes, void *src);
62+
int bytes, const void *src);
6363

6464
void *control_data;
6565

@@ -89,7 +89,7 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
8989
int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
9090
int count, u16 *buf);
9191
int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
92-
int count, u16 *buf);
92+
int count, const u16 *buf);
9393

9494

9595
/* Helper to save on boilerplate */

0 commit comments

Comments
 (0)