[PATCH v2 3/5] platform profile: Complete class notifications and registration cleanup
From: Daniel Lezcano
Date: Mon Oct 19 2026 - 03:43:43 EST
The class profile attribute documents POLLPRI notifications for changes
made through userspace writes as well as changes reported by providers.
However, a direct write currently notifies only the legacy ACPI aggregate
attribute, leaving listeners on the provider's own profile attribute
unaware of the change.
Notify the class device after a successful direct write, using the same
helper as aggregate writes and provider-originated notifications. This
also makes notifications available when ACPI is absent or disabled.
Restore aggregate attribute visibility after unlinking a handler whose
registration failed during a sysfs group update. Keep aggregation exposed
only through the existing ACPI interface; the existing class devices
provide firmware-independent userspace access.
Assisted-by: OpenCode:gpt-6.1-sol
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>
---
drivers/platform/profile/core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/platform/profile/core.c b/drivers/platform/profile/core.c
index f18fd96b942c..320a5a964fea 100644
--- a/drivers/platform/profile/core.c
+++ b/drivers/platform/profile/core.c
@@ -250,6 +250,7 @@ static ssize_t profile_store(struct device *dev,
ret = _store_class_profile(dev, &index);
if (ret)
return ret;
+ _notify_class_profile(dev, NULL);
}
profile_notify();
@@ -324,7 +325,7 @@ static int _remove_hidden_choices(struct device *dev, void *arg)
}
/**
- * platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
+ * platform_profile_choices_show - Show the aggregate profile choices
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
@@ -360,7 +361,7 @@ static ssize_t platform_profile_choices_show(struct kobject *kobj,
}
/**
- * _aggregate_profiles - Aggregate the profiles for legacy sysfs interface
+ * _aggregate_profiles - Aggregate the profiles across providers
* @dev: The device
* @data: The profile to return
*
@@ -385,7 +386,7 @@ static int _aggregate_profiles(struct device *dev, void *data)
}
/**
- * _store_and_notify - Store and notify a class from legacy sysfs interface
+ * _store_and_notify - Store and notify a provider from an aggregate write
* @dev: The device
* @data: The profile to return
*
@@ -403,7 +404,7 @@ static int _store_and_notify(struct device *dev, void *data)
}
/**
- * platform_profile_show - Show the current profile for legacy sysfs interface
+ * platform_profile_show - Show the current aggregate profile
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to write to
@@ -431,7 +432,7 @@ static ssize_t platform_profile_show(struct kobject *kobj,
}
/**
- * platform_profile_store - Set the profile for legacy sysfs interface
+ * platform_profile_store - Set the profile across all providers
* @kobj: The kobject
* @attr: The attribute
* @buf: The buffer to read from
@@ -502,7 +503,7 @@ static int profile_update(void)
}
/**
- * platform_profile_notify - Notify class device and legacy sysfs interface
+ * platform_profile_notify - Notify the provider and aggregate sysfs interfaces
* @dev: The class device
*/
void platform_profile_notify(struct device *dev)
@@ -643,6 +644,7 @@ struct device *platform_profile_register(struct device *dev, const char *name,
cleanup_cur:
scoped_guard(mutex, &profile_lock)
list_del(&to_pprof_handler(ppdev)->node);
+ profile_update();
device_unregister(ppdev);
cleanup_ida:
--
2.43.0