From: Rafael J. Wysocki Date: Tue, 11 Mar 2025 17:41:27 +0000 (+0100) Subject: Merge back ACPI platform_profile driver material for 6.15 X-Git-Tag: v6.15-rc1~192^2^3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f3161782eb8aa9e5c08b07b392be6be0813bdaf9;p=thirdparty%2Flinux.git Merge back ACPI platform_profile driver material for 6.15 --- f3161782eb8aa9e5c08b07b392be6be0813bdaf9 diff --cc drivers/acpi/platform_profile.c index ef9444482db19,7b7ac12bc94cd..671407fc2bd4a --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@@ -295,28 -266,19 +295,28 @@@ static int _remove_hidden_choices(struc * * 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)]; + struct aggregate_choices_data data = { + .aggregate = { [0 ... BITS_TO_LONGS(PLATFORM_PROFILE_LAST) - 1] = ~0UL }, + .count = 0, + }; int err; - set_bit(PLATFORM_PROFILE_LAST, aggregate); + set_bit(PLATFORM_PROFILE_LAST, data.aggregate); scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { err = class_for_each_device(&platform_profile_class, NULL, - aggregate, _aggregate_choices); + &data, _aggregate_choices); if (err) return err; + if (data.count == 1) { + err = class_for_each_device(&platform_profile_class, NULL, + &data, _remove_hidden_choices); + if (err) + return err; + } } /* no profile handler registered any more */ @@@ -407,14 -369,11 +407,14 @@@ static ssize_t platform_profile_show(st * * 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)]; + struct aggregate_choices_data data = { + .aggregate = { [0 ... BITS_TO_LONGS(PLATFORM_PROFILE_LAST) - 1] = ~0UL }, + .count = 0, + }; int ret; int i;