summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2002-11-18 15:16:18 +0000
committerHolger Waechtler <devnull@localhost>2002-11-18 15:16:18 +0000
commit8f5e712c82d858f56937d284c9cd5600172ccefd (patch)
tree500b54f507733c02b1bac2047933bb8fda651c2c /linux/drivers/media/dvb/dvb-core
parent6c6060f3632163ab6029960adfdabf7b3e0f16f0 (diff)
downloadmediapointer-dvb-s2-8f5e712c82d858f56937d284c9cd5600172ccefd.tar.gz
mediapointer-dvb-s2-8f5e712c82d858f56937d284c9cd5600172ccefd.tar.bz2
replace __MOD_(INC|DEC)_USE_COUNT() by try_module_get() and module_put()
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r--linux/drivers/media/dvb/dvb-core/compat.h15
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_i2c.c21
2 files changed, 24 insertions, 12 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/compat.h b/linux/drivers/media/dvb/dvb-core/compat.h
index d3c58054b..89979bade 100644
--- a/linux/drivers/media/dvb/dvb-core/compat.h
+++ b/linux/drivers/media/dvb/dvb-core/compat.h
@@ -82,5 +82,20 @@ extern u32 crc32_le (u32 crc, unsigned char const *p, size_t len);
#include <linux/crc32.h>
#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,48))
+static inline
+int try_module_get(struct module *mod)
+{
+ if (!MOD_CAN_QUERY(mod))
+ return 0;
+ __MOD_INC_USE_COUNT(mod);
+ return 1;
+}
+
+#define module_put(mod) __MOD_DEC_USE_COUNT(mod)
+#endif
+
+
#endif
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_i2c.c b/linux/drivers/media/dvb/dvb-core/dvb_i2c.c
index c25e846a9..3f3c4592e 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_i2c.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_i2c.c
@@ -64,17 +64,14 @@ static
void try_attach_device (struct dvb_i2c_bus *i2c, struct dvb_i2c_device *dev)
{
if (dev->owner) {
- if (!MOD_CAN_QUERY(dev->owner))
- return;
-
- __MOD_INC_USE_COUNT(dev->owner);
- }
-
- if (dev->attach (i2c) == 0) {
- register_i2c_client (i2c, dev);
- } else {
- if (dev->owner)
- __MOD_DEC_USE_COUNT(dev->owner);
+ if (try_module_get(dev->owner)) {
+ if (dev->attach (i2c) == 0) {
+ register_i2c_client (i2c, dev);
+ } else {
+ if (dev->owner)
+ module_put (dev->owner);
+ }
+ }
}
}
@@ -85,7 +82,7 @@ void detach_device (struct dvb_i2c_bus *i2c, struct dvb_i2c_device *dev)
dev->detach (i2c);
if (dev->owner)
- __MOD_DEC_USE_COUNT(dev->owner);
+ module_put (dev->owner);
}