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

Nick Withers nick.withers at anu.edu.au
Thu Jan 30 00:17:19 UTC 2014


On Wed, 2014-01-29 at 18:04 -0600, Joel Sherrill wrote:
> 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. :(

That's not OK for BSP code? It seems to be used in other, more generic
places in libbsp too, e.g., c/src/lib/libbsp/shared/src/irq-generic.c .

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

The _System_state_Is_up(_System_state_Get()) call you mean? Yeah, but
it's disabled.

Possibly because it's an API violation...?

> 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);
> > ____

-- 
Nick Withers

Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)




More information about the devel mailing list