aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lis3lv02d.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/lis3lv02d.c')
-rw-r--r--drivers/hwmon/lis3lv02d.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index ef7510d83603..25f385010953 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -75,6 +75,30 @@ struct lis3lv02d lis3_dev = {
75 75
76EXPORT_SYMBOL_GPL(lis3_dev); 76EXPORT_SYMBOL_GPL(lis3_dev);
77 77
78/* just like param_set_int() but does sanity-check so that it won't point
79 * over the axis array size
80 */
81static int param_set_axis(const char *val, const struct kernel_param *kp)
82{
83 int ret = param_set_int(val, kp);
84 if (!ret) {
85 int val = *(int *)kp->arg;
86 if (val < 0)
87 val = -val;
88 if (!val || val > 3)
89 return -EINVAL;
90 }
91 return ret;
92}
93
94static struct kernel_param_ops param_ops_axis = {
95 .set = param_set_axis,
96 .get = param_get_int,
97};
98
99module_param_array_named(axes, lis3_dev.ac.as_array, axis, NULL, 0644);
100MODULE_PARM_DESC(axes, "Axis-mapping for x,y,z directions");
101
78static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg) 102static s16 lis3lv02d_read_8(struct lis3lv02d *lis3, int reg)
79{ 103{
80 s8 lo; 104 s8 lo;