Commit 0a7717df authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

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: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f2f7e05
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment