Re: [PATCH] HID: playstation: DS4: Add BT poll interval adjustment
From: Terry Junge
Date: Sun Jun 29 2025 - 23:46:33 EST
On 5/13/25 1:44 AM, Vadym Tytan wrote:
>> kernel test robot noticed the following build warnings:
>>
>> sparse warnings: (new ones prefixed by >>)
>>>> drivers/hid/hid-playstation.c:1773:25: sparse: sparse: symbol 'dev_attr_dualshock4_bt_poll_interval' was not declared. Should it be static?
>>
>> vim +/dev_attr_dualshock4_bt_poll_interval +1773 drivers/hid/hid-playstation.c
>>
>> 1772
>>> 1773 struct device_attribute dev_attr_dualshock4_bt_poll_interval = {
>> 1774 .attr = { .name = "bt_poll_interval", .mode = 0644 },
Should it be .attr = { .name = "dualshock4_bt_poll_interval", .mode = 0644 }, ?
Or did you not expand the macro fully on purpose?
Thanks,
Terry
>> 1775 .show = dualshock4_show_poll_interval,
>> 1776 .store = dualshock4_store_poll_interval,
>> 1777 };
>> 1778
>
> This piece of code is expanded `DEVICE_ATTR` macro with changed variable name.
> `DEVICE_ATTR` is defined as:
> ```c
> // Reference: https://github.com/intel-lab-lkp/linux/blob/Vadym-Tytan/HID-playstation-DS4-Add-BT-poll-interval-adjustment/20250509-054413/include/linux/device.h#L138-L158
> #define DEVICE_ATTR(_name, _mode, _show, _store) \
> struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
> ```
> It doesn't use `static` so neither did I.
>
> P.S. Macro was expanded and variable name was changed from `dev_attr_bt_poll_interval` to `dev_attr_dualshock4_bt_poll_interval` because this attribute only applies to DualShock4
>
>