From: Mario Limonciello <mario.limonciello@amd.com>
To: Kurt Borja <kuurtb@gmail.com>, platform-driver-x86@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
"Armin Wolf" <W_Armin@gmx.de>,
"Joshua Grisham" <josh@joshuagrisham.com>,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Maximilian Luz" <luzmaximilian@gmail.com>,
"Lee, Chun-Yi" <jlee@suse.com>,
"Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
"Corentin Chary" <corentin.chary@gmail.com>,
"Luke D. Jones" <luke@ljones.dev>,
"Lyndon Sanche" <lsanche@lyndeno.ca>,
"Ike Panhc" <ike.pan@canonical.com>,
"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Colin Ian King" <colin.i.king@gmail.com>,
"Alexis Belmonte" <alexbelm48@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Ai Chao" <aichao@kylinos.cn>, "Gergo Koteles" <soyer@irl.hu>,
Dell.Client.Kernel@dell.com,
ibm-acpi-devel@lists.sourceforge.net
Subject: Re: [PATCH 15/18] ACPI: platform_profile: Remove platform_profile_handler from callbacks
Date: Thu, 9 Jan 2025 10:42:01 -0600 [thread overview]
Message-ID: <eb746e5b-74a2-4d9a-9e7d-a914e96051fe@amd.com> (raw)
In-Reply-To: <20250109150731.110799-16-kuurtb@gmail.com>
On 1/9/2025 09:06, Kurt Borja wrote:
> Devices can now set drvdata to the class device, thus passing the
> platform_profile_handler to callbacks is unnecessary. Instead pass the
> class device.
>
If not too hard; could you bring this earlier in the series?
If so it would avoid some ping-ponging on some of the files from when
you introduced the choices callback.
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/acpi/platform_profile.c | 6 ++--
> .../surface/surface_platform_profile.c | 18 ++++++------
> drivers/platform/x86/acer-wmi.c | 16 +++++------
> drivers/platform/x86/amd/pmf/sps.c | 16 +++++------
> drivers/platform/x86/asus-wmi.c | 16 +++++------
> drivers/platform/x86/dell/alienware-wmi.c | 12 ++++----
> drivers/platform/x86/dell/dell-pc.c | 14 +++++-----
> drivers/platform/x86/hp/hp-wmi.c | 28 +++++++++----------
> drivers/platform/x86/ideapad-laptop.c | 16 +++++------
> .../platform/x86/inspur_platform_profile.c | 16 +++++------
> drivers/platform/x86/thinkpad_acpi.c | 12 ++++----
> include/linux/platform_profile.h | 8 ++----
> 12 files changed, 88 insertions(+), 90 deletions(-)
>
> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
> index fdf79b81b62e..8d034d928e32 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -67,7 +67,7 @@ static int _store_class_profile(struct device *dev, void *data)
> if (!test_bit(*bit, handler->choices))
> return -EOPNOTSUPP;
>
> - return handler->ops->profile_set(handler, *bit);
> + return handler->ops->profile_set(dev, *bit);
> }
>
> /**
> @@ -104,7 +104,7 @@ static int get_class_profile(struct device *dev,
>
> lockdep_assert_held(&profile_lock);
> handler = to_pprof_handler(dev);
> - err = handler->ops->profile_get(handler, &val);
> + err = handler->ops->profile_get(dev, &val);
> if (err) {
> pr_err("Failed to get profile for handler %s\n", handler->name);
> return err;
> @@ -490,7 +490,7 @@ struct device *platform_profile_register(struct device *dev, const char *name,
> if (!pprof)
> return ERR_PTR(-ENOMEM);
>
> - err = ops->choices(pprof);
> + err = ops->choices(drvdata, pprof->choices);
> if (err < 0)
> return ERR_PTR(err);
>
> diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
> index 965940223892..0d059986cc5c 100644
> --- a/drivers/platform/surface/surface_platform_profile.c
> +++ b/drivers/platform/surface/surface_platform_profile.c
> @@ -154,14 +154,14 @@ static int convert_profile_to_ssam_fan(struct ssam_device *sdev, enum platform_p
> }
> }
>
> -static int ssam_platform_profile_get(struct platform_profile_handler *pprof,
> +static int ssam_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> struct ssam_platform_profile_device *tpd;
> enum ssam_tmp_profile tp;
> int status;
>
> - tpd = dev_get_drvdata(&pprof->class_dev);
> + tpd = dev_get_drvdata(dev);
>
> status = ssam_tmp_profile_get(tpd->sdev, &tp);
> if (status)
> @@ -175,13 +175,13 @@ static int ssam_platform_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int ssam_platform_profile_set(struct platform_profile_handler *pprof,
> +static int ssam_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> struct ssam_platform_profile_device *tpd;
> int tp;
>
> - tpd = dev_get_drvdata(&pprof->class_dev);
> + tpd = dev_get_drvdata(dev);
>
> tp = convert_profile_to_ssam_tmp(tpd->sdev, profile);
> if (tp < 0)
> @@ -201,12 +201,12 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof,
> return tp;
> }
>
> -static int ssam_platform_profile_choices(struct platform_profile_handler *pprof)
> +static int ssam_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 2059b29dd36b..2900ba060cc4 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1827,7 +1827,7 @@ static int acer_toggle_turbo(void)
> }
>
> static int
> -acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof,
> +acer_predator_v4_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> u8 tp;
> @@ -1862,7 +1862,7 @@ acer_predator_v4_platform_profile_get(struct platform_profile_handler *pprof,
> }
>
> static int
> -acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
> +acer_predator_v4_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> int tp;
> @@ -1901,13 +1901,13 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof,
> }
>
> static int
> -acer_predator_v4_platform_profile_choices(struct platform_profile_handler *pprof)
> +acer_predator_v4_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices);
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
> index e8d2de9bb646..700a6ef39201 100644
> --- a/drivers/platform/x86/amd/pmf/sps.c
> +++ b/drivers/platform/x86/amd/pmf/sps.c
> @@ -282,10 +282,10 @@ bool is_pprof_balanced(struct amd_pmf_dev *pmf)
> return (pmf->current_profile == PLATFORM_PROFILE_BALANCED) ? true : false;
> }
>
> -static int amd_pmf_profile_get(struct platform_profile_handler *pprof,
> +static int amd_pmf_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> - struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev);
> + struct amd_pmf_dev *pmf = dev_get_drvdata(dev);
>
> *profile = pmf->current_profile;
> return 0;
> @@ -363,10 +363,10 @@ int amd_pmf_power_slider_update_event(struct amd_pmf_dev *dev)
> return 0;
> }
>
> -static int amd_pmf_profile_set(struct platform_profile_handler *pprof,
> +static int amd_pmf_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> - struct amd_pmf_dev *pmf = dev_get_drvdata(&pprof->class_dev);
> + struct amd_pmf_dev *pmf = dev_get_drvdata(dev);
> int ret = 0;
>
> pmf->current_profile = profile;
> @@ -387,11 +387,11 @@ static int amd_pmf_profile_set(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int amd_pmf_profile_choices(struct platform_profile_handler *pprof)
> +static int amd_pmf_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 809ab0353b68..11e5fcecf3a4 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -3800,13 +3800,13 @@ static ssize_t throttle_thermal_policy_store(struct device *dev,
> static DEVICE_ATTR_RW(throttle_thermal_policy);
>
> /* Platform profile ***********************************************************/
> -static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof,
> +static int asus_wmi_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> struct asus_wmi *asus;
> int tp;
>
> - asus = dev_get_drvdata(&pprof->class_dev);
> + asus = dev_get_drvdata(dev);
> tp = asus->throttle_thermal_policy_mode;
>
> switch (tp) {
> @@ -3826,13 +3826,13 @@ static int asus_wmi_platform_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof,
> +static int asus_wmi_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> struct asus_wmi *asus;
> int tp;
>
> - asus = dev_get_drvdata(&pprof->class_dev);
> + asus = dev_get_drvdata(dev);
>
> switch (profile) {
> case PLATFORM_PROFILE_PERFORMANCE:
> @@ -3852,11 +3852,11 @@ static int asus_wmi_platform_profile_set(struct platform_profile_handler *pprof,
> return throttle_thermal_policy_write(asus);
> }
>
> -static int asus_wmi_platform_profile_choices(struct platform_profile_handler *pprof)
> +static int asus_wmi_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> index 1eaa746eb4f1..19b7cd95018c 100644
> --- a/drivers/platform/x86/dell/alienware-wmi.c
> +++ b/drivers/platform/x86/dell/alienware-wmi.c
> @@ -1055,7 +1055,7 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data)
> return 0;
> }
>
> -static int thermal_profile_get(struct platform_profile_handler *pprof,
> +static int thermal_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> u32 out_data;
> @@ -1081,7 +1081,7 @@ static int thermal_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int thermal_profile_set(struct platform_profile_handler *pprof,
> +static int thermal_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> if (quirks->gmode) {
> @@ -1107,7 +1107,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
> return wmax_thermal_control(supported_thermal_profiles[profile]);
> }
>
> -static int thermal_profile_choices(struct platform_profile_handler *pprof)
> +static int thermal_profile_choices(void *drvdata, unsigned long *choices)
> {
> u32 out_data;
> u8 sys_desc[4];
> @@ -1140,17 +1140,17 @@ static int thermal_profile_choices(struct platform_profile_handler *pprof)
> profile = wmax_mode_to_platform_profile[mode];
> supported_thermal_profiles[profile] = out_data;
>
> - set_bit(profile, pprof->choices);
> + set_bit(profile, choices);
> }
>
> - if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST))
> + if (bitmap_empty(choices, PLATFORM_PROFILE_LAST))
> return -ENODEV;
>
> if (quirks->gmode) {
> supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =
> WMAX_THERMAL_MODE_GMODE;
>
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
> }
>
> return 0;
> diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
> index 4ff80ed4f157..1ba2e58451e1 100644
> --- a/drivers/platform/x86/dell/dell-pc.c
> +++ b/drivers/platform/x86/dell/dell-pc.c
> @@ -184,7 +184,7 @@ static int thermal_set_mode(enum thermal_mode_bits state)
> return dell_send_request(&buffer, CLASS_INFO, SELECT_THERMAL_MANAGEMENT);
> }
>
> -static int thermal_platform_profile_set(struct platform_profile_handler *pprof,
> +static int thermal_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> switch (profile) {
> @@ -201,7 +201,7 @@ static int thermal_platform_profile_set(struct platform_profile_handler *pprof,
> }
> }
>
> -static int thermal_platform_profile_get(struct platform_profile_handler *pprof,
> +static int thermal_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> int ret;
> @@ -230,16 +230,16 @@ static int thermal_platform_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int thermal_platform_profile_choices(struct platform_profile_handler *pprof)
> +static int thermal_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> if (supported_modes & DELL_QUIET)
> - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices);
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> if (supported_modes & DELL_COOL_BOTTOM)
> - set_bit(PLATFORM_PROFILE_COOL, pprof->choices);
> + set_bit(PLATFORM_PROFILE_COOL, choices);
> if (supported_modes & DELL_BALANCED)
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> if (supported_modes & DELL_PERFORMANCE)
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> index 1b9e176f8d6f..3849cf761a46 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -1221,7 +1221,7 @@ static int platform_profile_omen_get_ec(enum platform_profile_option *profile)
> return 0;
> }
>
> -static int platform_profile_omen_get(struct platform_profile_handler *pprof,
> +static int platform_profile_omen_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> /*
> @@ -1318,7 +1318,7 @@ static int platform_profile_omen_set_ec(enum platform_profile_option profile)
> return 0;
> }
>
> -static int platform_profile_omen_set(struct platform_profile_handler *pprof,
> +static int platform_profile_omen_set(struct device *dev,
> enum platform_profile_option profile)
> {
> int err;
> @@ -1345,7 +1345,7 @@ static int thermal_profile_set(int thermal_profile)
> sizeof(thermal_profile), 0);
> }
>
> -static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
> +static int hp_wmi_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> int tp;
> @@ -1374,7 +1374,7 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
> +static int hp_wmi_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> int err, tp;
> @@ -1440,11 +1440,11 @@ static int platform_profile_victus_get_ec(enum platform_profile_option *profile)
> return 0;
> }
>
> -static int platform_profile_victus_get(struct platform_profile_handler *pprof,
> +static int platform_profile_victus_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> /* Same behaviour as platform_profile_omen_get */
> - return platform_profile_omen_get(pprof, profile);
> + return platform_profile_omen_get(dev, profile);
> }
>
> static int platform_profile_victus_set_ec(enum platform_profile_option profile)
> @@ -1472,7 +1472,7 @@ static int platform_profile_victus_set_ec(enum platform_profile_option profile)
> return 0;
> }
>
> -static int platform_profile_victus_set(struct platform_profile_handler *pprof,
> +static int platform_profile_victus_set(struct device *dev,
> enum platform_profile_option profile)
> {
> int err;
> @@ -1488,19 +1488,19 @@ static int platform_profile_victus_set(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int hp_wmi_platform_profile_choices(struct platform_profile_handler *pprof)
> +static int hp_wmi_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> if (is_omen_thermal_profile()) {
> - set_bit(PLATFORM_PROFILE_COOL, pprof->choices);
> + set_bit(PLATFORM_PROFILE_COOL, choices);
> } else if (is_victus_thermal_profile()) {
> - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices);
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> } else {
> - set_bit(PLATFORM_PROFILE_QUIET, pprof->choices);
> - set_bit(PLATFORM_PROFILE_COOL, pprof->choices);
> + set_bit(PLATFORM_PROFILE_QUIET, choices);
> + set_bit(PLATFORM_PROFILE_COOL, choices);
> }
>
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 55aac0190624..1937a2f00bec 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -933,10 +933,10 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe
> * dytc_profile_get: Function to register with platform_profile
> * handler. Returns current platform profile.
> */
> -static int dytc_profile_get(struct platform_profile_handler *pprof,
> +static int dytc_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> - struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev);
> + struct ideapad_dytc_priv *dytc = dev_get_drvdata(dev);
>
> *profile = dytc->current_profile;
> return 0;
> @@ -986,10 +986,10 @@ static int dytc_cql_command(struct ideapad_private *priv, unsigned long cmd,
> * dytc_profile_set: Function to register with platform_profile
> * handler. Sets current platform profile.
> */
> -static int dytc_profile_set(struct platform_profile_handler *pprof,
> +static int dytc_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> - struct ideapad_dytc_priv *dytc = dev_get_drvdata(&pprof->class_dev);
> + struct ideapad_dytc_priv *dytc = dev_get_drvdata(dev);
> struct ideapad_private *priv = dytc->priv;
> unsigned long output;
> int err;
> @@ -1023,11 +1023,11 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
> return -EINTR;
> }
>
> -static int dytc_profile_choices(struct platform_profile_handler *pprof)
> +static int dytc_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c
> index 9e2f24de0207..3d45df807b8b 100644
> --- a/drivers/platform/x86/inspur_platform_profile.c
> +++ b/drivers/platform/x86/inspur_platform_profile.c
> @@ -84,10 +84,10 @@ static int inspur_wmi_perform_query(struct wmi_device *wdev,
> * 0x0: No Error
> * 0x1: Error
> */
> -static int inspur_platform_profile_set(struct platform_profile_handler *pprof,
> +static int inspur_platform_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> - struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev);
> + struct inspur_wmi_priv *priv = dev_get_drvdata(dev);
> u8 ret_code[4] = {0, 0, 0, 0};
> int ret;
>
> @@ -131,10 +131,10 @@ static int inspur_platform_profile_set(struct platform_profile_handler *pprof,
> * 0x1: Performance Mode
> * 0x2: Power Saver Mode
> */
> -static int inspur_platform_profile_get(struct platform_profile_handler *pprof,
> +static int inspur_platform_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> - struct inspur_wmi_priv *priv = dev_get_drvdata(&pprof->class_dev);
> + struct inspur_wmi_priv *priv = dev_get_drvdata(dev);
> u8 ret_code[4] = {0, 0, 0, 0};
> int ret;
>
> @@ -164,11 +164,11 @@ static int inspur_platform_profile_get(struct platform_profile_handler *pprof,
> return 0;
> }
>
> -static int inspur_platform_profile_choices(struct platform_profile_handler *pprof)
> +static int inspur_platform_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 964f842ef756..2e9740b7e328 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -10415,7 +10415,7 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe
> * dytc_profile_get: Function to register with platform_profile
> * handler. Returns current platform profile.
> */
> -static int dytc_profile_get(struct platform_profile_handler *pprof,
> +static int dytc_profile_get(struct device *dev,
> enum platform_profile_option *profile)
> {
> *profile = dytc_current_profile;
> @@ -10490,7 +10490,7 @@ static int dytc_cql_command(int command, int *output)
> * dytc_profile_set: Function to register with platform_profile
> * handler. Sets current platform profile.
> */
> -static int dytc_profile_set(struct platform_profile_handler *pprof,
> +static int dytc_profile_set(struct device *dev,
> enum platform_profile_option profile)
> {
> int perfmode;
> @@ -10539,11 +10539,11 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
> return err;
> }
>
> -static int dytc_profile_choices(struct platform_profile_handler *pprof)
> +static int dytc_profile_choices(void *drvdata, unsigned long *choices)
> {
> - set_bit(PLATFORM_PROFILE_LOW_POWER, pprof->choices);
> - set_bit(PLATFORM_PROFILE_BALANCED, pprof->choices);
> - set_bit(PLATFORM_PROFILE_PERFORMANCE, pprof->choices);
> + set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> + set_bit(PLATFORM_PROFILE_BALANCED, choices);
> + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>
> return 0;
> }
> diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
> index 97ce9bd476ab..0824a12b9998 100644
> --- a/include/linux/platform_profile.h
> +++ b/include/linux/platform_profile.h
> @@ -31,11 +31,9 @@ enum platform_profile_option {
> struct platform_profile_handler;
>
> struct platform_profile_ops {
> - int (*profile_get)(struct platform_profile_handler *pprof,
> - enum platform_profile_option *profile);
> - int (*profile_set)(struct platform_profile_handler *pprof,
> - enum platform_profile_option profile);
> - int (*choices)(struct platform_profile_handler *pprof);
> + int (*profile_get)(struct device *dev, enum platform_profile_option *profile);
> + int (*profile_set)(struct device *dev, enum platform_profile_option profile);
> + int (*choices)(void *drvdata, unsigned long *choices);
> };
>
> struct platform_profile_handler {
next prev parent reply other threads:[~2025-01-09 16:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 15:06 [PATCH 00/18] Hide platform_profile_handler from consumers Kurt Borja
2025-01-09 15:06 ` [PATCH 01/18] ACPI: platform_profile: Add `ops` member to handlers Kurt Borja
2025-01-09 16:32 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 02/18] ACPI: platform_profile: Add `choices` to platform_profile_ops Kurt Borja
2025-01-09 16:32 ` Mario Limonciello
2025-01-09 23:02 ` Kurt Borja
2025-01-09 15:06 ` [PATCH 03/18] ACPI: platform_profile: Replace *class_dev member with class_dev Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 04/18] ACPI: platform_profile: Let drivers set drvdata to the class device Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 05/18] platform/surface: surface_platform_profile: Use devm_platform_profile_register() Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 06/18] platform/x86: acer-wmi: " Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 07/18] platform/x86: amd: pmf: sps: " Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 08/18] platform/x86: asus-wmi: " Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 09/18] platform/x86: dell-pc: " Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 10/18] platform/x86: ideapad-laptop: " Kurt Borja
2025-01-09 16:36 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 11/18] platform/x86: hp-wmi: " Kurt Borja
2025-01-09 16:46 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 12/18] platform/x86: inspur_platform_profile: " Kurt Borja
2025-01-09 16:46 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 13/18] platform/x86: thinkpad_acpi: " Kurt Borja
2025-01-09 16:45 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 14/18] ACPI: platform_profile: Remove platform_profile_handler from exported symbols Kurt Borja
2025-01-09 16:45 ` Mario Limonciello
2025-01-09 22:49 ` Kurt Borja
2025-01-09 15:06 ` [PATCH 15/18] ACPI: platform_profile: Remove platform_profile_handler from callbacks Kurt Borja
2025-01-09 16:42 ` Mario Limonciello [this message]
2025-01-09 22:51 ` Kurt Borja
2025-01-09 15:06 ` [PATCH 16/18] ACPI: platform_profile: Move platform_profile_handler Kurt Borja
2025-01-09 16:40 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 17/18] ACPI: platform_profile: Clean platform_profile_handler Kurt Borja
2025-01-09 16:42 ` Mario Limonciello
2025-01-09 15:06 ` [PATCH 18/18] ACPI: platform_profile: Add documentation Kurt Borja
2025-01-09 16:39 ` Mario Limonciello
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb746e5b-74a2-4d9a-9e7d-a914e96051fe@amd.com \
--to=mario.limonciello@amd.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=W_Armin@gmx.de \
--cc=aichao@kylinos.cn \
--cc=alexbelm48@gmail.com \
--cc=colin.i.king@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=derekjohn.clark@gmail.com \
--cc=hdegoede@redhat.com \
--cc=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ike.pan@canonical.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jlee@suse.com \
--cc=josh@joshuagrisham.com \
--cc=kuurtb@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsanche@lyndeno.ca \
--cc=luke@ljones.dev \
--cc=luzmaximilian@gmail.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=soyer@irl.hu \
--cc=u.kleine-koenig@baylibre.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox