linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 11502/12841] drivers/hid/hid-nintendo.c:85:17: error: 'JC_USB_CMD_CONN_STATUS' defined but not used
@ 2021-10-30 13:43 kernel test robot
  2021-11-01 14:33 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-10-30 13:43 UTC (permalink / raw)
  To: Daniel J. Ogorchock; +Cc: kbuild-all, Linux Memory Management List, Jiri Kosina

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   bdcc9f6a568275aed4cc32fd2312432d2ff1b704
commit: 2af16c1f846bd60240745bbd3afa13d5f040c61a [11502/12841] HID: nintendo: add nintendo switch controller driver
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=2af16c1f846bd60240745bbd3afa13d5f040c61a
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 2af16c1f846bd60240745bbd3afa13d5f040c61a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/hid/hid-nintendo.c:92:17: error: 'JC_USB_SEND_UART' defined but not used [-Werror=unused-const-variable=]
      92 | static const u8 JC_USB_SEND_UART                = 0x92;
         |                 ^~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:91:17: error: 'JC_USB_PRE_HANDSHAKE' defined but not used [-Werror=unused-const-variable=]
      91 | static const u8 JC_USB_PRE_HANDSHAKE            = 0x91;
         |                 ^~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:90:17: error: 'JC_USB_RESET' defined but not used [-Werror=unused-const-variable=]
      90 | static const u8 JC_USB_RESET                    = 0x06;
         |                 ^~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:89:17: error: 'JC_USB_CMD_EN_TIMEOUT' defined but not used [-Werror=unused-const-variable=]
      89 | static const u8 JC_USB_CMD_EN_TIMEOUT           = 0x05;
         |                 ^~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:85:17: error: 'JC_USB_CMD_CONN_STATUS' defined but not used [-Werror=unused-const-variable=]
      85 | static const u8 JC_USB_CMD_CONN_STATUS          = 0x01;
         |                 ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:82:17: error: 'JC_FEATURE_LAUNCH' defined but not used [-Werror=unused-const-variable=]
      82 | static const u8 JC_FEATURE_LAUNCH               = 0x75;
         |                 ^~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:81:17: error: 'JC_FEATURE_MEM_WRITE' defined but not used [-Werror=unused-const-variable=]
      81 | static const u8 JC_FEATURE_MEM_WRITE            = 0x74;
         |                 ^~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:80:17: error: 'JC_FEATURE_ERASE_MEM_SECTOR' defined but not used [-Werror=unused-const-variable=]
      80 | static const u8 JC_FEATURE_ERASE_MEM_SECTOR     = 0x73;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:79:17: error: 'JC_FEATURE_MEM_READ' defined but not used [-Werror=unused-const-variable=]
      79 | static const u8 JC_FEATURE_MEM_READ             = 0x72;
         |                 ^~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:78:17: error: 'JC_FEATURE_SETUP_MEM_READ' defined but not used [-Werror=unused-const-variable=]
      78 | static const u8 JC_FEATURE_SETUP_MEM_READ       = 0x71;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:77:17: error: 'JC_FEATURE_OTA_FW_UPGRADE' defined but not used [-Werror=unused-const-variable=]
      77 | static const u8 JC_FEATURE_OTA_FW_UPGRADE       = 0x70;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:76:17: error: 'JC_FEATURE_LAST_SUBCMD' defined but not used [-Werror=unused-const-variable=]
      76 | static const u8 JC_FEATURE_LAST_SUBCMD          = 0x02;
         |                 ^~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:69:17: error: 'JC_INPUT_BUTTON_EVENT' defined but not used [-Werror=unused-const-variable=]
      69 | static const u8 JC_INPUT_BUTTON_EVENT           = 0x3F;
         |                 ^~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:66:17: error: 'JC_SUBCMD_GET_REGULATED_VOLTAGE' defined but not used [-Werror=unused-const-variable=]
      66 | static const u8 JC_SUBCMD_GET_REGULATED_VOLTAGE = 0x50;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:65:17: error: 'JC_SUBCMD_ENABLE_VIBRATION' defined but not used [-Werror=unused-const-variable=]
      65 | static const u8 JC_SUBCMD_ENABLE_VIBRATION      = 0x48;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:64:17: error: 'JC_SUBCMD_READ_IMU_REG' defined but not used [-Werror=unused-const-variable=]
      64 | static const u8 JC_SUBCMD_READ_IMU_REG          = 0x43;
         |                 ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:63:17: error: 'JC_SUBCMD_WRITE_IMU_REG' defined but not used [-Werror=unused-const-variable=]
      63 | static const u8 JC_SUBCMD_WRITE_IMU_REG         = 0x42;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:62:17: error: 'JC_SUBCMD_SET_IMU_SENSITIVITY' defined but not used [-Werror=unused-const-variable=]
      62 | static const u8 JC_SUBCMD_SET_IMU_SENSITIVITY   = 0x41;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:61:17: error: 'JC_SUBCMD_ENABLE_IMU' defined but not used [-Werror=unused-const-variable=]
      61 | static const u8 JC_SUBCMD_ENABLE_IMU            = 0x40;
         |                 ^~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:60:17: error: 'JC_SUBCMD_SET_HOME_LIGHT' defined but not used [-Werror=unused-const-variable=]
      60 | static const u8 JC_SUBCMD_SET_HOME_LIGHT        = 0x38;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:59:17: error: 'JC_SUBCMD_GET_PLAYER_LIGHTS' defined but not used [-Werror=unused-const-variable=]
      59 | static const u8 JC_SUBCMD_GET_PLAYER_LIGHTS     = 0x31;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:57:17: error: 'JC_SUBCMD_SET_MCU_STATE' defined but not used [-Werror=unused-const-variable=]
      57 | static const u8 JC_SUBCMD_SET_MCU_STATE         = 0x22;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:56:17: error: 'JC_SUBCMD_SET_MCU_CONFIG' defined but not used [-Werror=unused-const-variable=]
      56 | static const u8 JC_SUBCMD_SET_MCU_CONFIG        = 0x21;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:55:17: error: 'JC_SUBCMD_RESET_MCU' defined but not used [-Werror=unused-const-variable=]
      55 | static const u8 JC_SUBCMD_RESET_MCU             = 0x20;
         |                 ^~~~~~~~~~~~~~~~~~~
