[PATCH] HID: google_hammer: Fix invalid ENOSYS warning and unsigned.

Guy Chronister posted 1 patch 2 years ago
drivers/hid/hid-google-hammer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] HID: google_hammer: Fix invalid ENOSYS warning and unsigned.
Posted by Guy Chronister 2 years ago
Fixed warnings about ENOSYS and bare unsigned without int.

Signed-off-by: Guy Chronister <guylovesbritt@gmail.com>
---
 drivers/hid/hid-google-hammer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index c6bdb9c4ef3e..d567f020bead 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -324,7 +324,7 @@ static int hammer_kbd_brightness_set_blocking(struct led_classdev *cdev,
 	}
 
 	ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf));
-	if (ret == -ENOSYS)
+	if (ret == -EINVAL)
 		ret = hid_hw_raw_request(led->hdev, 0, led->buf,
 					 sizeof(led->buf),
 					 HID_OUTPUT_REPORT,
@@ -420,7 +420,7 @@ static int hammer_event(struct hid_device *hid, struct hid_field *field,
 }
 
 static bool hammer_has_usage(struct hid_device *hdev, unsigned int report_type,
-			unsigned application, unsigned usage)
+			unsigned int application, unsigned int usage)
 {
 	struct hid_report_enum *re = &hdev->report_enum[report_type];
 	struct hid_report *report;
-- 
2.40.1
Re: [PATCH] HID: google_hammer: Fix invalid ENOSYS warning and unsigned.
Posted by Jiri Kosina 1 year, 12 months ago
On Tue, 12 Dec 2023, Guy Chronister wrote:

> Fixed warnings about ENOSYS and bare unsigned without int.
> 
> Signed-off-by: Guy Chronister <guylovesbritt@gmail.com>
> ---
>  drivers/hid/hid-google-hammer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
> index c6bdb9c4ef3e..d567f020bead 100644
> --- a/drivers/hid/hid-google-hammer.c
> +++ b/drivers/hid/hid-google-hammer.c
> @@ -324,7 +324,7 @@ static int hammer_kbd_brightness_set_blocking(struct led_classdev *cdev,
>  	}
>  
>  	ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf));
> -	if (ret == -ENOSYS)
> +	if (ret == -EINVAL)
>  		ret = hid_hw_raw_request(led->hdev, 0, led->buf,
>  					 sizeof(led->buf),
>  					 HID_OUTPUT_REPORT,

Could you please elaborate why this is funcionally correct thing to do? 
How are you now handling the special case when 
hdev->ll_driver->output_report() callback doesn't exist for the specific 
low-level driver?

-- 
Jiri Kosina
SUSE Labs