You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/25 08:22:54 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5333: drivers/timers: Add weak_function for up_ function

xiaoxiang781216 opened a new pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333


   ## Summary
   so the user could replace the implementation if need
   
   ## Impact
   Can replace the default implementation
   
   ## Testing
   Pass CI
   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko merged pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333


   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791523416



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       The intention of weak is to allow the board code overwrite the default implementation, but not to make it optional.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791529825



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       Thank you for explanation.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791523416



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       Once CONFIG_CLOCK_TIMEKEEPING is enabled, the caller expect up_timer_getcounter will be implemented.. The intention of weak here is to allow the board code overwrite the default implementation, not to make it optional. 




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791491502



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       If `up_timer_getcounter` becomes `weak`, then shouldn't we change
   ```
   ret = up_timer_getcounter(&counter);
   ```
   to
   ```
   if (up_timer_getcounter != NULL)
     {
       ret = up_timer_getcounter(&counter);
     }
   else
     {
       ret = ERROR;
     }
   ```
   ???

##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       Thank you for explanation.




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] anchao commented on pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#issuecomment-1020925288


   LGTM


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791523416



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       The intention of weak is to allow the board code overwrite the default implementation, but not to make it optional.

##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       Once CONFIG_CLOCK_TIMEKEEPING is enabled, the caller expect up_timer_getcounter will be implemented.. The intention of weak here is to allow the board code overwrite the default implementation, not to make it optional. 




-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko merged pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333


   


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] anchao commented on pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
anchao commented on pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#issuecomment-1020925288


   LGTM


-- 
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-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5333: drivers/timers: Add weak_function for up_ function

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5333:
URL: https://github.com/apache/incubator-nuttx/pull/5333#discussion_r791491502



##########
File path: drivers/timers/arch_alarm.c
##########
@@ -204,7 +204,7 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower)
  ****************************************************************************/
 
 #ifdef CONFIG_CLOCK_TIMEKEEPING
-int up_timer_getcounter(FAR uint64_t *cycles)
+int weak_function up_timer_getcounter(FAR uint64_t *cycles)

Review comment:
       If `up_timer_getcounter` becomes `weak`, then shouldn't we change
   ```
   ret = up_timer_getcounter(&counter);
   ```
   to
   ```
   if (up_timer_getcounter != NULL)
     {
       ret = up_timer_getcounter(&counter);
     }
   else
     {
       ret = ERROR;
     }
   ```
   ???




-- 
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-unsubscribe@nuttx.apache.org

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