ACPI: platform_profile: Add platform handler argument to platform_profile_remove()
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 6 Dec 2024 03:19:00 +0000 (21:19 -0600)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 10 Dec 2024 17:17:51 +0000 (19:17 +0200)
To allow registering and unregistering multiple platform handlers calls
to platform_profile_remove() will need to know which handler is to be
removed.  Add an argument for this.

Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241206031918.1537-5-mario.limonciello@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
12 files changed:
drivers/acpi/platform_profile.c
drivers/platform/surface/surface_platform_profile.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/amd/pmf/sps.c
drivers/platform/x86/asus-wmi.c
drivers/platform/x86/dell/alienware-wmi.c
drivers/platform/x86/dell/dell-pc.c
drivers/platform/x86/hp/hp-wmi.c
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/inspur_platform_profile.c
drivers/platform/x86/thinkpad_acpi.c
include/linux/platform_profile.h

index d2f7fd7743a13df1dac3100c885208f4418218a5..c24744da209164adcae6cc801e62bfb57cd5d109 100644 (file)
@@ -205,7 +205,7 @@ int platform_profile_register(struct platform_profile_handler *pprof)
 }
 EXPORT_SYMBOL_GPL(platform_profile_register);
 
-int platform_profile_remove(void)
+int platform_profile_remove(struct platform_profile_handler *pprof)
 {
        sysfs_remove_group(acpi_kobj, &platform_profile_group);
 
index b73cfdd920c6638054caeac404e2470a4fd95a70..6c87e982bfc8f0cc78eb5341b67f16ad02d66cd0 100644 (file)
@@ -210,6 +210,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
                return -ENOMEM;
 
        tpd->sdev = sdev;
+       ssam_device_set_drvdata(sdev, tpd);
 
        tpd->handler.name = "Surface Platform Profile";
        tpd->handler.dev = &sdev->dev;
@@ -228,7 +229,10 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
 
 static void surface_platform_profile_remove(struct ssam_device *sdev)
 {
-       platform_profile_remove();
+       struct ssam_platform_profile_device *tpd;
+
+       tpd = ssam_device_get_drvdata(sdev);
+       platform_profile_remove(&tpd->handler);
 }
 
 static const struct ssam_device_id ssam_platform_profile_match[] = {
index aca4a5746bee1c0c3f9c8ccdb85bf326d8a51327..b12965d9fcdb791a8d797d5fb90bf52bb94cdc2a 100644 (file)
@@ -2547,7 +2547,7 @@ static int acer_platform_probe(struct platform_device *device)
 
 error_hwmon:
        if (platform_profile_support)
-               platform_profile_remove();
+               platform_profile_remove(&platform_profile_handler);
 error_platform_profile:
        acer_rfkill_exit();
 error_rfkill:
@@ -2570,7 +2570,7 @@ static void acer_platform_remove(struct platform_device *device)
        acer_rfkill_exit();
 
        if (platform_profile_support)
-               platform_profile_remove();
+               platform_profile_remove(&platform_profile_handler);
 }
 
 #ifdef CONFIG_PM_SLEEP
index 1b94af7c0e0c48b2c7a904e25e36963dc4825fb9..bd2bd6cfc39a0abdcfa47c7edc5ad66695457536 100644 (file)
@@ -426,5 +426,5 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev)
 
 void amd_pmf_deinit_sps(struct amd_pmf_dev *dev)
 {
-       platform_profile_remove();
+       platform_profile_remove(&dev->pprof);
 }
index 14d84cad01b49edabd86a3b1276bdd28226cf16d..805bce80beef20d654f6ce413654ee4552e106f5 100644 (file)
@@ -4852,7 +4852,7 @@ fail_sysfs:
 fail_custom_fan_curve:
 fail_platform_profile_setup:
        if (asus->platform_profile_support)
-               platform_profile_remove();
+               platform_profile_remove(&asus->platform_profile_handler);
 fail_fan_boost_mode:
 fail_platform:
        kfree(asus);
@@ -4879,7 +4879,7 @@ static void asus_wmi_remove(struct platform_device *device)
        asus_wmi_battery_exit(asus);
 
        if (asus->platform_profile_support)
-               platform_profile_remove();
+               platform_profile_remove(&asus->platform_profile_handler);
 
        kfree(asus);
 }
index 78aac761327886ddcf30c18bc484f4a79ada118a..e95d22c7b60cd604cb9acda6677349dc380d1d04 100644 (file)
@@ -1165,7 +1165,7 @@ static int create_thermal_profile(struct platform_device *platform_device)
 static void remove_thermal_profile(void)
 {
        if (quirks->thermal)
-               platform_profile_remove();
+               platform_profile_remove(&pp_handler);
 }
 
 static int __init alienware_wmi_init(void)
index b9a6dd7b321d9a26fedd81a649c8305403595732..3797a5721dbde6c6e41aafc4146ceb51134d7e29 100644 (file)
@@ -289,7 +289,7 @@ cleanup_platform_device:
 static void thermal_cleanup(void)
 {
        if (thermal_handler)
-               platform_profile_remove();
+               platform_profile_remove(thermal_handler);
        platform_device_unregister(platform_device);
 }
 
index ffb09799142bc857b1da6bc339ffae037a14011d..6d6e13a0c6e2d24e764bad6ff2cafabb42001ac3 100644 (file)
@@ -1693,7 +1693,7 @@ static void __exit hp_wmi_bios_remove(struct platform_device *device)
        }
 
        if (platform_profile_support)
-               platform_profile_remove();
+               platform_profile_remove(&platform_profile_handler);
 }
 
 static int hp_wmi_resume_handler(struct device *device)
index b6586c473ba91604965e36c2324d4366138c46a0..95b66ac3ea1d6701616f9ddab592f7d90caec9a5 100644 (file)
@@ -1136,7 +1136,7 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv)
        if (!priv->dytc)
                return;
 
-       platform_profile_remove();
+       platform_profile_remove(&priv->dytc->pprof);
        mutex_destroy(&priv->dytc->mutex);
        kfree(priv->dytc);
 
index 5a53949bbbf5f30627a58df4361babdfc0d418b1..53af73a7fbf7b10e25e9ad0792882d0a42bb6d09 100644 (file)
@@ -191,7 +191,10 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context)
 
 static void inspur_wmi_remove(struct wmi_device *wdev)
 {
-       platform_profile_remove();
+       struct inspur_wmi_priv *priv;
+
+       priv = dev_get_drvdata(&wdev->dev);
+       platform_profile_remove(&priv->handler);
 }
 
 static const struct wmi_device_id inspur_wmi_id_table[] = {
index 58af9020382c1d1a9d9e8fffc4b6bbd719d1ab96..298100d5c535c14c3dd0e3aa2dfd2f196e951f44 100644 (file)
@@ -10660,7 +10660,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
 
 static void dytc_profile_exit(void)
 {
-       platform_profile_remove();
+       platform_profile_remove(&dytc_profile);
 }
 
 static struct ibm_struct  dytc_profile_driver_data = {
index daec6b9bad81f8a91383da36167ec2c40013da9c..bcaf3aa39160fa33ce27bfc4f4f3278d82117c4e 100644 (file)
@@ -37,7 +37,7 @@ struct platform_profile_handler {
 };
 
 int platform_profile_register(struct platform_profile_handler *pprof);
-int platform_profile_remove(void);
+int platform_profile_remove(struct platform_profile_handler *pprof);
 int platform_profile_cycle(void);
 void platform_profile_notify(void);