diff options
author | Robert Collins <rcollins@nvidia.com> | 2013-04-08 10:35:11 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:12:13 -0700 |
commit | 26c7a4971f03f1c683e0ba0291b5e7568e4b2075 (patch) | |
tree | ac5891905632b586ae02266c6226728cfde1c7ea /drivers/input | |
parent | 5156bca07cc75487dc72e8aba8277e11c0adf404 (diff) |
driver: sensor: change compass value from int to short
Bug 1266211
Change-Id: Ib4a9f9cd58bd526c0afd3d815b29f0a72defac79
Signed-off-by: Robert Collins <rcollins@nvidia.com>
Reviewed-on: http://git-master/r/217421
(cherry picked from commit 984398033a9f4c26454e2018ab025f52a115cf91)
Reviewed-on: http://git-master/r/216731
(cherry picked from commit 24cdec613f41532522fc79346e1754bb8bbc183f)
Reviewed-on: http://git-master/r/226355
Reviewed-by: Xiaohui Tao <xtao@nvidia.com>
Tested-by: Xiaohui Tao <xtao@nvidia.com>
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/compass/ak8975_input.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/input/misc/compass/ak8975_input.c b/drivers/input/misc/compass/ak8975_input.c index e89455434d73..b371de58c293 100644 --- a/drivers/input/misc/compass/ak8975_input.c +++ b/drivers/input/misc/compass/ak8975_input.c @@ -134,7 +134,7 @@ struct akm_inf { int port_id[2]; /* MPU port ID */ u8 data_out; /* write value to trigger a sample */ u8 range_index; /* max_range index */ - int xyz[3]; /* sample data */ + short xyz[3]; /* sample data */ bool cycle; /* cycle MPU en/dis for high speed */ unsigned long cycle_delay_us; /* cycle off time (us) */ s64 cycle_ts; /* cycle MPU disable timestamp */ @@ -548,9 +548,9 @@ static int akm_init_hw(struct akm_inf *inf) static void akm_calc(struct akm_inf *inf, u8 *data) { - int x; - int y; - int z; + short x; + short y; + short z; /* data[1] = AKM_REG_HXL * data[2] = AKM_REG_HXH @@ -559,9 +559,9 @@ static void akm_calc(struct akm_inf *inf, u8 *data) * data[5] = AKM_REG_HZL * data[6] = AKM_REG_HZH */ - x = (int)((data[2] << 8) | data[1]); - y = (int)((data[4] << 8) | data[3]); - z = (int)((data[6] << 8) | data[5]); + x = ((data[2] << 8) | data[1]); + y = ((data[4] << 8) | data[3]); + z = ((data[6] << 8) | data[5]); x = ((x * (inf->asa.asa[AXIS_X] + 128)) >> 8); y = ((y * (inf->asa.asa[AXIS_Y] + 128)) >> 8); z = ((z * (inf->asa.asa[AXIS_Z] + 128)) >> 8); @@ -981,9 +981,9 @@ static ssize_t akm_magnetic_field_show(struct device *dev, char *buf) { struct akm_inf *inf; - int x; - int y; - int z; + short x; + short y; + short z; inf = dev_get_drvdata(dev); if (inf->enable) { @@ -992,7 +992,7 @@ static ssize_t akm_magnetic_field_show(struct device *dev, y = inf->xyz[AXIS_Y]; z = inf->xyz[AXIS_Z]; mutex_unlock(&inf->mutex_data); - return sprintf(buf, "%d, %d, %d\n", x, y, z); + return sprintf(buf, "%hd, %hd, %hd\n", x, y, z); } return -EPERM; |