aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nseval.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-11-12 22:19:24 -0500
committerLen Brown <len.brown@intel.com>2008-12-29 22:38:39 -0500
commiteeb4437e63c39ce19cf9b2de36a1dddbf12910c4 (patch)
treef8a03de090080a3a781a927ca13253774aebdfe7 /drivers/acpi/namespace/nseval.c
parenta647b5c34047560d7efe7e53e756c6692ce67dc7 (diff)
ACPICA: Consolidate method arg count validation code
Merge the code that validates control method argument counts into the predefined validation module. Eliminates possible multiple warnings for incorrect counts. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace/nseval.c')
-rw-r--r--drivers/acpi/namespace/nseval.c69
1 files changed, 14 insertions, 55 deletions
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index 738a4517b7c1..b95bfbbf5617 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -89,6 +89,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
89 /* Initialize the return value to an invalid object */ 89 /* Initialize the return value to an invalid object */
90 90
91 info->return_object = NULL; 91 info->return_object = NULL;
92 info->param_count = 0;
92 93
93 /* 94 /*
94 * Get the actual namespace node for the target object. Handles these cases: 95 * Get the actual namespace node for the target object. Handles these cases:
@@ -141,41 +142,17 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
141 return_ACPI_STATUS(AE_NULL_OBJECT); 142 return_ACPI_STATUS(AE_NULL_OBJECT);
142 } 143 }
143 144
144 /* 145 /* Count the number of arguments being passed to the method */
145 * Calculate the number of arguments being passed to the method
146 */
147 146
148 info->param_count = 0;
149 if (info->parameters) { 147 if (info->parameters) {
150 while (info->parameters[info->param_count]) 148 while (info->parameters[info->param_count]) {
149 if (info->param_count > ACPI_METHOD_MAX_ARG) {
150 return_ACPI_STATUS(AE_LIMIT);
151 }
151 info->param_count++; 152 info->param_count++;
153 }
152 } 154 }
153 155
154 /*
155 * Warning if too few or too many arguments have been passed by the
156 * caller. We don't want to abort here with an error because an
157 * incorrect number of arguments may not cause the method to fail.
158 * However, the method will fail if there are too few arguments passed
159 * and the method attempts to use one of the missing ones.
160 */
161
162 if (info->param_count < info->obj_desc->method.param_count) {
163 ACPI_WARNING((AE_INFO,
164 "Insufficient arguments - "
165 "method [%4.4s] needs %d, found %d",
166 acpi_ut_get_node_name(info->resolved_node),
167 info->obj_desc->method.param_count,
168 info->param_count));
169 } else if (info->param_count >
170 info->obj_desc->method.param_count) {
171 ACPI_WARNING((AE_INFO,
172 "Excess arguments - "
173 "method [%4.4s] needs %d, found %d",
174 acpi_ut_get_node_name(info->
175 resolved_node),
176 info->obj_desc->method.param_count,
177 info->param_count));
178 }
179 156
180 ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", 157 ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:",
181 ACPI_LV_INFO, _COMPONENT); 158 ACPI_LV_INFO, _COMPONENT);
@@ -264,31 +241,13 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
264 } 241 }
265 } 242 }
266 243
267 /* Validation of return values for ACPI-predefined methods and objects */ 244 /*
268 245 * Check input argument count against the ASL-defined count for a method.
269 if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) { 246 * Also check predefined names: argument count and return value against
270 /* 247 * the ACPI specification. Some incorrect return value types are repaired.
271 * If this is the first evaluation, check the return value. This 248 */
272 * ensures that any warnings will only be emitted during the very 249 (void)acpi_ns_check_predefined_names(node, info->param_count,
273 * first evaluation of the object. 250 status, &info->return_object);
274 */
275 if (!(node->flags & ANOBJ_EVALUATED)) {
276 /*
277 * Check for a predefined ACPI name. If found, validate the
278 * returned object.
279 *
280 * Note: Ignore return status for now, emit warnings if there are
281 * problems with the returned object. May change later to abort
282 * the method on invalid return object.
283 */
284 (void)acpi_ns_check_predefined_names(node,
285 &info->return_object);
286 }
287
288 /* Mark the node as having been evaluated */
289
290 node->flags |= ANOBJ_EVALUATED;
291 }
292 251
293 /* Check if there is a return value that must be dealt with */ 252 /* Check if there is a return value that must be dealt with */
294 253