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

staging: comedi: report success/failure of autoconfig

Added success message to the driver autoconfig and error
message in case it fails. A success message is required
so that the user can find out which comedi driver has been
associated with which udev device. This also makes troubleshooting
much easier when more than one card is in the computer or
there is a mix of USB and PCI devices.
As Ian suggested we should report both the driver and the board
which might have different names, especially if one driver covers a
range of different boards.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bernd Porr and committed by
Greg Kroah-Hartman
bcb6232d 52ef9e7c

+18 -2
+18 -2
drivers/staging/comedi/drivers.c
··· 603 603 } 604 604 605 605 dev = comedi_alloc_board_minor(hardware_device); 606 - if (IS_ERR(dev)) 606 + if (IS_ERR(dev)) { 607 + dev_warn(hardware_device, 608 + "driver '%s' could not create device.\n", 609 + driver->driver_name); 607 610 return PTR_ERR(dev); 611 + } 608 612 /* Note: comedi_alloc_board_minor() locked dev->mutex. */ 609 613 610 614 dev->driver = driver; ··· 620 616 comedi_device_detach(dev); 621 617 mutex_unlock(&dev->mutex); 622 618 623 - if (ret < 0) 619 + if (ret < 0) { 620 + dev_warn(hardware_device, 621 + "driver '%s' failed to auto-configure device.\n", 622 + driver->driver_name); 624 623 comedi_release_hardware_device(hardware_device); 624 + } else { 625 + /* 626 + * class_dev should be set properly here 627 + * after a successful auto config 628 + */ 629 + dev_info(dev->class_dev, 630 + "driver '%s' has successfully auto-configured '%s'.\n", 631 + driver->driver_name, dev->board_name); 632 + } 625 633 return ret; 626 634 } 627 635 EXPORT_SYMBOL_GPL(comedi_auto_config);