From: Ian Abbott Date: Mon, 15 Oct 2012 12:07:31 +0000 (+0100) Subject: staging: comedi: avoid a put_device(), get_device() sequence X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a7717dfe097d7a0a08e824ed39547c3e6e9d7e8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index cb67a5cb9c82..100ea0b0772c 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);