diff mbox series

[2/6] Input: cyttsp5: remove unused code

Message ID 20230323135205.1160879-3-mweigand@mweigand.net (mailing list archive)
State Superseded
Headers show
Series Small fixes to the cyttsp5 touchscreen driver | expand

Commit Message

Maximilian Weigand March 23, 2023, 1:52 p.m. UTC
The removed lines were remnants of the android driver of the touch
screen and are not used in the current driver.

Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
Reviewed-by: Alistair Francis <alistair@alistair23.me>
---
 drivers/input/touchscreen/cyttsp5.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

kernel test robot March 23, 2023, 3:18 p.m. UTC | #1
Hi Maximilian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Maximilian-Weigand/Input-cyttsp5-fix-array-length/20230323-215957
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230323135205.1160879-3-mweigand%40mweigand.net
patch subject: [PATCH 2/6] Input: cyttsp5: remove unused code
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20230323/202303232302.FB64fi39-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/4358a60821eb8149dabed197c09d3c0eab63bf38
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Maximilian-Weigand/Input-cyttsp5-fix-array-length/20230323-215957
        git checkout 4358a60821eb8149dabed197c09d3c0eab63bf38
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/input/touchscreen/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303232302.FB64fi39-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/input/touchscreen/cyttsp5.c: In function 'cyttsp5_get_hid_descriptor':
>> drivers/input/touchscreen/cyttsp5.c:604:12: warning: unused variable 'cmd' [-Wunused-variable]
     604 |         u8 cmd[2];
         |            ^~~


vim +/cmd +604 drivers/input/touchscreen/cyttsp5.c

