Skip to content

Commit d183540

Browse files
committed
Revert "ACPI: platform_profile: Add support for non-ACPI platforms"
This reverts commit 1638a9a.
1 parent 8062d91 commit d183540

File tree

1 file changed

+13
-55
lines changed

1 file changed

+13
-55
lines changed

drivers/acpi/platform_profile.c

Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,6 @@ static ssize_t profile_show(struct device *dev,
190190
return sysfs_emit(buf, "%s\n", profile_names[profile]);
191191
}
192192

193-
/**
194-
* profile_notify_legacy - Notify the legacy sysfs interface
195-
*
196-
* This wrapper takes care of only notifying the legacy sysfs interface
197-
* if it was registered during module initialization.
198-
*/
199-
static void profile_notify_legacy(void)
200-
{
201-
if (!acpi_kobj)
202-
return;
203-
204-
sysfs_notify(acpi_kobj, NULL, "platform_profile");
205-
}
206-
207193
/**
208194
* profile_store - Set the profile for a class device
209195
* @dev: The device
@@ -229,7 +215,7 @@ static ssize_t profile_store(struct device *dev,
229215
return ret;
230216
}
231217

232-
profile_notify_legacy();
218+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
233219

234220
return count;
235221
}
@@ -449,7 +435,7 @@ static ssize_t platform_profile_store(struct kobject *kobj,
449435
return ret;
450436
}
451437

452-
profile_notify_legacy();
438+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
453439

454440
return count;
455441
}
@@ -486,22 +472,6 @@ static const struct attribute_group platform_profile_group = {
486472
.is_visible = profile_class_is_visible,
487473
};
488474

489-
/**
490-
* profile_update_legacy - Update the legacy sysfs interface
491-
*
492-
* This wrapper takes care of only updating the legacy sysfs interface
493-
* if it was registered during module initialization.
494-
*
495-
* Return: 0 on success or error code on failure.
496-
*/
497-
static int profile_update_legacy(void)
498-
{
499-
if (!acpi_kobj)
500-
return 0;
501-
502-
return sysfs_update_group(acpi_kobj, &platform_profile_group);
503-
}
504-
505475
/**
506476
* platform_profile_notify - Notify class device and legacy sysfs interface
507477
* @dev: The class device
@@ -511,7 +481,7 @@ void platform_profile_notify(struct device *dev)
511481
scoped_cond_guard(mutex_intr, return, &profile_lock) {
512482
_notify_class_profile(dev, NULL);
513483
}
514-
profile_notify_legacy();
484+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
515485
}
516486
EXPORT_SYMBOL_GPL(platform_profile_notify);
517487

@@ -559,7 +529,7 @@ int platform_profile_cycle(void)
559529
return err;
560530
}
561531

562-
profile_notify_legacy();
532+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
563533

564534
return 0;
565535
}
@@ -633,9 +603,9 @@ struct device *platform_profile_register(struct device *dev, const char *name,
633603
goto cleanup_ida;
634604
}
635605

636-
profile_notify_legacy();
606+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
637607

638-
err = profile_update_legacy();
608+
err = sysfs_update_group(acpi_kobj, &platform_profile_group);
639609
if (err)
640610
goto cleanup_cur;
641611

@@ -669,8 +639,8 @@ void platform_profile_remove(struct device *dev)
669639
ida_free(&platform_profile_ida, pprof->minor);
670640
device_unregister(&pprof->dev);
671641

672-
profile_notify_legacy();
673-
profile_update_legacy();
642+
sysfs_notify(acpi_kobj, NULL, "platform_profile");
643+
sysfs_update_group(acpi_kobj, &platform_profile_group);
674644
}
675645
EXPORT_SYMBOL_GPL(platform_profile_remove);
676646

@@ -725,28 +695,16 @@ static int __init platform_profile_init(void)
725695
if (err)
726696
return err;
727697

728-
/*
729-
* The ACPI kobject can be missing if ACPI was disabled during booting.
730-
* We thus skip the initialization of the legacy sysfs interface in such
731-
* cases to allow the platform profile class to work on ARM64 notebooks
732-
* without ACPI support.
733-
*/
734-
if (acpi_kobj) {
735-
err = sysfs_create_group(acpi_kobj, &platform_profile_group);
736-
if (err < 0) {
737-
class_unregister(&platform_profile_class);
738-
return err;
739-
}
740-
}
698+
err = sysfs_create_group(acpi_kobj, &platform_profile_group);
699+
if (err)
700+
class_unregister(&platform_profile_class);
741701

742-
return 0;
702+
return err;
743703
}
744704

745705
static void __exit platform_profile_exit(void)
746706
{
747-
if (acpi_kobj)
748-
sysfs_remove_group(acpi_kobj, &platform_profile_group);
749-
707+
sysfs_remove_group(acpi_kobj, &platform_profile_group);
750708
class_unregister(&platform_profile_class);
751709
}
752710
module_init(platform_profile_init);

0 commit comments

Comments
 (0)