From bdbda6a75fa5898fa24e3cbbfdf568779910be15 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 18 Jun 2024 11:56:09 +0200 Subject: [PATCH] score: Remove ISR_LOCK_DEFINE() Use ISR_LOCK_NEEDS_OBJECT to determine if a lock object is needed. Update #4957 and #5038. --- cpukit/include/rtems/score/isrlock.h | 17 ----------------- .../libmisc/capture/rtems-trace-buffer-vars.c | 4 +++- cpukit/libtest/testgcovdumpinfo.c | 4 +++- cpukit/posix/src/alarm.c | 5 ++++- cpukit/posix/src/ualarm.c | 5 ++++- cpukit/sapi/src/ioregisterdriver.c | 5 ++++- cpukit/score/src/kern_tc.c | 4 +++- cpukit/score/src/objectmp.c | 5 ++++- cpukit/score/src/threadmp.c | 5 ++++- testsuites/sptests/spwatchdog/init.c | 4 +++- 10 files changed, 32 insertions(+), 26 deletions(-) diff --git a/cpukit/include/rtems/score/isrlock.h b/cpukit/include/rtems/score/isrlock.h index 230650ebc8..5e74e6b1c9 100644 --- a/cpukit/include/rtems/score/isrlock.h +++ b/cpukit/include/rtems/score/isrlock.h @@ -138,23 +138,6 @@ typedef struct { #define ISR_LOCK_DECLARE( _qualifier, _designator ) #endif -/** - * @brief Defines an ISR lock variable. - * - * Do not add a ';' after this macro. - * - * @param _qualifier The qualifier for the interrupt lock, e.g. static. - * @param _designator The designator for the interrupt lock. - * @param _name The name for the interrupt lock. It must be a string. The - * name is only used if profiling is enabled. - */ -#if defined( RTEMS_SMP ) - #define ISR_LOCK_DEFINE( _qualifier, _designator, _name ) \ - _qualifier ISR_lock_Control _designator = { SMP_LOCK_INITIALIZER( _name ) }; -#else - #define ISR_LOCK_DEFINE( _qualifier, _designator, _name ) -#endif - /** * @brief Defines an ISR lock variable reference. * diff --git a/cpukit/libmisc/capture/rtems-trace-buffer-vars.c b/cpukit/libmisc/capture/rtems-trace-buffer-vars.c index 5e565387d0..7826f19a2b 100644 --- a/cpukit/libmisc/capture/rtems-trace-buffer-vars.c +++ b/cpukit/libmisc/capture/rtems-trace-buffer-vars.c @@ -29,7 +29,9 @@ #include -ISR_LOCK_DEFINE (static, __rtld_tbg_lock, "RTLD TBG") +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control __rtld_tbg_lock = ISR_LOCK_INITIALIZER ("RTLD TBG"); +#endif uint32_t rtems_trace_names_size (void) diff --git a/cpukit/libtest/testgcovdumpinfo.c b/cpukit/libtest/testgcovdumpinfo.c index 9687280e21..82ec7adc6a 100644 --- a/cpukit/libtest/testgcovdumpinfo.c +++ b/cpukit/libtest/testgcovdumpinfo.c @@ -45,7 +45,9 @@ #include #include -ISR_LOCK_DEFINE( static, gcov_dump_lock, "gcov dump" ); +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control gcov_dump_lock = ISR_LOCK_INITIALIZER( "gcov dump" ); +#endif static bool gcov_dump_done; diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index a65668bc11..37d09c7ce5 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -47,7 +47,10 @@ #include #include -ISR_LOCK_DEFINE( static, _POSIX_signals_Alarm_lock, "POSIX Alarm" ) +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control _POSIX_signals_Alarm_lock = + ISR_LOCK_INITIALIZER( "POSIX Alarm" ); +#endif static void _POSIX_signals_Alarm_TSR( Watchdog_Control *the_watchdog ) { diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c index 36953025c4..c8ff81e76c 100644 --- a/cpukit/posix/src/ualarm.c +++ b/cpukit/posix/src/ualarm.c @@ -45,7 +45,10 @@ #include #include -ISR_LOCK_DEFINE( static, _POSIX_signals_Ualarm_lock, "POSIX Ualarm" ) +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control _POSIX_signals_Ualarm_lock = + ISR_LOCK_INITIALIZER( "POSIX Ualarm" ); +#endif static uint32_t _POSIX_signals_Ualarm_interval; diff --git a/cpukit/sapi/src/ioregisterdriver.c b/cpukit/sapi/src/ioregisterdriver.c index 686c6e2e00..32c4ced31f 100644 --- a/cpukit/sapi/src/ioregisterdriver.c +++ b/cpukit/sapi/src/ioregisterdriver.c @@ -44,7 +44,10 @@ #include #include -ISR_LOCK_DEFINE( , _IO_Driver_registration_lock, "IO Driver Registration" ) +#if ISR_LOCK_NEEDS_OBJECT +ISR_lock_Control _IO_Driver_registration_lock = + ISR_LOCK_INITIALIZER( "IO Driver Registration" ); +#endif static inline bool rtems_io_is_empty_table( const rtems_driver_address_table *table diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c index 0fea77c92c..a6985b0691 100644 --- a/cpukit/score/src/kern_tc.c +++ b/cpukit/score/src/kern_tc.c @@ -100,7 +100,9 @@ #include #include #include -ISR_LOCK_DEFINE(, _Timecounter_Lock, "Timecounter") +#if ISR_LOCK_NEEDS_OBJECT +ISR_lock_Control _Timecounter_Lock = ISR_LOCK_INITIALIZER( "Timecounter"); +#endif #define _Timecounter_Release(lock_context) \ _ISR_lock_Release_and_ISR_enable(&_Timecounter_Lock, lock_context) #define hz rtems_clock_get_ticks_per_second() diff --git a/cpukit/score/src/objectmp.c b/cpukit/score/src/objectmp.c index 0a24bf501d..0575ccbff4 100644 --- a/cpukit/score/src/objectmp.c +++ b/cpukit/score/src/objectmp.c @@ -70,7 +70,10 @@ uint32_t _Objects_MP_Maximum_global_objects; static CHAIN_DEFINE_EMPTY( _Objects_MP_Inactive_global_objects ); -ISR_LOCK_DEFINE( static, _Objects_MP_Global_lock, "MP Objects" ) +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control _Objects_MP_Global_lock = + ISR_LOCK_INITIALIZER( "MP Objects" ); +#endif static void _Objects_MP_Global_acquire( ISR_lock_Context *lock_context ) { diff --git a/cpukit/score/src/threadmp.c b/cpukit/score/src/threadmp.c index 93dec72cf9..952bf54288 100644 --- a/cpukit/score/src/threadmp.c +++ b/cpukit/score/src/threadmp.c @@ -50,7 +50,10 @@ static RBTREE_DEFINE_EMPTY( _Thread_MP_Active_proxies ); static CHAIN_DEFINE_EMPTY( _Thread_MP_Inactive_proxies ); -ISR_LOCK_DEFINE( static, _Thread_MP_Proxies_lock, "Thread MP Proxies" ) +#if ISR_LOCK_NEEDS_OBJECT +static ISR_lock_Control _Thread_MP_Proxies_lock = + ISR_LOCK_INITIALIZER( "Thread MP Proxies" ); +#endif static void _Thread_MP_Proxies_acquire( ISR_lock_Context *lock_context ) { diff --git a/testsuites/sptests/spwatchdog/init.c b/testsuites/sptests/spwatchdog/init.c index babe440649..de84a2963b 100644 --- a/testsuites/sptests/spwatchdog/init.c +++ b/testsuites/sptests/spwatchdog/init.c @@ -98,7 +98,9 @@ static void test_watchdog_init( test_watchdog *watchdog, int counter ) static uint64_t test_watchdog_tick( Watchdog_Header *header, uint64_t now ) { - ISR_LOCK_DEFINE( , lock, "Test" ) +#if ISR_LOCK_NEEDS_OBJECT + ISR_lock_Control lock = ISR_LOCK_INITIALIZER( "Test" ); +#endif ISR_lock_Context lock_context; Watchdog_Control *first;