aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-09-06 11:14:28 -0400
committerLee Jones <lee.jones@linaro.org>2013-10-23 11:20:37 -0400
commitb5f90240e1ef0568a8c666da3c3be4c6a682c5a6 (patch)
treee8d25ef536822cd09371903a9e3b65e03c043e9f /include/linux
parent8a8320c2e78d1b619a8fa8eb5ae946b8691de604 (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.h45
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 */
88int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
89int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
90 unsigned short val);
91int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
92 unsigned short mask, unsigned short val);
93int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
94 int count, u16 *buf);
95int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
96 int count, const u16 *buf);
97 88
89static 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
102static 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
108static 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
114static 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
120static 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 */
100static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, 127static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,