patch to add a success/failure message to comedi autoconfig

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

 



Hi all,

I've added a success / fail message to comedi autoconfig. That's badly needed to see which driver has been associated with which comedi dev in udev. Also, as far as I know an error in the USB probe callback won't cause the kernel to print any errors so tracking down failures in autoconfig would be really tricky.

/Bernd
--
http://www.berndporr.me.uk
http://www.linux-usb-daq.co.uk
http://www.imdb.com/name/nm3293421/
+44 (0)7840 340069
>From e516c966fb36a9a8fee3e743ec97d4732cd9285c Mon Sep 17 00:00:00 2001
From: Bernd Porr <mail@xxxxxxxxxxxxxxx>
Date: Sat, 21 Dec 2013 09:52:11 +0000
Subject: [PATCH 1/1] 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/comedi_fops.c |  1 +
 drivers/staging/comedi/drivers.c     | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 33b4e58..4e53c5d 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2523,6 +2523,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
 		return ERR_PTR(-EBUSY);
 	}
 	dev->minor = i;
+
 	csdev = device_create(comedi_class, hardware_device,
 			      MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i", i);
 	if (!IS_ERR(csdev))
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 29b3480..f9be097 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -585,8 +585,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;
@@ -598,8 +602,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);
+	}
 	return ret;
 }
 EXPORT_SYMBOL_GPL(comedi_auto_config);
-- 
1.8.5.1

_______________________________________________
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