[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf6eb834-2337-4f5c-87e3-012713301912@gmx.de>
Date: Thu, 7 Nov 2024 09:21:14 +0100
From: Armin Wolf <W_Armin@....de>
To: Mario Limonciello <mario.limonciello@....com>,
Hans de Goede <hdegoede@...hat.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Maximilian Luz <luzmaximilian@...il.com>, Lee Chun-Yi <jlee@...e.com>,
Shyam Sundar S K <Shyam-sundar.S-k@....com>,
Corentin Chary <corentin.chary@...il.com>, "Luke D . Jones"
<luke@...nes.dev>, Ike Panhc <ike.pan@...onical.com>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
Alexis Belmonte <alexbelm48@...il.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Ai Chao <aichao@...inos.cn>, Gergo Koteles <soyer@....hu>,
open list <linux-kernel@...r.kernel.org>,
"open list:ACPI" <linux-acpi@...r.kernel.org>,
"open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER"
<platform-driver-x86@...r.kernel.org>,
"open list:THINKPAD ACPI EXTRAS DRIVER"
<ibm-acpi-devel@...ts.sourceforge.net>,
Mark Pearson <mpearson-lenovo@...ebb.ca>,
Matthew Schwartz <matthew.schwartz@...ux.dev>
Subject: Re: [PATCH v5 09/20] ACPI: platform_profile: Unregister class and
sysfs group on module unload
Am 07.11.24 um 07:02 schrieb Mario Limonciello:
> The class and sysfs group are no longer needed when the platform profile
> core is a module and unloaded.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@....com>
> ---
> drivers/acpi/platform_profile.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
> index 652034b71ee9b..9caf070f77f6a 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -224,6 +224,13 @@ int platform_profile_remove(struct platform_profile_handler *pprof)
> }
> EXPORT_SYMBOL_GPL(platform_profile_remove);
>
> +static void __exit platform_profile_exit(void)
> +{
> + class_unregister(&platform_profile_class);
> + sysfs_remove_group(acpi_kobj, &platform_profile_group);
This will crash should the class still not exist.
I suggest you register the class and the legacy sysfs group during module initialization, and
add a is_visible() callback to the legacy sysfs group. Then you can use sysfs_update_group() to
update the visibility of the sysfs files when platform profiles come and go.
Also please squash this patch with the patch introducing the class infrastructure.
Thanks,
Armin Wolf
> +}
> +module_exit(platform_profile_exit);
> +
> MODULE_AUTHOR("Mark Pearson <markpearson@...ovo.com>");
> MODULE_DESCRIPTION("ACPI platform profile sysfs interface");
> MODULE_LICENSE("GPL");
Powered by blists - more mailing lists