HID: amd_sfh: change global variables to static
Subsystems (2)
PATCH 1/1 HID: amd_sfh: change global variables to static
Smatch reports this representative issue
amd_sfh_hid_report_desc.h:182:10: warning: symbol 'gyro3_report_descriptor' was not declared. Should it be static? Similar issues for comp3_report_descriptor and als_report_descriptor.
Global variables should not be defined in header files. This only works because amd_sfh_hid_report_desc.h in only included by amd_sfh_hid_desc.c so change the storage-class specifiers to static.
--- .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +3 -3
@@ -179,7 +179,7 @@ static const u8 accel3_report_descriptor[] = {0xC0 /* HID end collection */ }; -const u8 gyro3_report_descriptor[] = { +static const u8 gyro3_report_descriptor[] = {0x05 ,0x20 ,/* Usage page */ 0x09 ,0x76 ,/* Motion type Gyro3D */ 0xA1 ,0x00 ,/* HID Collection (Physical) */
@@ -340,7 +340,7 @@ const u8 gyro3_report_descriptor[] = { 0xC0, /* HID end collection */ }; -const u8 comp3_report_descriptor[] = { +static const u8 comp3_report_descriptor[] = {0x05 ,0x20 ,/* Usage page */ 0x09 ,0x83 ,/* Motion type Orientation compass 3D */ 0xA1 ,0x00 ,/* HID Collection (Physical) */
@@ -512,7 +512,7 @@ const u8 comp3_report_descriptor[] = {0xC0 /* HID end collection */ }; -const u8 als_report_descriptor[] = { +static const u8 als_report_descriptor[] = {0x05 ,0x20 ,/* HID usage page sensor */ 0x09 ,0x41 ,/* HID usage sensor type Ambientlight */ 0xA1 ,0x00 ,/* HID Collection (Physical) */
Signature · 1 line
2.27.0
Quoted 36 lines · Tom Rix
Smatch reports this representative issue
amd_sfh_hid_report_desc.h:182:10: warning: symbol 'gyro3_report_descriptor' was not declared. Should it be static? Similar issues forcomp3_report_descriptorandals_report_descriptor.Global variables should not be defined in header files. This only works because
amd_sfh_hid_report_desc.hin only included byamd_sfh_hid_desc.cso change the storage-class specifiers to static.Signed-off-by Tom Rix <[email protected]>--- .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +2
-2@@ -179,7 +179,7 @@ static const u8 accel3_report_descriptor[] = {0xC0 /* HID end collection */ }; -const u8 gyro3_report_descriptor[] = { +static const u8 gyro3_report_descriptor[] = {0x05 ,0x20 ,/* Usage page */ 0x09 ,0x76 ,/* Motion type Gyro3D */ 0xA1 ,0x00 ,/* HID Collection (Physical) */ @@ -340,7 +340,7 @@ const u8 gyro3_report_descriptor[] = { 0xC0, /* HID end collection */ }; -const u8 comp3_report_descriptor[] = { +static const u8 comp3_report_descriptor[] = {0x05 ,0x20 ,/* Usage page */ 0x09 ,0x83 ,/* Motion type Orientation compass 3D */ 0xA1 ,0x00 ,/* HID Collection (Physical) */
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h const u8 comp3_report_descriptor[] = { · line 518
Quoted 8 lines
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +1
-1@@ -512,7 +512,7 @@ const u8 comp3_report_descriptor[] = {0xC0 /* HID end collection */ }; -const u8 als_report_descriptor[] = { +static const u8 als_report_descriptor[] = {0x05 ,0x20 ,/* HID usage page sensor */ 0x09 ,0x41 ,/* HID usage sensor type Ambientlight */ 0xA1 ,0x00 ,/* HID Collection (Physical) */
Quoted 9 lines · Tom Rix
Smatch reports this representative issue
amd_sfh_hid_report_desc.h:182:10: warning: symbol 'gyro3_report_descriptor' was not declared. Should it be static? Similar issues forcomp3_report_descriptorandals_report_descriptor.Global variables should not be defined in header files. This only works because
amd_sfh_hid_report_desc.hin only included byamd_sfh_hid_desc.cso change the storage-class specifiers to static.Signed-off-by Tom Rix <[email protected]>
Applied, thanks Tom.
Signature · 2 lines
Jiri Kosina SUSE Labs