FreeBSD/sys/contrib/dev/acpica/compiler/aslmapenter.c
/*******************************************************************************
 *
 * FUNCTION:    MpCreateGpioInfo
 *
 * PARAMETERS:  PinNumber               - GPIO pin number
 *              DeviceName              - The "ResourceSource" name
 *
 * RETURN:      New GPIO info block.
 *
 * DESCRIPTION: Create a new GPIO info block and place it on the global list.
 *              The list is sorted by GPIO device names first, and pin numbers
 *              secondarily.
 *
 ******************************************************************************/


New GPIO info block.

Create a new GPIO info block and place it on the global list.
The list is sorted by GPIO device names first, and pin numbers
secondarily.
New GPIO info block . Create a new GPIO info block and place it on the global list . The list is sorted by GPIO device names first and pin numbers secondarily .
static ACPI_GPIO_INFO *
MpCreateGpioInfo (
    UINT16                  PinNumber,
    char                    *DeviceName)
{
    ACPI_GPIO_INFO          *Info;
    ACPI_GPIO_INFO          *NextGpio;
    ACPI_GPIO_INFO          *PrevGpio;
    char                    *Buffer;
    Buffer = UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO));
    Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer);
    NextGpio = Gbl_GpioList;
    PrevGpio = NULL;
    if (!Gbl_GpioList)
    {
        Gbl_GpioList = Info;
        Info->Next = NULL;
        return (Info);
    }
    while (NextGpio &&
        (strcmp (DeviceName, NextGpio->DeviceName) > 0))
    {
        PrevGpio = NextGpio;
        NextGpio = NextGpio->Next;
    }
    while (NextGpio &&
        (NextGpio->PinNumber < PinNumber) &&
        !strcmp (DeviceName, NextGpio->DeviceName))
    {
        PrevGpio = NextGpio;
        NextGpio = NextGpio->Next;
    }
    if (PrevGpio)
    {
        PrevGpio->Next = Info;
    }
    else
    {
        Gbl_GpioList = Info;
    }
    Info->Next = NextGpio;
    return (Info);
}
static ACPI_GPIO_INFO * MpCreateGpioInfo ( UINT16 PinNumber , char * DeviceName ) { ACPI_GPIO_INFO * Info ; ACPI_GPIO_INFO * NextGpio ; ACPI_GPIO_INFO * PrevGpio ; char * Buffer ; Buffer = UtStringCacheCalloc ( sizeof ( ACPI_GPIO_INFO ) ) ; Info = ACPI_CAST_PTR ( ACPI_GPIO_INFO , Buffer ) ; NextGpio = Gbl_GpioList ; PrevGpio = NULL ; if ( ! Gbl_GpioList ) { Gbl_GpioList = Info ; Info -> Next = NULL ; return ( Info ) ; } while ( NextGpio && ( strcmp ( DeviceName , NextGpio -> DeviceName ) > 0 ) ) { PrevGpio = NextGpio ; NextGpio = NextGpio -> Next ; } while ( NextGpio && ( NextGpio -> PinNumber < PinNumber ) && ! strcmp ( DeviceName , NextGpio -> DeviceName ) ) { PrevGpio = NextGpio ; NextGpio = NextGpio -> Next ; } if ( PrevGpio ) { PrevGpio -> Next = Info ; } else { Gbl_GpioList = Info ; } Info -> Next = NextGpio ; return ( Info ) ; }
FUNCTION:    MpCreateGpioInfo
 PARAMETERS:  PinNumber               - GPIO pin number
              DeviceName              - The "ResourceSource" name
FUNCTION : MpCreateGpioInfo PARAMETERS : PinNumber - GPIO pin number DeviceName - The " ResourceSource " name
/*
     * Allocate a new info block and insert it into the global GPIO list
     * sorted by both source device name and then the pin number. There is
     * one block per pin.
     */ /* Sort on source DeviceName first */ /* Now sort on the PinNumber */ /* Finish the list insertion */