summaryrefslogtreecommitdiff
path: root/drivers/misc/m4sensorhub_pedometer.c
diff options
context:
space:
mode:
authorEric Tashakkor <w36098@motorola.com>2014-04-03 08:40:27 -0500
committerERIC TASHAKKOR <w36098@motorola.com>2014-04-11 13:21:21 +0000
commitf44afc705c2c3dc7c944b8b5e9e972c844f09881 (patch)
tree95e4f983e2ea5a6cb2d90664b09a9760b9c6411a /drivers/misc/m4sensorhub_pedometer.c
parente2dce2b183866d0a347f7a21b80dc54d1c405cd5 (diff)
downloadolio-linux-3.10-f44afc705c2c3dc7c944b8b5e9e972c844f09881.tar.xz
olio-linux-3.10-f44afc705c2c3dc7c944b8b5e9e972c844f09881.zip
IKXCLOCK-627 Remove Custom input.h Changes from M4 Drivers.
Converted the gesture driver to IIO and sysfs (see other M4 drivers). Converted the passive driver to IIO and sysfs (see other M4 drivers). Removed fusion data from the mpu9150 driver (needs to be refactored). Removed custom EV_REL and EV_MSC events and restored stock MAX_* values. Updated pedometer and heartrate drivers to match gesture and passive. Updated the ALS driver to init the samplerate to -1 (disabled). Change-Id: I324bd3a4ee0a4bcbb76f36300d51c5b743aa44f9 Signed-off-by: Eric Tashakkor <w36098@motorola.com>
Diffstat (limited to 'drivers/misc/m4sensorhub_pedometer.c')
-rw-r--r--drivers/misc/m4sensorhub_pedometer.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/misc/m4sensorhub_pedometer.c b/drivers/misc/m4sensorhub_pedometer.c
index 15e8850bf91..ce4d161c4d8 100644
--- a/drivers/misc/m4sensorhub_pedometer.c
+++ b/drivers/misc/m4sensorhub_pedometer.c
@@ -395,17 +395,11 @@ static int m4ped_driver_init(struct init_calldata *p_arg)
goto m4ped_driver_init_fail;
}
- err = m4ped_create_iiodev(iio);
- if (err < 0) {
- m4ped_err("%s: Failed to create IIO device.\n", __func__);
- goto m4ped_driver_init_fail;
- }
-
err = m4sensorhub_irq_register(dd->m4,
M4SH_IRQ_PEDOMETER_DATA_READY, m4ped_isr, iio);
if (err < 0) {
m4ped_err("%s: Failed to register M4 PED IRQ.\n", __func__);
- goto m4ped_driver_init_irq_ped_fail;
+ goto m4ped_driver_init_fail;
}
err = m4sensorhub_irq_register(dd->m4,
@@ -415,24 +409,14 @@ static int m4ped_driver_init(struct init_calldata *p_arg)
goto m4ped_driver_init_irq_act_fail;
}
- /*
- * NOTE: We're intentionally unlocking here instead of
- * at function end (after error cases). The reason
- * is that the mutex ceases to exist because IIO is
- * freed, so we would cause a panic putting the unlock
- * after m4ped_driver_init_exit.
- */
- mutex_unlock(&(dd->mutex));
-
goto m4ped_driver_init_exit;
m4ped_driver_init_irq_act_fail:
m4sensorhub_irq_unregister(dd->m4, M4SH_IRQ_PEDOMETER_DATA_READY);
-m4ped_driver_init_irq_ped_fail:
- m4ped_remove_iiodev(iio); /* dd is freed here */
m4ped_driver_init_fail:
m4ped_err("%s: Init failed with error code %d.\n", __func__, err);
m4ped_driver_init_exit:
+ mutex_unlock(&(dd->mutex));
return err;
}
@@ -455,6 +439,12 @@ static int m4ped_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, iio);
dd->samplerate = -1; /* We always start disabled */
+ err = m4ped_create_iiodev(iio); /* iio and dd are freed on fail */
+ if (err < 0) {
+ m4ped_err("%s: Failed to create IIO device.\n", __func__);
+ goto m4ped_probe_fail_noiio;
+ }
+
err = m4sensorhub_register_initcall(m4ped_driver_init, iio);
if (err < 0) {
m4ped_err("%s: Failed to register initcall.\n", __func__);
@@ -465,7 +455,7 @@ static int m4ped_probe(struct platform_device *pdev)
m4ped_probe_fail:
mutex_destroy(&(dd->mutex));
- iio_device_free(iio); /* dd is freed here */
+ m4ped_remove_iiodev(iio); /* iio and dd are freed here */
m4ped_probe_fail_noiio:
m4ped_err("%s: Probe failed with error code %d.\n", __func__, err);
return err;