mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator
@ 2024-08-21 12:04 Andy Shevchenko
  2024-08-21 12:32 ` Ilpo Järvinen
  2024-08-26 14:49 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-08-21 12:04 UTC (permalink / raw)
  To: Ilpo Järvinen, Hans de Goede, Andy Shevchenko,
	platform-driver-x86, linux-kernel
  Cc: Alex Hung

Use modern string_choices API instead of manually determining the
output using ternary operator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/platform/x86/intel/hid.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/hid.c
index 10cd65497cc1..445e7a59beb4 100644
--- a/drivers/platform/x86/intel/hid.c
+++ b/drivers/platform/x86/intel/hid.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/string_choices.h>
 #include <linux/suspend.h>
 #include "../dual_accel_detect.h"
 
@@ -331,10 +332,8 @@ static int intel_hid_set_enable(struct device *device, bool enable)
 	acpi_handle handle = ACPI_HANDLE(device);
 
 	/* Enable|disable features - power button is always enabled */
-	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN,
-				      enable)) {
-		dev_warn(device, "failed to %sable hotkeys\n",
-			 enable ? "en" : "dis");
+	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN, enable)) {
+		dev_warn(device, "failed to %s hotkeys\n", str_enable_disable(enable));
 		return -EIO;
 	}
 
-- 
2.43.0.rc1.1336.g36b5255a03ac


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator
  2024-08-21 12:04 [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator Andy Shevchenko
@ 2024-08-21 12:32 ` Ilpo Järvinen
  2024-08-26 14:49 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-08-21 12:32 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Hans de Goede, platform-driver-x86, LKML, Alex Hung

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

On Wed, 21 Aug 2024, Andy Shevchenko wrote:

> Use modern string_choices API instead of manually determining the
> output using ternary operator.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/platform/x86/intel/hid.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/hid.c
> index 10cd65497cc1..445e7a59beb4 100644
> --- a/drivers/platform/x86/intel/hid.c
> +++ b/drivers/platform/x86/intel/hid.c
> @@ -13,6 +13,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/string_choices.h>
>  #include <linux/suspend.h>
>  #include "../dual_accel_detect.h"
>  
> @@ -331,10 +332,8 @@ static int intel_hid_set_enable(struct device *device, bool enable)
>  	acpi_handle handle = ACPI_HANDLE(device);
>  
>  	/* Enable|disable features - power button is always enabled */
> -	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN,
> -				      enable)) {
> -		dev_warn(device, "failed to %sable hotkeys\n",
> -			 enable ? "en" : "dis");
> +	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN, enable)) {
> +		dev_warn(device, "failed to %s hotkeys\n", str_enable_disable(enable));
>  		return -EIO;
>  	}
>  
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator
  2024-08-21 12:04 [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator Andy Shevchenko
  2024-08-21 12:32 ` Ilpo Järvinen
@ 2024-08-26 14:49 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2024-08-26 14:49 UTC (permalink / raw)
  To: Andy Shevchenko, Ilpo Järvinen, platform-driver-x86, linux-kernel
  Cc: Alex Hung

Hi,

On 8/21/24 2:04 PM, Andy Shevchenko wrote:
> Use modern string_choices API instead of manually determining the
> output using ternary operator.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> ---
>  drivers/platform/x86/intel/hid.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/hid.c
> index 10cd65497cc1..445e7a59beb4 100644
> --- a/drivers/platform/x86/intel/hid.c
> +++ b/drivers/platform/x86/intel/hid.c
> @@ -13,6 +13,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/string_choices.h>
>  #include <linux/suspend.h>
>  #include "../dual_accel_detect.h"
>  
> @@ -331,10 +332,8 @@ static int intel_hid_set_enable(struct device *device, bool enable)
>  	acpi_handle handle = ACPI_HANDLE(device);
>  
>  	/* Enable|disable features - power button is always enabled */
> -	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN,
> -				      enable)) {
> -		dev_warn(device, "failed to %sable hotkeys\n",
> -			 enable ? "en" : "dis");
> +	if (!intel_hid_execute_method(handle, INTEL_HID_DSM_HDSM_FN, enable)) {
> +		dev_warn(device, "failed to %s hotkeys\n", str_enable_disable(enable));
>  		return -EIO;
>  	}
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-26 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-21 12:04 [PATCH v1 1/1] platform/x86: intel-hid: Use string_choices API instead of ternary operator Andy Shevchenko
2024-08-21 12:32 ` Ilpo Järvinen
2024-08-26 14:49 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®