Skip to content

Commit

Permalink
Rename nameseg compare macro for clarity
Browse files Browse the repository at this point in the history
ACPI_COMPARE_NAME changed to ACPI_COMPARE_NAMESEG
This clarifies (1) this is a compare on 4-byte namesegs, not
a generic compare. Improves understanding of the code.
  • Loading branch information
acpibob committed Feb 22, 2019
1 parent 19c18d3 commit 92ec093
Show file tree
Hide file tree
Showing 42 changed files with 134 additions and 133 deletions.
2 changes: 1 addition & 1 deletion source/common/adwalk.c
Expand Up @@ -814,7 +814,7 @@ AcpiDmLoadDescendingOp (

while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name)
{
if (ACPI_COMPARE_NAME (Node->Name.Ascii,
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii,
AcpiGbl_PreDefinedNames[PreDefineIndex].Name))
{
PreDefined = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion source/common/ahpredef.c
Expand Up @@ -490,7 +490,7 @@ AcpiAhMatchPredefinedName (

for (Info = AslPredefinedInfo; Info->Name; Info++)
{
if (ACPI_COMPARE_NAME (Nameseg, Info->Name))
if (ACPI_COMPARE_NAMESEG (Nameseg, Info->Name))
{
return (Info);
}
Expand Down
2 changes: 1 addition & 1 deletion source/common/ahtable.c
Expand Up @@ -183,7 +183,7 @@ AcpiAhGetTableInfo (

for (Info = AcpiGbl_SupportedTables; Info->Signature; Info++)
{
if (ACPI_COMPARE_NAME (Signature, Info->Signature))
if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature))
{
return (Info);
}
Expand Down
6 changes: 3 additions & 3 deletions source/common/dmtable.c
Expand Up @@ -602,7 +602,7 @@ AcpiDmGetTableData (

for (Info = AcpiDmTableData; Info->Signature; Info++)
{
if (ACPI_COMPARE_NAME (Signature, Info->Signature))
if (ACPI_COMPARE_NAMESEG (Signature, Info->Signature))
{
return (Info);
}
Expand Down Expand Up @@ -657,7 +657,7 @@ AcpiDmDumpDataTable (
* Handle tables that don't use the common ACPI table header structure.
* Currently, these are the FACS, RSDP, and S3PT.
*/
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
{
Length = Table->Length;
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
Expand All @@ -670,7 +670,7 @@ AcpiDmDumpDataTable (
{
Length = AcpiDmDumpRsdp (Table);
}
else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
{
Length = AcpiDmDumpS3pt (Table);
}
Expand Down
2 changes: 1 addition & 1 deletion source/common/dmtables.c
Expand Up @@ -281,7 +281,7 @@ AdCreateTableHeader (

/* Revision of DSDT controls the ACPI integer width */

if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
{
AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");
}
Expand Down
8 changes: 4 additions & 4 deletions source/compiler/aslanalyze.c
Expand Up @@ -622,7 +622,7 @@ ApCheckForGpeNameConflict (
if ((NextOp->Asl.ParseOpcode == PARSEOP_METHOD) ||
(NextOp->Asl.ParseOpcode == PARSEOP_NAME))
{
if (ACPI_COMPARE_NAME (Target, NextOp->Asl.NameSeg))
if (ACPI_COMPARE_NAMESEG (Target, NextOp->Asl.NameSeg))
{
/* Found both _Exy and _Lxy in the same scope, error */

Expand Down Expand Up @@ -666,7 +666,7 @@ ApCheckRegMethod (

/* We are only interested in _REG methods */

if (!ACPI_COMPARE_NAME (METHOD_NAME__REG, &Op->Asl.NameSeg))
if (!ACPI_COMPARE_NAMESEG (METHOD_NAME__REG, &Op->Asl.NameSeg))
{
return;
}
Expand Down Expand Up @@ -772,7 +772,7 @@ ApDeviceSubtreeWalk (

/* These are what we are looking for */

if (ACPI_COMPARE_NAME (Name, Op->Asl.NameSeg))
if (ACPI_COMPARE_NAMESEG (Name, Op->Asl.NameSeg))
{
return (AE_CTRL_TRUE);
}
Expand Down Expand Up @@ -831,7 +831,7 @@ ApFindNameInScope (
if ((Next->Asl.ParseOpcode == PARSEOP_METHOD) ||
(Next->Asl.ParseOpcode == PARSEOP_NAME))
{
if (ACPI_COMPARE_NAME (Name, Next->Asl.NameSeg))
if (ACPI_COMPARE_NAMESEG (Name, Next->Asl.NameSeg))
{
return (TRUE);
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/aslload.c
Expand Up @@ -732,7 +732,7 @@ LdNamespace1Begin (
* 10/2015.
*/
if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
(ACPI_COMPARE_NAME (AslGbl_TableSignature, "DSDT")))
(ACPI_COMPARE_NAMESEG (AslGbl_TableSignature, "DSDT")))
{
/* However, allowed if the reference is within a method */

Expand Down
8 changes: 4 additions & 4 deletions source/compiler/aslmethod.c
Expand Up @@ -228,7 +228,7 @@ MtMethodAnalysisWalkBegin (
* 1) _PS0 - One of these must exist: _PS1, _PS2, _PS3
* 2) _PS1/_PS2/_PS3: A _PS0 must exist
*/
if (ACPI_COMPARE_NAME (METHOD_NAME__PS0, Op->Asl.NameSeg))
if (ACPI_COMPARE_NAMESEG (METHOD_NAME__PS0, Op->Asl.NameSeg))
{
/* For _PS0, one of _PS1/_PS2/_PS3 must exist */

Expand All @@ -241,9 +241,9 @@ MtMethodAnalysisWalkBegin (
}
}
else if (
ACPI_COMPARE_NAME (METHOD_NAME__PS1, Op->Asl.NameSeg) ||
ACPI_COMPARE_NAME (METHOD_NAME__PS2, Op->Asl.NameSeg) ||
ACPI_COMPARE_NAME (METHOD_NAME__PS3, Op->Asl.NameSeg))
ACPI_COMPARE_NAMESEG (METHOD_NAME__PS1, Op->Asl.NameSeg) ||
ACPI_COMPARE_NAMESEG (METHOD_NAME__PS2, Op->Asl.NameSeg) ||
ACPI_COMPARE_NAMESEG (METHOD_NAME__PS3, Op->Asl.NameSeg))
{
/* For _PS1/_PS2/_PS3, a _PS0 must exist */

Expand Down
2 changes: 1 addition & 1 deletion source/compiler/aslopt.c
Expand Up @@ -363,7 +363,7 @@ OptBuildShortestPath (

Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1;

if (!ACPI_COMPARE_NAME (
if (!ACPI_COMPARE_NAMESEG (
&(ACPI_CAST_PTR (char, TargetPath->Pointer)) [Index],
&(ACPI_CAST_PTR (char, CurrentPath->Pointer)) [Index]))
{
Expand Down
6 changes: 3 additions & 3 deletions source/compiler/aslpredef.c
Expand Up @@ -578,7 +578,7 @@ ApCheckForPredefinedName (
ThisName = AcpiGbl_PredefinedMethods;
for (i = 0; ThisName->Info.Name[0]; i++)
{
if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name))
if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
{
/* Return index into predefined array */
return (i);
Expand All @@ -592,7 +592,7 @@ ApCheckForPredefinedName (
ThisName = AcpiGbl_ResourceNames;
while (ThisName->Info.Name[0])
{
if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name))
if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
{
return (ACPI_PREDEFINED_NAME);
}
Expand All @@ -603,7 +603,7 @@ ApCheckForPredefinedName (
ThisName = AcpiGbl_ScopeNames;
while (ThisName->Info.Name[0])
{
if (ACPI_COMPARE_NAME (Name, ThisName->Info.Name))
if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
{
return (ACPI_PREDEFINED_NAME);
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/asltransform.c
Expand Up @@ -553,7 +553,7 @@ TrDoDefinitionBlock (
* to be at the root of the namespace; Therefore, namepath
* optimization can only be performed on the DSDT.
*/
if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT))
if (!ACPI_COMPARE_NAMESEG (Next->Asl.Value.String, ACPI_SIG_DSDT))
{
AslGbl_ReferenceOptimizationFlag = FALSE;
}
Expand Down
4 changes: 2 additions & 2 deletions source/compiler/dtcompile.c
Expand Up @@ -418,7 +418,7 @@ DtCompileDataTable (
* Currently, these are the FACS and RSDP. Also check for an OEMx table,
* these tables have user-defined contents.
*/
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS))
{
Status = DtCompileFacs (FieldList);
if (ACPI_FAILURE (Status))
Expand All @@ -434,7 +434,7 @@ DtCompileDataTable (
Status = DtCompileRsdp (FieldList);
return (Status);
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_S3PT))
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_S3PT))
{
Status = DtCompileS3pt (FieldList);
if (ACPI_FAILURE (Status))
Expand Down
20 changes: 10 additions & 10 deletions source/compiler/dttemplate.c
Expand Up @@ -204,11 +204,11 @@ AcpiUtIsSpecialTable (
char *Signature)
{

if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_OSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS) ||
ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_OSDT) ||
ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT) ||
ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS) ||
ACPI_COMPARE_NAMESEG (Signature, ACPI_RSDP_NAME))
{
return (TRUE);
}
Expand Down Expand Up @@ -567,7 +567,7 @@ DtCreateOneTemplate (
AcpiOsPrintf (" (AML byte code table)\n");
AcpiOsPrintf (" */\n");

if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_DSDT))
{
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_DSDT, 1);
Expand All @@ -590,7 +590,7 @@ DtCreateOneTemplate (
}
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_SSDT, 1);
Expand All @@ -600,7 +600,7 @@ DtCreateOneTemplate (
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_OSDT))
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_OSDT))
{
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_OSDT, 1);
Expand All @@ -610,12 +610,12 @@ DtCreateOneTemplate (
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS))
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateFacs));
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_RSDP_NAME))
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateRsdp));
Expand Down
2 changes: 1 addition & 1 deletion source/components/debugger/dbexec.c
Expand Up @@ -658,7 +658,7 @@ AcpiDbExecute (

/* Dump a _PLD buffer if present */

if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
if (ACPI_COMPARE_NAMESEG ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
AcpiGbl_DbMethodInfo.Method)->Name.Ascii),
METHOD_NAME__PLD))
{
Expand Down
8 changes: 4 additions & 4 deletions source/components/disassembler/dmbuffer.c
Expand Up @@ -736,7 +736,7 @@ AcpiDmIsPldBuffer (
{
Node = ParentOp->Common.Node;

if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__PLD))
{
/* Ignore the Size argument in the disassembly of this buffer op */

Expand Down Expand Up @@ -770,7 +770,7 @@ AcpiDmIsPldBuffer (
{
Node = ParentOp->Common.Node;

if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__PLD))
{
/* Ignore the Size argument in the disassembly of this buffer op */

Expand Down Expand Up @@ -1100,15 +1100,15 @@ AcpiDmCheckForHardwareId (

/* Check for _HID - has one argument */

if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
if (ACPI_COMPARE_NAMESEG (&Name, METHOD_NAME__HID))
{
AcpiDmGetHardwareIdType (NextOp);
return;
}

/* Exit if not _CID */

if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID))
if (!ACPI_COMPARE_NAMESEG (&Name, METHOD_NAME__CID))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion source/components/dispatcher/dsinit.c
Expand Up @@ -359,7 +359,7 @@ AcpiDsInitializeObjects (

/* DSDT is always the first AML table */

if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nInitializing Namespace objects:\n"));
Expand Down
4 changes: 2 additions & 2 deletions source/components/namespace/nsinit.c
Expand Up @@ -662,7 +662,7 @@ AcpiNsFindIniMethods (

/* We are only looking for methods named _INI */

if (!ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__INI))
if (!ACPI_COMPARE_NAMESEG (Node->Name.Ascii, METHOD_NAME__INI))
{
return (AE_OK);
}
Expand Down Expand Up @@ -839,7 +839,7 @@ AcpiNsInitOneDevice (
* Note: We know there is an _INI within this subtree, but it may not be
* under this particular device, it may be lower in the branch.
*/
if (!ACPI_COMPARE_NAME (DeviceNode->Name.Ascii, "_SB_") ||
if (!ACPI_COMPARE_NAMESEG (DeviceNode->Name.Ascii, "_SB_") ||
DeviceNode->Parent != AcpiGbl_RootNode)
{
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
Expand Down
2 changes: 1 addition & 1 deletion source/components/namespace/nsparse.c
Expand Up @@ -365,7 +365,7 @@ AcpiNsOneCompleteParse (

/* Found OSDT table, enable the namespace override feature */

if (ACPI_COMPARE_NAME(Table->Signature, ACPI_SIG_OSDT) &&
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_OSDT) &&
PassNumber == ACPI_IMODE_LOAD_PASS1)
{
WalkState->NamespaceOverride = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion source/components/namespace/nsrepair.c
Expand Up @@ -470,7 +470,7 @@ AcpiNsMatchSimpleRepair (
ThisName = AcpiObjectRepairInfo;
while (ThisName->ObjectConverter)
{
if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name))
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, ThisName->Name))
{
/* Check if we can actually repair this name/type combination */

Expand Down
2 changes: 1 addition & 1 deletion source/components/namespace/nsrepair2.c
Expand Up @@ -358,7 +358,7 @@ AcpiNsMatchComplexRepair (
ThisName = AcpiNsRepairableNames;
while (ThisName->RepairFunction)
{
if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name))
if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, ThisName->Name))
{
return (ThisName);
}
Expand Down
4 changes: 2 additions & 2 deletions source/components/namespace/nsxfname.c
Expand Up @@ -691,8 +691,8 @@ AcpiInstallMethod (

/* Table must be a DSDT or SSDT */

if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
if (!ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_SSDT))
{
return (AE_BAD_HEADER);
}
Expand Down
8 changes: 4 additions & 4 deletions source/components/resources/rsxface.c
Expand Up @@ -825,10 +825,10 @@ AcpiWalkResources (
/* Parameter validation */

if (!DeviceHandle || !UserFunction || !Name ||
(!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
!ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) &&
!ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI) &&
!ACPI_COMPARE_NAME (Name, METHOD_NAME__DMA)))
(!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__CRS) &&
!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__PRS) &&
!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__AEI) &&
!ACPI_COMPARE_NAMESEG (Name, METHOD_NAME__DMA)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Expand Down
2 changes: 1 addition & 1 deletion source/components/tables/tbdata.c
Expand Up @@ -676,7 +676,7 @@ AcpiTbVerifyTempTable (
/* If a particular signature is expected (DSDT/FACS), it must match */

if (Signature &&
!ACPI_COMPARE_NAME (&TableDesc->Signature, Signature))
!ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature))
{
ACPI_BIOS_ERROR ((AE_INFO,
"Invalid signature 0x%X for ACPI table, expected [%s]",
Expand Down
2 changes: 1 addition & 1 deletion source/components/tables/tbinstal.c
Expand Up @@ -274,7 +274,7 @@ AcpiTbInstallStandardTable (
*/
if (!Reload &&
AcpiGbl_DisableSsdtTableInstall &&
ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT))
ACPI_COMPARE_NAMESEG (&NewTableDesc.Signature, ACPI_SIG_SSDT))
{
ACPI_INFO ((
"Ignoring installation of %4.4s at %8.8X%8.8X",
Expand Down

0 comments on commit 92ec093

Please sign in to comment.