ppisa commented on code in PR #15079:
URL: https://github.com/apache/nuttx/pull/15079#discussion_r1895654268


##########
arch/risc-v/src/common/espressif/esp_qencoder.c:
##########
@@ -439,13 +295,20 @@ static int esp_position(struct qe_lowerhalf_s *lower, 
int32_t *pos)
   struct qe_dev_lowerhalf_s *priv = (struct qe_dev_lowerhalf_s *)lower;
   irqstate_t flags;
   int32_t position;
-  int16_t count;
+  int count = 0;
+  int ret = OK;
 
   flags = spin_lock_irqsave(&priv->lock);
 
   position = priv->position;
-  count = (int16_t)(pcnt_ll_get_count(priv->dev,
-                                      priv->config->pcntid) & 0xffff);
+  ret = (priv->pcnt->ops->ioctl(priv->pcnt,

Review Comment:
   The change seems as total nonsense, please review and correct, 
@eren-terzioglu, @acassis, @Vajnar
   
   The return value should not be clipped to 16-bits if you compare return to 
zero at the next line. The logic around  counter seems to be totally broken as 
well. The value has been converted to int16_t in the Martin Vajnar to allow 
modulo arithmetic. I have open Issue #15319 for more communication and very 
probable breakages fixup.



-- 
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