libbsp/powerpc/shared/motorola/vpd.c: Why is the _System_state_Is_up() path disabled?

Joel Sherrill joel.sherrill at OARcorp.com
Thu Jan 30 00:04:18 UTC 2014


On 1/29/2014 5:56 PM, Nick Withers wrote:
> Hi all,
>
> Anyone have any idea why the "_System_state_Is_up(_System_state_Get())"
> check in libbsp/powerpc/shared/motorola/vpd.c's BSP_vpdRetrieveFields()
> is disabled with an (0 && _System_state_Is_up(_System_state_Get())?
First, that is a violation of the public API. :(

But it is avoiding calling open() before the device drivers are
initialized and possibly before
RTEMS is even initialized.

I suppose it should be discussed what to do about this case and
if some system state information should be publicly available via
a defined API.
> I use the following and haven't observed any troubles (it mis-reads
> otherwise):
> ____
>
> diff --git a/c/src/lib/libbsp/powerpc/shared/motorola/vpd.c b/c/src/lib/libbsp/powerpc/shared/motorola/vpd.c
> index 4b0bbef..1cbfebc 100644
> --- a/c/src/lib/libbsp/powerpc/shared/motorola/vpd.c
> +++ b/c/src/lib/libbsp/powerpc/shared/motorola/vpd.c
> @@ -137,7 +137,7 @@ static int    (*stop)(int fd);
>  
>         memset(mot,0,sizeof(mot));
>  
> -       if ( 0 && _System_state_Is_up(_System_state_Get()) ) {
> +       if ( _System_state_Is_up(_System_state_Get()) ) {
>                 read_bytes = read;
>                 stop       = close;
>                 fd         = open(BSP_I2C_VPD_EEPROM_DEV_NAME, 0);
> ____

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the devel mailing list