Message ID | 20230930123449.1170359-1-singhabhinav9051571833@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fixed documentation warning about duplicate symbol | expand |
On Sat, Sep 30, 2023 at 06:04:49PM +0530, Abhinav wrote: > Compiling the documentation in html gives a warning about duplicate symbol > because same name is used for function usb_string(...) and > also for the struct usb_string.Also having a different name can > be helpful while searching or debugging the code. > > Renaming the function usb_string(...) to utf16le_to_utf8(...) fixes > this warning.Reason for choosing this name because > this is what the function description says it is doing. Odd trailing spaces, why? Anyway, sorry, but that's a horrible function name for a usb core function, especially just for a documentation warning? Surely the documentation tools can determine the difference between a structure name and a function name? This can't be the only place this has ever happened, right? Try fixing the documentation tools instead? thanks, greg k-h
Hi Abhinav,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus johan-usb-serial/usb-next johan-usb-serial/usb-linus hid/for-next linus/master v6.6-rc3 next-20230929]
[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/Abhinav/fixed-documentation-warning-about-duplicate-symbol/20230930-203554
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20230930123449.1170359-1-singhabhinav9051571833%40gmail.com
patch subject: [PATCH] fixed documentation warning about duplicate symbol
config: sh-defconfig (https://download.01.org/0day-ci/archive/20230930/202309302312.Sk9H9aNZ-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230930/202309302312.Sk9H9aNZ-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309302312.Sk9H9aNZ-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/hid/usbhid/hid-core.c: In function 'usbhid_probe':
>> drivers/hid/usbhid/hid-core.c:1409:13: error: implicit declaration of function 'usb_string' [-Werror=implicit-function-declaration]
1409 | if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0)
| ^~~~~~~~~~
cc1: some warnings being treated as errors
vim +/usb_string +1409 drivers/hid/usbhid/hid-core.c
8c3e24065e3d37 drivers/hid/usbhid/hid-core.c Thomas Weißschuh 2022-12-22 1341
c4c259bcc27c42 drivers/hid/usbhid/hid-core.c Jiri Kosina 2009-09-15 1342 static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1343 {
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1344 struct usb_host_interface *interface = intf->cur_altsetting;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1345 struct usb_device *dev = interface_to_usbdev(intf);
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1346 struct usbhid_device *usbhid;
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1347 struct hid_device *hid;
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1348 unsigned int n, has_in = 0;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1349 size_t len;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1350 int ret;
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1351
58037eb961f859 drivers/hid/usbhid/hid-core.c Jiri Kosina 2007-05-30 1352 dbg_hid("HID probe called for ifnum %d\n",
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1353 intf->altsetting->desc.bInterfaceNumber);
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1354
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1355 for (n = 0; n < interface->desc.bNumEndpoints; n++)
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1356 if (usb_endpoint_is_int_in(&interface->endpoint[n].desc))
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1357 has_in++;
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1358 if (!has_in) {
4291ee305e9bb0 drivers/hid/usbhid/hid-core.c Joe Perches 2010-12-09 1359 hid_err(intf, "couldn't find an input interrupt endpoint\n");
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1360 return -ENODEV;
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1361 }
131d3a7a009d56 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-11-14 1362
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1363 hid = hid_allocate_device();
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1364 if (IS_ERR(hid))
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1365 return PTR_ERR(hid);
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1366
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1367 usb_set_intfdata(intf, hid);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1368 hid->ll_driver = &usb_hid_driver;
76483cf4d0efbc drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-09-18 1369 hid->ff_init = hid_pidff_init;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1370 #ifdef CONFIG_USB_HIDDEV
93c10132a7ac16 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-06-27 1371 hid->hiddev_connect = hiddev_connect;
c4c259bcc27c42 drivers/hid/usbhid/hid-core.c Jiri Kosina 2009-09-15 1372 hid->hiddev_disconnect = hiddev_disconnect;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1373 hid->hiddev_hid_event = hiddev_hid_event;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1374 hid->hiddev_report_event = hiddev_report_event;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1375 #endif
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1376 hid->dev.parent = &intf->dev;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1377 hid->bus = BUS_USB;
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1378 hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1379 hid->product = le16_to_cpu(dev->descriptor.idProduct);
d5158e020c4593 drivers/hid/usbhid/hid-core.c Niels Skou Olsen 2017-10-04 1380 hid->version = le16_to_cpu(dev->descriptor.bcdDevice);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1381 hid->name[0] = 0;
a73a63701f8f23 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-22 1382 if (intf->cur_altsetting->desc.bInterfaceProtocol ==
a73a63701f8f23 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-22 1383 USB_INTERFACE_PROTOCOL_MOUSE)
a73a63701f8f23 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-22 1384 hid->type = HID_TYPE_USBMOUSE;
6dc1418e131441 drivers/hid/usbhid/hid-core.c Tomoki Sekiyama 2011-05-23 1385 else if (intf->cur_altsetting->desc.bInterfaceProtocol == 0)
6dc1418e131441 drivers/hid/usbhid/hid-core.c Tomoki Sekiyama 2011-05-23 1386 hid->type = HID_TYPE_USBNONE;
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1387
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1388 if (dev->manufacturer)
eeeec27d682047 drivers/hid/usbhid/hid-core.c Wolfram Sang 2022-08-18 1389 strscpy(hid->name, dev->manufacturer, sizeof(hid->name));
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1390
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1391 if (dev->product) {
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1392 if (dev->manufacturer)
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1393 strlcat(hid->name, " ", sizeof(hid->name));
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1394 strlcat(hid->name, dev->product, sizeof(hid->name));
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1395 }
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1396
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1397 if (!strlen(hid->name))
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1398 snprintf(hid->name, sizeof(hid->name), "HID %04x:%04x",
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1399 le16_to_cpu(dev->descriptor.idVendor),
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1400 le16_to_cpu(dev->descriptor.idProduct));
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1401
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1402 usb_make_path(dev, hid->phys, sizeof(hid->phys));
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1403 strlcat(hid->phys, "/input", sizeof(hid->phys));
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1404 len = strlen(hid->phys);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1405 if (len < sizeof(hid->phys) - 1)
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1406 snprintf(hid->phys + len, sizeof(hid->phys) - len,
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1407 "%d", intf->altsetting[0].desc.bInterfaceNumber);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1408
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 @1409 if (usb_string(dev, dev->descriptor.iSerialNumber, hid->uniq, 64) <= 0)
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1410 hid->uniq[0] = 0;
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1411
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1412 usbhid = kzalloc(sizeof(*usbhid), GFP_KERNEL);
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1413 if (usbhid == NULL) {
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1414 ret = -ENOMEM;
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1415 goto err;
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1416 }
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1417
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1418 hid->driver_data = usbhid;
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1419 usbhid->hid = hid;
57ab12e418ec4f drivers/hid/usbhid/hid-core.c Jiri Kosina 2010-02-17 1420 usbhid->intf = intf;
57ab12e418ec4f drivers/hid/usbhid/hid-core.c Jiri Kosina 2010-02-17 1421 usbhid->ifnum = interface->desc.bInterfaceNumber;
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1422
fde4e2f73208b8 drivers/hid/usbhid/hid-core.c Alan Stern 2010-05-07 1423 init_waitqueue_head(&usbhid->wait);
fde4e2f73208b8 drivers/hid/usbhid/hid-core.c Alan Stern 2010-05-07 1424 INIT_WORK(&usbhid->reset_work, hid_reset);
0ee32774aed648 drivers/hid/usbhid/hid-core.c Kees Cook 2017-10-04 1425 timer_setup(&usbhid->io_retry, hid_retry_timeout, 0);
fde4e2f73208b8 drivers/hid/usbhid/hid-core.c Alan Stern 2010-05-07 1426 spin_lock_init(&usbhid->lock);
0ed08faded1da0 drivers/hid/usbhid/hid-core.c Alan Stern 2020-04-22 1427 mutex_init(&usbhid->mutex);
fde4e2f73208b8 drivers/hid/usbhid/hid-core.c Alan Stern 2010-05-07 1428
85cdaf524b7dda drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1429 ret = hid_add_device(hid);
85cdaf524b7dda drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1430 if (ret) {
d458a9dfc4de24 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1431 if (ret != -ENODEV)
4291ee305e9bb0 drivers/hid/usbhid/hid-core.c Joe Perches 2010-12-09 1432 hid_err(intf, "can't add hid device: %d\n", ret);
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1433 goto err_free;
85cdaf524b7dda drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1434 }
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1435
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1436 return 0;
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1437 err_free:
3d5afd324a4bf9 drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-10-27 1438 kfree(usbhid);
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1439 err:
c500c9714011ed drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1440 hid_destroy_device(hid);
85cdaf524b7dda drivers/hid/usbhid/hid-core.c Jiri Slaby 2008-05-16 1441 return ret;
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1442 }
^1da177e4c3f41 drivers/usb/input/hid-core.c Linus Torvalds 2005-04-16 1443
On 9/30/23 06:31, Greg KH wrote: > On Sat, Sep 30, 2023 at 06:04:49PM +0530, Abhinav wrote: >> Compiling the documentation in html gives a warning about duplicate symbol >> because same name is used for function usb_string(...) and >> also for the struct usb_string.Also having a different name can >> be helpful while searching or debugging the code. >> >> Renaming the function usb_string(...) to utf16le_to_utf8(...) fixes >> this warning.Reason for choosing this name because >> this is what the function description says it is doing. > > Odd trailing spaces, why? > > Anyway, sorry, but that's a horrible function name for a usb core > function, especially just for a documentation warning? Surely the > documentation tools can determine the difference between a structure > name and a function name? This can't be the only place this has ever > happened, right? > > Try fixing the documentation tools instead? Yes, this is a known Sphinx issue (i.e., not in scripts/kernel-doc). There was an email thread about this on linux-doc last year: https://lore.kernel.org/linux-doc/564cbd05-8788-9223-1ecc-59e7fc41b46a@gmail.com/ It looks like this particular issue has patch(es) available but they are moving very slowly.
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 4ce7cba2b48a..c27d13f9de74 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -1352,7 +1352,7 @@ static int cxacru_usb_probe(struct usb_interface *intf, * Abort if bDeviceClass is 0xff and iProduct is "USB NET CARD". */ if (usb_dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC - && usb_string(usb_dev, usb_dev->descriptor.iProduct, + && utf16le_to_utf8(usb_dev, usb_dev->descriptor.iProduct, buf, sizeof(buf)) > 0) { if (!strcmp(buf, "USB NET CARD")) { dev_info(&intf->dev, "ignoring cx82310_eth device\n"); diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 973548b5c15c..4e13f740e2ae 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -655,7 +655,7 @@ static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_de /* Set MAC address, it is stored in the serial number */ memset(atm_dev->esi, 0, sizeof(atm_dev->esi)); - if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { + if (utf16le_to_utf8(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { for (i = 0; i < 6; i++) atm_dev->esi[i] = (hex_to_bin(mac_str[i * 2]) << 4) + hex_to_bin(mac_str[i * 2 + 1]); diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 5812f7ea7f90..2998c9b90a11 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -2416,7 +2416,7 @@ static int uea_getesi(struct uea_softc *sc, u_char *esi) { unsigned char mac_str[2 * ETH_ALEN + 1]; int i; - if (usb_string + if (utf16le_to_utf8 (sc->usb_dev, sc->usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) != 2 * ETH_ALEN) return 1; diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 1cdb8758ae01..88ff90454572 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -1035,7 +1035,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, buf = instance->description; length = sizeof(instance->description); - if ((i = usb_string(usb_dev, usb_dev->descriptor.iProduct, buf, length)) < 0) + if ((i = utf16le_to_utf8(usb_dev, usb_dev->descriptor.iProduct, buf, length)) < 0) goto bind; buf += i; diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 3c54b218301c..0cdf81b07852 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5244,7 +5244,7 @@ static int descriptors_changed(struct usb_device *udev, } if (!changed && serial_len) { - length = usb_string(udev, udev->descriptor.iSerialNumber, + length = utf16le_to_utf8(udev, udev->descriptor.iSerialNumber, buf, serial_len); if (length + 1 != serial_len) { dev_dbg(&udev->dev, "serial string error %d\n", diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 077dfe48d01c..5f4c178d83f7 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -767,7 +767,7 @@ EXPORT_SYMBOL_GPL(usb_sg_cancel); * * Gets a USB descriptor. Convenience functions exist to simplify * getting some types of descriptors. Use - * usb_get_string() or usb_string() for USB_DT_STRING. + * usb_get_string() or utf16le_to_utf8() for USB_DT_STRING. * Device (USB_DT_DEVICE) and configuration descriptors (USB_DT_CONFIG) * are part of the device structure. * In addition to a number of USB-standard descriptors, some @@ -819,7 +819,7 @@ EXPORT_SYMBOL_GPL(usb_get_descriptor); * * Retrieves a string, encoded using UTF-16LE (Unicode, 16 bits per character, * in little-endian byte order). - * The usb_string() function will often be a convenient way to turn + * The utf16le_to_utf8() function will often be a convenient way to turn * these strings into kernel-printable form. * * Strings may be referenced in device, configuration, interface, or other @@ -948,7 +948,7 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) } /** - * usb_string - returns UTF-8 version of a string descriptor + * utf16le_to_utf8 - returns UTF-8 version of a string descriptor * @dev: the device whose string descriptor is being retrieved * @index: the number of the descriptor * @buf: where to put the string @@ -965,7 +965,7 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) * * Return: length of the string (>= 0) or usb_control_msg status (< 0). */ -int usb_string(struct usb_device *dev, int index, char *buf, size_t size) +int utf16le_to_utf8(struct usb_device *dev, int index, char *buf, size_t size) { unsigned char *tbuf; int err; @@ -1003,7 +1003,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) kfree(tbuf); return err; } -EXPORT_SYMBOL_GPL(usb_string); +EXPORT_SYMBOL_GPL(utf16le_to_utf8); /* one UTF-8-encoded 16-bit character has at most three bytes */ #define MAX_USB_STRING_SIZE (127 * 3 + 1) @@ -1027,7 +1027,7 @@ char *usb_cache_string(struct usb_device *udev, int index) buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO); if (buf) { - len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); + len = utf16le_to_utf8(udev, index, buf, MAX_USB_STRING_SIZE); if (len > 0) { smallbuf = kmalloc(++len, GFP_NOIO); if (!smallbuf) diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index ed6a19254d2f..9c8e482d9dd9 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -717,7 +717,7 @@ static int adu_probe(struct usb_interface *interface, if (!dev->interrupt_out_urb) goto error; - if (!usb_string(udev, udev->descriptor.iSerialNumber, dev->serial_number, + if (!utf16le_to_utf8(udev, udev->descriptor.iSerialNumber, dev->serial_number, sizeof(dev->serial_number))) { dev_err(&interface->dev, "Could not retrieve serial number\n"); retval = -EIO; diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 1e3df27bab58..8b39662e3ae2 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -840,7 +840,7 @@ static int iowarrior_probe(struct usb_interface *interface, goto error; /* Get the serial-number of the chip */ memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial)); - usb_string(udev, udev->descriptor.iSerialNumber, dev->chip_serial, + utf16le_to_utf8(udev, udev->descriptor.iSerialNumber, dev->chip_serial, sizeof(dev->chip_serial)); if (strlen(dev->chip_serial) != 8) memset(dev->chip_serial, 0x00, sizeof(dev->chip_serial)); diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 7cbef74dfc9a..4c13f7f0d5e4 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -675,7 +675,7 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id * if (!buffer) goto error; /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ - usb_string(udev, 255, buffer, 256); + utf16le_to_utf8(udev, 255, buffer, 256); kfree(buffer); } diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index abe4bbb0ac65..70d487e95117 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2723,12 +2723,12 @@ static int edge_startup(struct usb_serial *serial) usb_set_serial_data(serial, edge_serial); /* get the name for the device from the device */ - i = usb_string(dev, dev->descriptor.iManufacturer, + i = utf16le_to_utf8(dev, dev->descriptor.iManufacturer, &edge_serial->name[0], MAX_NAME_LEN+1); if (i < 0) i = 0; edge_serial->name[i++] = ' '; - usb_string(dev, dev->descriptor.iProduct, + utf16le_to_utf8(dev, dev->descriptor.iProduct, &edge_serial->name[i], MAX_NAME_LEN+2 - i); dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); diff --git a/include/linux/usb.h b/include/linux/usb.h index a21074861f91..870430a1fa52 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1879,7 +1879,7 @@ static inline int usb_get_ptm_status(struct usb_device *dev, void *data) 0, data); } -extern int usb_string(struct usb_device *dev, int index, +extern int utf16le_to_utf8(struct usb_device *dev, int index, char *buf, size_t size); extern char *usb_cache_string(struct usb_device *udev, int index);
Compiling the documentation in html gives a warning about duplicate symbol because same name is used for function usb_string(...) and also for the struct usb_string.Also having a different name can be helpful while searching or debugging the code. Renaming the function usb_string(...) to utf16le_to_utf8(...) fixes this warning.Reason for choosing this name because this is what the function description says it is doing. Signed-off-by: Abhinav <singhabhinav9051571833@gmail.com> --- drivers/usb/atm/cxacru.c | 2 +- drivers/usb/atm/speedtch.c | 2 +- drivers/usb/atm/ueagle-atm.c | 2 +- drivers/usb/atm/usbatm.c | 2 +- drivers/usb/core/hub.c | 2 +- drivers/usb/core/message.c | 12 ++++++------ drivers/usb/misc/adutux.c | 2 +- drivers/usb/misc/iowarrior.c | 2 +- drivers/usb/misc/ldusb.c | 2 +- drivers/usb/serial/io_edgeport.c | 4 ++-- include/linux/usb.h | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-)