[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb746e5b-74a2-4d9a-9e7d-a914e96051fe@amd.com>
Date: Thu, 9 Jan 2025 10:42:01 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: Kurt Borja <kuurtb@...il.com>, platform-driver-x86@...r.kernel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
Armin Wolf <W_Armin@....de>, Joshua Grisham <josh@...huagrisham.com>,
"Derek J . Clark" <derekjohn.clark@...il.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>, 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>, Lyndon Sanche <lsanche@...deno.ca>,
Ike Panhc <ike.pan@...onical.com>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
Mark Pearson <mpearson-lenovo@...ebb.ca>,
Colin Ian King <colin.i.king@...il.com>,
Alexis Belmonte <alexbelm48@...il.com>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Ai Chao <aichao@...inos.cn>, Gergo Koteles <soyer@....hu>,
Dell.Client.Kernel@...l.com, ibm-acpi-devel@...ts.sourceforge.net
Subject: Re: [PATCH 15/18] ACPI: platform_profile: Remove
platform_profile_handler from callbacks
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@...il.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 {
Powered by blists - more mailing lists