aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/acpica/acmacros.h6
-rw-r--r--drivers/acpi/acpica/acnamesp.h2
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/nsutils.c60
-rw-r--r--drivers/acpi/acpica/nsxfeval.c2
-rw-r--r--drivers/acpi/acpica/nsxfname.c2
-rw-r--r--drivers/acpi/acpica/psargs.c5
-rw-r--r--drivers/acpi/acpica/psutils.c8
8 files changed, 22 insertions, 65 deletions
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 3ba11d23cba0..edfcbc8909ca 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -311,6 +311,12 @@
311#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position)) 311#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position))
312#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position)) 312#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position))
313 313
314/* ACPI Pathname helpers */
315
316#define ACPI_IS_ROOT_PREFIX(c) ((c) == (u8) 0x5C) /* Backslash */
317#define ACPI_IS_PARENT_PREFIX(c) ((c) == (u8) 0x5E) /* Carat */
318#define ACPI_IS_PATH_SEPARATOR(c) ((c) == (u8) 0x2E) /* Period (dot) */
319
314/* 320/*
315 * An object of type struct acpi_namespace_node can appear in some contexts 321 * An object of type struct acpi_namespace_node can appear in some contexts
316 * where a pointer to an object of type union acpi_operand_object can also 322 * where a pointer to an object of type union acpi_operand_object can also
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 9b19d4b86424..b826d9c7aa73 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -333,8 +333,6 @@ acpi_ns_install_node(struct acpi_walk_state *walk_state,
333/* 333/*
334 * nsutils - Utility functions 334 * nsutils - Utility functions
335 */ 335 */
336u8 acpi_ns_valid_root_prefix(char prefix);
337
338acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); 336acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
339 337
340u32 acpi_ns_local(acpi_object_type type); 338u32 acpi_ns_local(acpi_object_type type);
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index eefcf47a61a0..24a59056eee1 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -211,8 +211,6 @@ void acpi_ps_free_op(union acpi_parse_object *op);
211 211
212u8 acpi_ps_is_leading_char(u32 c); 212u8 acpi_ps_is_leading_char(u32 c);
213 213
214u8 acpi_ps_is_prefix_char(u32 c);
215
216#ifdef ACPI_FUTURE_USAGE 214#ifdef ACPI_FUTURE_USAGE
217u32 acpi_ps_get_name(union acpi_parse_object *op); 215u32 acpi_ps_get_name(union acpi_parse_object *op);
218#endif /* ACPI_FUTURE_USAGE */ 216#endif /* ACPI_FUTURE_USAGE */
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 4479654760ac..d2dfe6172181 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -51,8 +51,6 @@
51ACPI_MODULE_NAME("nsutils") 51ACPI_MODULE_NAME("nsutils")
52 52
53/* Local prototypes */ 53/* Local prototypes */
54static u8 acpi_ns_valid_path_separator(char sep);
55
56#ifdef ACPI_OBSOLETE_FUNCTIONS 54#ifdef ACPI_OBSOLETE_FUNCTIONS
57acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); 55acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
58#endif 56#endif
@@ -98,42 +96,6 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node,
98 96
99/******************************************************************************* 97/*******************************************************************************
100 * 98 *
101 * FUNCTION: acpi_ns_valid_root_prefix
102 *
103 * PARAMETERS: prefix - Character to be checked
104 *
105 * RETURN: TRUE if a valid prefix
106 *
107 * DESCRIPTION: Check if a character is a valid ACPI Root prefix
108 *
109 ******************************************************************************/
110
111u8 acpi_ns_valid_root_prefix(char prefix)
112{
113
114 return ((u8)(prefix == '\\'));
115}
116
117/*******************************************************************************
118 *
119 * FUNCTION: acpi_ns_valid_path_separator
120 *
121 * PARAMETERS: sep - Character to be checked
122 *
123 * RETURN: TRUE if a valid path separator
124 *
125 * DESCRIPTION: Check if a character is a valid ACPI path separator
126 *
127 ******************************************************************************/
128
129static u8 acpi_ns_valid_path_separator(char sep)
130{
131
132 return ((u8)(sep == '.'));
133}
134
135/*******************************************************************************
136 *
137 * FUNCTION: acpi_ns_get_type 99 * FUNCTION: acpi_ns_get_type
138 * 100 *
139 * PARAMETERS: node - Parent Node to be examined 101 * PARAMETERS: node - Parent Node to be examined
@@ -217,19 +179,19 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
217 * 179 *
218 * strlen() + 1 covers the first name_seg, which has no path separator 180 * strlen() + 1 covers the first name_seg, which has no path separator
219 */ 181 */
220 if (acpi_ns_valid_root_prefix(*next_external_char)) { 182 if (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
221 info->fully_qualified = TRUE; 183 info->fully_qualified = TRUE;
222 next_external_char++; 184 next_external_char++;
223 185
224 /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ 186 /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
225 187
226 while (acpi_ns_valid_root_prefix(*next_external_char)) { 188 while (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
227 next_external_char++; 189 next_external_char++;
228 } 190 }
229 } else { 191 } else {
230 /* Handle Carat prefixes */ 192 /* Handle Carat prefixes */
231 193
232 while (*next_external_char == '^') { 194 while (ACPI_IS_PARENT_PREFIX(*next_external_char)) {
233 info->num_carats++; 195 info->num_carats++;
234 next_external_char++; 196 next_external_char++;
235 } 197 }
@@ -243,7 +205,7 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
243 if (*next_external_char) { 205 if (*next_external_char) {
244 info->num_segments = 1; 206 info->num_segments = 1;
245 for (i = 0; next_external_char[i]; i++) { 207 for (i = 0; next_external_char[i]; i++) {
246 if (acpi_ns_valid_path_separator(next_external_char[i])) { 208 if (ACPI_IS_PATH_SEPARATOR(next_external_char[i])) {
247 info->num_segments++; 209 info->num_segments++;
248 } 210 }
249 } 211 }
@@ -281,7 +243,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
281 /* Setup the correct prefixes, counts, and pointers */ 243 /* Setup the correct prefixes, counts, and pointers */
282 244
283 if (info->fully_qualified) { 245 if (info->fully_qualified) {
284 internal_name[0] = '\\'; 246 internal_name[0] = AML_ROOT_PREFIX;
285 247
286 if (num_segments <= 1) { 248 if (num_segments <= 1) {
287 result = &internal_name[1]; 249 result = &internal_name[1];
@@ -301,7 +263,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
301 i = 0; 263 i = 0;
302 if (info->num_carats) { 264 if (info->num_carats) {
303 for (i = 0; i < info->num_carats; i++) { 265 for (i = 0; i < info->num_carats; i++) {
304 internal_name[i] = '^'; 266 internal_name[i] = AML_PARENT_PREFIX;
305 } 267 }
306 } 268 }
307 269
@@ -321,7 +283,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
321 283
322 for (; num_segments; num_segments--) { 284 for (; num_segments; num_segments--) {
323 for (i = 0; i < ACPI_NAME_SIZE; i++) { 285 for (i = 0; i < ACPI_NAME_SIZE; i++) {
324 if (acpi_ns_valid_path_separator(*external_name) || 286 if (ACPI_IS_PATH_SEPARATOR(*external_name) ||
325 (*external_name == 0)) { 287 (*external_name == 0)) {
326 288
327 /* Pad the segment with underscore(s) if segment is short */ 289 /* 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)
338 300
339 /* Now we must have a path separator, or the pathname is bad */ 301 /* Now we must have a path separator, or the pathname is bad */
340 302
341 if (!acpi_ns_valid_path_separator(*external_name) && 303 if (!ACPI_IS_PATH_SEPARATOR(*external_name) &&
342 (*external_name != 0)) { 304 (*external_name != 0)) {
343 return_ACPI_STATUS(AE_BAD_PATHNAME); 305 return_ACPI_STATUS(AE_BAD_PATHNAME);
344 } 306 }
@@ -456,13 +418,13 @@ acpi_ns_externalize_name(u32 internal_name_length,
456 /* Check for a prefix (one '\' | one or more '^') */ 418 /* Check for a prefix (one '\' | one or more '^') */
457 419
458 switch (internal_name[0]) { 420 switch (internal_name[0]) {
459 case '\\': 421 case AML_ROOT_PREFIX:
460 prefix_length = 1; 422 prefix_length = 1;
461 break; 423 break;
462 424
463 case '^': 425 case AML_PARENT_PREFIX:
464 for (i = 0; i < internal_name_length; i++) { 426 for (i = 0; i < internal_name_length; i++) {
465 if (internal_name[i] == '^') { 427 if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
466 prefix_length = i + 1; 428 prefix_length = i + 1;
467 } else { 429 } else {
468 break; 430 break;
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index ef29925d1620..1070eeefcbce 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -236,7 +236,7 @@ acpi_evaluate_object(acpi_handle handle,
236 * 2) No handle, not fully qualified pathname (error) 236 * 2) No handle, not fully qualified pathname (error)
237 * 3) Valid handle 237 * 3) Valid handle
238 */ 238 */
239 if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { 239 if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
240 240
241 /* The path is fully qualified, just evaluate by name */ 241 /* The path is fully qualified, just evaluate by name */
242 242
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index a8deae82b24b..1664fad5e303 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -107,7 +107,7 @@ acpi_get_handle(acpi_handle parent,
107 * 107 *
108 * Error for <null Parent + relative path> 108 * Error for <null Parent + relative path>
109 */ 109 */
110 if (acpi_ns_valid_root_prefix(pathname[0])) { 110 if (ACPI_IS_ROOT_PREFIX(pathname[0])) {
111 111
112 /* Pathname is fully qualified (starts with '\') */ 112 /* Pathname is fully qualified (starts with '\') */
113 113
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index cb79e2d4d743..9f3189395f3a 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -162,7 +162,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
162 162
163 /* Point past any namestring prefix characters (backslash or carat) */ 163 /* Point past any namestring prefix characters (backslash or carat) */
164 164
165 while (acpi_ps_is_prefix_char(*end)) { 165 while (ACPI_IS_ROOT_PREFIX(*end) || ACPI_IS_PARENT_PREFIX(*end)) {
166 end++; 166 end++;
167 } 167 }
168 168
@@ -798,7 +798,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
798 subop = acpi_ps_peek_opcode(parser_state); 798 subop = acpi_ps_peek_opcode(parser_state);
799 if (subop == 0 || 799 if (subop == 0 ||
800 acpi_ps_is_leading_char(subop) || 800 acpi_ps_is_leading_char(subop) ||
801 acpi_ps_is_prefix_char(subop)) { 801 ACPI_IS_ROOT_PREFIX(subop) ||
802 ACPI_IS_PARENT_PREFIX(subop)) {
802 803
803 /* null_name or name_string */ 804 /* null_name or name_string */
804 805
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index afefb3a1b577..2bbf670b34f9 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -202,14 +202,6 @@ u8 acpi_ps_is_leading_char(u32 c)
202} 202}
203 203
204/* 204/*
205 * Is "c" a namestring prefix character?
206 */
207u8 acpi_ps_is_prefix_char(u32 c)
208{
209 return ((u8)(c == '\\' || c == '^'));
210}
211
212/*
213 * Get op's name (4-byte name segment) or 0 if unnamed 205 * Get op's name (4-byte name segment) or 0 if unnamed
214 */ 206 */
215#ifdef ACPI_FUTURE_USAGE 207#ifdef ACPI_FUTURE_USAGE