sumpfralle opened a new pull request, #12630:
URL: https://github.com/apache/nuttx/pull/12630

   ## Summary
   
   Previously compilation with ticket spinlock enabled failed for the rp2040 
board due to comparisons between structs:
   
   ```
   CC:  netdb/lib_proto.c chip/rp2040_testset.c: In function 'up_testset':
   chip/rp2040_testset.c:73:11: error: invalid operands to binary == (have 
'spinlock_t' {aka 'union spinlock_u'} and 'union spinlock_u')
      73 |   if (ret == SP_UNLOCKED)
         |           ^~
   ```
   
   Now all occurrences of comparisons are replaced with the existing macro 
`spin_is_locked`.
   Most of these occurrences were not relevant, since they were located in the 
spinlock code branches for "non-ticket" mode (with `spinlock_t` being an 
integer).
   But in order to keep everything clear and predictable, we want to avoid 
potential struct comparisons everywhere.
   
   ## Impact
   Based on the existing definition of the `spin_is_locked` macro for 
non-ticket mode there should be no change compared to the previous simple 
comparison:
   ```
   #ifdef CONFIG_TICKET_SPINLOCK
   #  define spin_is_locked(l) ((*l).tickets.owner != (*l).tickets.next)
   #else
   #  define spin_is_locked(l) (*(l) == SP_LOCKED)
   #endif
   ```
   
   ## Testing
   
   Now the code compiles cleanly for rp2040.


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