diff options
| author | Mark Brown <broonie@linaro.org> | 2013-09-06 11:14:28 -0400 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2013-10-23 11:20:37 -0400 |
| commit | b5f90240e1ef0568a8c666da3c3be4c6a682c5a6 (patch) | |
| tree | e8d25ef536822cd09371903a9e3b65e03c043e9f /include/linux | |
| parent | 8a8320c2e78d1b619a8fa8eb5ae946b8691de604 (diff) | |
mfd: wm8994: Inline register I/O functions
Since the register I/O functions are all simple wrappers for the regmap
equivalents inline them to provide a small code size saving and an example
of good practice.
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mfd/wm8994/core.h | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h index 40854ac0ba3d..3fbcf3d4a0fe 100644 --- a/include/linux/mfd/wm8994/core.h +++ b/include/linux/mfd/wm8994/core.h | |||
| @@ -85,16 +85,43 @@ struct wm8994 { | |||
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | /* Device I/O API */ | 87 | /* Device I/O API */ |
| 88 | int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg); | ||
| 89 | int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg, | ||
| 90 | unsigned short val); | ||
| 91 | int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg, | ||
| 92 | unsigned short mask, unsigned short val); | ||
| 93 | int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, | ||
| 94 | int count, u16 *buf); | ||
| 95 | int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg, | ||
| 96 | int count, const u16 *buf); | ||
| 97 | 88 | ||
| 89 | static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg) | ||
| 90 | { | ||
| 91 | unsigned int val; | ||
| 92 | int ret; | ||
| 93 | |||
| 94 | ret = regmap_read(wm8994->regmap, reg, &val); | ||
| 95 | |||
| 96 | if (ret < 0) | ||
| 97 | return ret; | ||
| 98 | else | ||
| 99 | return val; | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg, | ||
| 103 | unsigned short val) | ||
| 104 | { | ||
| 105 | return regmap_write(wm8994->regmap, reg, val); | ||
| 106 | } | ||
| 107 | |||
| 108 | static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, | ||
| 109 | int count, u16 *buf) | ||
| 110 | { | ||
| 111 | return regmap_bulk_read(wm8994->regmap, reg, buf, count); | ||
| 112 | } | ||
| 113 | |||
| 114 | static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg, | ||
| 115 | int count, const u16 *buf) | ||
| 116 | { | ||
| 117 | return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16)); | ||
| 118 | } | ||
| 119 | |||
| 120 | static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg, | ||
| 121 | unsigned short mask, unsigned short val) | ||
| 122 | { | ||
| 123 | return regmap_update_bits(wm8994->regmap, reg, mask, val); | ||
| 124 | } | ||
| 98 | 125 | ||
| 99 | /* Helper to save on boilerplate */ | 126 | /* Helper to save on boilerplate */ |
| 100 | static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, | 127 | static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, |
