From 8a7ed241f03ab7cf5dd88af34a8f35fc8cda87e5 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 26 Jan 2014 11:54:55 +0100 Subject: sensors: K3DH cannot be enabled or disabled twice in a row Signed-off-by: Paul Kocialkowski --- sensors/k3dh.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sensors/k3dh.c b/sensors/k3dh.c index aa80292..6335122 100644 --- a/sensors/k3dh.c +++ b/sensors/k3dh.c @@ -246,6 +246,9 @@ int k3dh_activate(struct smdk4210_sensors_handlers *handlers) if (handlers == NULL || handlers->data == NULL) return -EINVAL; + if (handlers->activated == 1) + return 0; + data = (struct k3dh_data *) handlers->data; device_fd = data->device_fd; @@ -277,6 +280,9 @@ int k3dh_deactivate(struct smdk4210_sensors_handlers *handlers) if (handlers == NULL || handlers->data == NULL) return -EINVAL; + if (handlers->activated == 0) + return 0; + data = (struct k3dh_data *) handlers->data; device_fd = data->device_fd; -- cgit v1.1