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 2020/08/09 17:10:45 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   ## Summary
   to save the preserved space(1KB) and also avoid the heap overhead just like how work_s implement.
   
   ## Impact
   All wdog user
   
   ## Testing
   with ostest
   


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

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



[GitHub] [incubator-nuttx] hartmannathan commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   On Tue, Aug 11, 2020 at 11:36 AM patacongo <no...@github.com> wrote:
   
   > @btashton <https://github.com/btashton> @hartmannathan
   > <https://github.com/hartmannathan> @Ouss4 <https://github.com/Ouss4>
   > People will need to be forewarned in the release notes that this will break
   > almost all user implementations of drivers. Their code will not longer
   > build and they will need to make the same code modifications in their
   > product-specific code. Keeping stable interfaces for the user community is
   > a virtue and something we need to take very seriously
   >
   Nowhere in this discussion have I seen what is the advantage of this change
   and/or what problem does it solve, that justifies breaking downstream code,
   so that we can weigh the advantages vs the disadvantages before merging it.
   
   >
   


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxUserGuide.html
##########
@@ -10139,7 +10139,6 @@ <h3><a name="shmdt">2.12.4 <code>shmdt</code></a></h3>
 <li>struct tcb_s
 <li>mqd_t
 <li>sem_t
-<li>WDOG_ID
 <li>pthread_key_t

Review comment:
       I remove WDOG_ID from the list because wdog API is for OS internal use and then shouldn't exist in NuttxUserGuide.html. Even WDOG_ID/wd_create/wd_delete is removed from API, but the usage of rest functions is still similar to VxWork counterpart(actually, the difference already exist e.g. wd_create v.s. wdCreate before this PR). So it isn't harm to name VxWork in the document.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   @patacongo the keep part is 
   
   > > @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   > > The break is due to: [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357). If the change looks good, you can merge [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357) first, and rerun the check for this patch again.
   > 
   > I am not sure when I will have an opportunity or motivation to review all 662 files. I will try to do a little at a time until I get through them all. I do not work full time on this project these days. I will not be able to complete the review soon.
   
   The real change happen inside sched/ and Documentation folder which need you review carefully, others just add & for each wd_xxx and fix nxstyle warning which can be verify by the pre-check system. You can  download the patch:
   https://github.com/apache/incubator-nuttx/pull/1545.diff
   and review the related change locally.


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

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



[GitHub] [incubator-nuttx] davids5 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   > @btashton People will need to be forewarned in the release notes that this will break almost all user implementations of drivers. Their code will not longer build and they will need to make the same code modifications in their product-specific code. Keeping stable interfaces for the user community is a virtue and something we need to take very seriously.
   
   Would it be worthwhile to offer a 'sed script' or a diff with the update  release notes when we do this sort of thing?


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   Need merge https://github.com/apache/incubator-nuttx-apps/pull/357 first to pass the build check.


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>
   <li><a href="#wdcancel">4.4.5.4 wd_cancel</a></li>
   <li><a href="#wdgettime">4.4.5.5 wd_gettime</a></li>
   <li><a href="#wdcallback">4.4.5.6 Watchdog Timer Callback</a></li>
 
 </ul>
 
-<h4><a name="wdcreate">4.4.5.1 wd_create/wd_static</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    WDOG_ID wd_create(void);
-    void wd_static(FAR struct wdog_s *wdog);
-</pre>
-
-<p>
-<b>Description:</b> The <code>wd_create()</code> function will create a timer by allocating the appropriate resources for the watchdog.  The <code>wd_create()</code> function returns a pointer to a fully initialized, dynamically allocated <code>struct wdog_s</code> instance (which is <code>typedef</code>'ed as <code>WDOG_ID</code>);
-</p>
-<p>
-<code>wd_static()</code> performs the equivalent initialization of a statically allocated <code>struct wdog_s</code> instance.  No allocation is performed in this case.  The initializer definition, <code>WDOG_INITIALIZER</code> is also available for initialization of static instances of <code>struct wdog_s</code>.  NOTE: <code>wd_static()</code> is also implemented as a macro definition.
-</p>
-<p>
-<b>Input Parameters:</b> None.
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources are available to create the watchdogs.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b>
-<p>
-<b>  POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    WDOG_ID wdCreate (void);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>The number of available watchdogs is fixed (configured at
-initialization time).
-</ul>
-
-<h4><a name="wddelete">4.4.5.2 wd_delete</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    int wd_delete(WDOG_ID wdog);
-</pre>
-
-<p>
-<b>Description:</b> The wd_delete function will deallocate a watchdog timer previously allocated via <code>wd_create()</code>. The watchdog timer will be removed from the timer queue if has been started.
-<p>
-<p>
-This function need not be called for statically allocated timers (but it is not harmful to do so).
-</p>
-<b>Input Parameters:</b>
-<ul>
-<li><code>wdog</code>. The watchdog ID to delete. This is actually a
-pointer to a watchdog structure.
-</ul>
-
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Zero (<code>OK</code>) is returned on success; a negated <code>errno</code> value is return to indicate the nature of any failure.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b> It is the responsibility of the
-caller to assure that the watchdog is inactive before deleting
-it.
-<p>
-<b>POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    STATUS wdDelete (WDOG_ID wdog);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>Does not make any checks to see if the watchdog is being used
-before deallocating it (i.e., never returns ERROR).
-</ul>
-
 <h4><a name="wdstart">4.4.5.3 wd_start</a></h4>

Review comment:
       I will not merge without the fix.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>
   <li><a href="#wdcancel">4.4.5.4 wd_cancel</a></li>
   <li><a href="#wdgettime">4.4.5.5 wd_gettime</a></li>
   <li><a href="#wdcallback">4.4.5.6 Watchdog Timer Callback</a></li>
 
 </ul>
 
-<h4><a name="wdcreate">4.4.5.1 wd_create/wd_static</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    WDOG_ID wd_create(void);
-    void wd_static(FAR struct wdog_s *wdog);
-</pre>
-
-<p>
-<b>Description:</b> The <code>wd_create()</code> function will create a timer by allocating the appropriate resources for the watchdog.  The <code>wd_create()</code> function returns a pointer to a fully initialized, dynamically allocated <code>struct wdog_s</code> instance (which is <code>typedef</code>'ed as <code>WDOG_ID</code>);
-</p>
-<p>
-<code>wd_static()</code> performs the equivalent initialization of a statically allocated <code>struct wdog_s</code> instance.  No allocation is performed in this case.  The initializer definition, <code>WDOG_INITIALIZER</code> is also available for initialization of static instances of <code>struct wdog_s</code>.  NOTE: <code>wd_static()</code> is also implemented as a macro definition.
-</p>
-<p>
-<b>Input Parameters:</b> None.
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources are available to create the watchdogs.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b>
-<p>
-<b>  POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    WDOG_ID wdCreate (void);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>The number of available watchdogs is fixed (configured at
-initialization time).
-</ul>
-
-<h4><a name="wddelete">4.4.5.2 wd_delete</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    int wd_delete(WDOG_ID wdog);
-</pre>
-
-<p>
-<b>Description:</b> The wd_delete function will deallocate a watchdog timer previously allocated via <code>wd_create()</code>. The watchdog timer will be removed from the timer queue if has been started.
-<p>
-<p>
-This function need not be called for statically allocated timers (but it is not harmful to do so).
-</p>
-<b>Input Parameters:</b>
-<ul>
-<li><code>wdog</code>. The watchdog ID to delete. This is actually a
-pointer to a watchdog structure.
-</ul>
-
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Zero (<code>OK</code>) is returned on success; a negated <code>errno</code> value is return to indicate the nature of any failure.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b> It is the responsibility of the
-caller to assure that the watchdog is inactive before deleting
-it.
-<p>
-<b>POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    STATUS wdDelete (WDOG_ID wdog);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>Does not make any checks to see if the watchdog is being used
-before deallocating it (i.e., never returns ERROR).
-</ul>
-
 <h4><a name="wdstart">4.4.5.3 wd_start</a></h4>

Review comment:
       Will fix in the next update.




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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/samv7/sam_ssc.c
##########
@@ -3053,23 +3035,15 @@ static int ssc_dma_allocate(struct sam_ssc_s *priv)
 static void ssc_dma_free(struct sam_ssc_s *priv)
 {
 #ifdef SSC_HAVE_TX
-  if (priv->tx.dog)
-    {
-       wd_delete(priv->tx.dog);
-    }
-
+  wd_cancel(&priv->tx.dog);

Review comment:
       This is a general question and applies to all places where wd_cancel() is called, not just the one that I have flagged here.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>

Review comment:
       Done.

##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>
   <li><a href="#wdcancel">4.4.5.4 wd_cancel</a></li>
   <li><a href="#wdgettime">4.4.5.5 wd_gettime</a></li>
   <li><a href="#wdcallback">4.4.5.6 Watchdog Timer Callback</a></li>
 
 </ul>
 
-<h4><a name="wdcreate">4.4.5.1 wd_create/wd_static</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    WDOG_ID wd_create(void);
-    void wd_static(FAR struct wdog_s *wdog);
-</pre>
-
-<p>
-<b>Description:</b> The <code>wd_create()</code> function will create a timer by allocating the appropriate resources for the watchdog.  The <code>wd_create()</code> function returns a pointer to a fully initialized, dynamically allocated <code>struct wdog_s</code> instance (which is <code>typedef</code>'ed as <code>WDOG_ID</code>);
-</p>
-<p>
-<code>wd_static()</code> performs the equivalent initialization of a statically allocated <code>struct wdog_s</code> instance.  No allocation is performed in this case.  The initializer definition, <code>WDOG_INITIALIZER</code> is also available for initialization of static instances of <code>struct wdog_s</code>.  NOTE: <code>wd_static()</code> is also implemented as a macro definition.
-</p>
-<p>
-<b>Input Parameters:</b> None.
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources are available to create the watchdogs.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b>
-<p>
-<b>  POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    WDOG_ID wdCreate (void);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>The number of available watchdogs is fixed (configured at
-initialization time).
-</ul>
-
-<h4><a name="wddelete">4.4.5.2 wd_delete</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    int wd_delete(WDOG_ID wdog);
-</pre>
-
-<p>
-<b>Description:</b> The wd_delete function will deallocate a watchdog timer previously allocated via <code>wd_create()</code>. The watchdog timer will be removed from the timer queue if has been started.
-<p>
-<p>
-This function need not be called for statically allocated timers (but it is not harmful to do so).
-</p>
-<b>Input Parameters:</b>
-<ul>
-<li><code>wdog</code>. The watchdog ID to delete. This is actually a
-pointer to a watchdog structure.
-</ul>
-
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Zero (<code>OK</code>) is returned on success; a negated <code>errno</code> value is return to indicate the nature of any failure.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b> It is the responsibility of the
-caller to assure that the watchdog is inactive before deleting
-it.
-<p>
-<b>POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    STATUS wdDelete (WDOG_ID wdog);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>Does not make any checks to see if the watchdog is being used
-before deallocating it (i.e., never returns ERROR).
-</ul>
-
 <h4><a name="wdstart">4.4.5.3 wd_start</a></h4>

Review comment:
       Done.




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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   @btashton People will need to be forewarned in the release notes that this will break almost all user implementations of drivers.  Their code will not longer build and they will need to make the same code modifications in their product-specific code.  Keeping stable interfaces for the user community is a virtue and something we need to take very seriously.


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>

Review comment:
       Paragraph numbering is wrong.  All need to be re-numbered starting at 1.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>

Review comment:
       Will fix in the next update.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-672062434


   @patacongo the keep part is 
   
   > > @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   > > The break is due to: [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357). If the change looks good, you can merge [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357) first, and rerun the check for this patch again.
   > 
   > I am not sure when I will have an opportunity or motivation to review all 662 files. I will try to do a little at a time until I get through them all. I do not work full time on this project these days. I will not be able to complete the review soon.
   
   The real change happen inside sched/ and Documentation folder which need you review carefully, others just add & for each wd_xxx and fix nxstyle warning which can be verify by the pre-check system. You can  download the patch:
   https://github.com/apache/incubator-nuttx/pull/1545.diff
   and review the related change locally.
   BTW since I split the nxstyle change in another patch, you can just review the patch which make real change from commit tab:
   https://github.com/apache/incubator-nuttx/pull/1545/commits


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>

Review comment:
       Paragraph number is wrong.  All need to be re-numbered starting at 1.




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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   > 
   > 
   > @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   > The break is due to: [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357). If the change looks good, you can merge [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357) first, and rerun the check for this patch again.
   
   I am not sure when I will have an opportunity or motivation to review 662 files.  I do not work full time on this project these days.  I will not be able to do the review soon.


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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   All PR checks are now failing due to:
   
       sam_ili9488.c: In function 'board_lcd_initialize':
       sam_ili9488.c:1605:7: error: label 'errout_with_dmadog' used but not defined
        1605 |       goto errout_with_dmadog;
             |       ^~~~


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/samv7/sam_ssc.c
##########
@@ -3053,23 +3035,15 @@ static int ssc_dma_allocate(struct sam_ssc_s *priv)
 static void ssc_dma_free(struct sam_ssc_s *priv)
 {
 #ifdef SSC_HAVE_TX
-  if (priv->tx.dog)
-    {
-       wd_delete(priv->tx.dog);
-    }
-
+  wd_cancel(&priv->tx.dog);

Review comment:
       The usage can be classified as:
   1.The first catagory contain both work_s and wdog_s which is safe because work_s already has the same requirement.
   2.The second catagory declare the global variable which will zero by default.
   3.The third catagory is dynamically allocated struct which either done by kmm_malloc/memset or kmm_zalloc.
   But after review each wdog_s instance, I found one driver in catagory 3 but don't zero memory, here is PR: https://github.com/apache/incubator-nuttx/pull/1564.
   Please take a look, @patacongo.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   > On Tue, Aug 11, 2020 at 11:36 AM patacongo ***@***.***> wrote: @btashton <https://github.com/btashton> @hartmannathan <https://github.com/hartmannathan> @Ouss4 <https://github.com/Ouss4> People will need to be forewarned in the release notes that this will break almost all user implementations of drivers. Their code will not longer build and they will need to make the same code modifications in their product-specific code. Keeping stable interfaces for the user community is a virtue and something we need to take very seriously
   > Nowhere in this discussion have I seen what is the advantage of this change and/or what problem does it solve, that justifies breaking downstream code, so that we can weigh the advantages vs the disadvantages before merging it.
   > […](#)
   
   If the compatibility is important, wd_create/wd_delete could keep as before. But because the new usage use the less memory, more simple and the conversion is just one line change and be safe(the compiling will fail if forget), I would prefer to encourage people migrate to the new usage.
   As dissussion here https://github.com/apache/incubator-nuttx/pull/1517: I will prepare another PR to change the callback from:
   ```
   typedef CODE void (*wdentry_t)(int argc, wdparm_t arg1, ...);
   ```
   to:
   ```
   typedef CODE void (*wdentry_t)(FAR void *arg);
   ```
   This change has no way to avoid the compatibility issue, but is less error prone and generate the fast and compact code.
   https://github.com/apache/incubator-nuttx/issues/740


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-672162616


   > On Tue, Aug 11, 2020 at 11:36 AM patacongo ***@***.***> wrote: @btashton <https://github.com/btashton> @hartmannathan <https://github.com/hartmannathan> @Ouss4 <https://github.com/Ouss4> People will need to be forewarned in the release notes that this will break almost all user implementations of drivers. Their code will not longer build and they will need to make the same code modifications in their product-specific code. Keeping stable interfaces for the user community is a virtue and something we need to take very seriously
   > Nowhere in this discussion have I seen what is the advantage of this change and/or what problem does it solve, that justifies breaking downstream code, so that we can weigh the advantages vs the disadvantages before merging it.
   > […](#)
   
   If the compatibility is important, wd_create/wd_delete could keep as before. But because the new usage use the less memory, more simple and the conversion is just one line change and be safe(the compiling will fail if forget), I would prefer to encourage people migrate to the new usage and keep the consistence.
   As dissussion here https://github.com/apache/incubator-nuttx/pull/1517: I will prepare another PR to change the callback from:
   ```
   typedef CODE void (*wdentry_t)(int argc, wdparm_t arg1, ...);
   ```
   to:
   ```
   typedef CODE void (*wdentry_t)(FAR void *arg);
   ```
   This change has no way to avoid the compatibility issue, but is less error prone and generate the fast and compact code.
   https://github.com/apache/incubator-nuttx/issues/740


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

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



[GitHub] [incubator-nuttx] patacongo edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
patacongo edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-671988242


   > 
   > 
   > @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   > The break is due to: [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357). If the change looks good, you can merge [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357) first, and rerun the check for this patch again.
   
   I am not sure when I will have an opportunity or motivation to review all 662 files.  I will try to do a little at a time until I get through them all.  I do not work full time on this project these days.  I will not be able to complete the review soon.


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/cxd56xx/cxd56_rtc.c
##########
@@ -254,13 +254,8 @@ static void cxd56_rtc_initialize(int argc, ...)
 {
   struct timespec ts;
 #ifdef CONFIG_CXD56_RTC_LATEINIT
-  static WDOG_ID s_wdog = NULL;
-  static int     s_retry = 0;
-
-  if (s_wdog == NULL)
-    {
-      s_wdog = wd_create();
-    }
+  static struct wdog_s s_wdog;

Review comment:
       Yes, this is the only case which use a static/global variable, all other place put WDOG_ID in some type of structure.




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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxUserGuide.html
##########
@@ -10139,7 +10139,6 @@ <h3><a name="shmdt">2.12.4 <code>shmdt</code></a></h3>
 <li>struct tcb_s
 <li>mqd_t
 <li>sem_t
-<li>WDOG_ID
 <li>pthread_key_t

Review comment:
       Should this be replaced with struct wdog_s versus just removing WDOG_ID?
   
   NOTE:  The wdog interfaces derive from the VxWorks wdog interfaces which does use the type WDOG_ID.  So this introduces another deviation from the interface definitions.  VxWorks is not a standard we have to follow, however, so that is not necessarily a problem but we probably should remove the statement that these interface functions derive from VxWorks.




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

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



[GitHub] [incubator-nuttx] patacongo merged pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/samv7/sam_ssc.c
##########
@@ -3053,23 +3035,15 @@ static int ssc_dma_allocate(struct sam_ssc_s *priv)
 static void ssc_dma_free(struct sam_ssc_s *priv)
 {
 #ifdef SSC_HAVE_TX
-  if (priv->tx.dog)
-    {
-       wd_delete(priv->tx.dog);
-    }
-
+  wd_cancel(&priv->tx.dog);

Review comment:
       Are all instances of struct wdog_s properly zeroed?  I think there would be a crash if wd_cancel() were called without at least one wd_start() if the struct wdog_s is not zeroed(?)




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

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



[GitHub] [incubator-nuttx] patacongo commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   > typedef CODE void (*wdentry_t)(FAR void *arg);
   
   I assume you meant (wdparm_t arg) not (FAR void *arg).  wdparm_t handles all cases where uint32_t's and pointers differ in size..
   
   I have been adding my responses to #740.  Please look there.


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

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



[GitHub] [incubator-nuttx] patacongo edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
patacongo edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-671988242


   > 
   > 
   > @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   > The break is due to: [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357). If the change looks good, you can merge [apache/incubator-nuttx-apps#357](https://github.com/apache/incubator-nuttx-apps/pull/357) first, and rerun the check for this patch again.
   
   I am not sure when I will have an opportunity or motivation to review all 662 files.  I will try to do a little at a time until I get through them all.  I do not work full time on this project these days.  I will not be able to complete the review soon.
   
   I think I can get through the remaining files today and will merge then after the HTML document is fixed.


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>
   <li><a href="#wdcancel">4.4.5.4 wd_cancel</a></li>
   <li><a href="#wdgettime">4.4.5.5 wd_gettime</a></li>
   <li><a href="#wdcallback">4.4.5.6 Watchdog Timer Callback</a></li>
 
 </ul>
 
-<h4><a name="wdcreate">4.4.5.1 wd_create/wd_static</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    WDOG_ID wd_create(void);
-    void wd_static(FAR struct wdog_s *wdog);
-</pre>
-
-<p>
-<b>Description:</b> The <code>wd_create()</code> function will create a timer by allocating the appropriate resources for the watchdog.  The <code>wd_create()</code> function returns a pointer to a fully initialized, dynamically allocated <code>struct wdog_s</code> instance (which is <code>typedef</code>'ed as <code>WDOG_ID</code>);
-</p>
-<p>
-<code>wd_static()</code> performs the equivalent initialization of a statically allocated <code>struct wdog_s</code> instance.  No allocation is performed in this case.  The initializer definition, <code>WDOG_INITIALIZER</code> is also available for initialization of static instances of <code>struct wdog_s</code>.  NOTE: <code>wd_static()</code> is also implemented as a macro definition.
-</p>
-<p>
-<b>Input Parameters:</b> None.
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Pointer to watchdog that may be used as a handle in subsequent NuttX calls (i.e., the watchdog ID), or NULL if insufficient resources are available to create the watchdogs.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b>
-<p>
-<b>  POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    WDOG_ID wdCreate (void);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>The number of available watchdogs is fixed (configured at
-initialization time).
-</ul>
-
-<h4><a name="wddelete">4.4.5.2 wd_delete</a></h4>
-
-<p>
-<b>Function Prototype:</b>
-<pre>
-    #include &lt;nuttx/wdog.h&gt;
-    int wd_delete(WDOG_ID wdog);
-</pre>
-
-<p>
-<b>Description:</b> The wd_delete function will deallocate a watchdog timer previously allocated via <code>wd_create()</code>. The watchdog timer will be removed from the timer queue if has been started.
-<p>
-<p>
-This function need not be called for statically allocated timers (but it is not harmful to do so).
-</p>
-<b>Input Parameters:</b>
-<ul>
-<li><code>wdog</code>. The watchdog ID to delete. This is actually a
-pointer to a watchdog structure.
-</ul>
-
-<p>
-<b>Returned Value:</b>
-<ul>
-<li>Zero (<code>OK</code>) is returned on success; a negated <code>errno</code> value is return to indicate the nature of any failure.
-</ul>
-
-<p>
-<b>Assumptions/Limitations:</b> It is the responsibility of the
-caller to assure that the watchdog is inactive before deleting
-it.
-<p>
-<b>POSIX  Compatibility:</b> This is a NON-POSIX interface.
-VxWorks provides the following comparable interface:
-<pre>
-    STATUS wdDelete (WDOG_ID wdog);
-</pre>
-
-<p>
-Differences from the VxWorks interface include:
-<ul>
-<li>Does not make any checks to see if the watchdog is being used
-before deallocating it (i.e., never returns ERROR).
-</ul>
-
 <h4><a name="wdstart">4.4.5.3 wd_start</a></h4>

Review comment:
       This should be 4.4.5.1




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   Sorry, the fix is here: https://github.com/apache/incubator-nuttx/pull/1566.
   Before the build system can handle this type of couple directly, it's better to merge the change in apps folder first and then rerun the check in nuttx side. In most case, the change in nuttx is much most complex than apps side.


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/cxd56xx/cxd56_rtc.c
##########
@@ -254,13 +254,8 @@ static void cxd56_rtc_initialize(int argc, ...)
 {
   struct timespec ts;
 #ifdef CONFIG_CXD56_RTC_LATEINIT
-  static WDOG_ID s_wdog = NULL;
-  static int     s_retry = 0;
-
-  if (s_wdog == NULL)
-    {
-      s_wdog = wd_create();
-    }
+  static struct wdog_s s_wdog;

Review comment:
       @masayuki2009 Is there a problem with this?  A single static instance implies that there will be only a single instance of the cxd_rtc_initialize() active.  Is this a valid assumption?  This is the only case like this I have seen in the review.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: arch/arm/src/samv7/sam_ssc.c
##########
@@ -3053,23 +3035,15 @@ static int ssc_dma_allocate(struct sam_ssc_s *priv)
 static void ssc_dma_free(struct sam_ssc_s *priv)
 {
 #ifdef SSC_HAVE_TX
-  if (priv->tx.dog)
-    {
-       wd_delete(priv->tx.dog);
-    }
-
+  wd_cancel(&priv->tx.dog);

Review comment:
       The usage can be classified as:
   1.The first catagory contain both work_s and wdog_s which is safe because work_s already has the same requirement.
   2.The second catagory declare the global variable which will zero by default.
   3.The third catagory is dynamically allocated struct which either done by kmm_malloc/memset or kmm_zalloc.
   But after review each wdog_s instance, I found one driver in catagory 3 but don't zero memory, here is PR: https://github.com/apache/incubator-nuttx/pull/1564 




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-671976809


   @patacongo could you review this patch? I have a pending patch which remove the variadic argument from callback.
   The break is due to: https://github.com/apache/incubator-nuttx-apps/pull/357. If the change looks good, you can merge https://github.com/apache/incubator-nuttx-apps/pull/357 first, and rerun the check for this patch again.


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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxUserGuide.html
##########
@@ -10139,7 +10139,6 @@ <h3><a name="shmdt">2.12.4 <code>shmdt</code></a></h3>
 <li>struct tcb_s
 <li>mqd_t
 <li>sem_t
-<li>WDOG_ID
 <li>pthread_key_t

Review comment:
       I will remove WDOG_ID and VxWork in the new patch.




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

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



[GitHub] [incubator-nuttx] hartmannathan commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   On Tue, Aug 11, 2020 at 2:24 PM Xiang Xiao <no...@github.com> wrote:
   
   > If the compatibility is important, wd_create/wd_delete could keep as
   > before. But because the new usage use the less memory, more simple and the
   > conversion is just one line change and be safe(the compiling will fail if
   > forget), I would prefer to encourage people migrate to the new usage.
   > As dissussion here #1517
   > <https://github.com/apache/incubator-nuttx/pull/1517>: I will prepare
   > another PR to change the callback from:
   >
   > typedef CODE void (*wdentry_t)(int argc, wdparm_t arg1, ...);
   >
   >
   > to:
   >
   > typedef CODE void (*wdentry_t)(FAR void *arg);
   >
   >
   > This change has no way to avoid the compatibility issue, but is less error
   > prone and generate the fast and compact code.
   > #740 <https://github.com/apache/incubator-nuttx/issues/740>
   >
   Reduction in the memory usage is a valid concern. I am OK with it, since a
   compiler error will alert the downstream users, not fail mysteriously at
   runtime.
   
   
   <https://github.com/apache/incubator-nuttx/issues/740>
   >
   


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

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



[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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



##########
File path: Documentation/NuttxPortingGuide.html
##########
@@ -2824,100 +2824,13 @@ <h3><a name="Watchdogs">4.4.5 Watchdog Timer Interfaces</a></h3>
   or <code>kill()</code> to communicate with NuttX tasks.
 </p>
 <ul>
-  <li><a href="#wdcreate">4.4.5.1 wd_create/wd_static</a></li>
-  <li><a href="#wddelete">4.4.5.2 wd_delete</a></li>
   <li><a href="#wdstart">4.4.5.3 wd_start</a></li>

Review comment:
       I will not merge without the fix.




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

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

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


   @v01d there is a documentation change here for PR #1501


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

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



[GitHub] [incubator-nuttx] patacongo edited a comment on pull request #1545: sched/wdog: Don't dynamically allocate wdog_s

Posted by GitBox <gi...@apache.org>.
patacongo edited a comment on pull request #1545:
URL: https://github.com/apache/incubator-nuttx/pull/1545#issuecomment-672016259


   @btashton @hartmannathan @Ouss4 People will need to be forewarned in the release notes that this will break almost all user implementations of drivers.  Their code will not longer build and they will need to make the same code modifications in their product-specific code.  Keeping stable interfaces for the user community is a virtue and something we need to take very seriously.


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

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