]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: report success/failure of autoconfig
authorBernd Porr <mail@berndporr.me.uk>
Tue, 7 Jan 2014 21:42:25 +0000 (21:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 18:51:54 +0000 (10:51 -0800)
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>
drivers/staging/comedi/drivers.c

index 9d71b4d8540be0c51ef5ece557ae16412e65fd1e..246080316c9014a91509da617551a20d7eddc4fa 100644 (file)
@@ -603,8 +603,12 @@ int comedi_auto_config(struct device *hardware_device,
        }
 
        dev = comedi_alloc_board_minor(hardware_device);
-       if (IS_ERR(dev))
+       if (IS_ERR(dev)) {
+               dev_warn(hardware_device,
+                        "driver '%s' could not create device.\n",
+                        driver->driver_name);
                return PTR_ERR(dev);
+       }
        /* Note: comedi_alloc_board_minor() locked dev->mutex. */
 
        dev->driver = driver;
@@ -616,8 +620,20 @@ int comedi_auto_config(struct device *hardware_device,
                comedi_device_detach(dev);
        mutex_unlock(&dev->mutex);
 
-       if (ret < 0)
+       if (ret < 0) {
+               dev_warn(hardware_device,
+                        "driver '%s' failed to auto-configure device.\n",
+                        driver->driver_name);
                comedi_release_hardware_device(hardware_device);
+       } else {
+               /*
+                * class_dev should be set properly here
+                *  after a successful auto config
+                */
+               dev_info(dev->class_dev,
+                        "driver '%s' has successfully auto-configured '%s'.\n",
+                        driver->driver_name, dev->board_name);
+       }
        return ret;
 }
 EXPORT_SYMBOL_GPL(comedi_auto_config);