aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@kernel.org>2015-03-27 10:39:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-03 10:20:54 -0400
commitcdcd6f824ecb6b5e5fd6729c2552c1254012c3ca (patch)
treeea3d5b02a4437c3324bf438e60450dfbc0f0820f
parent797f88c987b02a8de8d4fac94ec2877b92ec35a2 (diff)
lis3lv02d: DT: use s32 to support negative values
st,axis-{x,y,z} can be negative to imply inverted axis. Apart from that the minimal and maximal threshold may be negative. Signed-off-by: Sebastian Reichel <sre@kernel.org> Reviewed-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 3ef4627f9cb1..d2b0968b1ded 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -950,6 +950,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
950 struct lis3lv02d_platform_data *pdata; 950 struct lis3lv02d_platform_data *pdata;
951 struct device_node *np = lis3->of_node; 951 struct device_node *np = lis3->of_node;
952 u32 val; 952 u32 val;
953 s32 sval;
953 954
954 if (!lis3->of_node) 955 if (!lis3->of_node)
955 return 0; 956 return 0;
@@ -1054,29 +1055,29 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
1054 if (of_get_property(np, "st,hipass2-disable", NULL)) 1055 if (of_get_property(np, "st,hipass2-disable", NULL))
1055 pdata->hipass_ctrl |= LIS3_HIPASS2_DISABLE; 1056 pdata->hipass_ctrl |= LIS3_HIPASS2_DISABLE;
1056 1057
1057 if (of_get_property(np, "st,axis-x", &val)) 1058 if (of_property_read_s32(np, "st,axis-x", &sval) == 0)
1058 pdata->axis_x = val; 1059 pdata->axis_x = sval;
1059 if (of_get_property(np, "st,axis-y", &val)) 1060 if (of_property_read_s32(np, "st,axis-y", &sval) == 0)
1060 pdata->axis_y = val; 1061 pdata->axis_y = sval;
1061 if (of_get_property(np, "st,axis-z", &val)) 1062 if (of_property_read_s32(np, "st,axis-z", &sval) == 0)
1062 pdata->axis_z = val; 1063 pdata->axis_z = sval;
1063 1064
1064 if (of_get_property(np, "st,default-rate", NULL)) 1065 if (of_get_property(np, "st,default-rate", NULL))
1065 pdata->default_rate = val; 1066 pdata->default_rate = val;
1066 1067
1067 if (of_get_property(np, "st,min-limit-x", &val)) 1068 if (of_property_read_s32(np, "st,min-limit-x", &sval) == 0)
1068 pdata->st_min_limits[0] = val; 1069 pdata->st_min_limits[0] = sval;
1069 if (of_get_property(np, "st,min-limit-y", &val)) 1070 if (of_property_read_s32(np, "st,min-limit-y", &sval) == 0)
1070 pdata->st_min_limits[1] = val; 1071 pdata->st_min_limits[1] = sval;
1071 if (of_get_property(np, "st,min-limit-z", &val)) 1072 if (of_property_read_s32(np, "st,min-limit-z", &sval) == 0)
1072 pdata->st_min_limits[2] = val; 1073 pdata->st_min_limits[2] = sval;
1073 1074
1074 if (of_get_property(np, "st,max-limit-x", &val)) 1075 if (of_property_read_s32(np, "st,max-limit-x", &sval) == 0)
1075 pdata->st_max_limits[0] = val; 1076 pdata->st_max_limits[0] = sval;
1076 if (of_get_property(np, "st,max-limit-y", &val)) 1077 if (of_property_read_s32(np, "st,max-limit-y", &sval) == 0)
1077 pdata->st_max_limits[1] = val; 1078 pdata->st_max_limits[1] = sval;
1078 if (of_get_property(np, "st,max-limit-z", &val)) 1079 if (of_property_read_s32(np, "st,max-limit-z", &sval) == 0)
1079 pdata->st_max_limits[2] = val; 1080 pdata->st_max_limits[2] = sval;
1080 1081
1081 1082
1082 lis3->pdata = pdata; 1083 lis3->pdata = pdata;