Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Brown and committed by
Samuel Ortiz
07e73fbb 4277163c

+6 -6
+4 -4
drivers/mfd/wm8994-core.c
··· 97 97 EXPORT_SYMBOL_GPL(wm8994_bulk_read); 98 98 99 99 static int wm8994_write(struct wm8994 *wm8994, unsigned short reg, 100 - int bytes, void *src) 100 + int bytes, const void *src) 101 101 { 102 - u16 *buf = src; 102 + const u16 *buf = src; 103 103 int i; 104 104 105 105 BUG_ON(bytes % 2); ··· 146 146 * @buf: Buffer to write from. Data must be big-endian formatted. 147 147 */ 148 148 int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg, 149 - int count, u16 *buf) 149 + int count, const u16 *buf) 150 150 { 151 151 int ret; 152 152 ··· 583 583 } 584 584 585 585 static int wm8994_i2c_write_device(struct wm8994 *wm8994, unsigned short reg, 586 - int bytes, void *src) 586 + int bytes, const void *src) 587 587 { 588 588 struct i2c_client *i2c = wm8994->control_data; 589 589 struct i2c_msg xfer[2];
+2 -2
include/linux/mfd/wm8994/core.h
··· 59 59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 60 60 int bytes, void *dest); 61 61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg, 62 - int bytes, void *src); 62 + int bytes, const void *src); 63 63 64 64 void *control_data; 65 65 ··· 89 89 int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 90 90 int count, u16 *buf); 91 91 int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg, 92 - int count, u16 *buf); 92 + int count, const u16 *buf); 93 93 94 94 95 95 /* Helper to save on boilerplate */