Re: [PATCH 1/4] Input: Add driver for Cypress Generation 5 touchscreen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alistair,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm/for-next]
[also build test WARNING on xilinx-xlnx/master soc/for-next rockchip/for-next arm64/for-next/core shawnguo/for-next clk/clk-next linus/master keystone/next v5.15-rc7 next-20211026]
[cannot apply to 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]

url:    https://github.com/0day-ci/linux/commits/Alistair-Francis/Add-support-for-the-Cypress-cyttsp5/20211025-194449
base:   git://git.armlinux.org.uk/~rmk/linux-arm.git for-next
config: sparc-randconfig-m031-20211027 (attached as .config)
compiler: sparc-linux-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://github.com/0day-ci/linux/commit/0709ecf257374af4472f599dddb75dc13e7e46c9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alistair-Francis/Add-support-for-the-Cypress-cyttsp5/20211025-194449
        git checkout 0709ecf257374af4472f599dddb75dc13e7e46c9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=sparc 

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

All warnings (new ones prefixed by >>):

   drivers/input/touchscreen/cyttsp5.c: In function 'cyttsp5_write':
>> drivers/input/touchscreen/cyttsp5.c:243:9: warning: ISO C90 forbids variable length array 'cmd' [-Wvla]
     243 |         u8 cmd[size + 1];
         |         ^~
   drivers/input/touchscreen/cyttsp5.c: In function 'cyttsp5_get_touch_axis':
>> drivers/input/touchscreen/cyttsp5.c:305:13: warning: variable 'next' set but not used [-Wunused-but-set-variable]
     305 |         int next;
         |             ^~~~
   drivers/input/touchscreen/cyttsp5.c: In function 'cyttsp5_get_mt_touches':
