pkarashchenko commented on code in PR #6653:
URL: https://github.com/apache/incubator-nuttx/pull/6653#discussion_r934371214


##########
drivers/sensors/sensor.c:
##########
@@ -609,35 +733,45 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   FAR struct sensor_upperhalf_s *upper = inode->i_private;
   FAR struct sensor_lowerhalf_s *lower = upper->lower;
   FAR struct sensor_user_s *user = filep->f_priv;
-  int ret;
+  int ret = 0;
 
   sninfo("cmd=%x arg=%08lx\n", cmd, arg);
 
-  ret = nxsem_wait(&upper->exclsem);
-  if (ret < 0)
-    {
-      return ret;
-    }
-
   switch (cmd)
     {
       case SNIOC_GET_STATE:
         {
+          nxrmutex_lock(&upper->lock);
           memcpy((FAR void *)(uintptr_t)arg,
                  &upper->state, sizeof(upper->state));
           user->changed = false;
+          nxrmutex_unlock(&upper->lock);
+        }
+        break;
+
+      case SNIOC_GET_USTATE:
+        {
+          nxrmutex_lock(&upper->lock);

Review Comment:
   Ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to