5b0c03e24a061f Alistair Francis 2022-10-31  598  
5b0c03e24a061f Alistair Francis 2022-10-31  599  static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts,
5b0c03e24a061f Alistair Francis 2022-10-31  600  				      struct cyttsp5_hid_desc *desc)
5b0c03e24a061f Alistair Francis 2022-10-31  601  {
5b0c03e24a061f Alistair Francis 2022-10-31  602  	struct device *dev = ts->dev;
5b0c03e24a061f Alistair Francis 2022-10-31  603  	int rc;
5b0c03e24a061f Alistair Francis 2022-10-31 @604  	u8 cmd[2];
5b0c03e24a061f Alistair Francis 2022-10-31  605  
5b0c03e24a061f Alistair Francis 2022-10-31  606  	rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0);
5b0c03e24a061f Alistair Francis 2022-10-31  607  	if (rc) {
5b0c03e24a061f Alistair Francis 2022-10-31  608  		dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc);
5b0c03e24a061f Alistair Francis 2022-10-31  609  		return rc;
5b0c03e24a061f Alistair Francis 2022-10-31  610  	}
5b0c03e24a061f Alistair Francis 2022-10-31  611  
5b0c03e24a061f Alistair Francis 2022-10-31  612  	rc = wait_for_completion_interruptible_timeout(&ts->cmd_done,
5b0c03e24a061f Alistair Francis 2022-10-31  613  			msecs_to_jiffies(CY_HID_GET_HID_DESCRIPTOR_TIMEOUT_MS));
5b0c03e24a061f Alistair Francis 2022-10-31  614  	if (rc <= 0) {
5b0c03e24a061f Alistair Francis 2022-10-31  615  		dev_err(ts->dev, "HID get descriptor timed out\n");
5b0c03e24a061f Alistair Francis 2022-10-31  616  		rc = -ETIMEDOUT;
5b0c03e24a061f Alistair Francis 2022-10-31  617  		return rc;
5b0c03e24a061f Alistair Francis 2022-10-31  618  	}
5b0c03e24a061f Alistair Francis 2022-10-31  619  
5b0c03e24a061f Alistair Francis 2022-10-31  620  	memcpy(desc, ts->response_buf, sizeof(*desc));
5b0c03e24a061f Alistair Francis 2022-10-31  621  
5b0c03e24a061f Alistair Francis 2022-10-31  622  	/* Check HID descriptor length and version */
5b0c03e24a061f Alistair Francis 2022-10-31  623  	if (le16_to_cpu(desc->hid_desc_len) != sizeof(*desc) ||
5b0c03e24a061f Alistair Francis 2022-10-31  624  	    le16_to_cpu(desc->bcd_version) != HID_VERSION) {
5b0c03e24a061f Alistair Francis 2022-10-31  625  		dev_err(dev, "Unsupported HID version\n");
5b0c03e24a061f Alistair Francis 2022-10-31  626  		return -ENODEV;
5b0c03e24a061f Alistair Francis 2022-10-31  627  	}
5b0c03e24a061f Alistair Francis 2022-10-31  628  
5b0c03e24a061f Alistair Francis 2022-10-31  629  	return 0;
5b0c03e24a061f Alistair Francis 2022-10-31  630  }
5b0c03e24a061f Alistair Francis 2022-10-31  631
kernel test robot March 27, 2023, 3:17 p.m. UTC | #2
Hi Maximilian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus linus/master v6.3-rc4 next-20230327]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Maximilian-Weigand/Input-cyttsp5-fix-array-length/20230323-215957
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230323135205.1160879-3-mweigand%40mweigand.net
patch subject: [PATCH 2/6] Input: cyttsp5: remove unused code
config: i386-randconfig-a011-20230327 (https://download.01.org/0day-ci/archive/20230327/202303272323.nRNi9Sso-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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://github.com/intel-lab-lkp/linux/commit/4358a60821eb8149dabed197c09d3c0eab63bf38
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Maximilian-Weigand/Input-cyttsp5-fix-array-length/20230323-215957
        git checkout 4358a60821eb8149dabed197c09d3c0eab63bf38
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/input/touchscreen/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303272323.nRNi9Sso-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/input/touchscreen/cyttsp5.c:604:5: warning: unused variable 'cmd' [-Wunused-variable]
           u8 cmd[2];
              ^
   1 warning generated.


vim +/cmd +604 drivers/input/touchscreen/cyttsp5.c

5b0c03e24a061f Alistair Francis 2022-10-31  598  
5b0c03e24a061f Alistair Francis 2022-10-31  599  static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts,
5b0c03e24a061f Alistair Francis 2022-10-31  600  				      struct cyttsp5_hid_desc *desc)
5b0c03e24a061f Alistair Francis 2022-10-31  601  {
5b0c03e24a061f Alistair Francis 2022-10-31  602  	struct device *dev = ts->dev;
5b0c03e24a061f Alistair Francis 2022-10-31  603  	int rc;
5b0c03e24a061f Alistair Francis 2022-10-31 @604  	u8 cmd[2];
5b0c03e24a061f Alistair Francis 2022-10-31  605  
5b0c03e24a061f Alistair Francis 2022-10-31  606  	rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0);
5b0c03e24a061f Alistair Francis 2022-10-31  607  	if (rc) {
5b0c03e24a061f Alistair Francis 2022-10-31  608  		dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc);
5b0c03e24a061f Alistair Francis 2022-10-31  609  		return rc;
5b0c03e24a061f Alistair Francis 2022-10-31  610  	}
5b0c03e24a061f Alistair Francis 2022-10-31  611  
5b0c03e24a061f Alistair Francis 2022-10-31  612  	rc = wait_for_completion_interruptible_timeout(&ts->cmd_done,
5b0c03e24a061f Alistair Francis 2022-10-31  613  			msecs_to_jiffies(CY_HID_GET_HID_DESCRIPTOR_TIMEOUT_MS));
5b0c03e24a061f Alistair Francis 2022-10-31  614  	if (rc <= 0) {
5b0c03e24a061f Alistair Francis 2022-10-31  615  		dev_err(ts->dev, "HID get descriptor timed out\n");
5b0c03e24a061f Alistair Francis 2022-10-31  616  		rc = -ETIMEDOUT;
5b0c03e24a061f Alistair Francis 2022-10-31  617  		return rc;
5b0c03e24a061f Alistair Francis 2022-10-31  618  	}
5b0c03e24a061f Alistair Francis 2022-10-31  619  
5b0c03e24a061f Alistair Francis 2022-10-31  620  	memcpy(desc, ts->response_buf, sizeof(*desc));
5b0c03e24a061f Alistair Francis 2022-10-31  621  
5b0c03e24a061f Alistair Francis 2022-10-31  622  	/* Check HID descriptor length and version */
5b0c03e24a061f Alistair Francis 2022-10-31  623  	if (le16_to_cpu(desc->hid_desc_len) != sizeof(*desc) ||
5b0c03e24a061f Alistair Francis 2022-10-31  624  	    le16_to_cpu(desc->bcd_version) != HID_VERSION) {
5b0c03e24a061f Alistair Francis 2022-10-31  625  		dev_err(dev, "Unsupported HID version\n");
5b0c03e24a061f Alistair Francis 2022-10-31  626  		return -ENODEV;
5b0c03e24a061f Alistair Francis 2022-10-31  627  	}
5b0c03e24a061f Alistair Francis 2022-10-31  628  
5b0c03e24a061f Alistair Francis 2022-10-31  629  	return 0;
5b0c03e24a061f Alistair Francis 2022-10-31  630  }
5b0c03e24a061f Alistair Francis 2022-10-31  631
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
index 42c7b44e37f8..8b0c6975c6ec 100644
--- a/drivers/input/touchscreen/cyttsp5.c
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -600,13 +600,9 @@  static int cyttsp5_get_hid_descriptor(struct cyttsp5 *ts,
 				      struct cyttsp5_hid_desc *desc)
 {
 	struct device *dev = ts->dev;
-	__le16 hid_desc_register = cpu_to_le16(HID_DESC_REG);
 	int rc;
 	u8 cmd[2];
 
-	/* Set HID descriptor register */
-	memcpy(cmd, &hid_desc_register, sizeof(hid_desc_register));
-
 	rc = cyttsp5_write(ts, HID_DESC_REG, NULL, 0);
 	if (rc) {
 		dev_err(dev, "Failed to get HID descriptor, rc=%d\n", rc);