lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202511180542.hR4anHLj-lkp@intel.com>
Date: Tue, 18 Nov 2025 05:36:08 +0800
From: kernel test robot <lkp@...el.com>
To: 2724853925@...com, Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Henrik Rydberg <rydberg@...math.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
	2724853925@...com
Subject: Re: [PATCH] input: touchscreen: Add ilitek touchscreen driver support

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus linus/master v6.18-rc6 next-20251117]
[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/2724853925-qq-com/input-touchscreen-Add-ilitek-touchscreen-driver-support/20251116-215220
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/tencent_995E6FC62EDBC1EED14E6052847F270F6406%40qq.com
patch subject: [PATCH] input: touchscreen: Add ilitek touchscreen driver support
config: riscv-randconfig-r133-20251118 (https://download.01.org/0day-ci/archive/20251118/202511180542.hR4anHLj-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251118/202511180542.hR4anHLj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511180542.hR4anHLj-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:93:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got char const *buf @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:93:38: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:93:38: sparse:     got char const *buf
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:239:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:239:45: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:239:45: sparse:     got unsigned char [usertype] *
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:268:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:268:35: sparse:     expected void [noderef] __user *to
   drivers/input/touchscreen/ilitek/ilitek_tool.c:268:35: sparse:     got unsigned char [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:279:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:279:35: sparse:     expected void [noderef] __user *to
   drivers/input/touchscreen/ilitek/ilitek_tool.c:279:35: sparse:     got unsigned char [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:286:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:286:35: sparse:     expected void [noderef] __user *to
   drivers/input/touchscreen/ilitek/ilitek_tool.c:286:35: sparse:     got unsigned char [usertype] *
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:307:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void [noderef] __user *__p @@     got signed int [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:307:21: sparse:     expected void [noderef] __user *__p
   drivers/input/touchscreen/ilitek/ilitek_tool.c:307:21: sparse:     got signed int [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:312:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:312:45: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:312:45: sparse:     got unsigned char [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:324:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:324:45: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:324:45: sparse:     got unsigned char [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:340:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:340:45: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:340:45: sparse:     got unsigned char [usertype] *
   drivers/input/touchscreen/ilitek/ilitek_tool.c:365:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned char [usertype] * @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:365:35: sparse:     expected void [noderef] __user *to
   drivers/input/touchscreen/ilitek/ilitek_tool.c:365:35: sparse:     got unsigned char [usertype] *
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:416:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got char *buf @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:416:26: sparse:     expected void [noderef] __user *to
   drivers/input/touchscreen/ilitek/ilitek_tool.c:416:26: sparse:     got char *buf
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:444:17: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *read )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:444:17: sparse:     expected int ( *read )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:444:17: sparse:     got int ( * )( ... )
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:445:18: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *write )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:445:18: sparse:     expected int ( *write )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:445:18: sparse:     got int ( * )( ... )
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:457:22: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_read )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:457:22: sparse:     expected int ( *proc_read )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:457:22: sparse:     got int ( * )( ... )
>> drivers/input/touchscreen/ilitek/ilitek_tool.c:458:23: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_write )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:458:23: sparse:     expected int ( *proc_write )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:458:23: sparse:     got int ( * )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:571:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got char const *buf @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:571:37: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:571:37: sparse:     got char const *buf
   drivers/input/touchscreen/ilitek/ilitek_tool.c:610:23: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_write )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:610:23: sparse:     expected int ( *proc_write )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:610:23: sparse:     got int ( * )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:622:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got char const *buf @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:622:33: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:622:33: sparse:     got char const *buf
   drivers/input/touchscreen/ilitek/ilitek_tool.c:684:23: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_write )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:684:23: sparse:     expected int ( *proc_write )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:684:23: sparse:     got int ( * )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:693:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got char const *buf @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:693:36: sparse:     expected void const [noderef] __user *from
   drivers/input/touchscreen/ilitek/ilitek_tool.c:693:36: sparse:     got char const *buf
   drivers/input/touchscreen/ilitek/ilitek_tool.c:731:23: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_write )( ... ) @@     got int ( * )( ... ) @@
   drivers/input/touchscreen/ilitek/ilitek_tool.c:731:23: sparse:     expected int ( *proc_write )( ... )
   drivers/input/touchscreen/ilitek/ilitek_tool.c:731:23: sparse:     got int ( * )( ... )
--
>> drivers/input/touchscreen/ilitek/ilitek_main.c:971:5: sparse: sparse: symbol 'event_spacing' was not declared. Should it be static?
>> drivers/input/touchscreen/ilitek/ilitek_main.c:981:15: sparse: sparse: symbol 'start_event_time_jiffies' was not declared. Should it be static?
>> drivers/input/touchscreen/ilitek/ilitek_main.c:1398:31: sparse: sparse: symbol 'update_cb' was not declared. Should it be static?
>> drivers/input/touchscreen/ilitek/ilitek_main.c:2060:27: sparse: sparse: symbol 'dev_cb' was not declared. Should it be static?
--
>> drivers/input/touchscreen/ilitek/ilitek_protocol.c:37:21: sparse: sparse: symbol 'protocol_maps' was not declared. Should it be static?

vim +93 drivers/input/touchscreen/ilitek/ilitek_tool.c

    78	
    79	static ssize_t ilitek_file_write(struct file *filp,
    80					 const char *buf, size_t size, loff_t *f_pos)
    81	{
    82		s32 ret = 0, count = 0;
    83		u8 buffer[512];
    84		u32 *data;
    85		char *token = NULL, *cur = NULL;
    86	
    87		if (size > sizeof(buffer)) {
    88			TP_ERR(NULL, "invalid buf len: %zu > %zu too large\n",
    89				size, sizeof(buffer));
    90			return -EINVAL;
    91		}
    92	
  > 93		ret = copy_from_user(buffer, buf, size);
    94		if (ret < 0) {
    95			TP_ERR(NULL, "copy data from user space, failed");
    96			return -1;
    97		}
    98	
    99		token = cur = buffer;
   100	
   101		data = kcalloc(size, sizeof(u32), GFP_KERNEL);
   102	
   103		while ((token = strsep(&cur, ",")) != NULL) {
   104			//data[count] = str2hex(token);
   105			sscanf(token, "%x", &data[count]);
   106			TP_MSG(NULL, "data[%d] = %x\n", count, data[count]);
   107			count++;
   108		}
   109	
   110		if (buffer[size - 2] == 'I' && (size == 20 || size == 52) && buffer[0] == 0x77 && buffer[1] == 0x77) {
   111	
   112			TP_MSG(NULL, "IOCTL_WRITE CMD = %d\n", buffer[2]);
   113			switch (buffer[2]) {
   114			case 13:
   115				//ilitek_irq_enable();
   116				TP_MSG(NULL, "ilitek_irq_enable. do nothing\n");
   117				break;
   118			case 12:
   119				//ilitek_irq_disable();
   120				TP_MSG(NULL, "ilitek_irq_disable. do nothing\n");
   121				break;
   122			case 19:
   123				ilitek_reset(ts->dev->reset_time);
   124				break;
   125	#ifdef ILITEK_TUNING_MESSAGE
   126			case 21:
   127				TP_MSG(NULL, "ilitek The ilitek_debug_flag = %d.\n", buffer[3]);
   128				if (buffer[3] == 0) {
   129					ilitek_debug_flag = false;
   130				} else if (buffer[3] == 1) {
   131					ilitek_debug_flag = true;
   132				}
   133				break;
   134	#endif
   135			case 15:
   136				if (buffer[3] == 0)
   137					ilitek_irq_disable();
   138				else
   139					ilitek_irq_enable();
   140	
   141				break;
   142			case 16:
   143				ts->operation_protection = buffer[3];
   144				TP_MSG(NULL, "ts->operation_protection = %d\n", ts->operation_protection);
   145				break;
   146			case 18:
   147				ilitek_irq_disable();
   148				mutex_lock(&ts->ilitek_mutex);
   149				ret = ilitek_write(&buffer[3], 33);
   150				mutex_unlock(&ts->ilitek_mutex);
   151				ilitek_irq_enable();
   152				if (ret < 0)
   153					TP_ERR(NULL, "i2c write error, ret %d\n", ret);
   154	
   155				return ret;
   156				break;
   157			default:
   158				return -1;
   159			}
   160		}
   161	
   162		if (buffer[size - 2] == 'W') {
   163			ilitek_irq_disable();
   164			mutex_lock(&ts->ilitek_mutex);
   165			ret = ilitek_write(buffer, size - 2);
   166			mutex_unlock(&ts->ilitek_mutex);
   167			ilitek_irq_enable();
   168			if (ret < 0) {
   169				TP_ERR(NULL, "i2c write error, ret %d\n", ret);
   170				return ret;
   171			}
   172		} else if (!strncmp(buffer, "unhandle_irq", strlen("unhandle_irq"))) {
   173			ts->unhandle_irq = !ts->unhandle_irq;
   174			TP_MSG(NULL, "ts->unhandle_irq = %d.\n", ts->unhandle_irq);
   175		} else if (!strncmp(buffer, "dbg_pkt", strlen("dbg_pkt"))) {
   176			set_log_level(log_level_pkt);
   177			TP_MSG(NULL, "ilitek_log_level_value = %d.\n", log_level_pkt);
   178		} else if (!strncmp(buffer, "dbg_debug", strlen("dbg_debug"))) {
   179			set_log_level(log_level_dbg);
   180			TP_MSG(NULL, "ilitek_log_level_value = %d.\n", log_level_dbg);
   181		} else if (!strncmp(buffer, "dbg_info", strlen("dbg_info"))) {
   182			set_log_level(log_level_msg);
   183			TP_MSG(NULL, "ilitek_log_level_value = %d.\n", log_level_msg);
   184		} else if (!strncmp(buffer, "dbg_err", strlen("dbg_err"))) {
   185			set_log_level(log_level_err);
   186			TP_MSG(NULL, "ilitek_log_level_value = %d.\n", log_level_err);
   187		} else if (!strncmp(buffer, "dbg_num", strlen("dbg_num"))) {
   188			TP_MSG(NULL, "ilitek_log_level_value = %d.\n", tp_log_level);
   189		}
   190	#ifdef ILITEK_TUNING_MESSAGE
   191		else if (!strncmp(buffer, "truning_dbg_flag", strlen("truning_dbg_flag"))) {
   192			ilitek_debug_flag = !ilitek_debug_flag;
   193			TP_MSG(NULL, " %s debug_flag message(%X).\n", ilitek_debug_flag ? "Enabled" : "Disabled", ilitek_debug_flag);
   194		}
   195	#endif
   196		else if (!strncmp(buffer, "irq_status", strlen("irq_status"))) {
   197			TP_MSG(NULL, "gpio_get_value(i2c.irq_gpio) = %d.\n", gpio_get_value(ts->irq_gpio));
   198		} else if (!strncmp(buffer, "enable", strlen("enable"))) {
   199			ilitek_irq_enable();
   200			TP_MSG(NULL, "irq enable\n");
   201		} else if (!strncmp(buffer, "disable", strlen("disable"))) {
   202			ilitek_irq_disable();
   203			TP_MSG(NULL, "irq disable\n");
   204		} else if (!strncmp(buffer, "info", strlen("info"))) {
   205			ilitek_irq_disable();
   206			mutex_lock(&ts->ilitek_mutex);
   207			api_update_ts_info(ts->dev);
   208			mutex_unlock(&ts->ilitek_mutex);
   209			ilitek_irq_enable();
   210		} else if (!strncmp(buffer, "reset", strlen("reset"))) {
   211			ilitek_reset(ts->dev->reset_time);
   212		}
   213	
   214		TP_DBG(NULL, "ilitek return count = %zu\n", size);
   215		kfree(data);
   216		return size;
   217	}
   218	
   219	static FOPS_IOCTL_FUNC(ilitek_file_ioctl, uint32_t cmd, unsigned long arg)
   220	{
   221		static u8 *buffer;
   222		static unsigned long len;
   223		s32 ret = 0;
   224		int tmp;
   225	
   226		buffer = kmalloc(ILITEK_IOCTL_MAX_TRANSFER, GFP_KERNEL);
   227		memset(buffer, 0, ILITEK_IOCTL_MAX_TRANSFER);
   228	
   229		switch (cmd) {
   230		case ILITEK_IOCTL_I2C_WRITE_DATA:
   231		case ILITEK_IOCTL_I2C_WRITE_DATA_COMPAT:
   232			if (len > ILITEK_IOCTL_MAX_TRANSFER) {
   233				TP_ERR(NULL, "invalid write len: %lu > %lu too large\n",
   234					len, ILITEK_IOCTL_MAX_TRANSFER);
   235				ret = -EINVAL;
   236				break;
   237			}
   238	
 > 239			if (copy_from_user(buffer, (u8 *)arg, len)) {
   240				TP_ERR(NULL, "copy data from user space, failed\n");
   241				ret = -EFAULT;
   242				break;
   243			}
   244	
   245			mutex_lock(&ts->ilitek_mutex);
   246			ret = ilitek_write_and_read(buffer, len, 0, NULL, 0);
   247			mutex_unlock(&ts->ilitek_mutex);
   248			if (ret < 0)
   249				TP_ERR(NULL, "i2c write failed, cmd: %x\n", buffer[0]);
   250			break;
   251		case ILITEK_IOCTL_I2C_READ_DATA:
   252		case ILITEK_IOCTL_I2C_READ_DATA_COMPAT:
   253			if (len > ILITEK_IOCTL_MAX_TRANSFER) {
   254				TP_ERR(NULL, "invalid read len: %lu > %lu too large\n",
   255					len, ILITEK_IOCTL_MAX_TRANSFER);
   256				ret = -EINVAL;
   257				break;
   258			}
   259	
   260			mutex_lock(&ts->ilitek_mutex);
   261			ret = ilitek_write_and_read(NULL, 0, 0, buffer, len);
   262			mutex_unlock(&ts->ilitek_mutex);
   263			if (ret < 0) {
   264				TP_ERR(NULL, "i2c read failed, buf: %x\n", buffer[0]);
   265				break;
   266			}
   267	
 > 268			if (copy_to_user((u8 *)arg, buffer, len)) {
   269				ret = -EFAULT;
   270				TP_ERR(NULL, "copy data to user space, failed\n");
   271			}
   272			break;
   273		case ILITEK_IOCTL_I2C_WRITE_LENGTH:
   274		case ILITEK_IOCTL_I2C_READ_LENGTH:
   275			len = arg;
   276			break;
   277		case ILITEK_IOCTL_DRIVER_INFORMATION:
   278			memcpy(buffer, driver_ver, 7);
   279			if (copy_to_user((u8 *)arg, buffer, 7))
   280				ret = -EFAULT;
   281			break;
   282		case ILITEK_IOCTL_I2C_UPDATE:
   283			break;
   284		case ILITEK_IOCTL_I2C_INT_FLAG:
   285			buffer[0] = !(gpio_get_value(ts->irq_gpio));
   286			if (copy_to_user((u8 *)arg, buffer, 1)) {
   287				TP_ERR(NULL, "copy data to user space, failed\n");
   288				ret = -EFAULT;
   289				break;
   290			}
   291			TP_DBG(NULL, "ILITEK_IOCTL_I2C_INT_FLAG = %d.\n", buffer[0]);
   292			break;
   293		case ILITEK_IOCTL_START_READ_DATA:
   294			ilitek_irq_enable();
   295			ts->unhandle_irq = false;
   296			TP_MSG(NULL, "enable_irq and ts->unhandle_irq = false.\n");
   297			break;
   298		case ILITEK_IOCTL_STOP_READ_DATA:
   299			ilitek_irq_disable();
   300			ts->unhandle_irq = true;
   301			TP_MSG(NULL, "disable_irq and ts->unhandle_irq = true.\n");
   302			break;
   303		case ILITEK_IOCTL_RESET:
   304			ilitek_reset(ts->dev->reset_time);
   305			break;
   306		case ILITEK_IOCTL_INT_STATUS:
   307			if (put_user(gpio_get_value(ts->irq_gpio), (s32 *)arg))
   308				ret = -EFAULT;
   309			break;
   310	#ifdef ILITEK_TUNING_MESSAGE
   311		case ILITEK_IOCTL_DEBUG_SWITCH:
   312			if (copy_from_user(buffer, (u8 *)arg, 1)) {
   313				ret = -EFAULT;
   314				break;
   315			}
   316			TP_MSG(NULL, "ilitek The debug_flag = %d.\n", buffer[0]);
   317			if (buffer[0] == 0)
   318				ilitek_debug_flag = false;
   319			else if (buffer[0] == 1)
   320				ilitek_debug_flag = true;
   321			break;
   322	#endif
   323		case ILITEK_IOCTL_I2C_SWITCH_IRQ:
   324			if (copy_from_user(buffer, (u8 *)arg, 1)) {
   325				ret = -EFAULT;
   326				break;
   327			}
   328	
   329			if (buffer[0] == 0)
   330				ilitek_irq_disable();
   331			else
   332				ilitek_irq_enable();
   333	
   334			break;
   335		case ILITEK_IOCTL_UPDATE_FLAG:
   336			ts->operation_protection = arg;
   337			TP_MSG(NULL, "operation_protection = %d\n", ts->operation_protection);
   338			break;
   339		case ILITEK_IOCTL_I2C_UPDATE_FW:
   340			if (copy_from_user(buffer, (u8 *)arg, 35)) {
   341				TP_ERR(NULL, "copy data from user space, failed\n");
   342				ret = -EFAULT;
   343				break;
   344			}
   345	
   346			ilitek_irq_disable();
   347			mutex_lock(&ts->ilitek_mutex);
   348			ret = ilitek_write_and_read(buffer, buffer[34], 0, NULL, 0);
   349			mutex_unlock(&ts->ilitek_mutex);
   350			ilitek_irq_enable();
   351	
   352			if (ret < 0)
   353				TP_ERR(NULL, "i2c write, failed\n");
   354	
   355			break;
   356		case ILITEK_IOCTL_I2C_INT_CLR:
   357			TP_DBG(NULL, "ILITEK_IOCTL_I2C_INT_CLR, set get_INT false\n");
   358			atomic_set(&ts->get_INT, 0);
   359			break;
   360		case ILITEK_IOCTL_I2C_INT_POLL:
   361		case ILITEK_IOCTL_I2C_INT_POLL_COMPAT:
   362			tmp = atomic_read(&ts->get_INT);
   363			TP_DBG(NULL, "ILITEK_IOCTL_I2C_INT_POLL, get_INT: %d\n", tmp);
   364	
   365			if (copy_to_user((u8 *)arg, &tmp, 1)) {
   366				TP_ERR(NULL, "copy data to user space, failed\n");
   367				ret = -EFAULT;
   368			}
   369			break;
   370		case ILITEK_IOCTL_I2C_ISR_TYPE:
   371			TP_MSG(NULL, "ILITEK_IOCTL_I2C_ISR_TYPE, set ISR type: %lu\n", arg);
   372			ts->irq_handle_type = (arg >> 16);
   373			ts->irq_read_len = arg & 0xFFFF;
   374			break;
   375		case ILITEK_IOCTL_I2C_NETLINK:
   376			TP_MSG(NULL, "ILITEK_IOCTL_I2C_NETLINK, set netlink: %s with ETH: %hhu\n",
   377				(arg >> 8) ? "ON" : "OFF", (u8)(arg & 0xFF));
   378	
   379			if (arg >> 8)
   380				ret = ilitek_netlink_init(arg & 0xFF);
   381			else
   382				ilitek_netlink_exit();
   383	
   384			break;
   385		default:
   386			TP_ERR(NULL, "unrecognized ioctl cmd: 0x%04x\n", cmd);
   387			ret = -EINVAL;
   388			break;
   389		}
   390	
   391		kfree(buffer);
   392		return (ret < 0) ? ret : 0;
   393	}
   394	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