mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
ACPI: platform_profile: Remove platform_profile_handler from callbacks
Devices can now set drvdata to the class device, thus passing the platform_profile_handler to callbacks is unnecessary. Instead pass the class device. Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Kurt Borja <kuurtb@gmail.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Link: https://lore.kernel.org/r/20250116002721.75592-4-kuurtb@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
249c576f0f
commit
cf3ea098dd
|
|
@ -65,7 +65,7 @@ static int _store_class_profile(struct device *dev, void *data)
|
|||
if (!test_bit(*bit, handler->choices))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return handler->profile_set(handler, *bit);
|
||||
return handler->profile_set(dev, *bit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,7 +102,7 @@ static int get_class_profile(struct device *dev,
|
|||
|
||||
lockdep_assert_held(&profile_lock);
|
||||
handler = to_pprof_handler(dev);
|
||||
err = handler->profile_get(handler, &val);
|
||||
err = handler->profile_get(dev, &val);
|
||||
if (err) {
|
||||
pr_err("Failed to get profile for handler %s\n", handler->name);
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1950,7 +1950,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;
|
||||
|
|
@ -1984,7 +1984,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 err, tp;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -1026,7 +1026,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;
|
||||
|
|
@ -1052,7 +1052,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) {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,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) {
|
||||
|
|
@ -202,7 +202,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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -34,10 +34,8 @@ struct platform_profile_handler {
|
|||
struct device class_dev;
|
||||
int minor;
|
||||
unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
|
||||
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 (*profile_get)(struct device *dev, enum platform_profile_option *profile);
|
||||
int (*profile_set)(struct device *dev, enum platform_profile_option profile);
|
||||
};
|
||||
|
||||
int platform_profile_register(struct platform_profile_handler *pprof, void *drvdata);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user