>> drivers/input/touchscreen/cyttsp5.c:333:9: warning: ISO C90 forbids variable length array 'ids' [-Wvla]
     333 |         DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
         |         ^~~~~~~~~~~~~~


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

   239	
   240	static int cyttsp5_write(struct cyttsp5 *ts, unsigned int reg, u8 *data,
   241				 size_t size)
   242	{
 > 243		u8 cmd[size + 1];
   244	
   245		/* High bytes of register address needed as first byte of cmd */
   246		cmd[0] = HI_BYTE(reg);
   247	
   248		/* Copy the rest of the data */
   249		if (data)
   250			memcpy(&cmd[1], data, size);
   251	
   252		/* The hardware wants to receive a frame with the address register
   253		 * contains in the first two bytes. As the regmap_write function
   254		 * add the register adresse in the frame, we use the LOW_BYTE as
   255		 * first frame byte for the address register and the first
   256		 * data byte is the high register + left of the cmd to send
   257		 */
   258		return regmap_bulk_write(ts->regmap, LOW_BYTE(reg), cmd, size + 1);
   259	}
   260	
   261	static void cyttsp5_final_sync(struct input_dev *input, int max_slots,
   262				       unsigned long *ids)
   263	{
   264		int t;
   265	
   266		for (t = 0; t < max_slots; t++) {
   267			if (test_bit(t, ids))
   268				continue;
   269			input_mt_slot(input, t);
   270			input_mt_report_slot_state(input, MT_TOOL_FINGER, false);
   271		}
   272	
   273		input_sync(input);
   274	}
   275	
   276	static void cyttsp5_report_slot_liftoff(struct cyttsp5 *ts, int max_slots)
   277	{
   278		int t;
   279	
   280		if (ts->num_prv_rec == 0)
   281			return;
   282	
   283		for (t = 0; t < max_slots; t++) {
   284			input_mt_slot(ts->input, t);
   285			input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
   286		}
   287	}
   288	
   289	static void cyttsp5_mt_lift_all(struct cyttsp5 *ts)
   290	{
   291		struct cyttsp5_sysinfo *si = &ts->sysinfo;
   292		int max = si->tch_abs[CY_TCH_T].max;
   293	
   294		if (ts->num_prv_rec != 0) {
   295			cyttsp5_report_slot_liftoff(ts, max);
   296			input_sync(ts->input);
   297			ts->num_prv_rec = 0;
   298		}
   299	}
   300	
   301	static void cyttsp5_get_touch_axis(int *axis, int size, int max, u8 *xy_data,
   302					   int bofs)
   303	{
   304		int nbyte;
 > 305		int next;
   306	
   307		for (nbyte = 0, *axis = 0, next = 0; nbyte < size; nbyte++)
   308			*axis = *axis + ((xy_data[nbyte] >> bofs) << (nbyte * 8));
   309	
   310		*axis &= max - 1;
   311	}
   312	
   313	static void cyttsp5_get_touch_record(struct cyttsp5 *ts,
   314					     struct cyttsp5_touch *touch, u8 *xy_data)
   315	{
   316		struct cyttsp5_sysinfo *si = &ts->sysinfo;
   317		enum cyttsp5_tch_abs abs;
   318	
   319		for (abs = CY_TCH_X; abs < CY_TCH_NUM_ABS; abs++) {
   320			cyttsp5_get_touch_axis(&touch->abs[abs],
   321					       si->tch_abs[abs].size,
   322					       si->tch_abs[abs].max,
   323					       xy_data + si->tch_abs[abs].ofs,
   324					       si->tch_abs[abs].bofs);
   325		}
   326	}
   327	
   328	static void cyttsp5_get_mt_touches(struct cyttsp5 *ts,
   329					   struct cyttsp5_touch *tch, int num_cur_tch)
   330	{
   331		struct cyttsp5_sysinfo *si = &ts->sysinfo;
   332		int i, t = 0;
 > 333		DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
   334		u8 *tch_addr;
   335		int tmp;
   336	
   337		bitmap_zero(ids, si->tch_abs[CY_TCH_T].max);
   338		memset(tch->abs, 0, sizeof(tch->abs));
   339	
   340		for (i = 0; i < num_cur_tch; i++) {
   341			tch_addr = si->xy_data + (i * TOUCH_REPORT_SIZE);
   342			cyttsp5_get_touch_record(ts, tch, tch_addr);
   343	
   344			/* Convert MAJOR/MINOR from mm to resolution */
   345			tmp = tch->abs[CY_TCH_MAJ] * 100 * si->sensing_conf_data.res_x;
   346			tch->abs[CY_TCH_MAJ] = tmp / si->sensing_conf_data.len_x;
   347			tmp = tch->abs[CY_TCH_MIN] * 100 * si->sensing_conf_data.res_x;
   348			tch->abs[CY_TCH_MIN] = tmp / si->sensing_conf_data.len_x;
   349	
   350			t = tch->abs[CY_TCH_T];
   351			input_mt_slot(ts->input, t);
   352			input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
   353			__set_bit(t, ids);
   354	
   355			/* position and pressure fields */
   356			input_report_abs(ts->input, ABS_MT_POSITION_X,
   357					 tch->abs[CY_TCH_X]);
   358			input_report_abs(ts->input, ABS_MT_POSITION_Y,
   359					 tch->abs[CY_TCH_Y]);
   360			input_report_abs(ts->input, ABS_MT_PRESSURE,
   361					 tch->abs[CY_TCH_P]);
   362	
   363			/* Get the extended touch fields */
   364			input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR,
   365					 tch->abs[CY_TCH_MAJ]);
   366			input_report_abs(ts->input, ABS_MT_TOUCH_MINOR,
   367					 tch->abs[CY_TCH_MIN]);
   368	
   369			touchscreen_report_pos(ts->input, &ts->prop,
   370					       tch->abs[CY_TCH_X], tch->abs[CY_TCH_Y],
   371					       true);
   372		}
   373	
   374		cyttsp5_final_sync(ts->input, si->tch_abs[CY_TCH_T].max, ids);
   375	
   376		ts->num_prv_rec = num_cur_tch;
   377	}
   378	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux