[PATCH] mpci: Simplify expressions

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Mar 8 13:59:24 UTC 2022


On 08/03/2022 14:56, Gedare Bloom wrote:
> On Mon, Mar 7, 2022 at 11:52 PM Sebastian Huber
> <sebastian.huber at embedded-brains.de>  wrote:
>> Use that rtems_configuration_get_user_multiprocessing_table() returns never
>> NULL if RTEMS_MULTIPROCESSING defined.
>> ---
>>   bsps/m68k/mvme147s/start/bspstart.c |  2 +-
>>   bsps/riscv/griscv/include/amba.h    |  3 +--
>>   bsps/sparc/leon3/btimer/btimer.c    |  5 ++---
>>   bsps/sparc/leon3/include/leon.h     |  3 +--
>>   cpukit/libmisc/monitor/mon-editor.c |  6 ------
>>   cpukit/libmisc/stackchk/check.c     | 10 ++++------
>>   6 files changed, 9 insertions(+), 20 deletions(-)
>>
>> diff --git a/bsps/m68k/mvme147s/start/bspstart.c b/bsps/m68k/mvme147s/start/bspstart.c
>> index 497b644150..e5eb48f108 100644
>> --- a/bsps/m68k/mvme147s/start/bspstart.c
>> +++ b/bsps/m68k/mvme147s/start/bspstart.c
>> @@ -58,7 +58,7 @@ void bsp_start( void )
>>
>>   #if defined(RTEMS_MULTIPROCESSING)
>>     node_number = (uint8_t)
>> -    (rtems_configuration_get_user_multiprocessing_table()->node - 1) & 0xF;
>> +    rtems_configuration_get_user_multiprocessing_table()->node - 1;
> node is never 0?

This would be a configuration error which is checked by:

#if CONFIGURE_MP_NODE_NUMBER < 1
   #error "CONFIGURE_MP_NODE_NUMBER must be greater than or equal to one"
#endif

#if CONFIGURE_MP_NODE_NUMBER > CONFIGURE_MP_MAXIMUM_NODES
   #error "CONFIGURE_MP_NODE_NUMBER must be less than or equal to 
CONFIGURE_MP_MAXIMUM_NODES"
#endif

> 
>>   #else
>>      node_number = 1;
>>   #endif
>> diff --git a/bsps/riscv/griscv/include/amba.h b/bsps/riscv/griscv/include/amba.h
>> index 292660d5c1..b615389df4 100644
>> --- a/bsps/riscv/griscv/include/amba.h
>> +++ b/bsps/riscv/griscv/include/amba.h
>> @@ -46,8 +46,7 @@
>>   #define GRLIB_APB_SLAVES 16
>>
>>   #if defined(RTEMS_MULTIPROCESSING)
>> -  #define GRLIB_CLOCK_INDEX \
>> -   (rtems_configuration_get_user_multiprocessing_table() ? GRLIB_Cpu_Index : 0)
>> +  #define GRLIB_CLOCK_INDEX GRLIB_Cpu_Index
>>   #else
>>     #define GRLIB_CLOCK_INDEX 0
>>   #endif
>> diff --git a/bsps/sparc/leon3/btimer/btimer.c b/bsps/sparc/leon3/btimer/btimer.c
>> index 9e9f2b02fc..03bbfe06e7 100644
>> --- a/bsps/sparc/leon3/btimer/btimer.c
>> +++ b/bsps/sparc/leon3/btimer/btimer.c
>> @@ -23,10 +23,9 @@
>>
>>   #if defined(RTEMS_MULTIPROCESSING)
>>     #define LEON3_TIMER_INDEX \
>> -      ((rtems_configuration_get_user_multiprocessing_table()) ? \
>> -        (rtems_configuration_get_user_multiprocessing_table()->node) - 1 : 1)
>> +    (rtems_configuration_get_user_multiprocessing_table()->node)
> This is not the same value, but
> 
>>   #else
>> -  #define LEON3_TIMER_INDEX 0
>> +  #define LEON3_TIMER_INDEX 1
> I guess this corrects the off-by-1?

Sorry, this should be probably an extra patch. See remark in:

https://lists.rtems.org/pipermail/devel/2022-March/070744.html

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list