diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-02-24 13:18:16 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-02-24 13:18:16 +0100 |
commit | 9597965c715541c014eac68e2bdab018c4e8ec82 (patch) | |
tree | e70f6014e07ffe727eb19fdb672e031b1a6c556f /drivers/acpi/platform_profile.c | |
parent | d403120cb9d4787b283ea202b2162f459d18fe9d (diff) | |
parent | bb519cf6113473c09d571e555137a36d7e2c8566 (diff) |
Merge back ACPI platform_profile material for 6.15
Diffstat (limited to 'drivers/acpi/platform_profile.c')
-rw-r--r-- | drivers/acpi/platform_profile.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 2ad53cc6aae5..7b7ac12bc94c 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -260,14 +260,14 @@ static int _aggregate_choices(struct device *dev, void *data) /** * platform_profile_choices_show - Show the available profile choices for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to * * Return: The number of bytes written */ -static ssize_t platform_profile_choices_show(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_choices_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) { unsigned long aggregate[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; @@ -333,14 +333,14 @@ static int _store_and_notify(struct device *dev, void *data) /** * platform_profile_show - Show the current profile for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to * * Return: The number of bytes written */ -static ssize_t platform_profile_show(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) { enum platform_profile_option profile = PLATFORM_PROFILE_LAST; @@ -362,15 +362,15 @@ static ssize_t platform_profile_show(struct device *dev, /** * platform_profile_store - Set the profile for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to read from * @count: The number of bytes to read * * Return: The number of bytes read */ -static ssize_t platform_profile_store(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) { unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; @@ -401,12 +401,12 @@ static ssize_t platform_profile_store(struct device *dev, return count; } -static DEVICE_ATTR_RO(platform_profile_choices); -static DEVICE_ATTR_RW(platform_profile); +static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices); +static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile); static struct attribute *platform_profile_attrs[] = { - &dev_attr_platform_profile_choices.attr, - &dev_attr_platform_profile.attr, + &attr_platform_profile_choices.attr, + &attr_platform_profile.attr, NULL }; @@ -575,24 +575,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register); /** * platform_profile_remove - Unregisters a platform profile class device * @dev: Class device - * - * Return: 0 */ -int platform_profile_remove(struct device *dev) +void platform_profile_remove(struct device *dev) { - struct platform_profile_handler *pprof = to_pprof_handler(dev); - int id; + struct platform_profile_handler *pprof; + + if (IS_ERR_OR_NULL(dev)) + return; + + pprof = to_pprof_handler(dev); + guard(mutex)(&profile_lock); - id = pprof->minor; + ida_free(&platform_profile_ida, pprof->minor); device_unregister(&pprof->dev); - ida_free(&platform_profile_ida, id); sysfs_notify(acpi_kobj, NULL, "platform_profile"); - sysfs_update_group(acpi_kobj, &platform_profile_group); - - return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); |