Skip to contentSkip to conversation

platform/x86: hp-wmi: Fix implementation of the platform_profile_omen_get function

PATCH In review Alexis Belmonte 3 participants 4 messages Jul 12, 2024 – Jul 15, 2024 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: hp-wmi: Fix implementation of the platform_profile_omen_get function

Fix ill-formed implementation of the platform_profile_omen_get function introduced by patch "platform/x86: hp-wmi: Fix platform profile option switch"

---
 drivers/platform/x86/hp/hp-wmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/platform/x86/hp/hp-wmi.c +2 -4
index c8bcb3e2b344..876e0a97cee1 100644
@@ -1238,8 +1238,6 @@ static int platform_profile_omen_get_ec(enum platform_profile_option *profile)
 static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 				     enum platform_profile_option *profile)
 {
-	enum platform_profile_option selected_platform_profile;
-
 	/*
 	 * We directly return the stored platform profile, as the embedded
 	 * controller will not accept switching to the performance option when
@@ -1253,9 +1251,9 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 	 * See also omen_powersource_event.
 	 */
 	guard(mutex)(&active_platform_profile_lock);
-	selected_platform_profile = active_platform_profile;
+	*profile = active_platform_profile;
 
-	return selected_platform_profile;
+	return 0;
 }
 
 static bool has_omen_thermal_profile_ec_timer(void)
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw

Am 12.07.24 um 19:26 schrieb Alexis Belmonte:

Quoted 24 lines

Fix ill-formed implementation of the platform_profile_omen_get function introduced by patch "platform/x86: hp-wmi: Fix platform profile option switch"

---
  drivers/platform/x86/hp/hp-wmi.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/platform/x86/hp/hp-wmi.c +0 -2
index c8bcb3e2b344..876e0a97cee1 100644
@@ -1238,8 +1238,6 @@ static int platform_profile_omen_get_ec(enum platform_profile_option *profile)
  static int platform_profile_omen_get(struct platform_profile_handler *pprof,
  				     enum platform_profile_option *profile)
  {
-	enum platform_profile_option selected_platform_profile;
-
  	/*
  	 * We directly return the stored platform profile, as the embedded
  	 * controller will not accept switching to the performance option when
@@ -1253,9 +1251,9 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
  	 * See also omen_powersource_event.

drivers/platform/x86/hp/hp-wmi.c static int platform_profile_omen_get(struct platform_profile_handler *pprof, · line 1259

Quoted 10 lines
drivers/platform/x86/hp/hp-wmi.c +2 -2
  	 */
  	guard(mutex)(&active_platform_profile_lock);
-	selected_platform_profile = active_platform_profile;
+	*profile = active_platform_profile;
 
-	return selected_platform_profile;
+	return 0;
  }
 
  static bool has_omen_thermal_profile_ec_timer(void)

Looks good to me.

maintainer
#2 lore raw
In reply to Alexis Belmonte
Quoted 5 lines · Alexis Belmonte

Fix ill-formed implementation of the platform_profile_omen_get function introduced by patch "platform/x86: hp-wmi: Fix platform profile option switch"

I took this patch but there were a number of issues with it I had to fix:

- Reported-by tag missing
- Fixes tag missing
- You didn't tell in the commit message what was wrong.

Signature · 1 line
 i.
Quoted 30 lines
---
 drivers/platform/x86/hp/hp-wmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/platform/x86/hp/hp-wmi.c +2 -4
index c8bcb3e2b344..876e0a97cee1 100644
@@ -1238,8 +1238,6 @@ static int platform_profile_omen_get_ec(enum platform_profile_option *profile)
 static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 				     enum platform_profile_option *profile)
 {
-	enum platform_profile_option selected_platform_profile;
-
 	/*
 	 * We directly return the stored platform profile, as the embedded
 	 * controller will not accept switching to the performance option when
@@ -1253,9 +1251,9 @@ static int platform_profile_omen_get(struct platform_profile_handler *pprof,
 	 * See also omen_powersource_event.
 	 */
 	guard(mutex)(&active_platform_profile_lock);
-	selected_platform_profile = active_platform_profile;
+	*profile = active_platform_profile;
 
-	return selected_platform_profile;
+	return 0;
 }
 
 static bool has_omen_thermal_profile_ec_timer(void)
#3 lore raw

Hi Ilpo,

Quoted 3 lines · Ilpo Järvinen

I took this patch but there were a number of issues with it I had to fix:

Thanks a lot for your attention to detail. As you can probably tell, it's my first time doing this kind of bug-fixing submission, so I apologize for that. I'll try to be more careful in the future. :]

Don't hesitate to let me do the fixes myself next time -- you certainly have better things to do than fixing this kind of stuff, and this will help me remember how things are supposed to be done. :]

Still, I'm very thankful for your help.

Hope you have a great afternoon!

Alexis