diff mbox series

[v1,3/7] HID: playstation: DS4: Don't fail on FW/HW version request

Message ID 20240115144538.12018-4-max@enpas.org (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series HID: playstation: DS4: LED bugfix, third-party gamepad support | expand

Commit Message

Max Staudt Jan. 15, 2024, 2:45 p.m. UTC
Some third-party controllers can't report firmware/hardware version.

Unlike for the DualSense, the driver does not use these values for
anything in the DualShock 4 case, but merely exposes them via sysfs.
They will simply be 0x0.

Signed-off-by: Max Staudt <max@enpas.org>
---
 drivers/hid/hid-playstation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roderick Colenbrander Jan. 25, 2024, 12:43 a.m. UTC | #1
On Mon, Jan 15, 2024 at 6:51 AM Max Staudt <max@enpas.org> wrote:
>
> Some third-party controllers can't report firmware/hardware version.
>
> Unlike for the DualSense, the driver does not use these values for
> anything in the DualShock 4 case, but merely exposes them via sysfs.
> They will simply be 0x0.
>
> Signed-off-by: Max Staudt <max@enpas.org>
> ---
>  drivers/hid/hid-playstation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index 0a3c442af305..12321cae4416 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -2561,7 +2561,7 @@ static struct ps_device *dualshock4_create(struct hid_device *hdev)
>         ret = dualshock4_get_firmware_info(ds4);
>         if (ret) {
>                 hid_err(hdev, "Failed to get firmware info from DualShock4\n");
> -               return ERR_PTR(ret);
> +               hid_err(hdev, "HW/FW version data in sysfs will be invalid.\n");
>         }
>
>         ret = ps_devices_list_add(ps_dev);
> --
> 2.39.2
>
>

This looks good. Perhaps could have been a hid_warn then, but err is
probably fine.

Roderick
Max Staudt Jan. 27, 2024, 8:56 a.m. UTC | #2
On 1/25/24 09:43, Roderick Colenbrander wrote:
> On Mon, Jan 15, 2024 at 6:51 AM Max Staudt <max@enpas.org> wrote:
>>
>>          ret = dualshock4_get_firmware_info(ds4);
>>          if (ret) {
>>                  hid_err(hdev, "Failed to get firmware info from DualShock4\n");
>> -               return ERR_PTR(ret);
>> +               hid_err(hdev, "HW/FW version data in sysfs will be invalid.\n");
>>          }
> 
> This looks good. Perhaps could have been a hid_warn then, but err is
> probably fine.

I didn't think about it and kept the hid_err that was already there :)

I agree, and maybe we can take this further: If this code block is not a fatal error anymore, maybe it makes sense to change *both* lines to hid_warn?

If you prefer this, then I'll update the other patches accordingly.


Max
diff mbox series

Patch

diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 0a3c442af305..12321cae4416 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -2561,7 +2561,7 @@  static struct ps_device *dualshock4_create(struct hid_device *hdev)
 	ret = dualshock4_get_firmware_info(ds4);
 	if (ret) {
 		hid_err(hdev, "Failed to get firmware info from DualShock4\n");
-		return ERR_PTR(ret);
+		hid_err(hdev, "HW/FW version data in sysfs will be invalid.\n");
 	}
 
 	ret = ps_devices_list_add(ps_dev);