diff --git a/drivers/sensors/mpu60x0.c b/drivers/sensors/mpu60x0.c index 7705cda54d..a91d55cea2 100644 --- a/drivers/sensors/mpu60x0.c +++ b/drivers/sensors/mpu60x0.c @@ -654,22 +654,6 @@ static inline uint8_t __mpu_read_who_am_i(FAR struct mpu_dev_s *dev) return val; } -/* Locks and unlocks the @dev data structure (mutex). - * - * Use these functions any time you call one of the lock-dependent - * helper functions defined above. - */ - -static void inline mpu_lock(FAR struct mpu_dev_s *dev) -{ - nxmutex_lock(&dev->lock); -} - -static void inline mpu_unlock(FAR struct mpu_dev_s *dev) -{ - nxmutex_unlock(&dev->lock); -} - /* Resets the mpu60x0, sets it to a default configuration. */ static int mpu_reset(FAR struct mpu_dev_s *dev) @@ -687,14 +671,14 @@ static int mpu_reset(FAR struct mpu_dev_s *dev) } #endif - mpu_lock(dev); + nxmutex_lock(&dev->lock); /* Awaken chip, issue hardware reset */ ret = __mpu_write_pwr_mgmt_1(dev, PWR_MGMT_1__DEVICE_RESET); if (ret != OK) { - mpu_unlock(dev); + nxmutex_unlock(&dev->lock); snerr("Could not find mpu60x0!\n"); return ret; } @@ -751,7 +735,7 @@ static int mpu_reset(FAR struct mpu_dev_s *dev) __mpu_write_int_pin_cfg(dev, INT_PIN_CFG__INT_RD_CLEAR); - mpu_unlock(dev); + nxmutex_unlock(&dev->lock); return 0; } @@ -776,9 +760,9 @@ static int mpu_open(FAR struct file *filep) /* Reset the register cache */ - mpu_lock(dev); + nxmutex_lock(&dev->lock); dev->bufpos = 0; - mpu_unlock(dev); + nxmutex_unlock(&dev->lock); return 0; } @@ -794,9 +778,9 @@ static int mpu_close(FAR struct file *filep) /* Reset (clear) the register cache. */ - mpu_lock(dev); + nxmutex_lock(&dev->lock); dev->bufpos = 0; - mpu_unlock(dev); + nxmutex_unlock(&dev->lock); return 0; } @@ -844,7 +828,7 @@ static ssize_t mpu_read(FAR struct file *filep, FAR char *buf, size_t len) FAR struct mpu_dev_s *dev = inode->i_private; size_t send_len = 0; - mpu_lock(dev); + nxmutex_lock(&dev->lock); /* Populate the register cache if it seems empty. */ @@ -877,8 +861,7 @@ static ssize_t mpu_read(FAR struct file *filep, FAR char *buf, size_t len) dev->bufpos = 0; } - mpu_unlock(dev); - + nxmutex_unlock(&dev->lock); return send_len; }