@@ -337,33 +337,14 @@ static ssize_t idlecpus_show(struct device *dev,
337
337
338
338
static DEVICE_ATTR_RW (idlecpus );
339
339
340
- static int acpi_pad_add_sysfs (struct acpi_device * device )
341
- {
342
- int result ;
343
-
344
- result = device_create_file (& device -> dev , & dev_attr_idlecpus );
345
- if (result )
346
- return - ENODEV ;
347
- result = device_create_file (& device -> dev , & dev_attr_idlepct );
348
- if (result ) {
349
- device_remove_file (& device -> dev , & dev_attr_idlecpus );
350
- return - ENODEV ;
351
- }
352
- result = device_create_file (& device -> dev , & dev_attr_rrtime );
353
- if (result ) {
354
- device_remove_file (& device -> dev , & dev_attr_idlecpus );
355
- device_remove_file (& device -> dev , & dev_attr_idlepct );
356
- return - ENODEV ;
357
- }
358
- return 0 ;
359
- }
340
+ static struct attribute * acpi_pad_attrs [] = {
341
+ & dev_attr_idlecpus .attr ,
342
+ & dev_attr_idlepct .attr ,
343
+ & dev_attr_rrtime .attr ,
344
+ NULL
345
+ };
360
346
361
- static void acpi_pad_remove_sysfs (struct acpi_device * device )
362
- {
363
- device_remove_file (& device -> dev , & dev_attr_idlecpus );
364
- device_remove_file (& device -> dev , & dev_attr_idlepct );
365
- device_remove_file (& device -> dev , & dev_attr_rrtime );
366
- }
347
+ ATTRIBUTE_GROUPS (acpi_pad );
367
348
368
349
/*
369
350
* Query firmware how many CPUs should be idle
@@ -439,15 +420,10 @@ static int acpi_pad_probe(struct platform_device *pdev)
439
420
strcpy (acpi_device_name (device ), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME );
440
421
strcpy (acpi_device_class (device ), ACPI_PROCESSOR_AGGREGATOR_CLASS );
441
422
442
- if (acpi_pad_add_sysfs (device ))
443
- return - ENODEV ;
444
-
445
423
status = acpi_install_notify_handler (device -> handle ,
446
424
ACPI_DEVICE_NOTIFY , acpi_pad_notify , device );
447
- if (ACPI_FAILURE (status )) {
448
- acpi_pad_remove_sysfs (device );
425
+ if (ACPI_FAILURE (status ))
449
426
return - ENODEV ;
450
- }
451
427
452
428
return 0 ;
453
429
}
@@ -462,7 +438,6 @@ static void acpi_pad_remove(struct platform_device *pdev)
462
438
463
439
acpi_remove_notify_handler (device -> handle ,
464
440
ACPI_DEVICE_NOTIFY , acpi_pad_notify );
465
- acpi_pad_remove_sysfs (device );
466
441
}
467
442
468
443
static const struct acpi_device_id pad_device_ids [] = {
@@ -475,6 +450,7 @@ static struct platform_driver acpi_pad_driver = {
475
450
.probe = acpi_pad_probe ,
476
451
.remove_new = acpi_pad_remove ,
477
452
.driver = {
453
+ .dev_groups = acpi_pad_groups ,
478
454
.name = "processor_aggregator" ,
479
455
.acpi_match_table = pad_device_ids ,
480
456
},
0 commit comments