summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-10-15 12:07:31 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-22 19:43:37 (GMT)
commit0a7717dfe097d7a0a08e824ed39547c3e6e9d7e8 (patch)
treeb9a9314a96cda75e3484d1cadc82a8e3b3cf8a12 /drivers/staging/comedi/comedidev.h
parent7f2f7e050bea242735880b7876d9771efb580213 (diff)
downloadlinux-fsl-qoriq-0a7717dfe097d7a0a08e824ed39547c3e6e9d7e8.tar.xz
staging: comedi: avoid a put_device(), get_device() sequence
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>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index cb67a5c..100ea0b 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -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);