@@ -277,6 +277,22 @@ acpi_get_subtable_type(char *id)
277
277
return ACPI_SUBTABLE_COMMON ;
278
278
}
279
279
280
+ static __init_or_acpilib bool has_handler (struct acpi_subtable_proc * proc )
281
+ {
282
+ return proc -> handler || proc -> handler_arg ;
283
+ }
284
+
285
+ static __init_or_acpilib int call_handler (struct acpi_subtable_proc * proc ,
286
+ union acpi_subtable_headers * hdr ,
287
+ unsigned long end )
288
+ {
289
+ if (proc -> handler )
290
+ return proc -> handler (hdr , end );
291
+ if (proc -> handler_arg )
292
+ return proc -> handler_arg (hdr , proc -> arg , end );
293
+ return - EINVAL ;
294
+ }
295
+
280
296
/**
281
297
* acpi_parse_entries_array - for each proc_num find a suitable subtable
282
298
*
@@ -327,8 +343,9 @@ static int __init_or_acpilib acpi_parse_entries_array(
327
343
for (i = 0 ; i < proc_num ; i ++ ) {
328
344
if (acpi_get_entry_type (& entry ) != proc [i ].id )
329
345
continue ;
330
- if (!proc [i ].handler ||
331
- (!errs && proc [i ].handler (entry .hdr , table_end ))) {
346
+ if (!has_handler (& proc [i ]) ||
347
+ (!errs &&
348
+ call_handler (& proc [i ], entry .hdr , table_end ))) {
332
349
errs ++ ;
333
350
continue ;
334
351
}
@@ -394,21 +411,41 @@ int __init_or_acpilib acpi_table_parse_entries_array(
394
411
return count ;
395
412
}
396
413
397
- int __init acpi_table_parse_entries (char * id ,
398
- unsigned long table_size ,
399
- int entry_id ,
400
- acpi_tbl_entry_handler handler ,
401
- unsigned int max_entries )
414
+ static int __init_or_acpilib __acpi_table_parse_entries (
415
+ char * id , unsigned long table_size , int entry_id ,
416
+ acpi_tbl_entry_handler handler , acpi_tbl_entry_handler_arg handler_arg ,
417
+ void * arg , unsigned int max_entries )
402
418
{
403
419
struct acpi_subtable_proc proc = {
404
420
.id = entry_id ,
405
421
.handler = handler ,
422
+ .handler_arg = handler_arg ,
423
+ .arg = arg ,
406
424
};
407
425
408
426
return acpi_table_parse_entries_array (id , table_size , & proc , 1 ,
409
427
max_entries );
410
428
}
411
429
430
+ int __init_or_acpilib
431
+ acpi_table_parse_cedt (enum acpi_cedt_type id ,
432
+ acpi_tbl_entry_handler_arg handler_arg , void * arg )
433
+ {
434
+ return __acpi_table_parse_entries (ACPI_SIG_CEDT ,
435
+ sizeof (struct acpi_table_cedt ), id ,
436
+ NULL , handler_arg , arg , 0 );
437
+ }
438
+ EXPORT_SYMBOL_ACPI_LIB (acpi_table_parse_cedt );
439
+
440
+ int __init acpi_table_parse_entries (char * id , unsigned long table_size ,
441
+ int entry_id ,
442
+ acpi_tbl_entry_handler handler ,
443
+ unsigned int max_entries )
444
+ {
445
+ return __acpi_table_parse_entries (id , table_size , entry_id , handler ,
446
+ NULL , NULL , max_entries );
447
+ }
448
+
412
449
int __init acpi_table_parse_madt (enum acpi_madt_type id ,
413
450
acpi_tbl_entry_handler handler , unsigned int max_entries )
414
451
{
0 commit comments