Re: [PATCH v2] include/linux/kfifo.h: fix some IDEs Intelligence errors and the previous patch was misnamed

From: kernel test robot
Date: Tue Oct 08 2024 - 07:50:45 EST


Hi Xiaofeng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc2 next-20241008]
[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/Xiaofeng-Lian/include-linux-kfifo-h-fix-some-IDEs-Intelligence-errors-and-the-previous-patch-was-misnamed/20241006-015547
base: linus/master
patch link: https://lore.kernel.org/r/20241002172427.412715-1-1198715581lxf%40gmail.com
patch subject: [PATCH v2] include/linux/kfifo.h: fix some IDEs Intelligence errors and the previous patch was misnamed
config: i386-randconfig-012-20241008 (https://download.01.org/0day-ci/archive/20241008/202410081934.6u1I94gw-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241008/202410081934.6u1I94gw-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410081934.6u1I94gw-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:79:24: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:61:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
61 | datatype *type; \
| ^~~~~~~~
>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:79:24: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:62:9: note: expanded from macro '__STRUCT_KFIFO_COMMON'
62 | const datatype *const_type; \
| ^~~~~~~~
>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:37: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:79:39: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
include/linux/kfifo.h:64:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
64 | ptrtype *ptr; \
| ^~~~~~~
>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:37: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:79:39: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
include/linux/kfifo.h:65:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
65 | ptrtype const *ptr_const; \
| ^~~~~~~
>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
include/linux/kfifo.h:116:56: note: expanded from macro 'DECLARE_KFIFO_PTR'
116 | #define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
| ~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:80:2: note: expanded from macro '__STRUCT_KFIFO_PTR'
80 | type buf[0]; \
| ^~~~
>> drivers/greybus/es2.c:1282:2: error: member reference base type 'char' is not a structure or union
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:139:52: note: expanded from macro '__KFIFO_SIZE'
139 | (sizeof(*(fifo)) - sizeof(__tmp_kfifo)) / sizeof(get_kfifo_data_type(fifo));\
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ~~~~~~^ ~~~~
>> drivers/greybus/es2.c:1282:2: error: invalid operands to binary expression ('void' and 'int')
1282 | INIT_KFIFO(es2->apb_log_fifo);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:71: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
7 errors generated.


vim +/char +1282 drivers/greybus/es2.c

24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1237
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1238 /*
4d5c446b53655d drivers/staging/greybus/es2.c Johan Hovold 2015-11-02 1239 * The ES2 USB Bridge device has 15 endpoints
4d5c446b53655d drivers/staging/greybus/es2.c Johan Hovold 2015-11-02 1240 * 1 Control - usual USB stuff + AP -> APBridgeA messages
4d5c446b53655d drivers/staging/greybus/es2.c Johan Hovold 2015-11-02 1241 * 7 Bulk IN - CPort data in
4d5c446b53655d drivers/staging/greybus/es2.c Johan Hovold 2015-11-02 1242 * 7 Bulk OUT - CPort data out
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1243 */
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1244 static int ap_probe(struct usb_interface *interface,
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1245 const struct usb_device_id *id)
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1246 {
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1247 struct es2_ap_dev *es2;
2537636abae5b8 drivers/staging/greybus/es2.c Johan Hovold 2015-11-03 1248 struct gb_host_device *hd;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1249 struct usb_device *udev;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1250 struct usb_host_interface *iface_desc;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1251 struct usb_endpoint_descriptor *endpoint;
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1252 __u8 ep_addr;
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1253 int retval;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1254 int i;
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1255 int num_cports;
403074b50b66f1 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1256 bool bulk_out_found = false;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1257 bool bulk_in_found = false;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1258 bool arpc_in_found = false;
4bc1389de9fcaa drivers/staging/greybus/es2.c Alex Elder 2015-06-13 1259
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1260 udev = usb_get_dev(interface_to_usbdev(interface));
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1261
3be0e17d62d5a9 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1262 num_cports = apb_get_cport_count(udev);
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1263 if (num_cports < 0) {
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1264 usb_put_dev(udev);
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1265 dev_err(&udev->dev, "Cannot retrieve CPort count: %d\n",
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1266 num_cports);
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1267 return num_cports;
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1268 }
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1269
d6e139bc15118c drivers/staging/greybus/es2.c Johan Hovold 2015-11-03 1270 hd = gb_hd_create(&es2_driver, &udev->dev, ES2_GBUF_MSG_SIZE_MAX,
24a6112fa53e8a drivers/staging/greybus/es2.c Fabien Parent 2015-09-02 1271 num_cports);
8ea70fe0497c5d drivers/staging/greybus/es2.c Alex Elder 2015-05-22 1272 if (IS_ERR(hd)) {
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1273 usb_put_dev(udev);
8ea70fe0497c5d drivers/staging/greybus/es2.c Alex Elder 2015-05-22 1274 return PTR_ERR(hd);
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1275 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1276
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1277 es2 = hd_to_es2(hd);
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1278 es2->hd = hd;
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1279 es2->usb_intf = interface;
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1280 es2->usb_dev = udev;
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1281 spin_lock_init(&es2->cport_out_urb_lock);
3be0e17d62d5a9 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 @1282 INIT_KFIFO(es2->apb_log_fifo);
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1283 usb_set_intfdata(interface, es2);
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1284
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1285 /*
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1286 * Reserve the CDSI0 and CDSI1 CPorts so they won't be allocated
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1287 * dynamically.
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1288 */
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1289 retval = gb_hd_cport_reserve(hd, ES2_CPORT_CDSI0);
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1290 if (retval)
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1291 goto error;
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1292 retval = gb_hd_cport_reserve(hd, ES2_CPORT_CDSI1);
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1293 if (retval)
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1294 goto error;
050615076699e5 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1295
4d5c446b53655d drivers/staging/greybus/es2.c Johan Hovold 2015-11-02 1296 /* find all bulk endpoints */
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1297 iface_desc = interface->cur_altsetting;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1298 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1299 endpoint = &iface_desc->endpoint[i].desc;
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1300 ep_addr = endpoint->bEndpointAddress;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1301
b767ee402070ce drivers/staging/greybus/es2.c Greg Kroah-Hartman 2015-07-24 1302 if (usb_endpoint_is_bulk_in(endpoint)) {
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1303 if (!bulk_in_found) {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1304 es2->cport_in.endpoint = ep_addr;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1305 bulk_in_found = true;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1306 } else if (!arpc_in_found) {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1307 es2->arpc_endpoint_in = ep_addr;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1308 arpc_in_found = true;
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1309 } else {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1310 dev_warn(&udev->dev,
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1311 "Unused bulk IN endpoint found: 0x%02x\n",
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1312 ep_addr);
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1313 }
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1314 continue;
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1315 }
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1316 if (usb_endpoint_is_bulk_out(endpoint)) {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1317 if (!bulk_out_found) {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1318 es2->cport_out_endpoint = ep_addr;
403074b50b66f1 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1319 bulk_out_found = true;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1320 } else {
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1321 dev_warn(&udev->dev,
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1322 "Unused bulk OUT endpoint found: 0x%02x\n",
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1323 ep_addr);
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1324 }
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1325 continue;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1326 }
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1327 dev_warn(&udev->dev,
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1328 "Unknown endpoint type found, address 0x%02x\n",
272291008fc55e drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1329 ep_addr);
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1330 }
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1331 if (!bulk_in_found || !arpc_in_found || !bulk_out_found) {
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1332 dev_err(&udev->dev, "Not enough endpoints found in device, aborting!\n");
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1333 retval = -ENODEV;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1334 goto error;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1335 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1336
0ce68ce41779c3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1337 /* Allocate buffers for our cport in messages */
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1338 for (i = 0; i < NUM_CPORT_IN_URB; ++i) {
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1339 struct urb *urb;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1340 u8 *buffer;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1341
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1342 urb = usb_alloc_urb(0, GFP_KERNEL);
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1343 if (!urb) {
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1344 retval = -ENOMEM;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1345 goto error;
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1346 }
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1347 es2->cport_in.urb[i] = urb;
5f62eab04ab7d7 drivers/staging/greybus/es2.c Johan Hovold 2016-08-17 1348
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1349 buffer = kmalloc(ES2_GBUF_MSG_SIZE_MAX, GFP_KERNEL);
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1350 if (!buffer) {
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1351 retval = -ENOMEM;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1352 goto error;
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1353 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1354
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1355 usb_fill_bulk_urb(urb, udev,
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1356 usb_rcvbulkpipe(udev, es2->cport_in.endpoint),
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1357 buffer, ES2_GBUF_MSG_SIZE_MAX,
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1358 cport_in_callback, hd);
5f62eab04ab7d7 drivers/staging/greybus/es2.c Johan Hovold 2016-08-17 1359
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1360 es2->cport_in.buffer[i] = buffer;
606addd2847ccc drivers/staging/greybus/es2.c Alexandre Bailon 2015-06-15 1361 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1362
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1363 /* Allocate buffers for ARPC in messages */
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1364 for (i = 0; i < NUM_ARPC_IN_URB; ++i) {
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1365 struct urb *urb;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1366 u8 *buffer;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1367
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1368 urb = usb_alloc_urb(0, GFP_KERNEL);
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1369 if (!urb) {
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1370 retval = -ENOMEM;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1371 goto error;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1372 }
5f62eab04ab7d7 drivers/staging/greybus/es2.c Johan Hovold 2016-08-17 1373 es2->arpc_urb[i] = urb;
5f62eab04ab7d7 drivers/staging/greybus/es2.c Johan Hovold 2016-08-17 1374
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1375 buffer = kmalloc(ARPC_IN_SIZE_MAX, GFP_KERNEL);
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1376 if (!buffer) {
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1377 retval = -ENOMEM;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1378 goto error;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1379 }
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1380
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1381 usb_fill_bulk_urb(urb, udev,
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1382 usb_rcvbulkpipe(udev,
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1383 es2->arpc_endpoint_in),
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1384 buffer, ARPC_IN_SIZE_MAX,
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1385 arpc_in_callback, es2);
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1386
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1387 es2->arpc_buffer[i] = buffer;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1388 }
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1389
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1390 /* Allocate urbs for our CPort OUT messages */
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1391 for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1392 struct urb *urb;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1393
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1394 urb = usb_alloc_urb(0, GFP_KERNEL);
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1395 if (!urb) {
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1396 retval = -ENOMEM;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1397 goto error;
be5d01f10bdb78 drivers/staging/greybus/es2.c Johan Hovold 2016-05-11 1398 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1399
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1400 es2->cport_out_urb[i] = urb;
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1401 es2->cport_out_urb_busy[i] = false; /* just to be anal */
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1402 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1403
3be0e17d62d5a9 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1404 /* XXX We will need to rename this per APB */
3be0e17d62d5a9 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1405 es2->apb_log_enable_dentry = debugfs_create_file("apb_log_enable",
563a8412c563cd drivers/staging/greybus/es2.c Gioh Kim 2017-02-09 1406 0644,
4b1d82047ebbb1 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1407 gb_debugfs_get(), es2,
3be0e17d62d5a9 drivers/staging/greybus/es2.c Alex Elder 2015-10-27 1408 &apb_log_enable_fops);
0ce68ce41779c3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1409
c14118a8411c4d drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1410 INIT_LIST_HEAD(&es2->arpcs);
c14118a8411c4d drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1411 spin_lock_init(&es2->arpc_lock);
c14118a8411c4d drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1412
1305f2b2f52af5 drivers/staging/greybus/es2.c Wei Yongjun 2016-10-19 1413 retval = es2_arpc_in_enable(es2);
1305f2b2f52af5 drivers/staging/greybus/es2.c Wei Yongjun 2016-10-19 1414 if (retval)
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1415 goto error;
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1416
c1700479845bc3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1417 retval = gb_hd_add(hd);
c1700479845bc3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1418 if (retval)
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1419 goto err_disable_arpc_in;
c1700479845bc3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1420
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1421 retval = es2_cport_in_enable(es2, &es2->cport_in);
0ce68ce41779c3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1422 if (retval)
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1423 goto err_hd_del;
0ce68ce41779c3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1424
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1425 return 0;
57bc17ffc566de drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1426
7330c48ec09367 drivers/staging/greybus/es2.c Greg Kroah-Hartman 2016-08-17 1427 err_hd_del:
c1700479845bc3 drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1428 gb_hd_del(hd);
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1429 err_disable_arpc_in:
9d9d3777a9db5c drivers/staging/greybus/es2.c Alexandre Bailon 2016-07-07 1430 es2_arpc_in_disable(es2);
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1431 error:
57bc17ffc566de drivers/staging/greybus/es2.c Johan Hovold 2015-11-04 1432 es2_destroy(es2);
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1433
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1434 return retval;
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1435 }
f587027e793cf8 drivers/staging/greybus/gb-es2.c Greg Kroah-Hartman 2015-01-21 1436

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