aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/psutils.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/parser/psutils.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/parser/psutils.c')
-rw-r--r--drivers/acpi/parser/psutils.c105
1 files changed, 34 insertions, 71 deletions
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index 4221b41ae1a6..2075efbb4324 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -41,14 +41,12 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acparser.h> 45#include <acpi/acparser.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48 47
49#define _COMPONENT ACPI_PARSER 48#define _COMPONENT ACPI_PARSER
50 ACPI_MODULE_NAME ("psutils") 49ACPI_MODULE_NAME("psutils")
51
52 50
53/******************************************************************************* 51/*******************************************************************************
54 * 52 *
@@ -61,15 +59,11 @@
61 * DESCRIPTION: Create a Scope and associated namepath op with the root name 59 * DESCRIPTION: Create a Scope and associated namepath op with the root name
62 * 60 *
63 ******************************************************************************/ 61 ******************************************************************************/
64 62union acpi_parse_object *acpi_ps_create_scope_op(void)
65union acpi_parse_object *
66acpi_ps_create_scope_op (
67 void)
68{ 63{
69 union acpi_parse_object *scope_op; 64 union acpi_parse_object *scope_op;
70 65
71 66 scope_op = acpi_ps_alloc_op(AML_SCOPE_OP);
72 scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
73 if (!scope_op) { 67 if (!scope_op) {
74 return (NULL); 68 return (NULL);
75 } 69 }
@@ -78,7 +72,6 @@ acpi_ps_create_scope_op (
78 return (scope_op); 72 return (scope_op);
79} 73}
80 74
81
82/******************************************************************************* 75/*******************************************************************************
83 * 76 *
84 * FUNCTION: acpi_ps_init_op 77 * FUNCTION: acpi_ps_init_op
@@ -92,23 +85,19 @@ acpi_ps_create_scope_op (
92 * 85 *
93 ******************************************************************************/ 86 ******************************************************************************/
94 87
95void 88void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
96acpi_ps_init_op (
97 union acpi_parse_object *op,
98 u16 opcode)
99{ 89{
100 ACPI_FUNCTION_ENTRY (); 90 ACPI_FUNCTION_ENTRY();
101
102 91
103 op->common.data_type = ACPI_DESC_TYPE_PARSER; 92 op->common.data_type = ACPI_DESC_TYPE_PARSER;
104 op->common.aml_opcode = opcode; 93 op->common.aml_opcode = opcode;
105 94
106 ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, 95 ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
107 (acpi_ps_get_opcode_info (opcode))->name, 96 (acpi_ps_get_opcode_info
108 sizeof (op->common.aml_op_name))); 97 (opcode))->name,
98 sizeof(op->common.aml_op_name)));
109} 99}
110 100
111
112/******************************************************************************* 101/*******************************************************************************
113 * 102 *
114 * FUNCTION: acpi_ps_alloc_op 103 * FUNCTION: acpi_ps_alloc_op
@@ -123,29 +112,23 @@ acpi_ps_init_op (
123 * 112 *
124 ******************************************************************************/ 113 ******************************************************************************/
125 114
126union acpi_parse_object* 115union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
127acpi_ps_alloc_op (
128 u16 opcode)
129{ 116{
130 union acpi_parse_object *op; 117 union acpi_parse_object *op;
131 const struct acpi_opcode_info *op_info; 118 const struct acpi_opcode_info *op_info;
132 u8 flags = ACPI_PARSEOP_GENERIC; 119 u8 flags = ACPI_PARSEOP_GENERIC;
133
134
135 ACPI_FUNCTION_ENTRY ();
136 120
121 ACPI_FUNCTION_ENTRY();
137 122
138 op_info = acpi_ps_get_opcode_info (opcode); 123 op_info = acpi_ps_get_opcode_info(opcode);
139 124
140 /* Determine type of parse_op required */ 125 /* Determine type of parse_op required */
141 126
142 if (op_info->flags & AML_DEFER) { 127 if (op_info->flags & AML_DEFER) {
143 flags = ACPI_PARSEOP_DEFERRED; 128 flags = ACPI_PARSEOP_DEFERRED;
144 } 129 } else if (op_info->flags & AML_NAMED) {
145 else if (op_info->flags & AML_NAMED) {
146 flags = ACPI_PARSEOP_NAMED; 130 flags = ACPI_PARSEOP_NAMED;
147 } 131 } else if (opcode == AML_INT_BYTELIST_OP) {
148 else if (opcode == AML_INT_BYTELIST_OP) {
149 flags = ACPI_PARSEOP_BYTELIST; 132 flags = ACPI_PARSEOP_BYTELIST;
150 } 133 }
151 134
@@ -154,27 +137,25 @@ acpi_ps_alloc_op (
154 if (flags == ACPI_PARSEOP_GENERIC) { 137 if (flags == ACPI_PARSEOP_GENERIC) {
155 /* The generic op (default) is by far the most common (16 to 1) */ 138 /* The generic op (default) is by far the most common (16 to 1) */
156 139
157 op = acpi_os_acquire_object (acpi_gbl_ps_node_cache); 140 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
158 memset(op, 0, sizeof(struct acpi_parse_obj_common)); 141 memset(op, 0, sizeof(struct acpi_parse_obj_common));
159 } 142 } else {
160 else {
161 /* Extended parseop */ 143 /* Extended parseop */
162 144
163 op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache); 145 op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
164 memset(op, 0, sizeof(struct acpi_parse_obj_named)); 146 memset(op, 0, sizeof(struct acpi_parse_obj_named));
165 } 147 }
166 148
167 /* Initialize the Op */ 149 /* Initialize the Op */
168 150
169 if (op) { 151 if (op) {
170 acpi_ps_init_op (op, opcode); 152 acpi_ps_init_op(op, opcode);
171 op->common.flags = flags; 153 op->common.flags = flags;
172 } 154 }
173 155
174 return (op); 156 return (op);
175} 157}
176 158
177
178/******************************************************************************* 159/*******************************************************************************
179 * 160 *
180 * FUNCTION: acpi_ps_free_op 161 * FUNCTION: acpi_ps_free_op
@@ -188,26 +169,22 @@ acpi_ps_alloc_op (
188 * 169 *
189 ******************************************************************************/ 170 ******************************************************************************/
190 171
191void 172void acpi_ps_free_op(union acpi_parse_object *op)
192acpi_ps_free_op (
193 union acpi_parse_object *op)
194{ 173{
195 ACPI_FUNCTION_NAME ("ps_free_op"); 174 ACPI_FUNCTION_NAME("ps_free_op");
196
197 175
198 if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 176 if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
199 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op)); 177 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n",
178 op));
200 } 179 }
201 180
202 if (op->common.flags & ACPI_PARSEOP_GENERIC) { 181 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
203 (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op); 182 (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
204 } 183 } else {
205 else { 184 (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
206 (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
207 } 185 }
208} 186}
209 187
210
211/******************************************************************************* 188/*******************************************************************************
212 * 189 *
213 * FUNCTION: Utility functions 190 * FUNCTION: Utility functions
@@ -216,36 +193,27 @@ acpi_ps_free_op (
216 * 193 *
217 ******************************************************************************/ 194 ******************************************************************************/
218 195
219
220/* 196/*
221 * Is "c" a namestring lead character? 197 * Is "c" a namestring lead character?
222 */ 198 */
223u8 199u8 acpi_ps_is_leading_char(u32 c)
224acpi_ps_is_leading_char (
225 u32 c)
226{ 200{
227 return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); 201 return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
228} 202}
229 203
230
231/* 204/*
232 * Is "c" a namestring prefix character? 205 * Is "c" a namestring prefix character?
233 */ 206 */
234u8 207u8 acpi_ps_is_prefix_char(u32 c)
235acpi_ps_is_prefix_char (
236 u32 c)
237{ 208{
238 return ((u8) (c == '\\' || c == '^')); 209 return ((u8) (c == '\\' || c == '^'));
239} 210}
240 211
241
242/* 212/*
243 * Get op's name (4-byte name segment) or 0 if unnamed 213 * Get op's name (4-byte name segment) or 0 if unnamed
244 */ 214 */
245#ifdef ACPI_FUTURE_USAGE 215#ifdef ACPI_FUTURE_USAGE
246u32 216u32 acpi_ps_get_name(union acpi_parse_object * op)
247acpi_ps_get_name (
248 union acpi_parse_object *op)
249{ 217{
250 218
251 /* The "generic" object has no name associated with it */ 219 /* The "generic" object has no name associated with it */
@@ -258,16 +226,12 @@ acpi_ps_get_name (
258 226
259 return (op->named.name); 227 return (op->named.name);
260} 228}
261#endif /* ACPI_FUTURE_USAGE */ 229#endif /* ACPI_FUTURE_USAGE */
262
263 230
264/* 231/*
265 * Set op's name 232 * Set op's name
266 */ 233 */
267void 234void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
268acpi_ps_set_name (
269 union acpi_parse_object *op,
270 u32 name)
271{ 235{
272 236
273 /* The "generic" object has no name associated with it */ 237 /* The "generic" object has no name associated with it */
@@ -278,4 +242,3 @@ acpi_ps_set_name (
278 242
279 op->named.name = name; 243 op->named.name = name;
280} 244}
281