Commit d8475074 authored by Linus Torvalds's avatar Linus Torvalds

Make request_module() take a printf-like vararg argument instead of a string.

This is what a lot of the callers really wanted.
parent 3584199a
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
void crypto_alg_autoload(const char *name) void crypto_alg_autoload(const char *name)
{ {
request_module(name); request_module("%s", name);
} }
struct crypto_alg *crypto_alg_mod_lookup(const char *name) struct crypto_alg *crypto_alg_mod_lookup(const char *name)
......
...@@ -367,9 +367,7 @@ extern int blk_dev_init(void); ...@@ -367,9 +367,7 @@ extern int blk_dev_init(void);
static struct gendisk *base_probe(dev_t dev, int *part, void *data) static struct gendisk *base_probe(dev_t dev, int *part, void *data)
{ {
char name[30]; request_module("block-major-%d", MAJOR(dev));
sprintf(name, "block-major-%d", MAJOR(dev));
request_module(name);
return NULL; return NULL;
} }
......
...@@ -114,10 +114,8 @@ static int misc_open(struct inode * inode, struct file * file) ...@@ -114,10 +114,8 @@ static int misc_open(struct inode * inode, struct file * file)
if (c != &misc_list) if (c != &misc_list)
new_fops = fops_get(c->fops); new_fops = fops_get(c->fops);
if (!new_fops) { if (!new_fops) {
char modname[20];
up(&misc_sem); up(&misc_sem);
sprintf(modname, "char-major-%d-%d", MISC_MAJOR, minor); request_module("char-major-%d-%d", MISC_MAJOR, minor);
request_module(modname);
down(&misc_sem); down(&misc_sem);
c = misc_list.next; c = misc_list.next;
while ((c != &misc_list) && (c->minor != minor)) while ((c != &misc_list) && (c->minor != minor))
......
...@@ -260,9 +260,7 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc) ...@@ -260,9 +260,7 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
/* Eduardo Blanco <ejbs@cs.cs.com.uy> */ /* Eduardo Blanco <ejbs@cs.cs.com.uy> */
/* Cyrus Durgin <cider@speakeasy.org> */ /* Cyrus Durgin <cider@speakeasy.org> */
if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) { if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) {
char modname [20]; request_module("tty-ldisc-%d", ldisc);
sprintf(modname, "tty-ldisc-%d", ldisc);
request_module (modname);
} }
if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED))
return -EINVAL; return -EINVAL;
......
...@@ -58,14 +58,7 @@ static struct tt_internal *get_target_type(const char *name) ...@@ -58,14 +58,7 @@ static struct tt_internal *get_target_type(const char *name)
static void load_module(const char *name) static void load_module(const char *name)
{ {
char module_name[DM_MOD_NAME_SIZE] = "dm-"; request_module("dm-%s", name);
/* Length check for strcat() below */
if (strlen(name) > (DM_MOD_NAME_SIZE - 4))
return;
strcat(module_name, name);
request_module(module_name);
} }
struct target_type *dm_get_target_type(const char *name) struct target_type *dm_get_target_type(const char *name)
......
...@@ -1564,9 +1564,7 @@ static int do_md_run(mddev_t * mddev) ...@@ -1564,9 +1564,7 @@ static int do_md_run(mddev_t * mddev)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!pers[pnum]) if (!pers[pnum])
{ {
char module_name[80]; request_module("md-personality-%d", pnum);
sprintf (module_name, "md-personality-%d", pnum);
request_module (module_name);
} }
#endif #endif
......
...@@ -83,11 +83,8 @@ static int video_open(struct inode *inode, struct file *file) ...@@ -83,11 +83,8 @@ static int video_open(struct inode *inode, struct file *file)
down(&videodev_lock); down(&videodev_lock);
vfl=video_device[minor]; vfl=video_device[minor];
if(vfl==NULL) { if(vfl==NULL) {
char modname[20];
up(&videodev_lock); up(&videodev_lock);
sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor); request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
request_module(modname);
down(&videodev_lock); down(&videodev_lock);
vfl=video_device[minor]; vfl=video_device[minor];
if (vfl==NULL) { if (vfl==NULL) {
......
...@@ -64,7 +64,7 @@ struct mtd_info *do_map_probe(char *name, struct map_info *map) ...@@ -64,7 +64,7 @@ struct mtd_info *do_map_probe(char *name, struct map_info *map)
drv = get_mtd_chip_driver(name); drv = get_mtd_chip_driver(name);
if (!drv && !request_module(name)) if (!drv && !request_module("%s", name))
drv = get_mtd_chip_driver(name); drv = get_mtd_chip_driver(name);
if (!drv) if (!drv)
......
...@@ -66,10 +66,7 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type) ...@@ -66,10 +66,7 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
int err = -EINVAL; int err = -EINVAL;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
char modname[30]; request_module("irda-dongle-%d", type);
sprintf(modname, "irda-dongle-%d", type);
request_module(modname);
#endif #endif
if (dev->dongle_drv != NULL) if (dev->dongle_drv != NULL)
......
...@@ -1948,9 +1948,6 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) ...@@ -1948,9 +1948,6 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
struct ppp_option_data data; struct ppp_option_data data;
void *state, *ostate; void *state, *ostate;
unsigned char ccp_option[CCP_MAX_OPTION_LENGTH]; unsigned char ccp_option[CCP_MAX_OPTION_LENGTH];
#ifdef CONFIG_KMOD
char modname[32];
#endif
err = -EFAULT; err = -EFAULT;
if (copy_from_user(&data, (void *) arg, sizeof(data)) if (copy_from_user(&data, (void *) arg, sizeof(data))
...@@ -1965,8 +1962,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg) ...@@ -1965,8 +1962,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
cp = find_compressor(ccp_option[0]); cp = find_compressor(ccp_option[0]);
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (cp == 0) { if (cp == 0) {
sprintf(modname, "ppp-compress-%d", ccp_option[0]); request_module("ppp-compress-%d", ccp_option[0]);
request_module(modname);
cp = find_compressor(ccp_option[0]); cp = find_compressor(ccp_option[0]);
} }
#endif /* CONFIG_KMOD */ #endif /* CONFIG_KMOD */
......
...@@ -613,7 +613,6 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count, ...@@ -613,7 +613,6 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count,
char *page; char *page;
struct comx_hardware *hw = comx_channels; struct comx_hardware *hw = comx_channels;
struct comx_protocol *line = comx_lines; struct comx_protocol *line = comx_lines;
char str[30];
int ret=0; int ret=0;
if (count > PAGE_SIZE) { if (count > PAGE_SIZE) {
...@@ -691,8 +690,7 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count, ...@@ -691,8 +690,7 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count,
} }
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if(!hw && comx_strcasecmp(HWNAME_NONE,page) != 0){ if(!hw && comx_strcasecmp(HWNAME_NONE,page) != 0){
sprintf(str,"comx-hw-%s",page); request_module("comx-hw-%s",page);
request_module(str);
} }
hw=comx_channels; hw=comx_channels;
while (hw) { while (hw) {
...@@ -734,8 +732,7 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count, ...@@ -734,8 +732,7 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count,
} }
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if(!line && comx_strcasecmp(PROTONAME_NONE, page) != 0) { if(!line && comx_strcasecmp(PROTONAME_NONE, page) != 0) {
sprintf(str,"comx-proto-%s",page); request_module("comx-proto-%s",page);
request_module(str);
} }
line=comx_lines; line=comx_lines;
while (line) { while (line) {
......
...@@ -59,11 +59,8 @@ static int phone_open(struct inode *inode, struct file *file) ...@@ -59,11 +59,8 @@ static int phone_open(struct inode *inode, struct file *file)
if (p) if (p)
new_fops = fops_get(p->f_op); new_fops = fops_get(p->f_op);
if (!new_fops) { if (!new_fops) {
char modname[32];
up(&phone_lock); up(&phone_lock);
sprintf(modname, "char-major-%d-%d", PHONE_MAJOR, minor); request_module("char-major-%d-%d", PHONE_MAJOR, minor);
request_module(modname);
down(&phone_lock); down(&phone_lock);
p = phone_device[minor]; p = phone_device[minor];
if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
......
...@@ -839,10 +839,7 @@ fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -839,10 +839,7 @@ fb_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
static void try_to_load(int fb) static void try_to_load(int fb)
{ {
char modname[16]; request_module("fb%d", fb);
sprintf(modname, "fb%d", fb);
request_module(modname);
} }
#endif /* CONFIG_KMOD */ #endif /* CONFIG_KMOD */
......
...@@ -102,9 +102,7 @@ get_chrfops(unsigned int major, unsigned int minor) ...@@ -102,9 +102,7 @@ get_chrfops(unsigned int major, unsigned int minor)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!ret) { if (!ret) {
char name[32]; request_module("char-major-%d", major);
sprintf(name, "char-major-%d", major);
request_module(name);
read_lock(&chrdevs_lock); read_lock(&chrdevs_lock);
ret = lookup_chrfops(major, minor); ret = lookup_chrfops(major, minor);
......
...@@ -1034,14 +1034,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) ...@@ -1034,14 +1034,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
}else{ }else{
#define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e)) #define printable(c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e))
char modname[20];
if (printable(bprm->buf[0]) && if (printable(bprm->buf[0]) &&
printable(bprm->buf[1]) && printable(bprm->buf[1]) &&
printable(bprm->buf[2]) && printable(bprm->buf[2]) &&
printable(bprm->buf[3])) printable(bprm->buf[3]))
break; /* -ENOEXEC */ break; /* -ENOEXEC */
sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2])); request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
request_module(modname);
#endif #endif
} }
} }
......
...@@ -279,7 +279,7 @@ struct file_system_type *get_fs_type(const char *name) ...@@ -279,7 +279,7 @@ struct file_system_type *get_fs_type(const char *name)
if (fs && !try_module_get(fs->owner)) if (fs && !try_module_get(fs->owner))
fs = NULL; fs = NULL;
read_unlock(&file_systems_lock); read_unlock(&file_systems_lock);
if (!fs && (request_module(name) == 0)) { if (!fs && (request_module("%s", name) == 0)) {
read_lock(&file_systems_lock); read_lock(&file_systems_lock);
fs = *(find_filesystem(name)); fs = *(find_filesystem(name));
if (fs && !try_module_get(fs->owner)) if (fs && !try_module_get(fs->owner))
......
...@@ -217,7 +217,6 @@ struct nls_table *load_nls(char *charset) ...@@ -217,7 +217,6 @@ struct nls_table *load_nls(char *charset)
{ {
struct nls_table *nls; struct nls_table *nls;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
char buf[40];
int ret; int ret;
#endif #endif
...@@ -226,14 +225,7 @@ struct nls_table *load_nls(char *charset) ...@@ -226,14 +225,7 @@ struct nls_table *load_nls(char *charset)
return nls; return nls;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (strlen(charset) > sizeof(buf) - sizeof("nls_")) { ret = request_module("nls_%s", charset);
printk("Unable to load NLS charset %s: name too long\n",
charset);
return NULL;
}
sprintf(buf, "nls_%s", charset);
ret = request_module(buf);
if (ret != 0) { if (ret != 0) {
printk("Unable to load NLS charset %s\n", charset); printk("Unable to load NLS charset %s\n", charset);
return NULL; return NULL;
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
extern int request_module(const char * name); extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2)));
#else #else
static inline int request_module(const char * name) { return -ENOSYS; } static inline int request_module(const char * name, ...) { return -ENOSYS; }
#endif #endif
#define try_then_request_module(x, mod) ((x) ?: request_module(mod), (x)) #define try_then_request_module(x, mod...) ((x) ?: request_module(mod), (x))
extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait); extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait);
#ifdef CONFIG_HOTPLUG #ifdef CONFIG_HOTPLUG
......
...@@ -88,11 +88,7 @@ lookup_exec_domain(u_long personality) ...@@ -88,11 +88,7 @@ lookup_exec_domain(u_long personality)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
read_unlock(&exec_domains_lock); read_unlock(&exec_domains_lock);
{ request_module("personality-%ld", pers);
char buffer[30];
sprintf(buffer, "personality-%ld", pers);
request_module(buffer);
}
read_lock(&exec_domains_lock); read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) { for (ep = exec_domains; ep; ep = ep->next) {
......
...@@ -143,7 +143,7 @@ const void *inter_module_get_request(const char *im_name, const char *modname) ...@@ -143,7 +143,7 @@ const void *inter_module_get_request(const char *im_name, const char *modname)
{ {
const void *result = inter_module_get(im_name); const void *result = inter_module_get(im_name);
if (!result) { if (!result) {
request_module(modname); request_module("%s", modname);
result = inter_module_get(im_name); result = inter_module_get(im_name);
} }
return(result); return(result);
......
...@@ -58,11 +58,14 @@ char modprobe_path[256] = "/sbin/modprobe"; ...@@ -58,11 +58,14 @@ char modprobe_path[256] = "/sbin/modprobe";
* If module auto-loading support is disabled then this function * If module auto-loading support is disabled then this function
* becomes a no-operation. * becomes a no-operation.
*/ */
int request_module(const char *module_name) #define MODULENAME_SIZE 32
int request_module(const char *fmt, ...)
{ {
va_list args;
char module_name[MODULENAME_SIZE];
unsigned int max_modprobes; unsigned int max_modprobes;
int ret; int ret;
char *argv[] = { modprobe_path, "--", (char*)module_name, NULL }; char *argv[] = { modprobe_path, "--", module_name, NULL };
static char *envp[] = { "HOME=/", static char *envp[] = { "HOME=/",
"TERM=linux", "TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin", "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
...@@ -71,6 +74,12 @@ int request_module(const char *module_name) ...@@ -71,6 +74,12 @@ int request_module(const char *module_name)
#define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */
static int kmod_loop_msg; static int kmod_loop_msg;
va_start(args, fmt);
ret = vsnprintf(module_name, MODULENAME_SIZE, fmt, args);
va_end(args);
if (ret >= MODULENAME_SIZE)
return -ENAMETOOLONG;
/* If modprobe needs a service that is in a module, we get a recursive /* If modprobe needs a service that is in a module, we get a recursive
* loop. Limit the number of running kmod threads to max_threads/2 or * loop. Limit the number of running kmod threads to max_threads/2 or
* MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method * MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method
...@@ -80,7 +89,6 @@ int request_module(const char *module_name) ...@@ -80,7 +89,6 @@ int request_module(const char *module_name)
* and it is not worth changing the proc code just to handle this case. * and it is not worth changing the proc code just to handle this case.
* KAO. * KAO.
* *
* "trace the ppid" is simple, but will fail if someone's * "trace the ppid" is simple, but will fail if someone's
* parent exits. I think this is as good as it gets. --RR * parent exits. I think this is as good as it gets. --RR
*/ */
......
...@@ -99,9 +99,7 @@ static int bt_sock_create(struct socket *sock, int proto) ...@@ -99,9 +99,7 @@ static int bt_sock_create(struct socket *sock, int proto)
#if defined(CONFIG_KMOD) #if defined(CONFIG_KMOD)
if (!bt_proto[proto]) { if (!bt_proto[proto]) {
char module_name[30]; request_module("bt-proto-%d", proto);
sprintf(module_name, "bt-proto-%d", proto);
request_module(module_name);
} }
#endif #endif
err = -EPROTONOSUPPORT; err = -EPROTONOSUPPORT;
......
...@@ -319,10 +319,7 @@ find_inlist_lock(struct list_head *head, const char *name, const char *prefix, ...@@ -319,10 +319,7 @@ find_inlist_lock(struct list_head *head, const char *name, const char *prefix,
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
if (!ret) { if (!ret) {
char modulename[EBT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1]; request_module("%s%s", prefix, name);
strcpy(modulename, prefix);
strcat(modulename, name);
request_module(modulename);
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
} }
return ret; return ret;
......
...@@ -721,7 +721,7 @@ void netdev_state_change(struct net_device *dev) ...@@ -721,7 +721,7 @@ void netdev_state_change(struct net_device *dev)
void dev_load(const char *name) void dev_load(const char *name)
{ {
if (!dev_get(name) && capable(CAP_SYS_MODULE)) if (!dev_get(name) && capable(CAP_SYS_MODULE))
request_module(name); request_module("%s", name);
} }
#else #else
......
...@@ -371,11 +371,8 @@ find_inlist_lock(struct list_head *head, ...@@ -371,11 +371,8 @@ find_inlist_lock(struct list_head *head,
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
if (!ret) { if (!ret) {
char modulename[ARPT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1]; duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
strcpy(modulename, prefix); request_module("%s%s", prefix, name);
strcat(modulename, name);
duprintf("find_inlist: loading `%s'.\n", modulename);
request_module(modulename);
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
} }
......
...@@ -426,7 +426,7 @@ int ip_nat_helper_register(struct ip_nat_helper *me) ...@@ -426,7 +426,7 @@ int ip_nat_helper_register(struct ip_nat_helper *me)
tmp += 6; tmp += 6;
sprintf(name, "ip_conntrack%s", tmp); sprintf(name, "ip_conntrack%s", tmp);
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!request_module(name) if (!request_module("ip_conntrack%s", tmp)
&& (ct_helper = ip_ct_find_helper(&me->tuple))) { && (ct_helper = ip_ct_find_helper(&me->tuple))) {
if (!try_module_get(ct_helper->me)) if (!try_module_get(ct_helper->me))
return -EBUSY; return -EBUSY;
......
...@@ -454,11 +454,8 @@ find_inlist_lock(struct list_head *head, ...@@ -454,11 +454,8 @@ find_inlist_lock(struct list_head *head,
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
if (!ret) { if (!ret) {
char modulename[IPT_FUNCTION_MAXNAMELEN + strlen(prefix) + 1]; duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
strcpy(modulename, prefix); request_module("%s%s", prefix, name);
strcat(modulename, name);
duprintf("find_inlist: loading `%s'.\n", modulename);
request_module(modulename);
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
} }
......
...@@ -527,11 +527,8 @@ find_inlist_lock(struct list_head *head, ...@@ -527,11 +527,8 @@ find_inlist_lock(struct list_head *head,
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
if (!ret) { if (!ret) {
char modulename[IP6T_FUNCTION_MAXNAMELEN + strlen(prefix) + 1]; duprintf("find_inlist: loading `%s%s'.\n", prefix, name);
strcpy(modulename, prefix); request_module("%s%s", prefix, name);
strcat(modulename, name);
duprintf("find_inlist: loading `%s'.\n", modulename);
request_module(modulename);
ret = find_inlist_lock_noload(head, name, error, mutex); ret = find_inlist_lock_noload(head, name, error, mutex);
} }
......
...@@ -433,13 +433,9 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) ...@@ -433,13 +433,9 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
ASSERT(dev != NULL, return NULL;); ASSERT(dev != NULL, return NULL;);
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
{
char modname[32];
ASSERT(!in_interrupt(), return NULL;); ASSERT(!in_interrupt(), return NULL;);
/* Try to load the module needed */ /* Try to load the module needed */
sprintf(modname, "irda-dongle-%d", type); request_module("irda-dongle-%d", type);
request_module(modname);
}
#endif #endif
if (!(reg = hashbin_lock_find(dongles, type, NULL))) { if (!(reg = hashbin_lock_find(dongles, type, NULL))) {
......
...@@ -204,11 +204,9 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) ...@@ -204,11 +204,9 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (tp_ops==NULL && tca[TCA_KIND-1] != NULL) { if (tp_ops==NULL && tca[TCA_KIND-1] != NULL) {
struct rtattr *kind = tca[TCA_KIND-1]; struct rtattr *kind = tca[TCA_KIND-1];
char module_name[4 + IFNAMSIZ + 1];
if (RTA_PAYLOAD(kind) <= IFNAMSIZ) { if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
sprintf(module_name, "cls_%s", (char*)RTA_DATA(kind)); request_module("cls_%s", (char*)RTA_DATA(kind));
request_module (module_name);
tp_ops = tcf_proto_lookup_ops(kind); tp_ops = tcf_proto_lookup_ops(kind);
} }
} }
......
...@@ -396,11 +396,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp) ...@@ -396,11 +396,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
ops = qdisc_lookup_ops(kind); ops = qdisc_lookup_ops(kind);
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (ops==NULL && tca[TCA_KIND-1] != NULL) { if (ops==NULL && tca[TCA_KIND-1] != NULL) {
char module_name[4 + IFNAMSIZ + 1];
if (RTA_PAYLOAD(kind) <= IFNAMSIZ) { if (RTA_PAYLOAD(kind) <= IFNAMSIZ) {
sprintf(module_name, "sch_%s", (char*)RTA_DATA(kind)); request_module("sch_%s", (char*)RTA_DATA(kind));
request_module (module_name);
ops = qdisc_lookup_ops(kind); ops = qdisc_lookup_ops(kind);
} }
} }
......
...@@ -1034,9 +1034,7 @@ int sock_create(int family, int type, int protocol, struct socket **res) ...@@ -1034,9 +1034,7 @@ int sock_create(int family, int type, int protocol, struct socket **res)
*/ */
if (net_families[family]==NULL) if (net_families[family]==NULL)
{ {
char module_name[30]; request_module("net-pf-%d",family);
sprintf(module_name,"net-pf-%d",family);
request_module(module_name);
} }
#endif #endif
......
...@@ -136,7 +136,6 @@ client_t *snd_seq_client_use_ptr(int clientid) ...@@ -136,7 +136,6 @@ client_t *snd_seq_client_use_ptr(int clientid)
static char card_requested[SNDRV_CARDS]; static char card_requested[SNDRV_CARDS];
if (clientid < 64) { if (clientid < 64) {
int idx; int idx;
char name[32];
if (! client_requested[clientid]) { if (! client_requested[clientid]) {
client_requested[clientid] = 1; client_requested[clientid] = 1;
...@@ -144,8 +143,7 @@ client_t *snd_seq_client_use_ptr(int clientid) ...@@ -144,8 +143,7 @@ client_t *snd_seq_client_use_ptr(int clientid)
if (seq_client_load[idx] < 0) if (seq_client_load[idx] < 0)
break; break;
if (seq_client_load[idx] == clientid) { if (seq_client_load[idx] == clientid) {
sprintf(name, "snd-seq-client-%i", clientid); request_module("snd-seq-client-%i", clientid);
request_module(name);
break; break;
} }
} }
......
...@@ -131,7 +131,6 @@ void snd_seq_device_load_drivers(void) ...@@ -131,7 +131,6 @@ void snd_seq_device_load_drivers(void)
{ {
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
struct list_head *head; struct list_head *head;
char modname[64];
down(&ops_mutex); down(&ops_mutex);
list_for_each(head, &opslist) { list_for_each(head, &opslist) {
...@@ -141,8 +140,7 @@ void snd_seq_device_load_drivers(void) ...@@ -141,8 +140,7 @@ void snd_seq_device_load_drivers(void)
ops->used++; ops->used++;
up(&ops_mutex); up(&ops_mutex);
ops->driver |= DRIVER_REQUESTED; ops->driver |= DRIVER_REQUESTED;
sprintf(modname, "snd-%s", ops->id); request_module("snd-%s", ops->id);
request_module(modname);
down(&ops_mutex); down(&ops_mutex);
ops->used--; ops->used--;
} }
......
...@@ -79,7 +79,6 @@ static DECLARE_MUTEX(sound_mutex); ...@@ -79,7 +79,6 @@ static DECLARE_MUTEX(sound_mutex);
*/ */
void snd_request_card(int card) void snd_request_card(int card)
{ {
char str[32];
int locked; int locked;
read_lock(&snd_card_rwlock); read_lock(&snd_card_rwlock);
...@@ -89,8 +88,7 @@ void snd_request_card(int card) ...@@ -89,8 +88,7 @@ void snd_request_card(int card)
return; return;
if (card < 0 || card >= cards_limit) if (card < 0 || card >= cards_limit)
return; return;
sprintf(str, "snd-card-%i", card); request_module("snd-card-%i", card);
request_module(str);
} }
static void snd_request_other(int minor) static void snd_request_other(int minor)
......
...@@ -216,9 +216,7 @@ static int sound_open(struct inode *inode, struct file *file) ...@@ -216,9 +216,7 @@ static int sound_open(struct inode *inode, struct file *file)
case SND_DEV_CTL: case SND_DEV_CTL:
dev >>= 4; dev >>= 4;
if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) {
char modname[20]; request_module("mixer%d", dev);
sprintf(modname, "mixer%d", dev);
request_module(modname);
} }
if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL))
return -ENXIO; return -ENXIO;
...@@ -318,9 +316,7 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, caddr_t arg) ...@@ -318,9 +316,7 @@ static int sound_mixer_ioctl(int mixdev, unsigned int cmd, caddr_t arg)
return -ENXIO; return -ENXIO;
/* Try to load the mixer... */ /* Try to load the mixer... */
if (mixer_devs[mixdev] == NULL) { if (mixer_devs[mixdev] == NULL) {
char modname[20]; request_module("mixer%d", mixdev);
sprintf(modname, "mixer%d", mixdev);
request_module(modname);
} }
if (mixdev >= num_mixers || !mixer_devs[mixdev]) if (mixdev >= num_mixers || !mixer_devs[mixdev])
return -ENXIO; return -ENXIO;
......
...@@ -500,8 +500,6 @@ int soundcore_open(struct inode *inode, struct file *file) ...@@ -500,8 +500,6 @@ int soundcore_open(struct inode *inode, struct file *file)
if (s) if (s)
new_fops = fops_get(s->unit_fops); new_fops = fops_get(s->unit_fops);
if (!new_fops) { if (!new_fops) {
char mod[32];
spin_unlock(&sound_loader_lock); spin_unlock(&sound_loader_lock);
/* /*
* Please, don't change this order or code. * Please, don't change this order or code.
...@@ -510,10 +508,8 @@ int soundcore_open(struct inode *inode, struct file *file) ...@@ -510,10 +508,8 @@ int soundcore_open(struct inode *inode, struct file *file)
* ALSA toplevel modules for soundcards, thus we need * ALSA toplevel modules for soundcards, thus we need
* load them at first. [Jaroslav Kysela <perex@jcu.cz>] * load them at first. [Jaroslav Kysela <perex@jcu.cz>]
*/ */
sprintf(mod, "sound-slot-%i", unit>>4); request_module("sound-slot-%i", unit>>4);
request_module(mod); request_module("sound-service-%i-%i", unit>>4, chain);
sprintf(mod, "sound-service-%i-%i", unit>>4, chain);
request_module(mod);
spin_lock(&sound_loader_lock); spin_lock(&sound_loader_lock);
s = __look_for_unit(chain, unit); s = __look_for_unit(chain, unit);
if (s) if (s)
......
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