>> drivers/hid/hid-nintendo.c:54:17: error: 'JC_SUBCMD_SPI_FLASH_WRITE' defined but not used [-Werror=unused-const-variable=]
      54 | static const u8 JC_SUBCMD_SPI_FLASH_WRITE       = 0x11;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:52:17: error: 'JC_SUBCMD_LOW_POWER_MODE' defined but not used [-Werror=unused-const-variable=]
      52 | static const u8 JC_SUBCMD_LOW_POWER_MODE        = 0x08;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:51:17: error: 'JC_SUBCMD_RESET_PAIRING_INFO' defined but not used [-Werror=unused-const-variable=]
      51 | static const u8 JC_SUBCMD_RESET_PAIRING_INFO    = 0x07;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:50:17: error: 'JC_SUBCMD_SET_HCI_STATE' defined but not used [-Werror=unused-const-variable=]
      50 | static const u8 JC_SUBCMD_SET_HCI_STATE         = 0x06;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:49:17: error: 'JC_SUBCMD_GET_PAGE_LIST_STATE' defined but not used [-Werror=unused-const-variable=]
      49 | static const u8 JC_SUBCMD_GET_PAGE_LIST_STATE   = 0x05;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:48:17: error: 'JC_SUBCMD_TRIGGERS_ELAPSED' defined but not used [-Werror=unused-const-variable=]
      48 | static const u8 JC_SUBCMD_TRIGGERS_ELAPSED      = 0x04;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:46:17: error: 'JC_SUBCMD_REQ_DEV_INFO' defined but not used [-Werror=unused-const-variable=]
      46 | static const u8 JC_SUBCMD_REQ_DEV_INFO          = 0x02;
         |                 ^~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:45:17: error: 'JC_SUBCMD_MANUAL_BT_PAIRING' defined but not used [-Werror=unused-const-variable=]
      45 | static const u8 JC_SUBCMD_MANUAL_BT_PAIRING     = 0x01;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:44:17: error: 'JC_SUBCMD_STATE' defined but not used [-Werror=unused-const-variable=]
      44 | static const u8 JC_SUBCMD_STATE                 /*= 0x00*/;
         |                 ^~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:40:17: error: 'JC_OUTPUT_MCU_DATA' defined but not used [-Werror=unused-const-variable=]
      40 | static const u8 JC_OUTPUT_MCU_DATA              = 0x11;
         |                 ^~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:39:17: error: 'JC_OUTPUT_RUMBLE_ONLY' defined but not used [-Werror=unused-const-variable=]
      39 | static const u8 JC_OUTPUT_RUMBLE_ONLY           = 0x10;
         |                 ^~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-nintendo.c:38:17: error: 'JC_OUTPUT_FW_UPDATE_PKT' defined but not used [-Werror=unused-const-variable=]
      38 | static const u8 JC_OUTPUT_FW_UPDATE_PKT         = 0x03;
         |                 ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/JC_USB_CMD_CONN_STATUS +85 drivers/hid/hid-nintendo.c

    42	
    43	/* Subcommand IDs */
    44	static const u8 JC_SUBCMD_STATE			/*= 0x00*/;
    45	static const u8 JC_SUBCMD_MANUAL_BT_PAIRING	= 0x01;
    46	static const u8 JC_SUBCMD_REQ_DEV_INFO		= 0x02;
    47	static const u8 JC_SUBCMD_SET_REPORT_MODE	= 0x03;
    48	static const u8 JC_SUBCMD_TRIGGERS_ELAPSED	= 0x04;
    49	static const u8 JC_SUBCMD_GET_PAGE_LIST_STATE	= 0x05;
    50	static const u8 JC_SUBCMD_SET_HCI_STATE		= 0x06;
    51	static const u8 JC_SUBCMD_RESET_PAIRING_INFO	= 0x07;
    52	static const u8 JC_SUBCMD_LOW_POWER_MODE	= 0x08;
    53	static const u8 JC_SUBCMD_SPI_FLASH_READ	= 0x10;
  > 54	static const u8 JC_SUBCMD_SPI_FLASH_WRITE	= 0x11;
    55	static const u8 JC_SUBCMD_RESET_MCU		= 0x20;
    56	static const u8 JC_SUBCMD_SET_MCU_CONFIG	= 0x21;
    57	static const u8 JC_SUBCMD_SET_MCU_STATE		= 0x22;
    58	static const u8 JC_SUBCMD_SET_PLAYER_LIGHTS	= 0x30;
  > 59	static const u8 JC_SUBCMD_GET_PLAYER_LIGHTS	= 0x31;
    60	static const u8 JC_SUBCMD_SET_HOME_LIGHT	= 0x38;
    61	static const u8 JC_SUBCMD_ENABLE_IMU		= 0x40;
  > 62	static const u8 JC_SUBCMD_SET_IMU_SENSITIVITY	= 0x41;
  > 63	static const u8 JC_SUBCMD_WRITE_IMU_REG		= 0x42;
  > 64	static const u8 JC_SUBCMD_READ_IMU_REG		= 0x43;
    65	static const u8 JC_SUBCMD_ENABLE_VIBRATION	= 0x48;
  > 66	static const u8 JC_SUBCMD_GET_REGULATED_VOLTAGE	= 0x50;
    67	
    68	/* Input Reports */
    69	static const u8 JC_INPUT_BUTTON_EVENT		= 0x3F;
    70	static const u8 JC_INPUT_SUBCMD_REPLY		= 0x21;
    71	static const u8 JC_INPUT_IMU_DATA		= 0x30;
    72	static const u8 JC_INPUT_MCU_DATA		= 0x31;
    73	static const u8 JC_INPUT_USB_RESPONSE		= 0x81;
    74	
    75	/* Feature Reports */
    76	static const u8 JC_FEATURE_LAST_SUBCMD		= 0x02;
    77	static const u8 JC_FEATURE_OTA_FW_UPGRADE	= 0x70;
    78	static const u8 JC_FEATURE_SETUP_MEM_READ	= 0x71;
    79	static const u8 JC_FEATURE_MEM_READ		= 0x72;
    80	static const u8 JC_FEATURE_ERASE_MEM_SECTOR	= 0x73;
  > 81	static const u8 JC_FEATURE_MEM_WRITE		= 0x74;
  > 82	static const u8 JC_FEATURE_LAUNCH		= 0x75;
    83	
    84	/* USB Commands */
  > 85	static const u8 JC_USB_CMD_CONN_STATUS		= 0x01;
    86	static const u8 JC_USB_CMD_HANDSHAKE		= 0x02;
    87	static const u8 JC_USB_CMD_BAUDRATE_3M		= 0x03;
    88	static const u8 JC_USB_CMD_NO_TIMEOUT		= 0x04;
    89	static const u8 JC_USB_CMD_EN_TIMEOUT		= 0x05;
    90	static const u8 JC_USB_RESET			= 0x06;
    91	static const u8 JC_USB_PRE_HANDSHAKE		= 0x91;
    92	static const u8 JC_USB_SEND_UART		= 0x92;
    93	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 79179 bytes --]

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

* Re: [linux-next:master 11502/12841] drivers/hid/hid-nintendo.c:85:17: error: 'JC_USB_CMD_CONN_STATUS' defined but not used
  2021-10-30 13:43 [linux-next:master 11502/12841] drivers/hid/hid-nintendo.c:85:17: error: 'JC_USB_CMD_CONN_STATUS' defined but not used kernel test robot
@ 2021-11-01 14:33 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2021-11-01 14:33 UTC (permalink / raw)
  To: kernel test robot
  Cc: Daniel J. Ogorchock, kbuild-all, Linux Memory Management List

On Sat, 30 Oct 2021, kernel test robot wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   bdcc9f6a568275aed4cc32fd2312432d2ff1b704
> commit: 2af16c1f846bd60240745bbd3afa13d5f040c61a [11502/12841] HID: nintendo: add nintendo switch controller driver
> config: arm-allyesconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=2af16c1f846bd60240745bbd3afa13d5f040c61a
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 2af16c1f846bd60240745bbd3afa13d5f040c61a
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):

From: Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] HID: nintendo: fix -Werror build

There are a lot of warnings due to unused protocol constants, but I believe
it's good to leave them in the sources for documentation purposes for further
development.

Switch them over from static conts to macros to avoid the warnings.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 drivers/hid/hid-nintendo.c | 160 ++++++++++++++++++++++-----------------------
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index c4270499fc6f..a1e0f6849875 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -41,106 +41,106 @@
  */
 
 /* Output Reports */
