diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-27 08:44:20 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-27 08:44:20 +0200 |
commit | 396e6e49c58bb23d1814d3c240c736c9f01523c5 (patch) | |
tree | a6ec8dac896c3ea3ac7b1bb0dce8728766afcf91 /drivers/input/misc/mma8450.c | |
parent | 18974369cfe23acf16d0fb79e0d1fba7a9a95ec0 (diff) | |
parent | 6ad390a25a9d1d8606b9b826878f0a30639dc2b3 (diff) | |
download | blackbird-op-linux-396e6e49c58bb23d1814d3c240c736c9f01523c5.tar.gz blackbird-op-linux-396e6e49c58bb23d1814d3c240c736c9f01523c5.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (68 commits)
Input: adp5589-keys - add support for the ADP5585 derivatives
Input: imx_keypad - add pm suspend and resume support
Input: force feedback - potential integer wrap in input_ff_create()
Input: tsc2007 - make sure that X plate resistance is specified
Input: serio_raw - fix memory leak when closing char device
Input: serio_raw - kick clients when disconnecting port
Input: serio_raw - explicitly mark disconnected ports as dead
Input: serio_raw - fix coding style issues
Input: serio_raw - use dev_*() for messages
Input: serio_raw - use bool for boolean data
Input: serio_raw - perform proper locking when adding clients to list
Input: serio_raw - rename serio_raw_list to serio_raw_client
Input: serio_raw - use kref instead of rolling out its own refcounting
Input: psmouse - switch to using dev_*() for messages
Input: wacom - correct max Y value on medium bamboos
Input: wacom - add ABS_DISTANCE to Bamboo Pen reports
Input: wacom - remove unneeded touch pressure initialization
Input: lm8323 - wrap suspend and resume in CONFIG_PM_SLEEP
Input: ad7879-i2c - wrap suspend and resume in CONFIG_PM_SLEEP
Input: synaptics_i2c - wrap suspend and resume in CONFIG_PM_SLEEP
...
Diffstat (limited to 'drivers/input/misc/mma8450.c')
-rw-r--r-- | drivers/input/misc/mma8450.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c index 0794778295fc..4d60080bb5d5 100644 --- a/drivers/input/misc/mma8450.c +++ b/drivers/input/misc/mma8450.c @@ -88,13 +88,13 @@ static int mma8450_write(struct mma8450 *m, unsigned off, u8 v) return 0; } -static int mma8450_read_xyz(struct mma8450 *m, int *x, int *y, int *z) +static int mma8450_read_block(struct mma8450 *m, unsigned off, + u8 *buf, size_t size) { struct i2c_client *c = m->client; - u8 buff[6]; int err; - err = i2c_smbus_read_i2c_block_data(c, MMA8450_OUT_X_LSB, 6, buff); + err = i2c_smbus_read_i2c_block_data(c, off, size, buf); if (err < 0) { dev_err(&c->dev, "failed to read block data at 0x%02x, error %d\n", @@ -102,10 +102,6 @@ static int mma8450_read_xyz(struct mma8450 *m, int *x, int *y, int *z) return err; } - *x = ((buff[1] << 4) & 0xff0) | (buff[0] & 0xf); - *y = ((buff[3] << 4) & 0xff0) | (buff[2] & 0xf); - *z = ((buff[5] << 4) & 0xff0) | (buff[4] & 0xf); - return 0; } @@ -114,7 +110,7 @@ static void mma8450_poll(struct input_polled_dev *dev) struct mma8450 *m = dev->private; int x, y, z; int ret; - int err; + u8 buf[6]; ret = mma8450_read(m, MMA8450_STATUS); if (ret < 0) @@ -123,10 +119,14 @@ static void mma8450_poll(struct input_polled_dev *dev) if (!(ret & MMA8450_STATUS_ZXYDR)) return; - err = mma8450_read_xyz(m, &x, &y, &z); - if (err) + ret = mma8450_read_block(m, MMA8450_OUT_X_LSB, buf, sizeof(buf)); + if (ret < 0) return; + x = ((buf[1] << 4) & 0xff0) | (buf[0] & 0xf); + y = ((buf[3] << 4) & 0xff0) | (buf[2] & 0xf); + z = ((buf[5] << 4) & 0xff0) | (buf[4] & 0xf); + input_report_abs(dev->input, ABS_X, x); input_report_abs(dev->input, ABS_Y, y); input_report_abs(dev->input, ABS_Z, z); |