ACPICA: Eliminate some small unnecessary pathname functions.
Removed several small pathname functions to increase efficiency. Essentially, they replace a function call with a single compare. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
528a412c86
commit
04a81dce13
@ -311,6 +311,12 @@
|
|||||||
#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position))
|
#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position))
|
||||||
#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position))
|
#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position))
|
||||||
|
|
||||||
|
/* ACPI Pathname helpers */
|
||||||
|
|
||||||
|
#define ACPI_IS_ROOT_PREFIX(c) ((c) == (u8) 0x5C) /* Backslash */
|
||||||
|
#define ACPI_IS_PARENT_PREFIX(c) ((c) == (u8) 0x5E) /* Carat */
|
||||||
|
#define ACPI_IS_PATH_SEPARATOR(c) ((c) == (u8) 0x2E) /* Period (dot) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An object of type struct acpi_namespace_node can appear in some contexts
|
* An object of type struct acpi_namespace_node can appear in some contexts
|
||||||
* where a pointer to an object of type union acpi_operand_object can also
|
* where a pointer to an object of type union acpi_operand_object can also
|
||||||
|
@ -333,8 +333,6 @@ acpi_ns_install_node(struct acpi_walk_state *walk_state,
|
|||||||
/*
|
/*
|
||||||
* nsutils - Utility functions
|
* nsutils - Utility functions
|
||||||
*/
|
*/
|
||||||
u8 acpi_ns_valid_root_prefix(char prefix);
|
|
||||||
|
|
||||||
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
|
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
|
||||||
|
|
||||||
u32 acpi_ns_local(acpi_object_type type);
|
u32 acpi_ns_local(acpi_object_type type);
|
||||||
|
@ -211,8 +211,6 @@ void acpi_ps_free_op(union acpi_parse_object *op);
|
|||||||
|
|
||||||
u8 acpi_ps_is_leading_char(u32 c);
|
u8 acpi_ps_is_leading_char(u32 c);
|
||||||
|
|
||||||
u8 acpi_ps_is_prefix_char(u32 c);
|
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
u32 acpi_ps_get_name(union acpi_parse_object *op);
|
u32 acpi_ps_get_name(union acpi_parse_object *op);
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
@ -51,8 +51,6 @@
|
|||||||
ACPI_MODULE_NAME("nsutils")
|
ACPI_MODULE_NAME("nsutils")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static u8 acpi_ns_valid_path_separator(char sep);
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
|
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
|
||||||
#endif
|
#endif
|
||||||
@ -96,42 +94,6 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
*
|
|
||||||
* FUNCTION: acpi_ns_valid_root_prefix
|
|
||||||
*
|
|
||||||
* PARAMETERS: prefix - Character to be checked
|
|
||||||
*
|
|
||||||
* RETURN: TRUE if a valid prefix
|
|
||||||
*
|
|
||||||
* DESCRIPTION: Check if a character is a valid ACPI Root prefix
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
u8 acpi_ns_valid_root_prefix(char prefix)
|
|
||||||
{
|
|
||||||
|
|
||||||
return ((u8)(prefix == '\\'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
*
|
|
||||||
* FUNCTION: acpi_ns_valid_path_separator
|
|
||||||
*
|
|
||||||
* PARAMETERS: sep - Character to be checked
|
|
||||||
*
|
|
||||||
* RETURN: TRUE if a valid path separator
|
|
||||||
*
|
|
||||||
* DESCRIPTION: Check if a character is a valid ACPI path separator
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
static u8 acpi_ns_valid_path_separator(char sep)
|
|
||||||
{
|
|
||||||
|
|
||||||
return ((u8)(sep == '.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_type
|
* FUNCTION: acpi_ns_get_type
|
||||||
@ -217,19 +179,19 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
|
|||||||
*
|
*
|
||||||
* strlen() + 1 covers the first name_seg, which has no path separator
|
* strlen() + 1 covers the first name_seg, which has no path separator
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_valid_root_prefix(*next_external_char)) {
|
if (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
|
||||||
info->fully_qualified = TRUE;
|
info->fully_qualified = TRUE;
|
||||||
next_external_char++;
|
next_external_char++;
|
||||||
|
|
||||||
/* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
|
/* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
|
||||||
|
|
||||||
while (acpi_ns_valid_root_prefix(*next_external_char)) {
|
while (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
|
||||||
next_external_char++;
|
next_external_char++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Handle Carat prefixes */
|
/* Handle Carat prefixes */
|
||||||
|
|
||||||
while (*next_external_char == '^') {
|
while (ACPI_IS_PARENT_PREFIX(*next_external_char)) {
|
||||||
info->num_carats++;
|
info->num_carats++;
|
||||||
next_external_char++;
|
next_external_char++;
|
||||||
}
|
}
|
||||||
@ -243,7 +205,7 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
|
|||||||
if (*next_external_char) {
|
if (*next_external_char) {
|
||||||
info->num_segments = 1;
|
info->num_segments = 1;
|
||||||
for (i = 0; next_external_char[i]; i++) {
|
for (i = 0; next_external_char[i]; i++) {
|
||||||
if (acpi_ns_valid_path_separator(next_external_char[i])) {
|
if (ACPI_IS_PATH_SEPARATOR(next_external_char[i])) {
|
||||||
info->num_segments++;
|
info->num_segments++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,7 +243,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
|||||||
/* Setup the correct prefixes, counts, and pointers */
|
/* Setup the correct prefixes, counts, and pointers */
|
||||||
|
|
||||||
if (info->fully_qualified) {
|
if (info->fully_qualified) {
|
||||||
internal_name[0] = '\\';
|
internal_name[0] = AML_ROOT_PREFIX;
|
||||||
|
|
||||||
if (num_segments <= 1) {
|
if (num_segments <= 1) {
|
||||||
result = &internal_name[1];
|
result = &internal_name[1];
|
||||||
@ -301,7 +263,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
|||||||
i = 0;
|
i = 0;
|
||||||
if (info->num_carats) {
|
if (info->num_carats) {
|
||||||
for (i = 0; i < info->num_carats; i++) {
|
for (i = 0; i < info->num_carats; i++) {
|
||||||
internal_name[i] = '^';
|
internal_name[i] = AML_PARENT_PREFIX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +283,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
|||||||
|
|
||||||
for (; num_segments; num_segments--) {
|
for (; num_segments; num_segments--) {
|
||||||
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
||||||
if (acpi_ns_valid_path_separator(*external_name) ||
|
if (ACPI_IS_PATH_SEPARATOR(*external_name) ||
|
||||||
(*external_name == 0)) {
|
(*external_name == 0)) {
|
||||||
|
|
||||||
/* Pad the segment with underscore(s) if segment is short */
|
/* Pad the segment with underscore(s) if segment is short */
|
||||||
@ -338,7 +300,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
|||||||
|
|
||||||
/* Now we must have a path separator, or the pathname is bad */
|
/* Now we must have a path separator, or the pathname is bad */
|
||||||
|
|
||||||
if (!acpi_ns_valid_path_separator(*external_name) &&
|
if (!ACPI_IS_PATH_SEPARATOR(*external_name) &&
|
||||||
(*external_name != 0)) {
|
(*external_name != 0)) {
|
||||||
return_ACPI_STATUS(AE_BAD_PATHNAME);
|
return_ACPI_STATUS(AE_BAD_PATHNAME);
|
||||||
}
|
}
|
||||||
@ -456,13 +418,13 @@ acpi_ns_externalize_name(u32 internal_name_length,
|
|||||||
/* Check for a prefix (one '\' | one or more '^') */
|
/* Check for a prefix (one '\' | one or more '^') */
|
||||||
|
|
||||||
switch (internal_name[0]) {
|
switch (internal_name[0]) {
|
||||||
case '\\':
|
case AML_ROOT_PREFIX:
|
||||||
prefix_length = 1;
|
prefix_length = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '^':
|
case AML_PARENT_PREFIX:
|
||||||
for (i = 0; i < internal_name_length; i++) {
|
for (i = 0; i < internal_name_length; i++) {
|
||||||
if (internal_name[i] == '^') {
|
if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
|
||||||
prefix_length = i + 1;
|
prefix_length = i + 1;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -236,7 +236,7 @@ acpi_evaluate_object(acpi_handle handle,
|
|||||||
* 2) No handle, not fully qualified pathname (error)
|
* 2) No handle, not fully qualified pathname (error)
|
||||||
* 3) Valid handle
|
* 3) Valid handle
|
||||||
*/
|
*/
|
||||||
if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
|
if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
|
||||||
|
|
||||||
/* The path is fully qualified, just evaluate by name */
|
/* The path is fully qualified, just evaluate by name */
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ acpi_get_handle(acpi_handle parent,
|
|||||||
*
|
*
|
||||||
* Error for <null Parent + relative path>
|
* Error for <null Parent + relative path>
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_valid_root_prefix(pathname[0])) {
|
if (ACPI_IS_ROOT_PREFIX(pathname[0])) {
|
||||||
|
|
||||||
/* Pathname is fully qualified (starts with '\') */
|
/* Pathname is fully qualified (starts with '\') */
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
|
|||||||
|
|
||||||
/* Point past any namestring prefix characters (backslash or carat) */
|
/* Point past any namestring prefix characters (backslash or carat) */
|
||||||
|
|
||||||
while (acpi_ps_is_prefix_char(*end)) {
|
while (ACPI_IS_ROOT_PREFIX(*end) || ACPI_IS_PARENT_PREFIX(*end)) {
|
||||||
end++;
|
end++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +798,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
|
|||||||
subop = acpi_ps_peek_opcode(parser_state);
|
subop = acpi_ps_peek_opcode(parser_state);
|
||||||
if (subop == 0 ||
|
if (subop == 0 ||
|
||||||
acpi_ps_is_leading_char(subop) ||
|
acpi_ps_is_leading_char(subop) ||
|
||||||
acpi_ps_is_prefix_char(subop)) {
|
ACPI_IS_ROOT_PREFIX(subop) ||
|
||||||
|
ACPI_IS_PARENT_PREFIX(subop)) {
|
||||||
|
|
||||||
/* null_name or name_string */
|
/* null_name or name_string */
|
||||||
|
|
||||||
|
@ -201,14 +201,6 @@ u8 acpi_ps_is_leading_char(u32 c)
|
|||||||
return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
|
return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Is "c" a namestring prefix character?
|
|
||||||
*/
|
|
||||||
u8 acpi_ps_is_prefix_char(u32 c)
|
|
||||||
{
|
|
||||||
return ((u8)(c == '\\' || c == '^'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get op's name (4-byte name segment) or 0 if unnamed
|
* Get op's name (4-byte name segment) or 0 if unnamed
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user