-static const u8 JC_OUTPUT_RUMBLE_AND_SUBCMD	= 0x01;
-static const u8 JC_OUTPUT_FW_UPDATE_PKT		= 0x03;
-static const u8 JC_OUTPUT_RUMBLE_ONLY		= 0x10;
-static const u8 JC_OUTPUT_MCU_DATA		= 0x11;
-static const u8 JC_OUTPUT_USB_CMD		= 0x80;
+#define JC_OUTPUT_RUMBLE_AND_SUBCMD	 0x01
+#define JC_OUTPUT_FW_UPDATE_PKT		 0x03
+#define JC_OUTPUT_RUMBLE_ONLY		 0x10
+#define JC_OUTPUT_MCU_DATA		 0x11
+#define JC_OUTPUT_USB_CMD		 0x80
 
 /* Subcommand IDs */
-static const u8 JC_SUBCMD_STATE			/*= 0x00*/;
-static const u8 JC_SUBCMD_MANUAL_BT_PAIRING	= 0x01;
-static const u8 JC_SUBCMD_REQ_DEV_INFO		= 0x02;
-static const u8 JC_SUBCMD_SET_REPORT_MODE	= 0x03;
-static const u8 JC_SUBCMD_TRIGGERS_ELAPSED	= 0x04;
-static const u8 JC_SUBCMD_GET_PAGE_LIST_STATE	= 0x05;
-static const u8 JC_SUBCMD_SET_HCI_STATE		= 0x06;
-static const u8 JC_SUBCMD_RESET_PAIRING_INFO	= 0x07;
-static const u8 JC_SUBCMD_LOW_POWER_MODE	= 0x08;
-static const u8 JC_SUBCMD_SPI_FLASH_READ	= 0x10;
-static const u8 JC_SUBCMD_SPI_FLASH_WRITE	= 0x11;
-static const u8 JC_SUBCMD_RESET_MCU		= 0x20;
-static const u8 JC_SUBCMD_SET_MCU_CONFIG	= 0x21;
-static const u8 JC_SUBCMD_SET_MCU_STATE		= 0x22;
-static const u8 JC_SUBCMD_SET_PLAYER_LIGHTS	= 0x30;
-static const u8 JC_SUBCMD_GET_PLAYER_LIGHTS	= 0x31;
-static const u8 JC_SUBCMD_SET_HOME_LIGHT	= 0x38;
-static const u8 JC_SUBCMD_ENABLE_IMU		= 0x40;
-static const u8 JC_SUBCMD_SET_IMU_SENSITIVITY	= 0x41;
-static const u8 JC_SUBCMD_WRITE_IMU_REG		= 0x42;
-static const u8 JC_SUBCMD_READ_IMU_REG		= 0x43;
-static const u8 JC_SUBCMD_ENABLE_VIBRATION	= 0x48;
-static const u8 JC_SUBCMD_GET_REGULATED_VOLTAGE	= 0x50;
+#define JC_SUBCMD_STATE			 0x00
+#define JC_SUBCMD_MANUAL_BT_PAIRING	 0x01
+#define JC_SUBCMD_REQ_DEV_INFO		 0x02
+#define JC_SUBCMD_SET_REPORT_MODE	 0x03
+#define JC_SUBCMD_TRIGGERS_ELAPSED	 0x04
+#define JC_SUBCMD_GET_PAGE_LIST_STATE	 0x05
+#define JC_SUBCMD_SET_HCI_STATE		 0x06
+#define JC_SUBCMD_RESET_PAIRING_INFO	 0x07
+#define JC_SUBCMD_LOW_POWER_MODE	 0x08
+#define JC_SUBCMD_SPI_FLASH_READ	 0x10
+#define JC_SUBCMD_SPI_FLASH_WRITE	 0x11
+#define JC_SUBCMD_RESET_MCU		 0x20
+#define JC_SUBCMD_SET_MCU_CONFIG	 0x21
+#define JC_SUBCMD_SET_MCU_STATE		 0x22
+#define JC_SUBCMD_SET_PLAYER_LIGHTS	 0x30
+#define JC_SUBCMD_GET_PLAYER_LIGHTS	 0x31
+#define JC_SUBCMD_SET_HOME_LIGHT	 0x38
+#define JC_SUBCMD_ENABLE_IMU		 0x40
+#define JC_SUBCMD_SET_IMU_SENSITIVITY	 0x41
+#define JC_SUBCMD_WRITE_IMU_REG		 0x42
+#define JC_SUBCMD_READ_IMU_REG		 0x43
+#define JC_SUBCMD_ENABLE_VIBRATION	 0x48
+#define JC_SUBCMD_GET_REGULATED_VOLTAGE	 0x50
 
 /* Input Reports */
