staging: comedi: remove comedi_dev_from_minor()
[firefly-linux-kernel-4.4.55.git] / drivers / staging / comedi / comedidev.h
index 143be8076a2e72361d11f88a2b64db8c4b89855b..4e7cd1443be66e0a7cab38c940483fe63b93f2d8 100644 (file)
 #define _COMEDIDEV_H
 
 #include <linux/dma-mapping.h>
+#include <linux/mutex.h>
+#include <linux/spinlock_types.h>
+#include <linux/rwsem.h>
+#include <linux/kref.h>
 
 #include "comedi.h"
 
@@ -141,10 +145,7 @@ struct comedi_async {
 
        wait_queue_head_t wait_head;
 
-       /* callback stuff */
        unsigned int cb_mask;
-       int (*cb_func) (unsigned int flags, void *);
-       void *cb_arg;
 
        int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s,
                        unsigned int x);
@@ -173,6 +174,7 @@ struct comedi_device {
 
        struct device *class_dev;
        int minor;
+       unsigned int detach_count;
        /* hw_dev is passed to dma_alloc_coherent when allocating async buffers
         * for subdevices that have async_dma_dir set to something other than
         * DMA_NONE */
@@ -185,6 +187,8 @@ struct comedi_device {
        bool ioenabled:1;
        spinlock_t spinlock;
        struct mutex mutex;
+       struct rw_semaphore attach_lock;
+       struct kref refcount;
 
        int n_subdevices;
        struct comedi_subdevice *subdevices;
@@ -231,7 +235,8 @@ enum comedi_minor_bits {
 static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
 static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
 
-struct comedi_device *comedi_dev_from_minor(unsigned minor);
+struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
+int comedi_dev_put(struct comedi_device *dev);
 
 void init_polling(void);
 void cleanup_polling(void);
@@ -240,7 +245,6 @@ void stop_polling(struct comedi_device *);
 
 /* subdevice runflags */
 enum subdevice_runflags {
-       SRF_USER = 0x00000001,
        SRF_RT = 0x00000002,
        /* indicates an COMEDI_CB_ERROR event has occurred since the last
         * command was started */