FreeBSD/sys/contrib/dev/acpica/compiler/aslmethod.c
/*******************************************************************************
 *
 * FUNCTION:    MtCheckNamedObjectInMethod
 *
 * PARAMETERS:  Op                  - Current parser op
 *              MethodInfo          - Info for method being parsed
 *
 * RETURN:      None
 *
 * DESCRIPTION: Detect if a non-serialized method is creating a named object,
 *              which could possibly cause problems if two threads execute
 *              the method concurrently. Emit a remark in this case.
 *
 ******************************************************************************/
MtCheckNamedObjectInMethod
PARAMETERS:  Op                  - Current parser op
MethodInfo          - Info for method being parsed

None

Detect if a non-serialized method is creating a named object,
which could possibly cause problems if two threads execute
the method concurrently. Emit a remark in this case.
MtCheckNamedObjectInMethod PARAMETERS : Op - Current parser op MethodInfo - Info for method being parsed None Detect if a non - serialized method is creating a named object which could possibly cause problems if two threads execute the method concurrently . Emit a remark in this case .
static void
MtCheckNamedObjectInMethod (
    ACPI_PARSE_OBJECT       *Op,
    ASL_METHOD_INFO         *MethodInfo)
{
    const ACPI_OPCODE_INFO  *OpInfo;
    if ((Op->Asl.AmlOpcode == AML_METHOD_OP) ||
        (Op->Asl.AmlOpcode == AML_SCOPE_OP))
    {
        return;
    }
    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
    {
        if (MethodInfo && !MethodInfo->ShouldBeSerialized)
        {
            AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,
                "due to creation of named objects within");
            MethodInfo->ShouldBeSerialized = TRUE;
        }
    }
}
static void MtCheckNamedObjectInMethod ( ACPI_PARSE_OBJECT * Op , ASL_METHOD_INFO * MethodInfo ) { const ACPI_OPCODE_INFO * OpInfo ; if ( ( Op -> Asl . AmlOpcode == AML_METHOD_OP ) || ( Op -> Asl . AmlOpcode == AML_SCOPE_OP ) ) { return ; } OpInfo = AcpiPsGetOpcodeInfo ( Op -> Asl . AmlOpcode ) ; if ( OpInfo -> Class == AML_CLASS_NAMED_OBJECT ) { if ( MethodInfo && ! MethodInfo -> ShouldBeSerialized ) { AslError ( ASL_REMARK , ASL_MSG_SERIALIZED_REQUIRED , MethodInfo -> Op , " " ) ; MethodInfo -> ShouldBeSerialized = TRUE ; } } }
FUNCTION:    MtCheckNamedObjectInMethod
 PARAMETERS:  Op                  - Current parser op
              MethodInfo          - Info for method being parsed
FUNCTION : MtCheckNamedObjectInMethod PARAMETERS : Op - Current parser op MethodInfo - Info for method being parsed
/* We don't care about actual method declarations or scopes */ /* Determine if we are creating a named object */ /*
         * If we have a named object created within a non-serialized method,
         * emit a remark that the method should be serialized.
         *
         * Reason: If a thread blocks within the method for any reason, and
         * another thread enters the method, the method will fail because an
         * attempt will be made to create the same object twice.
         */ /* Emit message only ONCE per method */