-static const u8 JC_INPUT_BUTTON_EVENT		= 0x3F;
-static const u8 JC_INPUT_SUBCMD_REPLY		= 0x21;
-static const u8 JC_INPUT_IMU_DATA		= 0x30;
-static const u8 JC_INPUT_MCU_DATA		= 0x31;
-static const u8 JC_INPUT_USB_RESPONSE		= 0x81;
+#define JC_INPUT_BUTTON_EVENT		 0x3F
+#define JC_INPUT_SUBCMD_REPLY		 0x21
+#define JC_INPUT_IMU_DATA		 0x30
+#define JC_INPUT_MCU_DATA		 0x31
+#define JC_INPUT_USB_RESPONSE		 0x81
 
 /* Feature Reports */
-static const u8 JC_FEATURE_LAST_SUBCMD		= 0x02;
-static const u8 JC_FEATURE_OTA_FW_UPGRADE	= 0x70;
-static const u8 JC_FEATURE_SETUP_MEM_READ	= 0x71;
-static const u8 JC_FEATURE_MEM_READ		= 0x72;
-static const u8 JC_FEATURE_ERASE_MEM_SECTOR	= 0x73;
-static const u8 JC_FEATURE_MEM_WRITE		= 0x74;
-static const u8 JC_FEATURE_LAUNCH		= 0x75;
+#define JC_FEATURE_LAST_SUBCMD		 0x02
+#define JC_FEATURE_OTA_FW_UPGRADE	 0x70
+#define JC_FEATURE_SETUP_MEM_READ	 0x71
+#define JC_FEATURE_MEM_READ		 0x72
+#define JC_FEATURE_ERASE_MEM_SECTOR	 0x73
+#define JC_FEATURE_MEM_WRITE		 0x74
+#define JC_FEATURE_LAUNCH		 0x75
 
 /* USB Commands */
