]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: avoid a put_device(), get_device() sequence
authorIan Abbott <abbotti@mev.co.uk>
Mon, 15 Oct 2012 12:07:31 +0000 (13:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 19:43:37 +0000 (12:43 -0700)
In `comedi_set_hw_dev()`, if there is no change to `dev->hw_dev` (and it
is not `NULL`), don't bother putting and getting the device.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedidev.h

index cb67a5cb9c824fd5e1fba9c701ae2a1a628618c1..100ea0b0772c7f30a008333fdeac74538df97e7c 100644 (file)
@@ -436,9 +436,10 @@ into comedi's buffer */
 static inline void comedi_set_hw_dev(struct comedi_device *dev,
                                     struct device *hw_dev)
 {
+       if (dev->hw_dev == hw_dev)
+               return;
        if (dev->hw_dev)
                put_device(dev->hw_dev);
-
        dev->hw_dev = hw_dev;
        if (dev->hw_dev) {
                dev->hw_dev = get_device(dev->hw_dev);