staging: comedi: add 'pacer' member to struct comedi_device
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 23 Feb 2015 21:57:29 +0000 (14:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Mar 2015 02:51:49 +0000 (18:51 -0800)
Add a new member to the comedi_device struct for a comedi_8254 'pacer'. This
provides a convient place to store the data allocated by the comedi_8254 module
for boards that use an 8254 device to create the data acquisition pacer clock.

Automatically free this pointer in comedi_device_detach_cleanup() so that the
drivers don't need to do it when then are detached.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers.c

index e138eb0dc374c24b6cf360eddeda716fa7cf476d..30595c0cd5b0f2a8ac10290f90e6c0a68b7f40f8 100644 (file)
@@ -256,6 +256,7 @@ struct comedi_driver {
 struct comedi_device {
        int use_count;
        struct comedi_driver *driver;
+       struct comedi_8254 *pacer;
        void *private;
 
        struct device *class_dev;
index f32e71438948a999bfa661f8cfad23dbf969a089..e87c68cf11d4751fb65cc43c940f700eb3d52f76 100644 (file)
@@ -139,7 +139,9 @@ static void comedi_device_detach_cleanup(struct comedi_device *dev)
                dev->n_subdevices = 0;
        }
        kfree(dev->private);
+       kfree(dev->pacer);
        dev->private = NULL;
+       dev->pacer = NULL;
        dev->driver = NULL;
        dev->board_name = NULL;
        dev->board_ptr = NULL;