[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202007101458.W0AEMevq%lkp@intel.com>
Date: Fri, 10 Jul 2020 14:04:02 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/usb/class/usbtmc.c:498:22: sparse: sparse: incorrect type in
initializer (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 3 weeks ago
config: openrisc-randconfig-s031-20200710 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-37-gc9676a3b-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/usb/class/usbtmc.c:498:22: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char *__pu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:498:22: sparse: expected unsigned char *__pu_addr
>> drivers/usb/class/usbtmc.c:498:22: sparse: got unsigned char [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:556:14: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char *__pu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:556:14: sparse: expected unsigned char *__pu_addr
drivers/usb/class/usbtmc.c:556:14: sparse: got unsigned char [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:584:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user *arg @@
drivers/usb/class/usbtmc.c:584:13: sparse: expected unsigned int const *__gu_addr
drivers/usb/class/usbtmc.c:584:13: sparse: got unsigned int [noderef] [usertype] __user *arg
>> drivers/usb/class/usbtmc.c:1033:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] __user * @@
drivers/usb/class/usbtmc.c:1033:13: sparse: expected unsigned int *__pu_addr
>> drivers/usb/class/usbtmc.c:1033:13: sparse: got unsigned int [noderef] __user *
drivers/usb/class/usbtmc.c:1244:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] __user * @@
drivers/usb/class/usbtmc.c:1244:13: sparse: expected unsigned int *__pu_addr
drivers/usb/class/usbtmc.c:1244:13: sparse: got unsigned int [noderef] __user *
>> drivers/usb/class/usbtmc.c:1265:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:1265:13: sparse: expected unsigned int *__pu_addr
drivers/usb/class/usbtmc.c:1265:13: sparse: got unsigned int [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:1952:16: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:1952:16: sparse: expected unsigned int *__pu_addr
drivers/usb/class/usbtmc.c:1952:16: sparse: got unsigned int [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:1963:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:1963:13: sparse: expected unsigned int const *__gu_addr
drivers/usb/class/usbtmc.c:1963:13: sparse: got unsigned int [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:2099:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:2099:26: sparse: expected unsigned int *__pu_addr
drivers/usb/class/usbtmc.c:2099:26: sparse: got unsigned int [noderef] [usertype] __user *
>> drivers/usb/class/usbtmc.c:2104:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char *__pu_addr @@ got unsigned char [noderef] __user * @@
drivers/usb/class/usbtmc.c:2104:26: sparse: expected unsigned char *__pu_addr
drivers/usb/class/usbtmc.c:2104:26: sparse: got unsigned char [noderef] __user *
drivers/usb/class/usbtmc.c:2138:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char *__pu_addr @@ got unsigned char [noderef] [usertype] __user * @@
drivers/usb/class/usbtmc.c:2138:26: sparse: expected unsigned char *__pu_addr
drivers/usb/class/usbtmc.c:2138:26: sparse: got unsigned char [noderef] [usertype] __user *
drivers/usb/class/usbtmc.c:2143:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef] __user * @@
drivers/usb/class/usbtmc.c:2143:26: sparse: expected unsigned char const *__gu_addr
drivers/usb/class/usbtmc.c:2143:26: sparse: got unsigned char [noderef] __user *
arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
--
>> drivers/hid/hid-roccat.c:393:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int *__pu_addr @@ got int [noderef] __user * @@
drivers/hid/hid-roccat.c:393:21: sparse: expected int *__pu_addr
>> drivers/hid/hid-roccat.c:393:21: sparse: got int [noderef] __user *
include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *to @@ got void [noderef] __user *to @@
include/linux/uaccess.h:131:38: sparse: expected void *to
include/linux/uaccess.h:131:38: sparse: got void [noderef] __user *to
include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got void const *from @@
include/linux/uaccess.h:131:42: sparse: expected void const [noderef] __user *from
include/linux/uaccess.h:131:42: sparse: got void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void const [noderef] __user *from @@
arch/openrisc/include/asm/uaccess.h:246:55: sparse: expected void const *from
arch/openrisc/include/asm/uaccess.h:246:55: sparse: got void const [noderef] __user *from
--
>> drivers/clk/clk-hsdk-pll.c:415:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *spec_regs @@
drivers/clk/clk-hsdk-pll.c:415:24: sparse: expected void *addr
>> drivers/clk/clk-hsdk-pll.c:415:24: sparse: got void [noderef] __iomem *spec_regs
>> drivers/clk/clk-hsdk-pll.c:417:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *regs @@
drivers/clk/clk-hsdk-pll.c:417:24: sparse: expected void *addr
>> drivers/clk/clk-hsdk-pll.c:417:24: sparse: got void [noderef] __iomem *regs
--
>> drivers/tty/serial/altera_uart.c:628:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got unsigned char [noderef] __iomem *membase @@
drivers/tty/serial/altera_uart.c:628:29: sparse: expected void *addr
>> drivers/tty/serial/altera_uart.c:628:29: sparse: got unsigned char [noderef] __iomem *membase
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
--
>> drivers/tty/serial/xilinx_uartps.c:988:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got unsigned char [noderef] __iomem *membase @@
drivers/tty/serial/xilinx_uartps.c:988:21: sparse: expected void *addr
>> drivers/tty/serial/xilinx_uartps.c:988:21: sparse: got unsigned char [noderef] __iomem *membase
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
drivers/tty/serial/xilinx_uartps.c:553:33: sparse: sparse: context imbalance in 'cdns_uart_clk_notifier_cb' - different lock contexts for basic block
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
vim +498 drivers/usb/class/usbtmc.c
0e59088e7ff7ae Guido Kiener 2018-09-12 477
4f3c8d6eddc272 Guido Kiener 2018-07-18 478 static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 479 void __user *arg)
dbf3e7f654c0f0 Dave Penkler 2016-01-27 480 {
4f3c8d6eddc272 Guido Kiener 2018-07-18 481 struct usbtmc_device_data *data = file_data->data;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 482 struct device *dev = &data->intf->dev;
4f3c8d6eddc272 Guido Kiener 2018-07-18 483 int srq_asserted = 0;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 484 u8 *buffer;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 485 u8 tag;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 486 __u8 stb;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 487 int rv;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 488
dbf3e7f654c0f0 Dave Penkler 2016-01-27 489 dev_dbg(dev, "Enter ioctl_read_stb iin_ep_present: %d\n",
dbf3e7f654c0f0 Dave Penkler 2016-01-27 490 data->iin_ep_present);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 491
4f3c8d6eddc272 Guido Kiener 2018-07-18 492 spin_lock_irq(&data->dev_lock);
4f3c8d6eddc272 Guido Kiener 2018-07-18 493 srq_asserted = atomic_xchg(&file_data->srq_asserted, srq_asserted);
4f3c8d6eddc272 Guido Kiener 2018-07-18 494 if (srq_asserted) {
4f3c8d6eddc272 Guido Kiener 2018-07-18 495 /* a STB with SRQ is already received */
4f3c8d6eddc272 Guido Kiener 2018-07-18 496 stb = file_data->srq_byte;
4f3c8d6eddc272 Guido Kiener 2018-07-18 497 spin_unlock_irq(&data->dev_lock);
4f3c8d6eddc272 Guido Kiener 2018-07-18 @498 rv = put_user(stb, (__u8 __user *)arg);
4f3c8d6eddc272 Guido Kiener 2018-07-18 499 dev_dbg(dev, "stb:0x%02x with srq received %d\n",
4f3c8d6eddc272 Guido Kiener 2018-07-18 500 (unsigned int)stb, rv);
4f3c8d6eddc272 Guido Kiener 2018-07-18 501 return rv;
4f3c8d6eddc272 Guido Kiener 2018-07-18 502 }
4f3c8d6eddc272 Guido Kiener 2018-07-18 503 spin_unlock_irq(&data->dev_lock);
4f3c8d6eddc272 Guido Kiener 2018-07-18 504
dbf3e7f654c0f0 Dave Penkler 2016-01-27 505 buffer = kmalloc(8, GFP_KERNEL);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 506 if (!buffer)
dbf3e7f654c0f0 Dave Penkler 2016-01-27 507 return -ENOMEM;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 508
dbf3e7f654c0f0 Dave Penkler 2016-01-27 509 atomic_set(&data->iin_data_valid, 0);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 510
dbf3e7f654c0f0 Dave Penkler 2016-01-27 511 rv = usb_control_msg(data->usb_dev,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 512 usb_rcvctrlpipe(data->usb_dev, 0),
dbf3e7f654c0f0 Dave Penkler 2016-01-27 513 USBTMC488_REQUEST_READ_STATUS_BYTE,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 514 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 515 data->iin_bTag,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 516 data->ifnum,
63c97bbad5ae5e Guido Kiener 2018-09-12 517 buffer, 0x03, USB_CTRL_GET_TIMEOUT);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 518 if (rv < 0) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 519 dev_err(dev, "stb usb_control_msg returned %d\n", rv);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 520 goto exit;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 521 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 522
dbf3e7f654c0f0 Dave Penkler 2016-01-27 523 if (buffer[0] != USBTMC_STATUS_SUCCESS) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 524 dev_err(dev, "control status returned %x\n", buffer[0]);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 525 rv = -EIO;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 526 goto exit;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 527 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 528
dbf3e7f654c0f0 Dave Penkler 2016-01-27 529 if (data->iin_ep_present) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 530 rv = wait_event_interruptible_timeout(
dbf3e7f654c0f0 Dave Penkler 2016-01-27 531 data->waitq,
dbf3e7f654c0f0 Dave Penkler 2016-01-27 532 atomic_read(&data->iin_data_valid) != 0,
048c6d88a02147 Guido Kiener 2018-07-18 533 file_data->timeout);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 534 if (rv < 0) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 535 dev_dbg(dev, "wait interrupted %d\n", rv);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 536 goto exit;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 537 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 538
dbf3e7f654c0f0 Dave Penkler 2016-01-27 539 if (rv == 0) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 540 dev_dbg(dev, "wait timed out\n");
19e6c57e96169c Guido Kiener 2018-07-18 541 rv = -ETIMEDOUT;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 542 goto exit;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 543 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 544
dbf3e7f654c0f0 Dave Penkler 2016-01-27 545 tag = data->bNotify1 & 0x7f;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 546 if (tag != data->iin_bTag) {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 547 dev_err(dev, "expected bTag %x got %x\n",
dbf3e7f654c0f0 Dave Penkler 2016-01-27 548 data->iin_bTag, tag);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 549 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 550
dbf3e7f654c0f0 Dave Penkler 2016-01-27 551 stb = data->bNotify2;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 552 } else {
dbf3e7f654c0f0 Dave Penkler 2016-01-27 553 stb = buffer[2];
dbf3e7f654c0f0 Dave Penkler 2016-01-27 554 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 555
4f3c8d6eddc272 Guido Kiener 2018-07-18 556 rv = put_user(stb, (__u8 __user *)arg);
4f3c8d6eddc272 Guido Kiener 2018-07-18 557 dev_dbg(dev, "stb:0x%02x received %d\n", (unsigned int)stb, rv);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 558
dbf3e7f654c0f0 Dave Penkler 2016-01-27 559 exit:
dbf3e7f654c0f0 Dave Penkler 2016-01-27 560 /* bump interrupt bTag */
dbf3e7f654c0f0 Dave Penkler 2016-01-27 561 data->iin_bTag += 1;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 562 if (data->iin_bTag > 127)
dbf3e7f654c0f0 Dave Penkler 2016-01-27 563 /* 1 is for SRQ see USBTMC-USB488 subclass spec section 4.3.1 */
dbf3e7f654c0f0 Dave Penkler 2016-01-27 564 data->iin_bTag = 2;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 565
dbf3e7f654c0f0 Dave Penkler 2016-01-27 566 kfree(buffer);
dbf3e7f654c0f0 Dave Penkler 2016-01-27 567 return rv;
dbf3e7f654c0f0 Dave Penkler 2016-01-27 568 }
dbf3e7f654c0f0 Dave Penkler 2016-01-27 569
739240a9f6ac4d Guido Kiener 2018-09-12 570 static int usbtmc488_ioctl_wait_srq(struct usbtmc_file_data *file_data,
739240a9f6ac4d Guido Kiener 2018-09-12 571 __u32 __user *arg)
739240a9f6ac4d Guido Kiener 2018-09-12 572 {
739240a9f6ac4d Guido Kiener 2018-09-12 573 struct usbtmc_device_data *data = file_data->data;
739240a9f6ac4d Guido Kiener 2018-09-12 574 struct device *dev = &data->intf->dev;
739240a9f6ac4d Guido Kiener 2018-09-12 575 int rv;
739240a9f6ac4d Guido Kiener 2018-09-12 576 u32 timeout;
739240a9f6ac4d Guido Kiener 2018-09-12 577 unsigned long expire;
739240a9f6ac4d Guido Kiener 2018-09-12 578
739240a9f6ac4d Guido Kiener 2018-09-12 579 if (!data->iin_ep_present) {
739240a9f6ac4d Guido Kiener 2018-09-12 580 dev_dbg(dev, "no interrupt endpoint present\n");
739240a9f6ac4d Guido Kiener 2018-09-12 581 return -EFAULT;
739240a9f6ac4d Guido Kiener 2018-09-12 582 }
739240a9f6ac4d Guido Kiener 2018-09-12 583
739240a9f6ac4d Guido Kiener 2018-09-12 @584 if (get_user(timeout, arg))
739240a9f6ac4d Guido Kiener 2018-09-12 585 return -EFAULT;
739240a9f6ac4d Guido Kiener 2018-09-12 586
739240a9f6ac4d Guido Kiener 2018-09-12 587 expire = msecs_to_jiffies(timeout);
739240a9f6ac4d Guido Kiener 2018-09-12 588
739240a9f6ac4d Guido Kiener 2018-09-12 589 mutex_unlock(&data->io_mutex);
739240a9f6ac4d Guido Kiener 2018-09-12 590
739240a9f6ac4d Guido Kiener 2018-09-12 591 rv = wait_event_interruptible_timeout(
739240a9f6ac4d Guido Kiener 2018-09-12 592 data->waitq,
739240a9f6ac4d Guido Kiener 2018-09-12 593 atomic_read(&file_data->srq_asserted) != 0 ||
739240a9f6ac4d Guido Kiener 2018-09-12 594 atomic_read(&file_data->closing),
739240a9f6ac4d Guido Kiener 2018-09-12 595 expire);
739240a9f6ac4d Guido Kiener 2018-09-12 596
739240a9f6ac4d Guido Kiener 2018-09-12 597 mutex_lock(&data->io_mutex);
739240a9f6ac4d Guido Kiener 2018-09-12 598
739240a9f6ac4d Guido Kiener 2018-09-12 599 /* Note! disconnect or close could be called in the meantime */
739240a9f6ac4d Guido Kiener 2018-09-12 600 if (atomic_read(&file_data->closing) || data->zombie)
739240a9f6ac4d Guido Kiener 2018-09-12 601 rv = -ENODEV;
739240a9f6ac4d Guido Kiener 2018-09-12 602
739240a9f6ac4d Guido Kiener 2018-09-12 603 if (rv < 0) {
739240a9f6ac4d Guido Kiener 2018-09-12 604 /* dev can be invalid now! */
739240a9f6ac4d Guido Kiener 2018-09-12 605 pr_debug("%s - wait interrupted %d\n", __func__, rv);
739240a9f6ac4d Guido Kiener 2018-09-12 606 return rv;
739240a9f6ac4d Guido Kiener 2018-09-12 607 }
739240a9f6ac4d Guido Kiener 2018-09-12 608
739240a9f6ac4d Guido Kiener 2018-09-12 609 if (rv == 0) {
739240a9f6ac4d Guido Kiener 2018-09-12 610 dev_dbg(dev, "%s - wait timed out\n", __func__);
739240a9f6ac4d Guido Kiener 2018-09-12 611 return -ETIMEDOUT;
739240a9f6ac4d Guido Kiener 2018-09-12 612 }
739240a9f6ac4d Guido Kiener 2018-09-12 613
739240a9f6ac4d Guido Kiener 2018-09-12 614 dev_dbg(dev, "%s - srq asserted\n", __func__);
739240a9f6ac4d Guido Kiener 2018-09-12 615 return 0;
739240a9f6ac4d Guido Kiener 2018-09-12 616 }
739240a9f6ac4d Guido Kiener 2018-09-12 617
:::::: The code at line 498 was first introduced by commit
:::::: 4f3c8d6eddc272b386464524235440a418ed2029 usb: usbtmc: Support Read Status Byte with SRQ per file
:::::: TO: Guido Kiener <guido@...ner-muenchen.de>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (25521 bytes)
Powered by blists - more mailing lists