yangsong8-a1 opened a new pull request, #22194:
URL: https://github.com/apache/nuttx/pull/22194

   ## Summary
     
     Add a `reason` parameter to `reset_control_ops::reset()` and `::assert()`
     so that controllers fronting a peer core (or any line that encodes a cause
     rather than a piece of hardware) can distinguish *why* a reset was
     requested, without overloading the `id` field that every other controller
     already uses for the line number.
     
     Expose the new parameter as `reset_control_reset_reason()` and
     `reset_control_assert_reason()`.  The existing `reset_control_reset()` and
     `reset_control_assert()` become static-inline wrappers that pass reason 0,
     so all current callers continue to work unchanged.
     
     Update every in-tree implementation of `reset_control_ops`:
       - `drivers/reset/core.c` (framework)
       - `drivers/reset/reset_rpmsg.c` (carries reason over rpmsg)
       - `arch/risc-v/src/eic7700x/eic7700x_reset_ops.c` (ignores reason)
     
     The first commit is a pure-whitespace nxstyle fix for a pre-existing
     alignment error in `core.c`.
     
     ## Impact
     
     Interface change: every `struct reset_control_ops` implementation must
     widen its `.reset` and `.assert` callbacks to accept the third `reason`
     argument.  The only in-tree implementations are the three listed above,
     all updated in this PR.  No callers in nuttx-apps.
     
     ## Testing
     
     Ubuntu 22.04, host gcc.  sim:nsh with RESET, CMake, no new warnings.  A
     temporary test program registers a dummy reset controller and prints the id
     and reason its ops receive.
     
     master:
     
     nsh> hello
     reset_controller_register: 0
     reset_control_get: ok
     reset_control_reset:
       ops->reset  id 2 reason 0
       ret 0
     reset_control_assert:
       ops->assert id 2 reason 0
       ret 0
     reset_control_deassert:
       ops->deassert id 2
       ret 0
     
     With this change (the program also calls the two new *_reason() APIs):
     
     nsh> hello
     reset_controller_register: 0
     reset_control_get: ok
     reset_control_reset:
       ops->reset  id 2 reason 0
       ret 0
     reset_control_assert:
       ops->assert id 2 reason 0
       ret 0
     reset_control_deassert:
       ops->deassert id 2
       ret 0
     reset_control_reset_reason(7):
       ops->reset  id 2 reason 7
       ret 0
     reset_control_assert_reason(9):
       ops->assert id 2 reason 9
       ret 0
    
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to