Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/usb: remove last USBFS user

In commit fb28d58b ("USB: remove CONFIG_USB_DEVICEFS") USBFS got
removed. Since it is gone we can stop using it in testusb and try udev
nodes right away.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sebastian Andrzej Siewior and committed by
Greg Kroah-Hartman
8a424bf4 0837e7e5

+1 -24
+1 -24
tools/usb/testusb.c
··· 253 253 254 254 if (flag != FTW_F) 255 255 return 0; 256 - /* ignore /proc/bus/usb/{devices,drivers} */ 257 - if (strrchr(name, '/')[1] == 'd') 258 - return 0; 259 256 260 257 fd = fopen(name, "rb"); 261 258 if (!fd) { ··· 353 356 354 357 static const char *usbfs_dir_find(void) 355 358 { 356 - static char usbfs_path_0[] = "/dev/usb/devices"; 357 - static char usbfs_path_1[] = "/proc/bus/usb/devices"; 358 359 static char udev_usb_path[] = "/dev/bus/usb"; 359 360 360 - static char *const usbfs_paths[] = { 361 - usbfs_path_0, usbfs_path_1 362 - }; 363 - 364 - static char *const * 365 - end = usbfs_paths + sizeof usbfs_paths / sizeof *usbfs_paths; 366 - 367 - char *const *it = usbfs_paths; 368 - do { 369 - int fd = open(*it, O_RDONLY); 370 - close(fd); 371 - if (fd >= 0) { 372 - strrchr(*it, '/')[0] = '\0'; 373 - return *it; 374 - } 375 - } while (++it != end); 376 - 377 - /* real device-nodes managed by udev */ 378 361 if (access(udev_usb_path, F_OK) == 0) 379 362 return udev_usb_path; 380 363 ··· 466 489 goto usage; 467 490 if (!all && !device) { 468 491 fprintf (stderr, "must specify '-a' or '-D dev', " 469 - "or DEVICE=/proc/bus/usb/BBB/DDD in env\n"); 492 + "or DEVICE=/dev/bus/usb/BBB/DDD in env\n"); 470 493 goto usage; 471 494 } 472 495