staging: comedi: make 'dev->attached' a bool bit-field
authorIan Abbott <abbotti@mev.co.uk>
Fri, 15 Mar 2013 13:15:33 +0000 (13:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Mar 2013 16:16:31 +0000 (09:16 -0700)
Change the `attached` member of `struct comedi_device` to a 1-bit
bit-field of type `bool`.  Change assigned values to `true` and `false`
and replace or remove comparison operations with simple boolean tests.

We'll put some extra bit-fields in the gap later to save space.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 files changed:
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers.c
drivers/staging/comedi/drivers/cb_pcidas.c
drivers/staging/comedi/drivers/cb_pcidas64.c
drivers/staging/comedi/drivers/das16.c
drivers/staging/comedi/drivers/das16m1.c
drivers/staging/comedi/drivers/das1800.c
drivers/staging/comedi/drivers/ni_660x.c
drivers/staging/comedi/drivers/ni_at_a2150.c
drivers/staging/comedi/drivers/ni_labpc.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/ni_pcidio.c
drivers/staging/comedi/drivers/s626.c

index f638381fe4249fd5b177f2bfd5154720d304b45b..bdd2936e509b42c7a0bd6b28180cebcf2f6a059f 100644 (file)
@@ -207,7 +207,7 @@ struct comedi_device {
 
        const char *board_name;
        const void *board_ptr;
-       int attached;
+       bool attached:1;
        spinlock_t spinlock;
        struct mutex mutex;
        int in_request_module;
index 64be7c5e891e77855d99c7ec46fa1c85742378bf..87052735d91c82eea1e33117de123ddb5ca532f3 100644 (file)
@@ -120,7 +120,7 @@ static void cleanup_device(struct comedi_device *dev)
 
 static void __comedi_device_detach(struct comedi_device *dev)
 {
-       dev->attached = 0;
+       dev->attached = false;
        if (dev->driver)
                dev->driver->detach(dev);
        else
@@ -290,7 +290,7 @@ static int comedi_device_postconfig(struct comedi_device *dev)
                dev->board_name = "BUG";
        }
        smp_wmb();
-       dev->attached = 1;
+       dev->attached = true;
        return 0;
 }
 
index 7a23d56645e7024e740157fa4402f3274d6b28e1..c19e4b2004f8b6dce992bf7f7e8562c7e8eb1875 100644 (file)
@@ -1341,7 +1341,7 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
        static const int timeout = 10000;
        unsigned long flags;
 
-       if (dev->attached == 0)
+       if (!dev->attached)
                return IRQ_NONE;
 
        async = s->async;
index 46b6af4c517d8811b0f83119723263b726bcf146..6988f5b7fd701996da418929d4ca1809cd88bbc7 100644 (file)
@@ -3113,7 +3113,7 @@ static irqreturn_t handle_interrupt(int irq, void *d)
        /* an interrupt before all the postconfig stuff gets done could
         * cause a NULL dereference if we continue through the
         * interrupt handler */
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                DEBUG_PRINT("premature interrupt, ignoring\n");
                return IRQ_HANDLED;
        }
index f238a1fbccbf7ac246e2e8e441846ae88cf5a846..caeaee8d4840fd3f1d70e3411118f50c13c1d716 100644 (file)
@@ -876,7 +876,7 @@ static void das16_interrupt(struct comedi_device *dev)
        int num_bytes, residue;
        int buffer_index;
 
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                comedi_error(dev, "premature interrupt");
                return;
        }
index b0a861a779bdc10576c55c686341c15050103d2b..7ba8fc7a02f697590b565d0e4b66244487045cbd 100644 (file)
@@ -499,7 +499,7 @@ static irqreturn_t das16m1_interrupt(int irq, void *d)
        int status;
        struct comedi_device *dev = d;
 
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                comedi_error(dev, "premature interrupt");
                return IRQ_HANDLED;
        }
index 7900f959555d71e2ed82e47f0b3004838e98a57b..d01e140885d8ebaf79c0bd6898c8a2d47decbde6 100644 (file)
@@ -731,7 +731,7 @@ static irqreturn_t das1800_interrupt(int irq, void *d)
        struct comedi_device *dev = d;
        unsigned int status;
 
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                comedi_error(dev, "premature interrupt");
                return IRQ_HANDLED;
        }
index 43b7ea8970a671aecc52b7476540d35007798dc7..440cfd17ee3aa6bc1d933dc0bba0d31c1bc16eef 100644 (file)
@@ -887,7 +887,7 @@ static irqreturn_t ni_660x_interrupt(int irq, void *d)
        unsigned i;
        unsigned long flags;
 
-       if (dev->attached == 0)
+       if (!dev->attached)
                return IRQ_NONE;
        /* lock to avoid race with comedi_poll */
        spin_lock_irqsave(&devpriv->interrupt_lock, flags);
index 06de25bb2f56fc3e7fa821945a39bfaf0def21ff..2a4a7a47214222148287cc3c81d9cbb5964d775c 100644 (file)
@@ -204,7 +204,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
        short dpnt;
        static const int sample_size = sizeof(devpriv->dma_buffer[0]);
 
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                comedi_error(dev, "premature interrupt");
                return IRQ_HANDLED;
        }
index 78f01709e22205d3a6c1ad2e3a69725758ce48d0..d2edaad4ddbecaad0b407c9c0c31413f1a2afc40 100644 (file)
@@ -1367,7 +1367,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
        struct comedi_async *async;
        struct comedi_cmd *cmd;
 
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                comedi_error(dev, "premature interrupt");
                return IRQ_HANDLED;
        }
index 208fa24295ae74f8651f6f5c68b51942167f0541..ca52b759fb9e96f8326e89477154c6f5173226d0 100644 (file)
@@ -847,7 +847,7 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
        struct mite_struct *mite = devpriv->mite;
 #endif
 
-       if (dev->attached == 0)
+       if (!dev->attached)
                return IRQ_NONE;
        smp_mb();               /*  make sure dev->attached is checked before handler does anything else. */
 
index 2298d6ee12ef0b946622e02211ea0349bcceb01b..3e3a03c49681c10a12d370357d4f4b6d1ce00732 100644 (file)
@@ -420,7 +420,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
        unsigned int m_status = 0;
 
        /* interrupcions parasites */
-       if (dev->attached == 0) {
+       if (!dev->attached) {
                /* assume it's from another card */
                return IRQ_NONE;
        }
index cd164ee3a5e1a880271e0a675165a5ff63da55e3..d1560524fc14c83ef6d03ac04d902ac3621d7116 100644 (file)
@@ -758,7 +758,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
        uint8_t group;
        uint16_t irqbit;
 
-       if (dev->attached == 0)
+       if (!dev->attached)
                return IRQ_NONE;
        /*  lock to avoid race with comedi_poll */
        spin_lock_irqsave(&dev->spinlock, flags);
This page took 0.035557 seconds and 5 git commands to generate.