|
@@ -772,9 +772,18 @@ static int try_stop_module(struct module *mod, int flags, int *forced)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-unsigned long module_refcount(struct module *mod)
|
|
|
+/**
|
|
|
+ * module_refcount - return the refcount or -1 if unloading
|
|
|
+ *
|
|
|
+ * @mod: the module we're checking
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * -1 if the module is in the process of unloading
|
|
|
+ * otherwise the number of references in the kernel to the module
|
|
|
+ */
|
|
|
+int module_refcount(struct module *mod)
|
|
|
{
|
|
|
- return (unsigned long)atomic_read(&mod->refcnt) - MODULE_REF_BASE;
|
|
|
+ return atomic_read(&mod->refcnt) - MODULE_REF_BASE;
|
|
|
}
|
|
|
EXPORT_SYMBOL(module_refcount);
|
|
|
|
|
@@ -856,7 +865,7 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
|
|
|
struct module_use *use;
|
|
|
int printed_something = 0;
|
|
|
|
|
|
- seq_printf(m, " %lu ", module_refcount(mod));
|
|
|
+ seq_printf(m, " %i ", module_refcount(mod));
|
|
|
|
|
|
/*
|
|
|
* Always include a trailing , so userspace can differentiate
|
|
@@ -908,7 +917,7 @@ EXPORT_SYMBOL_GPL(symbol_put_addr);
|
|
|
static ssize_t show_refcnt(struct module_attribute *mattr,
|
|
|
struct module_kobject *mk, char *buffer)
|
|
|
{
|
|
|
- return sprintf(buffer, "%lu\n", module_refcount(mk->mod));
|
|
|
+ return sprintf(buffer, "%i\n", module_refcount(mk->mod));
|
|
|
}
|
|
|
|
|
|
static struct module_attribute modinfo_refcnt =
|