Re: [PATCH 2/2] staging: comedi: report success/failure of autoconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/12/13 23:49, Bernd Porr wrote:
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 a
mix of USB and PCI devices.

Signed-off-by: Bernd Porr <mail@xxxxxxxxxxxxxxx>
---
  drivers/staging/comedi/drivers.c | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index d6dc58a..58c7f23 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -580,8 +580,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,
+			 "comedi 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;
@@ -593,8 +597,17 @@ 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,
+			 "comedi driver '%s' could not be auto-configured.\n",
+			 driver->driver_name);
  		comedi_release_hardware_device(hardware_device);
+	} else {
+		/* class_dev should be set properly here after a successul auto config*/
+		dev_info(dev->class_dev,
+			 "'%s' has been successfully auto-configured.\n",
+			 driver->driver_name);
+	}

That's fine, but you could maybe output dev->board_name instead of, or in addition to, driver->driver_name in that message. (dev->board_name defaults to dev->driver->driver_name, but may be changed by the low-level driver to something board-specific.)

Also, there is a typo in the comment avove the dev_info call. :)

  	return ret;
  }
  EXPORT_SYMBOL_GPL(comedi_auto_config);



--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux