From ae52cf5c50c291b5733aceffe8d1ce2e7c7a4d8d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sun, 29 Dec 2002 18:59:13 -0800 Subject: [PATCH] Minor compile fix for some modules. Expose declaration of __this_module outside #ifdef KBUILD_MODNAME (which is not defined for objects included in two modules). --- include/linux/module.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/linux/module.h') diff --git a/include/linux/module.h b/include/linux/module.h index 3a411c8c6575..ebdfc27efbb8 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -285,7 +285,9 @@ static inline const char *module_address_lookup(unsigned long addr, } #endif /* CONFIG_MODULES */ -#if defined(MODULE) && defined(KBUILD_MODNAME) +#ifdef MODULE +extern struct module __this_module; +#ifdef KBUILD_MODNAME /* We make the linker do some of the work. */ struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { @@ -296,7 +298,8 @@ __attribute__((section(".gnu.linkonce.this_module"))) = { .exit = cleanup_module, #endif }; -#endif /* MODULE && KBUILD_MODNAME */ +#endif /* KBUILD_MODNAME */ +#endif /* MODULE */ /* For archs to search exception tables */ extern struct list_head extables; -- cgit v1.2.3 From 2cea9523ee55d8bda0b14287d5761c956868572c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 29 Dec 2002 19:52:11 -0800 Subject: [PATCH] more obsolete module API fixes completly remove the old try_inc_mod_count() --- drivers/block/genhd.c | 4 ++-- drivers/char/busmouse.c | 2 +- drivers/ide/ide.c | 2 +- drivers/ieee1394/ieee1394_core.c | 3 +-- drivers/isdn/capi/capi.c | 11 ++--------- drivers/isdn/capi/kcapi.c | 12 +++--------- drivers/isdn/eicon/eicon_mod.c | 10 ---------- drivers/isdn/hardware/eicon/i4lididrv.c | 10 ---------- drivers/isdn/hisax/callc.c | 3 --- drivers/media/video/cpia.c | 2 +- drivers/mtd/chips/chipreg.c | 2 +- drivers/net/irda/sir_dev.c | 6 +----- drivers/net/irda/sir_dongle.c | 6 +++--- drivers/s390/block/dasd.c | 2 +- drivers/s390/block/dasd_ioctl.c | 11 ++++------- drivers/s390/char/tape_core.c | 2 +- drivers/serial/core.c | 2 +- fs/devfs/base.c | 2 +- fs/dquot.c | 2 +- fs/exec.c | 4 ++-- fs/filesystems.c | 10 +++++----- fs/nls/nls_base.c | 4 ++-- include/linux/fs.h | 10 ++-------- include/linux/module.h | 1 - include/linux/mtd/mtd.h | 5 +---- kernel/exec_domain.c | 4 ++-- kernel/intermodule.c | 2 +- net/core/dev.c | 2 +- net/ipv4/xfrm_policy.c | 2 +- net/rxrpc/krxsecd.c | 2 +- sound/core/control.c | 2 +- sound/core/info.c | 2 +- sound/core/init.c | 7 ++----- sound/core/oss/mixer_oss.c | 2 +- sound/core/oss/pcm_oss.c | 2 +- sound/core/pcm_native.c | 2 +- sound/core/rawmidi.c | 2 +- sound/core/seq/oss/seq_oss_synth.c | 2 +- sound/core/seq/seq_ports.c | 2 +- sound/core/seq/seq_virmidi.c | 4 ++-- sound/core/timer.c | 2 +- sound/drivers/opl3/opl3_seq.c | 2 +- sound/isa/gus/gus_main.c | 2 +- sound/isa/wavefront/wavefront_fx.c | 2 +- sound/isa/wavefront/wavefront_synth.c | 2 +- sound/synth/emux/emux_seq.c | 4 ++-- 46 files changed, 62 insertions(+), 119 deletions(-) (limited to 'include/linux/module.h') diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index c133b454b2fb..c7541b2fe264 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -160,7 +160,7 @@ retry: read_unlock(&gendisk_lock); return NULL; } - if (!try_inc_mod_count(p->owner)) + if (!try_module_get(p->owner)) continue; owner = p->owner; data = p->data; @@ -422,7 +422,7 @@ struct gendisk *get_disk(struct gendisk *disk) if (!disk->fops) return NULL; owner = disk->fops->owner; - if (owner && !try_inc_mod_count(owner)) + if (owner && !try_module_get(owner)) return NULL; return to_disk(kobject_get(&disk->kobj)); } diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c index 85baa0cdf51b..c574177b5418 100644 --- a/drivers/char/busmouse.c +++ b/drivers/char/busmouse.c @@ -200,7 +200,7 @@ static int busmouse_open(struct inode *inode, struct file *file) if (!mse || !mse->ops) /* shouldn't happen, but... */ goto end; - if (mse->ops->owner && !try_inc_mod_count(mse->ops->owner)) + if (!try_module_get(mse->ops->owner)) goto end; ret = 0; diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 0ae396abfcc1..a138e13d6b44 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -1332,7 +1332,7 @@ int ata_attach(ide_drive_t *drive) spin_lock(&drivers_lock); list_for_each(p, &drivers) { ide_driver_t *driver = list_entry(p, ide_driver_t, drivers); - if (!try_inc_mod_count(driver->owner)) + if (!try_module_get(driver->owner)) continue; spin_unlock(&drivers_lock); if (driver->attach(drive) == 0) { diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index b5e00b4b12b5..5433a0466ce9 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c @@ -1066,8 +1066,7 @@ static int ieee1394_get_chardev(int blocknum, if(*file_ops == NULL) goto out; - /* don't need try_inc_mod_count if the driver is non-modular */ - if(*module && (try_inc_mod_count(*module) == 0)) + if(!try_module_get(*module)) goto out; /* success! */ diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index ad595be2a0a6..4e01b76e1fcb 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -207,9 +207,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci) printk(KERN_ERR "capi: can't alloc capiminor\n"); return 0; } -#ifdef _DEBUG_REFCOUNT - printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE)); -#endif + memset(mp, 0, sizeof(struct capiminor)); mp->ap = ap; mp->ncci = ncci; @@ -252,9 +250,6 @@ static void capiminor_free(struct capiminor *mp) capiminor_del_all_ack(mp); kfree(mp); MOD_DEC_USE_COUNT; -#ifdef _DEBUG_REFCOUNT - printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE)); -#endif } struct capiminor *capiminor_find(unsigned int minor) @@ -980,9 +975,7 @@ static int capinc_tty_open(struct tty_struct * tty, struct file * file) return -ENXIO; tty->driver_data = (void *)mp; -#ifdef _DEBUG_REFCOUNT - printk(KERN_DEBUG "capi_tty_open %d\n", GET_USE_COUNT(THIS_MODULE)); -#endif + if (atomic_read(&mp->ttyopencount) == 0) mp->tty = tty; atomic_inc(&mp->ttyopencount); diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index 337124784e9c..0e07e706a576 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c @@ -77,15 +77,9 @@ static struct work_struct tq_recv_notify; static inline struct capi_ctr * capi_ctr_get(struct capi_ctr *card) { - if (card->owner) { - if (try_inc_mod_count(card->owner)) { - DBG("MOD_COUNT INC"); - return card; - } else - return NULL; - } - DBG("MOD_COUNT INC"); - return card; + if (try_module_get(card->owner)) + return card; + return NULL; } static inline void diff --git a/drivers/isdn/eicon/eicon_mod.c b/drivers/isdn/eicon/eicon_mod.c index 54edc7d3f470..4fd7dbcb6968 100644 --- a/drivers/isdn/eicon/eicon_mod.c +++ b/drivers/isdn/eicon/eicon_mod.c @@ -54,10 +54,6 @@ extern int do_ioctl(struct inode *pDivasInode, struct file *pDivasFile, unsigned int command, unsigned long arg); extern void eicon_pci_init_conf(eicon_card *card); -#ifdef MODULE -#define MOD_USE_COUNT (GET_USE_COUNT (&__this_module)) -#endif - #define EICON_CTRL_VERSION 2 ulong DebugVar; @@ -370,12 +366,6 @@ eicon_command(eicon_card * card, isdn_ctrl * c) DebugVar = a; eicon_log(card, 1, "Eicon: Debug Value set to %ld\n", DebugVar); return 0; -#ifdef MODULE - case EICON_IOCTL_FREEIT: - while (MOD_USE_COUNT > 0) MOD_DEC_USE_COUNT; - MOD_INC_USE_COUNT; - return 0; -#endif case EICON_IOCTL_LOADPCI: eicon_log(card, 1, "Eicon: Wrong version of load-utility,\n"); eicon_log(card, 1, "Eicon: re-compile eiconctrl !\n"); diff --git a/drivers/isdn/hardware/eicon/i4lididrv.c b/drivers/isdn/hardware/eicon/i4lididrv.c index d086cdd17d00..38cf7c984607 100644 --- a/drivers/isdn/hardware/eicon/i4lididrv.c +++ b/drivers/isdn/hardware/eicon/i4lididrv.c @@ -40,10 +40,6 @@ static char *DRIVERRELEASE = "2.0"; static char *eicon_revision = "$Revision: 1.1.2.2 $"; extern char *eicon_idi_revision; -#ifdef MODULE -#define MOD_USE_COUNT (GET_USE_COUNT (&__this_module)) -#endif - #define EICON_CTRL_VERSION 2 ulong DebugVar; @@ -507,12 +503,6 @@ eicon_command(eicon_card * card, isdn_ctrl * c) DebugVar = a; eicon_log(card, 1, "%s: Debug Value set to %ld\n", DRIVERLNAME, DebugVar); return 0; -#ifdef MODULE - case EICON_IOCTL_FREEIT: - while (MOD_USE_COUNT > 0) MOD_DEC_USE_COUNT; - MOD_INC_USE_COUNT; - return 0; -#endif case EICON_IOCTL_LOADPCI: eicon_log(card, 1, "%s: Wrong version of load-utility,\n", DRIVERLNAME); eicon_log(card, 1, "%s: re-compile eiconctrl !\n", DRIVERLNAME); diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c index 4e366732644d..d2958c806c62 100644 --- a/drivers/isdn/hisax/callc.c +++ b/drivers/isdn/hisax/callc.c @@ -21,9 +21,6 @@ #include "hisax.h" #include -#ifdef MODULE -#define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module)) -#endif /* MODULE */ const char *lli_revision = "$Revision: 2.51.6.6 $"; diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index bcc26db53c6a..af042ec7b2ad 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -3173,7 +3173,7 @@ static int cpia_open(struct inode *inode, struct file *file) return -ENODEV; } - if (!try_inc_mod_count(cam->ops->owner)) + if (!try_module_get(cam->ops->owner)) return -ENODEV; down(&cam->busy_lock); diff --git a/drivers/mtd/chips/chipreg.c b/drivers/mtd/chips/chipreg.c index efdd7ee41d34..b33292c88be6 100644 --- a/drivers/mtd/chips/chipreg.c +++ b/drivers/mtd/chips/chipreg.c @@ -44,7 +44,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name) break; } } - if (ret && !try_inc_mod_count(ret->module)) { + if (ret && !try_module_get(ret->module)) { /* Eep. Failed. */ ret = NULL; } diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c index a27737026547..09823085fa2d 100644 --- a/drivers/net/irda/sir_dev.c +++ b/drivers/net/irda/sir_dev.c @@ -466,13 +466,9 @@ static int sirdev_open(struct net_device *ndev) if (!drv) return -ENODEV; - lock_kernel(); /* serialize with rmmod */ /* increase the reference count of the driver module before doing serious stuff */ - if (drv->owner && !try_inc_mod_count(drv->owner)) { - unlock_kernel(); + if (!try_module_get(drv->owner)) return -ESTALE; - } - unlock_kernel(); IRDA_DEBUG(2, "%s()\n", __FUNCTION__); diff --git a/drivers/net/irda/sir_dongle.c b/drivers/net/irda/sir_dongle.c index cf7a17a002d3..b23cd3480519 100644 --- a/drivers/net/irda/sir_dongle.c +++ b/drivers/net/irda/sir_dongle.c @@ -95,13 +95,13 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type) * 1) dongle driver was already unregistered - then we haven't found the * requested dongle above and are already out here * 2) the module is already marked deleted but the driver is still - * registered - then the try_inc_mod_count() below will fail - * 3) the try_inc_mod_count() below succeeds before the module is marked + * registered - then the try_module_get() below will fail + * 3) the try_module_get() below succeeds before the module is marked * deleted - then sys_delete_module() fails and prevents the removal * because the module is in use. */ - if (drv->owner && !try_inc_mod_count(drv->owner)) { + if (!try_module_get(drv->owner)) { err = -ESTALE; goto out_unlock; /* rmmod already pending */ } diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 8eedee623a04..5be431297f86 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -1734,7 +1734,7 @@ dasd_open(struct inode *inp, struct file *filp) rc = 0; if (atomic_inc_return(&device->open_count) == 1) { - if (!try_inc_mod_count(device->discipline->owner)) { + if (!try_module_get(device->discipline->owner)) { /* Discipline is currently unloaded! */ atomic_dec(&device->open_count); rc = -ENODEV; diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 9047d68fb20a..e570db2497bd 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -111,13 +111,10 @@ dasd_ioctl(struct inode *inp, struct file *filp, ioctl = list_entry(l, dasd_ioctl_list_t, list); if (ioctl->no == no) { /* Found a matching ioctl. Call it. */ - if (ioctl->owner) { - if (try_inc_mod_count(ioctl->owner) != 0) - continue; - rc = ioctl->handler(bdev, no, data); - module_put(ioctl->owner); - } else - rc = ioctl->handler(bdev, no, data); + if (try_module_get(ioctl->owner) != 0) + continue; + rc = ioctl->handler(bdev, no, data); + module_put(ioctl->owner); return rc; } } diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index af71fadf2f52..7da7493a6a63 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c @@ -837,7 +837,7 @@ tape_open(struct tape_device *device) DBF_EVENT(6, "TAPE:dbusy\n"); rc = -EBUSY; } else if (device->discipline != NULL && - !try_inc_mod_count(device->discipline->owner)) { + !try_module_get(device->discipline->owner)) { DBF_EVENT(6, "TAPE:nodisc\n"); rc = -ENODEV; } else { diff --git a/drivers/serial/core.c b/drivers/serial/core.c index 39fe785bf275..22d42e3b18e9 100644 --- a/drivers/serial/core.c +++ b/drivers/serial/core.c @@ -1584,7 +1584,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) * is about to be unloaded). Therefore, it is safe to set * tty->driver_data to be NULL, so uart_close() doesn't bite us. */ - if (!try_inc_mod_count(drv->owner)) { + if (!try_module_get(drv->owner)) { tty->driver_data = NULL; goto fail; } diff --git a/fs/devfs/base.c b/fs/devfs/base.c index 186dc63d327b..b4cbba51d30e 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c @@ -1874,7 +1874,7 @@ static struct file_operations *devfs_get_ops (devfs_handle_t de) return NULL; owner = ops->owner; read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */ - if ( (de->next == de) || !try_inc_mod_count (owner) ) + if ( (de->next == de) || !try_module_get (owner) ) { /* Entry is already unhooked or module is unloading */ read_unlock (&de->parent->u.dir.lock); return NULL; diff --git a/fs/dquot.c b/fs/dquot.c index 8781f7201a87..4d8ea00be1f9 100644 --- a/fs/dquot.c +++ b/fs/dquot.c @@ -103,7 +103,7 @@ static struct quota_format_type *find_quota_format(int id) lock_kernel(); for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next); - if (actqf && !try_inc_mod_count(actqf->qf_owner)) + if (actqf && !try_module_get:(actqf->qf_owner)) actqf = NULL; unlock_kernel(); return actqf; diff --git a/fs/exec.c b/fs/exec.c index 901b8e12388f..8f0b41fd3a28 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -142,7 +142,7 @@ asmlinkage long sys_uselib(const char * library) for (fmt = formats ; fmt ; fmt = fmt->next) { if (!fmt->load_shlib) continue; - if (!try_inc_mod_count(fmt->module)) + if (!try_module_get(fmt->module)) continue; read_unlock(&binfmt_lock); error = fmt->load_shlib(file); @@ -971,7 +971,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary; if (!fn) continue; - if (!try_inc_mod_count(fmt->module)) + if (!try_module_get(fmt->module)) continue; read_unlock(&binfmt_lock); retval = fn(bprm, regs); diff --git a/fs/filesystems.c b/fs/filesystems.c index 223305689d30..824b04137c3a 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c @@ -20,7 +20,7 @@ * We can access the fields of list element if: * 1) spinlock is held or * 2) we hold the reference to the module. - * The latter can be guaranteed by call of try_inc_mod_count(); if it + * The latter can be guaranteed by call of try_module_get(); if it * returned 0 we must skip the element, otherwise we got the reference. * Once the reference is obtained we can drop the spinlock. */ @@ -153,8 +153,8 @@ static int fs_name(unsigned int index, char * buf) read_lock(&file_systems_lock); for (tmp = file_systems; tmp; tmp = tmp->next, index--) - if (index <= 0 && try_inc_mod_count(tmp->owner)) - break; + if (index <= 0 && try_module_get(tmp->owner)) + break; read_unlock(&file_systems_lock); if (!tmp) return -EINVAL; @@ -224,13 +224,13 @@ struct file_system_type *get_fs_type(const char *name) read_lock(&file_systems_lock); fs = *(find_filesystem(name)); - if (fs && !try_inc_mod_count(fs->owner)) + if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); if (!fs && (request_module(name) == 0)) { read_lock(&file_systems_lock); fs = *(find_filesystem(name)); - if (fs && !try_inc_mod_count(fs->owner)) + if (fs && !try_module_get(fs->owner)) fs = NULL; read_unlock(&file_systems_lock); } diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 3ea711688341..99c26613525c 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -205,9 +205,9 @@ static struct nls_table *find_nls(char *charset) struct nls_table *nls; spin_lock(&nls_lock); for (nls = tables; nls; nls = nls->next) - if (! strcmp(nls->charset, charset)) + if (!strcmp(nls->charset, charset)) break; - if (nls && !try_inc_mod_count(nls->owner)) + if (nls && !try_module_get(nls->owner)) nls = NULL; spin_unlock(&nls_lock); return nls; diff --git a/include/linux/fs.h b/include/linux/fs.h index 6c3188b991e6..3fa13b80747d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -982,15 +982,9 @@ struct super_block *get_sb_pseudo(struct file_system_type *, char *, /* Alas, no aliases. Too much hassle with bringing module.h everywhere */ #define fops_get(fops) \ - (((fops) && (fops)->owner) \ - ? (try_inc_mod_count((fops)->owner) ? (fops) : NULL) \ - : (fops)) - + (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) #define fops_put(fops) \ -do { \ - if ((fops) && (fops)->owner) \ - module_put((fops)->owner); \ -} while(0) + do { if (fops) module_put((fops)->owner); } while(0) extern int register_filesystem(struct file_system_type *); extern int unregister_filesystem(struct file_system_type *); diff --git a/include/linux/module.h b/include/linux/module.h index ebdfc27efbb8..8e1954a89913 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -357,7 +357,6 @@ static inline void __deprecated _MOD_INC_USE_COUNT(struct module *module) _MOD_INC_USE_COUNT(THIS_MODULE) #define MOD_DEC_USE_COUNT \ __MOD_DEC_USE_COUNT(THIS_MODULE) -#define try_inc_mod_count(mod) try_module_get(mod) #define EXPORT_NO_SYMBOLS extern int module_dummy_usage; #define GET_USE_COUNT(module) (module_dummy_usage) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 52d38241e91e..503a715fe014 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -215,10 +215,8 @@ static inline struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num) struct mtd_info *ret; ret = __get_mtd_device(mtd, num); - - if (ret && ret->module && !try_inc_mod_count(ret->module)) + if (ret && !try_module_get(ret->module)) return NULL; - return ret; } @@ -227,7 +225,6 @@ static inline void put_mtd_device(struct mtd_info *mtd) module_put(mtd->module); } - struct mtd_notifier { void (*add)(struct mtd_info *mtd); void (*remove)(struct mtd_info *mtd); diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index 162a5c23e606..5d53353d57b0 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -82,7 +82,7 @@ lookup_exec_domain(u_long personality) read_lock(&exec_domains_lock); for (ep = exec_domains; ep; ep = ep->next) { if (pers >= ep->pers_low && pers <= ep->pers_high) - if (try_inc_mod_count(ep->module)) + if (try_module_get(ep->module)) goto out; } @@ -97,7 +97,7 @@ lookup_exec_domain(u_long personality) for (ep = exec_domains; ep; ep = ep->next) { if (pers >= ep->pers_low && pers <= ep->pers_high) - if (try_inc_mod_count(ep->module)) + if (try_module_get(ep->module)) goto out; } #endif diff --git a/kernel/intermodule.c b/kernel/intermodule.c index 9228ca4fe035..5171df7d70fb 100644 --- a/kernel/intermodule.c +++ b/kernel/intermodule.c @@ -123,7 +123,7 @@ const void *inter_module_get(const char *im_name) list_for_each(tmp, &ime_list) { ime = list_entry(tmp, struct inter_module_entry, list); if (strcmp(ime->im_name, im_name) == 0) { - if (try_inc_mod_count(ime->owner)) + if (try_module_get(ime->owner)) result = ime->userdata; break; } diff --git a/net/core/dev.c b/net/core/dev.c index 97e772ff5f82..72f606980694 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -697,7 +697,7 @@ int dev_open(struct net_device *dev) /* * Call device private open method */ - if (try_inc_mod_count(dev->owner)) { + if (try_module_get(dev->owner)) { set_bit(__LINK_STATE_START, &dev->state); if (dev->open) { ret = dev->open(dev); diff --git a/net/ipv4/xfrm_policy.c b/net/ipv4/xfrm_policy.c index fe30556f78d6..f2c15d116118 100644 --- a/net/ipv4/xfrm_policy.c +++ b/net/ipv4/xfrm_policy.c @@ -192,7 +192,7 @@ struct xfrm_type *xfrm_get_type(u8 proto) read_lock(&xfrm_type_lock); type = xfrm_type_map[proto]; - if (type && !try_inc_mod_count(type->owner)) + if (type && !try_module_get(type->owner)) type = NULL; read_unlock(&xfrm_type_lock); return type; diff --git a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c index 0e50f85416d6..4e35bd351412 100644 --- a/net/rxrpc/krxsecd.c +++ b/net/rxrpc/krxsecd.c @@ -233,7 +233,7 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg) spin_lock(&trans->lock); list_for_each(_p,&trans->services) { srv = list_entry(_p,struct rxrpc_service,link); - if (srv->service_id==sid && try_inc_mod_count(srv->owner)) { + if (srv->service_id==sid && try_module_get(srv->owner)) { /* found a match (made sure it won't vanish) */ _debug("found service '%s'",srv->name); call->owner = srv->owner; diff --git a/sound/core/control.c b/sound/core/control.c index 7de5256c19fc..85a0a656c5b8 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -61,7 +61,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) err = -ENODEV; goto __error1; } - if (!try_inc_mod_count(card->module)) { + if (!try_module_get(card->module)) { err = -EFAULT; goto __error2; } diff --git a/sound/core/info.c b/sound/core/info.c index 0ae2541810a6..45bf36503596 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -296,7 +296,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) #ifdef LINUX_2_2 MOD_INC_USE_COUNT; #endif - if (entry->module && !try_inc_mod_count(entry->module)) { + if (!try_module_get(entry->module)) { err = -EFAULT; goto __error1; } diff --git a/sound/core/init.c b/sound/core/init.c index 10768c6f2898..bc320cb1d2bd 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -294,17 +294,14 @@ static void snd_card_free_thread(void * __card) snd_card_t *card = __card; struct module * module; - if (!try_inc_mod_count(module = card->module)) { + if (!try_module_get(module = card->module)) { snd_printk(KERN_ERR "unable to lock toplevel module for card %i in free thread\n", card->number); module = NULL; } wait_event(card->shutdown_sleep, card->files == NULL); - snd_card_free(card); - - if (module) - __MOD_DEC_USE_COUNT(module); + module_put(module); } /** diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 088bf5ea33c1..c4c6d4d3ff59 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -59,7 +59,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) #ifdef LINUX_2_2 MOD_INC_USE_COUNT; #endif - if (!try_inc_mod_count(card->module)) { + if (!try_module_get(card->module)) { kfree(fmixer); #ifdef LINUX_2_2 MOD_DEC_USE_COUNT; diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 4febec2769c2..4c7d5c33f134 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1551,7 +1551,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) err = snd_card_file_add(pcm->card, file); if (err < 0) goto __error1; - if (!try_inc_mod_count(pcm->card->module)) { + if (!try_module_get(pcm->card->module)) { err = -EFAULT; goto __error2; } diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 57f2a9c0f4a2..405fe698896e 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1791,7 +1791,7 @@ int snd_pcm_open(struct inode *inode, struct file *file) err = snd_card_file_add(pcm->card, file); if (err < 0) goto __error1; - if (!try_inc_mod_count(pcm->card->module)) { + if (!try_module_get(pcm->card->module)) { err = -EFAULT; goto __error2; } diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index a03924780f93..301445309d17 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -189,7 +189,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, err = -ENODEV; goto __error1; } - if (!try_inc_mod_count(rmidi->card->module)) { + if (!try_module_get(rmidi->card->module)) { err = -EFAULT; goto __error1; } diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index 837ef15abb69..af140edbdead 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c @@ -234,7 +234,7 @@ snd_seq_oss_synth_setup(seq_oss_devinfo_t *dp) else info->arg.event_passing = SNDRV_SEQ_OSS_PASS_EVENTS; info->opened = 0; - if (!try_inc_mod_count(rec->oper.owner)) { + if (!try_module_get(rec->oper.owner)) { snd_use_lock_free(&rec->use_lock); continue; } diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index 14943f8fecb8..d6654a1ab336 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -401,7 +401,7 @@ static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_ { int err = 0; - if (!try_inc_mod_count(port->owner)) + if (!try_module_get(port->owner)) return -EFAULT; grp->count++; if (grp->open && (port->callback_all || grp->count == 1)) { diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 0719b6ad0ee8..c493a659d3f5 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -282,7 +282,7 @@ static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *i snd_virmidi_dev_t *rdev; rdev = snd_magic_cast(snd_virmidi_dev_t, private_data, return -EINVAL); - if (!try_inc_mod_count(rdev->card->module)) + if (!try_module_get(rdev->card->module)) return -EFAULT; rdev->flags |= SNDRV_VIRMIDI_SUBSCRIBE; return 0; @@ -310,7 +310,7 @@ static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info) snd_virmidi_dev_t *rdev; rdev = snd_magic_cast(snd_virmidi_dev_t, private_data, return -EINVAL); - if (!try_inc_mod_count(rdev->card->module)) + if (!try_module_get(rdev->card->module)) return -EFAULT; rdev->flags |= SNDRV_VIRMIDI_USE; return 0; diff --git a/sound/core/timer.c b/sound/core/timer.c index 1b571b00728d..b386bdeb48c8 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -102,7 +102,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti timeri->in_use = (atomic_t)ATOMIC_INIT(0); timeri->timer = timer; - if (timer && timer->card && !try_inc_mod_count(timer->card->module)) { + if (timer && timer->card && !try_module_get(timer->card->module)) { kfree(timeri->owner); kfree(timeri); return NULL; diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index c622456c6136..c1f8429679f3 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -37,7 +37,7 @@ MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums."); int snd_opl3_synth_use_inc(opl3_t * opl3) { - if (!try_inc_mod_count(opl3->card->module)) + if (!try_module_get(opl3->card->module)) return -EFAULT; return 0; diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index a3473afd0118..7a9adec95248 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -42,7 +42,7 @@ static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches); int snd_gus_use_inc(snd_gus_card_t * gus) { MOD_INC_USE_COUNT; - if (!try_inc_mod_count(gus->card->module)) { + if (!try_module_get(gus->card->module)) { MOD_DEC_USE_COUNT; return 0; } diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 817b6d807a86..a9de8cb5dff2 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c @@ -145,7 +145,7 @@ snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file) { MOD_INC_USE_COUNT; - if (!try_inc_mod_count(hw->card->module)) { + if (!try_module_get(hw->card->module)) { MOD_DEC_USE_COUNT; return -EFAULT; } diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index f3e26ef9473f..88b88d23c3fd 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -1604,7 +1604,7 @@ snd_wavefront_synth_open (snd_hwdep_t *hw, struct file *file) { MOD_INC_USE_COUNT; - if (!try_inc_mod_count(hw->card->module)) { + if (!try_module_get(hw->card->module)) { MOD_DEC_USE_COUNT; return -EFAULT; } diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index 0dd6ef8c376c..a06961482fa5 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c @@ -274,9 +274,9 @@ int snd_emux_inc_count(snd_emux_t *emu) { emu->used++; - if (!try_inc_mod_count(emu->ops.owner)) + if (!try_module_get(emu->ops.owner)) goto __error; - if (!try_inc_mod_count(emu->card->module)) { + if (!try_module_get(emu->card->module)) { module_put(emu->ops.owner); __error: emu->used--; -- cgit v1.2.3