-static const u8 JC_USB_CMD_CONN_STATUS		= 0x01;
-static const u8 JC_USB_CMD_HANDSHAKE		= 0x02;
-static const u8 JC_USB_CMD_BAUDRATE_3M		= 0x03;
-static const u8 JC_USB_CMD_NO_TIMEOUT		= 0x04;
-static const u8 JC_USB_CMD_EN_TIMEOUT		= 0x05;
-static const u8 JC_USB_RESET			= 0x06;
-static const u8 JC_USB_PRE_HANDSHAKE		= 0x91;
-static const u8 JC_USB_SEND_UART		= 0x92;
+#define JC_USB_CMD_CONN_STATUS		 0x01
+#define JC_USB_CMD_HANDSHAKE		 0x02
+#define JC_USB_CMD_BAUDRATE_3M		 0x03
+#define JC_USB_CMD_NO_TIMEOUT		 0x04
+#define JC_USB_CMD_EN_TIMEOUT		 0x05
+#define JC_USB_RESET			 0x06
+#define JC_USB_PRE_HANDSHAKE		 0x91
+#define JC_USB_SEND_UART		 0x92
 
 /* Magic value denoting presence of user calibration */
-static const u16 JC_CAL_USR_MAGIC_0		= 0xB2;
-static const u16 JC_CAL_USR_MAGIC_1		= 0xA1;
-static const u8 JC_CAL_USR_MAGIC_SIZE		= 2;
+#define JC_CAL_USR_MAGIC_0		 0xB2
+#define JC_CAL_USR_MAGIC_1		 0xA1
+#define JC_CAL_USR_MAGIC_SIZE		 2
 
 /* SPI storage addresses of user calibration data */
-static const u16 JC_CAL_USR_LEFT_MAGIC_ADDR	= 0x8010;
-static const u16 JC_CAL_USR_LEFT_DATA_ADDR	= 0x8012;
-static const u16 JC_CAL_USR_LEFT_DATA_END	= 0x801A;
-static const u16 JC_CAL_USR_RIGHT_MAGIC_ADDR	= 0x801B;
-static const u16 JC_CAL_USR_RIGHT_DATA_ADDR	= 0x801D;
+#define JC_CAL_USR_LEFT_MAGIC_ADDR	 0x8010
+#define JC_CAL_USR_LEFT_DATA_ADDR	 0x8012
+#define JC_CAL_USR_LEFT_DATA_END	 0x801A
+#define JC_CAL_USR_RIGHT_MAGIC_ADDR	 0x801B
+#define JC_CAL_USR_RIGHT_DATA_ADDR	 0x801D
 #define JC_CAL_STICK_DATA_SIZE \
 	(JC_CAL_USR_LEFT_DATA_END - JC_CAL_USR_LEFT_DATA_ADDR + 1)
 
 /* SPI storage addresses of factory calibration data */
-static const u16 JC_CAL_FCT_DATA_LEFT_ADDR	= 0x603d;
-static const u16 JC_CAL_FCT_DATA_RIGHT_ADDR	= 0x6046;
+#define JC_CAL_FCT_DATA_LEFT_ADDR	 0x603d
+#define JC_CAL_FCT_DATA_RIGHT_ADDR	 0x6046
 
 /* SPI storage addresses of IMU factory calibration data */
-static const u16 JC_IMU_CAL_FCT_DATA_ADDR	= 0x6020;
-static const u16 JC_IMU_CAL_FCT_DATA_END	= 0x6037;
+#define JC_IMU_CAL_FCT_DATA_ADDR	 0x6020
+#define JC_IMU_CAL_FCT_DATA_END	 0x6037
 #define JC_IMU_CAL_DATA_SIZE \
 	(JC_IMU_CAL_FCT_DATA_END - JC_IMU_CAL_FCT_DATA_ADDR + 1)
 /* SPI storage addresses of IMU user calibration data */
-static const u16 JC_IMU_CAL_USR_MAGIC_ADDR	= 0x8026;
-static const u16 JC_IMU_CAL_USR_DATA_ADDR	= 0x8028;
+#define JC_IMU_CAL_USR_MAGIC_ADDR	 0x8026
+#define JC_IMU_CAL_USR_DATA_ADDR	 0x8028
 
 /* The raw analog joystick values will be mapped in terms of this magnitude */
-static const u16 JC_MAX_STICK_MAG		= 32767;
-static const u16 JC_STICK_FUZZ			= 250;
-static const u16 JC_STICK_FLAT			= 500;
+#define JC_MAX_STICK_MAG		 32767
+#define JC_STICK_FUZZ			 250
+#define JC_STICK_FLAT			 500
 
 /* Hat values for pro controller's d-pad */
-static const u16 JC_MAX_DPAD_MAG		= 1;
-static const u16 JC_DPAD_FUZZ			/*= 0*/;
-static const u16 JC_DPAD_FLAT			/*= 0*/;
+#define JC_MAX_DPAD_MAG		1
+#define JC_DPAD_FUZZ		0
+#define JC_DPAD_FLAT		0
 
 /* Under most circumstances IMU reports are pushed every 15ms; use as default */
-static const u16 JC_IMU_DFLT_AVG_DELTA_MS	= 15;
+#define JC_IMU_DFLT_AVG_DELTA_MS	15
 /* How many samples to sum before calculating average IMU report delta */
-static const u16 JC_IMU_SAMPLES_PER_DELTA_AVG	= 300;
+#define JC_IMU_SAMPLES_PER_DELTA_AVG	300
 /* Controls how many dropped IMU packets at once trigger a warning message */
-static const u16 JC_IMU_DROPPED_PKT_WARNING	= 3;
+#define JC_IMU_DROPPED_PKT_WARNING	3
 
 /*
  * The controller's accelerometer has a sensor resolution of 16bits and is
@@ -149,10 +149,10 @@ static const u16 JC_IMU_DROPPED_PKT_WARNING	= 3;
  * Resolution per G (rather than per millliG): 4.096 * 1000 = 4096 digits per G
  * Alternatively: 1/4096 = .0002441 Gs per digit
  */
-static const s32 JC_IMU_MAX_ACCEL_MAG		= 32767;
-static const u16 JC_IMU_ACCEL_RES_PER_G		= 4096;
-static const u16 JC_IMU_ACCEL_FUZZ		= 10;
-static const u16 JC_IMU_ACCEL_FLAT		/*= 0*/;
+#define JC_IMU_MAX_ACCEL_MAG		32767
+#define JC_IMU_ACCEL_RES_PER_G		4096
+#define JC_IMU_ACCEL_FUZZ		10
+#define JC_IMU_ACCEL_FLAT		0
 
 /*
  * The controller's gyroscope has a sensor resolution of 16bits and is
@@ -169,12 +169,12 @@ static const u16 JC_IMU_ACCEL_FLAT		/*= 0*/;
  * Now, 14.247 truncating to 14 loses a lot of precision, so we rescale the
  * min/max range by 1000.
  */
-static const s32 JC_IMU_PREC_RANGE_SCALE	= 1000;
+#define JC_IMU_PREC_RANGE_SCALE	1000
 /* Note: change mag and res_per_dps if prec_range_scale is ever altered */
-static const s32 JC_IMU_MAX_GYRO_MAG		= 32767000; /* (2^16-1)*1000 */
-static const u16 JC_IMU_GYRO_RES_PER_DPS	= 14247; /* (14.247*1000) */
-static const u16 JC_IMU_GYRO_FUZZ		= 10;
-static const u16 JC_IMU_GYRO_FLAT		/*= 0*/;
+#define JC_IMU_MAX_GYRO_MAG		32767000 /* (2^16-1)*1000 */
+#define JC_IMU_GYRO_RES_PER_DPS		14247 /* (14.247*1000) */
+#define JC_IMU_GYRO_FUZZ		10
+#define JC_IMU_GYRO_FLAT		0
 
 /* frequency/amplitude tables for rumble */
 struct joycon_rumble_freq_data {
-- 
2.12.3


-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2021-11-01 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-30 13:43 [linux-next:master 11502/12841] drivers/hid/hid-nintendo.c:85:17: error: 'JC_USB_CMD_CONN_STATUS' defined but not used kernel test robot
2021-11-01 14:33 ` Jiri Kosina

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