diff options
| author | Eric Tashakkor <w36098@motorola.com> | 2014-07-09 15:42:22 -0500 | 
|---|---|---|
| committer | ERIC TASHAKKOR <w36098@motorola.com> | 2014-07-10 13:20:41 +0000 | 
| commit | 2f02ffa1a9d46c192d19fed48190beceb9b6ec21 (patch) | |
| tree | 5726951fcc89a14602cf5982e78cfb5cc8d26ef1 /drivers/misc/m4sensorhub_pedometer.c | |
| parent | e1dfac029c58558d572d68b18d4d2a89470de088 (diff) | |
| download | olio-linux-3.10-2f02ffa1a9d46c192d19fed48190beceb9b6ec21.tar.xz olio-linux-3.10-2f02ffa1a9d46c192d19fed48190beceb9b6ec21.zip  | |
IKXCLOCK-2819 Add Mutex Protection to M4 Panic Handlers
Added mutex locking in panic restore handlers for all drivers to prevent
  losing data when restoring after an M4 panic.
Added a mutex to the mpu9150 driver to prevent concurrent access issues
  and loss of data during normal operation.
Change-Id: I9ad5595c632518093ad1aec86afc7a51d3cbbee3
Signed-off-by: Eric Tashakkor <w36098@motorola.com>
Diffstat (limited to 'drivers/misc/m4sensorhub_pedometer.c')
| -rw-r--r-- | drivers/misc/m4sensorhub_pedometer.c | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/m4sensorhub_pedometer.c b/drivers/misc/m4sensorhub_pedometer.c index de8564bc317..fee4c92c81a 100644 --- a/drivers/misc/m4sensorhub_pedometer.c +++ b/drivers/misc/m4sensorhub_pedometer.c @@ -549,11 +549,15 @@ static void m4ped_panic_restore(struct m4sensorhub_data *m4sensorhub,  				void *data)  {  	struct m4ped_driver_data *dd = (struct m4ped_driver_data *)data; +  	if (dd == NULL) {  		m4ped_err("%s: Driver data is null, unable to restore\n",  			  __func__);  		return;  	} + +	mutex_lock(&(dd->mutex)); +  	dd->base_dat.total_distance = dd->iiodat.total_distance;  	dd->base_dat.total_steps = dd->iiodat.total_steps;  	dd->base_dat.healthy_minutes = dd->iiodat.healthy_minutes; @@ -561,6 +565,8 @@ static void m4ped_panic_restore(struct m4sensorhub_data *m4sensorhub,  	m4ped_err("%s: Pedometer bases after panic = %d %d %d %d", __func__,  		  dd->base_dat.total_distance, dd->base_dat.total_steps,  		  dd->base_dat.healthy_minutes, dd->base_dat.calories); + +	mutex_unlock(&(dd->mutex));  }  static int m4ped_driver_init(struct init_calldata *p_arg)  |