remove CONFIG_KMOD
Subsystems (26)
PATCH 4/11 remove CONFIG_KMOD from drivers
In reply to Johannes BergStraight forward conversions to CONFIG_MODULE; many drivers include <linux/kmod.h> conditionally and then don't have any other conditional code so remove it from those.
---
v2: remove #ifdef in md.c
drivers/md/md.c | 7 ------- drivers/media/video/cpia.c | 4 ---- drivers/media/video/usbvision/usbvision-core.c | 4 ---- drivers/media/video/usbvision/usbvision-video.c | 4 ---- drivers/media/video/v4l1-compat.c | 4 ---- drivers/media/video/v4l2-common.c | 4 ---- drivers/media/video/vino.c | 5 +---- drivers/media/video/w9968cf.c | 4 ++-- drivers/mtd/mtdpart.c | 2 -- drivers/net/irda/sir_dongle.c | 2 -- drivers/net/ppp_generic.c | 10 +++------- drivers/net/pppox.c | 9 ++------- drivers/video/fbmem.c | 17 ++--------------- 13 files changed, 10 insertions(+), 66 deletions(-)
drivers/md/md.c +0 -7
@@ -44,14 +44,9 @@#include <linux/mutex.h> #include <linux/ctype.h> #include <linux/freezer.h> -#include <linux/init.h> -#include <linux/file.h> - -#ifdef CONFIG_KMOD #include <linux/kmod.h> -#endif #include <asm/unaligned.h>
@@ -3565,12 +3560,10 @@ static int do_md_run(mddev_t * mddev) } } -#ifdef CONFIG_KMOD if (mddev->level !=LEVEL_NONE )request_module ("md-level-%d" , mddev->level);else if (mddev->clevel[0 ])request_module ("md-%s" , mddev->clevel); -#endif /* * Drop all container device buffers, from now on
drivers/media/video/cpia.c +0 -4
@@ -39,10 +39,6 @@#include <asm/io.h> #include <linux/mutex.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -#include "cpia.h" static int video_nr =-1 ;
drivers/media/video/usbvision/usbvision-core.c +0 -4
@@ -47,10 +47,6 @@#include <linux/workqueue.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -#include "usbvision.h" static unsigned int core_debug;
drivers/media/video/usbvision/usbvision-video.c +0 -4
@@ -70,10 +70,6 @@#include <linux/workqueue.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -#include "usbvision.h" #include "usbvision-cards.h"
drivers/media/video/v4l1-compat.c +0 -4
@@ -35,10 +35,6 @@#include <asm/system.h> #include <asm/pgtable.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -static unsigned int debug;module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"enable debug messages" );
drivers/media/video/v4l2-common.c +0 -4
@@ -60,10 +60,6 @@#include <media/v4l2-common.h> #include <media/v4l2-chip-ident.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -#include <linux/videodev.h> MODULE_AUTHOR ("Bill Dirks, Justin Schoeman, Gerd Knorr" );
drivers/media/video/vino.c +1 -4
@@ -30,10 +30,7 @@#include <linux/mm.h> #include <linux/time.h> #include <linux/version.h> - -#ifdef CONFIG_KMOD #include <linux/kmod.h> -#endif #include <linux/i2c.h> #include <linux/i2c-algo-sgi.h>
@@ -4641,7 +4638,7 @@ static int __init vino_module_init(void) } vino_init_stage++; -#if defined(CONFIG_KMOD ) && defined(MODULE ) +#ifdef MODULE request_module ("saa7191" );request_module ("indycam" );#endif
drivers/media/video/w9968cf.c +2 -2
@@ -110,7 +110,7 @@ static int specific_debug = W9968CF_SPECstatic unsigned int param_nv[24 ];/* number of values per parameter */ -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES module_param (ovmod_load, bool,0644 );#endif module_param (simcams, ushort,0644 );
@@ -143,7 +143,7 @@ module_param(debug, ushort, 0644);module_param (specific_debug, bool,0644 );#endif -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES MODULE_PARM_DESC (ovmod_load,"\n<0|1> Automatic 'ovcamchip' module loading." "\n0 disabled, 1 enabled."
drivers/mtd/mtdpart.c +0 -2
@@ -544,10 +544,8 @@ int parse_mtd_partitions(struct mtd_infofor ( ; ret <=0 && *types; types++) { parser =get_partition_parser (*types); -#ifdef CONFIG_KMOD if (!parser && !request_module ("%s" , *types)) parser =get_partition_parser (*types); -#endif if (!parser) {printk (KERN_NOTICE "%s partition parsing not available\n" , *types);
drivers/net/irda/sir_dongle.c +0 -2
@@ -67,9 +67,7 @@ int sirdev_get_dongle(struct sir_dev *deconst struct dongle_driver *drv =NULL ;int err = -EINVAL ; -#ifdef CONFIG_KMOD request_module ("irda-dongle-%d" , type); -#endif if (dev->dongle_drv !=NULL )return -EBUSY ;
drivers/net/ppp_generic.c +3 -7
@@ -2124,13 +2124,9 @@ ppp_set_compress(struct ppp *ppp, unsign || ccp_option[1] < 2 || ccp_option[1] > data.length) goto out; - cp =find_compressor (ccp_option[0 ]); -#ifdef CONFIG_KMOD -if (!cp) { -request_module ("ppp-compress-%d" , ccp_option[0 ]); - cp =find_compressor (ccp_option[0 ]); - } -#endif /* CONFIG_KMOD */ + cp =try_then_request_module ( +find_compressor (ccp_option[0 ]), +"ppp-compress-%d" , ccp_option[0 ]);if (!cp) goto out;
drivers/net/pppox.c +2 -7
@@ -115,13 +115,8 @@ static int pppox_create(struct net *net, goto out; rc = -EPROTONOSUPPORT ; -#ifdef CONFIG_KMOD -if (!pppox_protos[protocol]) { -char buffer[32 ]; -sprintf (buffer,"pppox-proto-%d" , protocol); -request_module (buffer); - } -#endif +if (!pppox_protos[protocol]) +request_module ("pppox-proto-%d" , protocol);if (!pppox_protos[protocol] || !try_module_get (pppox_protos[protocol]->owner)) goto out;
drivers/video/fbmem.c +2 -15
@@ -28,9 +28,7 @@#include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/console.h> -#ifdef CONFIG_KMOD #include <linux/kmod.h> -#endif #include <linux/err.h> #include <linux/device.h> #include <linux/efi.h>
@@ -837,13 +835,6 @@ fb_write(struct file *file, const char _return (cnt) ? cnt : err; } -#ifdef CONFIG_KMOD -static void try_to_load (int fb) -{ -request_module ("fb%d" , fb); -} -#endif /* CONFIG_KMOD */ -int fb_pan_display (struct fb_info *info,struct fb_var_screeninfo *var) {
@@ -1086,10 +1077,8 @@ fb_ioctl(struct inode *inode, struct filreturn -EINVAL ;if (con2fb.framebuffer <0 || con2fb.framebuffer >=FB_MAX )return -EINVAL ; -#ifdef CONFIG_KMOD if (!registered_fb[con2fb.framebuffer]) -try_to_load (con2fb.framebuffer); -#endif /* CONFIG_KMOD */ +request_module ("fb%d" , con2fb.framebuffer);if (!registered_fb[con2fb.framebuffer])return -EINVAL ; event.info = info;
@@ -1327,10 +1316,8 @@ fb_open(struct inode *inode, struct fileif (fbidx >=FB_MAX )return -ENODEV ;lock_kernel (); -#ifdef CONFIG_KMOD if (!(info = registered_fb[fbidx])) -try_to_load (fbidx); -#endif /* CONFIG_KMOD */ +request_module ("fb%d" , fbidx);if (!(info = registered_fb[fbidx])) { res = -ENODEV ; goto out;
PATCH 9/11 remove CONFIG_KMOD from lib
In reply to Johannes Bergtextsearch algorithms can be loaded, make the code depend on CONFIG_MODULES instead of CONFIG_KMOD.
--- lib/textsearch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/textsearch.c +1 -1
@@ -265,7 +265,7 @@ struct ts_config *textsearch_prepare(conreturn ERR_PTR (-EINVAL ); ops =lookup_ts_algo (algo); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /* * Why not always autoload you may ask. Some users are * in a situation where requesting a module may deadlock,
PATCH 8/11 remove CONFIG_KMOD from net
In reply to Johannes BergSome code here depends on CONFIG_KMOD to not try to load protocol modules or similar, replace by CONFIG_MODULES where more than just request_module depends on CONFIG_KMOD and and also use try_then_request_module in ebtables.
---
v2: remove #ifdef around EXPORT_SYMBOL pointed out by
Adrian Bunk
include/linux/netdevice.h | 5 ++++- net/bluetooth/af_bluetooth.c | 8 +------- net/bridge/netfilter/ebtables.c | 15 +++------------ net/can/af_can.c | 4 ++-- net/core/dev.c | 2 -- net/core/rtnetlink.c | 4 ++-- net/dccp/ccid.c | 2 +- net/decnet/dn_dev.c | 2 -- net/ipv4/devinet.c | 2 -- net/ipv4/inet_diag.c | 2 -- net/ipv4/tcp_cong.c | 4 ++-- net/netfilter/nfnetlink.c | 2 +- net/netlink/af_netlink.c | 2 +- net/sched/act_api.c | 2 +- net/sched/cls_api.c | 2 +- net/sched/ematch.c | 2 +- net/sched/sch_api.c | 2 +- net/socket.c | 2 +- net/sunrpc/auth.c | 2 -- 19 files changed, 22 insertions(+), 44 deletions(-)
net/bluetooth/af_bluetooth.c +1 -7
@@ -36,10 +36,7 @@#include <linux/init.h> #include <linux/poll.h> #include <net/sock.h> - -#if defined(CONFIG_KMOD )#include <linux/kmod.h> -#endif #include <net/bluetooth/bluetooth.h>
@@ -144,11 +141,8 @@ static int bt_sock_create(struct net *neif (proto <0 || proto >=BT_MAX_PROTO )return -EINVAL ; -#if defined(CONFIG_KMOD ) -if (!bt_proto[proto]) { +if (!bt_proto[proto])request_module ("bt-proto-%d" , proto); - } -#endif err = -EPROTONOSUPPORT ;
net/bridge/netfilter/ebtables.c +3 -12
@@ -288,23 +288,14 @@ find_inlist_lock_noload(struct list_headreturn NULL ; } -#ifndef CONFIG_KMOD -#define find_inlist_lock (h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m)) -#else static void *find_inlist_lock (struct list_head *head,const char *name,const char *prefix,int *error,struct mutex *mutex) { -void *ret; - - ret =find_inlist_lock_noload (head, name, error, mutex); -if (!ret) { -request_module ("%s%s" , prefix, name); - ret =find_inlist_lock_noload (head, name, error, mutex); - } -return ret; +return try_then_request_module ( +find_inlist_lock_noload (head, name, error, mutex), +"%s%s" , prefix, name); } -#endif static inline struct ebt_table *find_table_lock (const char *name,int *error,struct mutex *mutex)
net/can/af_can.c +2 -2
@@ -128,8 +128,8 @@ static int can_create(struct net *net, sif (net != &init_net)return -EAFNOSUPPORT ; -#ifdef CONFIG_KMOD -/* try to load protocol module, when CONFIG_KMOD is defined */ +#ifdef CONFIG_MODULES +/* try to load protocol module kernel is modular */ if (!proto_tab[protocol]) { err =request_module ("can-proto-%d" , protocol);
net/core/dev.c +0 -2
@@ -4704,8 +4704,6 @@ EXPORT_SYMBOL(br_fdb_get_hook);EXPORT_SYMBOL (br_fdb_put_hook);#endif -#ifdef CONFIG_KMOD EXPORT_SYMBOL (dev_load); -#endif EXPORT_PER_CPU_SYMBOL (softnet_data);
net/core/rtnetlink.c +2 -2
@@ -1025,7 +1025,7 @@ static int rtnl_newlink(struct sk_buff *struct nlattr *linkinfo[IFLA_INFO_MAX +1 ];int err; -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES replay:#endif err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);
@@ -1114,7 +1114,7 @@ replay:return -EOPNOTSUPP ;if (!ops) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (kind[0 ]) {__rtnl_unlock ();request_module ("rtnl-link-%s" , kind);
net/dccp/ccid.c +1 -1
@@ -154,7 +154,7 @@ struct ccid *ccid_new(unsigned char id,struct ccid *ccid =NULL ;ccids_read_lock (); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (ccids[id] ==NULL ) {/* We only try to load if in process context */ ccids_read_unlock ();
net/decnet/dn_dev.c +0 -2
@@ -490,9 +490,7 @@ int dn_dev_ioctl(unsigned int cmd, voidreturn -EFAULT ; ifr->ifr_name[IFNAMSIZ -1 ] =0 ; -#ifdef CONFIG_KMOD dev_load (&init_net, ifr->ifr_name); -#endif switch (cmd) {case SIOCGIFADDR :
net/ipv4/devinet.c +0 -2
@@ -613,9 +613,7 @@ int devinet_ioctl(struct net *net, unsigif (colon) *colon =0 ; -#ifdef CONFIG_KMOD dev_load (net, ifr.ifr_name); -#endif switch (cmd) {case SIOCGIFADDR :/* Get interface address */
net/ipv4/inet_diag.c +0 -2
@@ -53,11 +53,9 @@ static DEFINE_MUTEX(inet_diag_table_mutestatic const struct inet_diag_handler *inet_diag_lock_handler (int type) { -#ifdef CONFIG_KMOD if (!inet_diag_table[type])request_module ("net-pf-%d-proto-%d-type-%d" ,PF_NETLINK ,NETLINK_INET_DIAG , type); -#endif mutex_lock (&inet_diag_table_mutex);if (!inet_diag_table[type])
net/ipv4/tcp_cong.c +2 -2
@@ -115,7 +115,7 @@ int tcp_set_default_congestion_control(cspin_lock (&tcp_cong_list_lock); ca =tcp_ca_find (name); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (!ca &&capable (CAP_SYS_MODULE )) {spin_unlock (&tcp_cong_list_lock);
@@ -244,7 +244,7 @@ int tcp_set_congestion_control(struct soif (ca == icsk->icsk_ca_ops) goto out; -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /* not found attempt to autoload module */ if (!ca &&capable (CAP_SYS_MODULE )) {rcu_read_unlock ();
net/netfilter/nfnetlink.c +1 -1
@@ -134,7 +134,7 @@ static int nfnetlink_rcv_msg(struct sk_b type = nlh->nlmsg_type; ss =nfnetlink_get_subsys (type);if (!ss) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES nfnl_unlock ();request_module ("nfnetlink-subsys-%d" ,NFNL_SUBSYS_ID (type));nfnl_lock ();
net/netlink/af_netlink.c +1 -1
@@ -434,7 +434,7 @@ static int netlink_create(struct net *nereturn -EPROTONOSUPPORT ;netlink_lock_table (); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (!nl_table[protocol].registered) {netlink_unlock_table ();request_module ("net-pf-%d-proto-%d" ,PF_NETLINK , protocol);
net/sched/act_api.c +1 -1
@@ -495,7 +495,7 @@ struct tc_action *tcf_action_init_1(stru a_o =tc_lookup_action_n (act_name);if (a_o ==NULL ) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES rtnl_unlock ();request_module ("act_%s" , act_name);rtnl_lock ();
net/sched/cls_api.c +1 -1
@@ -223,7 +223,7 @@ replay: err = -ENOENT ; tp_ops =tcf_proto_lookup_ops (tca[TCA_KIND ]);if (tp_ops ==NULL ) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES struct nlattr *kind = tca[TCA_KIND ];char name[IFNAMSIZ ];
net/sched/ematch.c +1 -1
@@ -224,7 +224,7 @@ static int tcf_em_validate(struct tcf_prif (em->ops ==NULL ) { err = -ENOENT ; -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES __rtnl_unlock ();request_module ("ematch-kind-%u" , em_hdr->kind);rtnl_lock ();
net/sched/sch_api.c +1 -1
@@ -561,7 +561,7 @@ qdisc_create(struct net_device *dev, u32struct Qdisc_ops *ops; ops =qdisc_lookup_ops (kind); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (ops ==NULL && kind !=NULL ) {char name[IFNAMSIZ ];if (nla_strlcpy (name, kind,IFNAMSIZ ) <IFNAMSIZ ) {
net/socket.c +1 -1
@@ -1140,7 +1140,7 @@ static int __sock_create(struct net *net sock->type = type; -#if defined(CONFIG_KMOD ) +#ifdef CONFIG_MODULES /* Attempt to load a protocol module if the find failed. * * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
net/sunrpc/auth.c +0 -2
@@ -83,10 +83,8 @@ rpcauth_create(rpc_authflavor_t pseudoflif (flavor >=RPC_AUTH_MAXFLAVOR ) goto out; -#ifdef CONFIG_KMOD if ((ops = auth_flavors[flavor]) ==NULL )request_module ("rpc-auth-%u" , flavor); -#endif spin_lock (&rpc_authflavor_lock); ops = auth_flavors[flavor];if (ops ==NULL || !try_module_get (ops->owner)) {
include/linux/netdevice.h +4 -1
@@ -1488,8 +1488,11 @@ extern int dev_set_allmulti(struct net_extern void netdev_state_change (struct net_device *dev);extern void netdev_bonding_change (struct net_device *dev);extern void netdev_features_change (struct net_device *dev); -/* Load a device via the kmod */ +#ifdef CONFIG_MODULES extern void dev_load (struct net *net,const char *name); +#else +static inline void dev_load (struct net *net,const char *name) {}; +#endif extern void dev_mcast_init (void );extern int netdev_max_backlog;extern int weight_p;
PATCH 1/11 make CONFIG_KMOD invisible
In reply to Johannes Berg... as preparation for removing it completely, make it an invisible bool defaulting to yes.
--- init/Kconfig | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
init/Kconfig +1 -9
@@ -893,16 +893,8 @@ config MODULE_SRCVERSION_ALL will be created for all modules. If unsure, say N. config KMOD - bool "Automatic kernel module loading" + def_bool y depends on MODULES - help - Normally when you have selected some parts of the kernel to - be created as kernel modules, you must load them (using the - "modprobe" command) before you can use them. If you say Y - here, some parts of the kernel will be able to load modules - automatically: when a part of the kernel needs a module, it - runs modprobe with the appropriate arguments, thereby - loading the module if it is available. If unsure, say Y. config STOP_MACHINE bool
PATCH 6/11 remove CONFIG_KMOD from fs
In reply to Johannes BergJust always compile the code when the kernel is modular. Convert load_nls to use try_then_request_module to tidy up the code.
---
v2: fix "unused variable" warning pointed out by Adrian Bunk
by just using try_then_request_module() for load_nls().
fs/char_dev.c | 3 --- fs/exec.c | 9 +++------ fs/nls/nls_base.c | 23 +++-------------------- 3 files changed, 6 insertions(+), 29 deletions(-)
fs/char_dev.c +0 -3
@@ -22,9 +22,6 @@#include <linux/mutex.h> #include <linux/backing-dev.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif #include "internal.h" /*
fs/exec.c +3 -6
@@ -51,15 +51,12 @@#include <linux/tsacct_kern.h> #include <linux/cn_proc.h> #include <linux/audit.h> +#include <linux/kmod.h> #include <asm/uaccess.h> #include <asm/mmu_context.h> #include <asm/tlb.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif -#ifdef __alpha__/* for /sbin/loader handling in search_binary_handler() */ #include <linux/a.out.h>
@@ -1239,8 +1236,8 @@ int search_binary_handler(struct linux_bread_unlock (&binfmt_lock);if (retval != -ENOEXEC || bprm->mm ==NULL ) {break ; -#ifdef CONFIG_KMOD - }else { +#ifdef CONFIG_MODULES + }else {#define printable (c) (((c)=='\t') || ((c)=='\n') || (0x20<=(c) && (c)<=0x7e)) if (printable(bprm->buf[0]) && printable(bprm->buf[1]) &&
fs/nls/nls_base.c +3 -20
@@ -13,9 +13,7 @@#include <linux/nls.h> #include <linux/kernel.h> #include <linux/errno.h> -#ifdef CONFIG_KMOD #include <linux/kmod.h> -#endif #include <linux/spinlock.h> static struct nls_table default_table;
@@ -215,24 +213,9 @@ static struct nls_table *find_nls(char *struct nls_table *load_nls (char *charset) { -struct nls_table *nls; -#ifdef CONFIG_KMOD -int ret; -#endif - - nls =find_nls (charset); -if (nls) -return nls; - -#ifdef CONFIG_KMOD - ret =request_module ("nls_%s" , charset); -if (ret !=0 ) { -printk ("Unable to load NLS charset %s\n" , charset); -return NULL ; - } - nls =find_nls (charset); -#endif -return nls; +return try_then_request_module ( +find_nls (charset), +"nls_%s" , charset); }void unload_nls (struct nls_table *nls)
PATCH 5/11 remove CONFIG_KMOD from sparc64
In reply to Johannes BergOne place is just a comment, the other a conditional, unused inclusion of linux/kmod.h.
--- arch/sparc64/kernel/process.c | 6 +++--- arch/sparc64/kernel/traps.c | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-)
arch/sparc64/kernel/traps.c +0 -3
@@ -37,9 +37,6 @@#include <asm/processor.h> #include <asm/timer.h> #include <asm/head.h> -#ifdef CONFIG_KMOD -#include <linux/kmod.h> -#endif #include <asm/prom.h> #include "entry.h"
arch/sparc64/kernel/process.c +3 -3
@@ -691,9 +691,9 @@ int copy_thread(int nr, unsigned long cl ((unsigned long ) child_sf) -STACK_BIAS ;/* Special case, if we are spawning a kernel thread from -* a userspace task (via KMOD, NFS, or similar) we must -* disable performance counters in the child because the -* address space and protection realm are changing. +* a userspace task (usermode helper, NFS or similar), we +* must disable performance counters in the child because +* the address space and protection realm are changing. */ if (t->flags & _TIF_PERFCTR) { t->user_cntd0 = t->user_cntd1 =NULL ;
PATCH 3/11 rework try_then_request_module to do less in non-modular kernels
In reply to Johannes BergThis reworks try_then_request_module to only invoke the "lookup" function "x" once when the kernel is not modular.
--- include/linux/kmod.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/kmod.h +2 -1
@@ -29,11 +29,12 @@/* modprobe exit status on success, -ve on error. Return value * usually useless though. */ extern int request_module (const char * name, ...) __attribute__ ((format (printf,1 ,2 ))); +#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))#else static inline int request_module (const char * name, ...) {return -ENOSYS ; } +#define try_then_request_module(x, mod...) (x)#endif -#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))struct key ;struct file ;
cover remove CONFIG_KMOD
I've rebased this patch series against -next-20080708 (one conflict against ftrace, another against BKL pushdown) and fixed the things Adrian Bunk pointed out.
johannes
PATCH 7/11 remove CONFIG_KMOD from sound
A bunch of things in alsa depend on CONFIG_KMOD, use CONFIG_MODULES instead where the dependency is needed at all.
---
v2: remove #ifdef around EXPORT_SYMBOL pointed out by
Adrian Bunk
include/sound/seq_kernel.h | 2 +- sound/core/seq/seq_clientmgr.c | 2 +- sound/core/seq/seq_device.c | 6 ++---- sound/core/sound.c | 8 ++++---- sound/core/timer.c | 6 +++--- sound/ppc/daca.c | 2 -- sound/ppc/tumbler.c | 2 -- 7 files changed, 11 insertions(+), 17 deletions(-)
include/sound/seq_kernel.h +1 -1
@@ -105,7 +105,7 @@ int snd_seq_event_port_attach(int client int cap, int type, int midi_channels, int midi_voices, char *portname);int snd_seq_event_port_detach (int client,int port); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES void snd_seq_autoload_lock (void );void snd_seq_autoload_unlock (void );#else
sound/core/seq/seq_clientmgr.c +1 -1
@@ -148,7 +148,7 @@ struct snd_seq_client *snd_seq_client_usreturn NULL ; }spin_unlock_irqrestore (&clients_lock, flags); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES if (!in_interrupt ()) {static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS ];static char card_requested[SNDRV_CARDS ];
sound/core/seq/seq_device.c +2 -4
@@ -124,7 +124,7 @@ static void snd_seq_device_info(struct s* load all registered drivers (called from seq_clientmgr.c) */ -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /* avoid auto-loading during module_init() */ static int snd_seq_in_init;void snd_seq_autoload_lock (void )
@@ -140,7 +140,7 @@ void snd_seq_autoload_unlock(void)void snd_seq_device_load_drivers (void ) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES struct ops_list *ops;/* Calling request_module during module_init()
@@ -566,7 +566,5 @@ EXPORT_SYMBOL(snd_seq_device_load_driverEXPORT_SYMBOL (snd_seq_device_new);EXPORT_SYMBOL (snd_seq_device_register_driver);EXPORT_SYMBOL (snd_seq_device_unregister_driver); -#ifdef CONFIG_KMOD EXPORT_SYMBOL (snd_seq_autoload_lock);EXPORT_SYMBOL (snd_seq_autoload_unlock); -#endif
sound/core/sound.c +4 -4
@@ -61,14 +61,14 @@ EXPORT_SYMBOL(snd_ecards_limit);static struct snd_minor *snd_minors[SNDRV_OS_MINORS ];static DEFINE_MUTEX (sound_mutex); -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /** * snd_request_card - try to load the card module * @card: the card number * * Tries to load the module "snd-card-X" for the given card number -* via KMOD. Returns immediately if already loaded. +* via request_module. Returns immediately if already loaded. */ void snd_request_card (int card) {
@@ -93,7 +93,7 @@ static void snd_request_other(int minor) request_module(str); } -#endif /* request_module support */ +#endif /* modular kernel */ /** * snd_lookup_minor_data - get user data of a registered device
@@ -133,7 +133,7 @@ static int __snd_open(struct inode *inodreturn -ENODEV ; mptr = snd_minors[minor];if (mptr ==NULL ) { -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES int dev =SNDRV_MINOR_DEVICE (minor);if (dev ==SNDRV_MINOR_CONTROL ) {/* /dev/aloadC? */
sound/core/timer.c +3 -3
@@ -146,7 +146,7 @@ static struct snd_timer *snd_timer_find(return NULL ; } -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES static void snd_timer_request (struct snd_timer_id *tid) {
@@ -259,8 +259,8 @@ int snd_timer_open(struct snd_timer_inst/* open a master instance */ mutex_lock (®ister_mutex); timer =snd_timer_find (tid); -#ifdef CONFIG_KMOD -if (timer ==NULL ) { +#ifdef CONFIG_MODULES +if (!timer) {mutex_unlock (®ister_mutex);snd_timer_request (tid);mutex_lock (®ister_mutex);
sound/ppc/daca.c +0 -2
@@ -249,9 +249,7 @@ int __init snd_pmac_daca_init(struct sndint i, err;struct pmac_daca *mix; -#ifdef CONFIG_KMOD request_module ("i2c-powermac" ); -#endif /* CONFIG_KMOD */ mix =kzalloc (sizeof (*mix),GFP_KERNEL );if (! mix)
sound/ppc/tumbler.c +0 -2
@@ -1350,9 +1350,7 @@ int __init snd_pmac_tumbler_init(structstruct device_node *tas_node, *np;char *chipname; -#ifdef CONFIG_KMOD request_module ("i2c-powermac" ); -#endif /* CONFIG_KMOD */ mix =kzalloc (sizeof (*mix),GFP_KERNEL );if (! mix)
PATCH 11/11 remove CONFIG_KMOD
In reply to Johannes BergNow that nothing depends on it any more, remove CONFIG_KMOD.
--- init/Kconfig | 4 ---- 1 file changed, 4 deletions(-)
init/Kconfig +0 -4
@@ -892,10 +892,6 @@ config MODULE_SRCVERSION_ALL the version). With this option, such a "srcversion" field will be created for all modules. If unsure, say N. -config KMOD - def_bool y - depends on MODULES - config STOP_MACHINE bool default y
PATCH 2/11 remove CONFIG_KMOD from core kernel code
In reply to Johannes BergAlways compile request_module when the kernel allows modules.
--- include/linux/kmod.h | 2 +- kernel/exec_domain.c | 2 +- kernel/kmod.c | 4 ++-- kernel/sysctl.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
include/linux/kmod.h +1 -1
@@ -25,7 +25,7 @@#define KMOD_PATH_LEN 256 -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /* modprobe exit status on success, -ve on error. Return value * usually useless though. */ extern int request_module (const char * name, ...) __attribute__ ((format (printf,1 ,2 )));
kernel/exec_domain.c +1 -1
@@ -65,7 +65,7 @@ lookup_exec_domain(u_long personality) goto out; } -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES read_unlock (&exec_domains_lock);request_module ("personality-%ld" , pers);read_lock (&exec_domains_lock);
kernel/kmod.c +2 -2
@@ -42,7 +42,7 @@ extern int max_threads;static struct workqueue_struct *khelper_wq; -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES /* modprobe_path is set via /proc/sys.
@@ -113,7 +113,7 @@ int request_module(const char *fmt, ...)return ret; }EXPORT_SYMBOL (request_module); -#endif /* CONFIG_KMOD */ +#endif /* CONFIG_MODULES */ struct subprocess_info {struct work_struct work;
kernel/sysctl.c +2 -2
@@ -112,7 +112,7 @@ static int min_percpu_pagelist_fract = 8static int ngroups_max =NGROUPS_MAX ; -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES extern char modprobe_path[];#endif #ifdef CONFIG_CHR_DEV_SG
@@ -477,7 +477,7 @@ static struct ctl_table kern_table[] = { .proc_handler = &ftrace_enable_sysctl, },#endif -#ifdef CONFIG_KMOD +#ifdef CONFIG_MODULES { .ctl_name = KERN_MODPROBE, .procname = "modprobe",
PATCH 10/11 remove mention of CONFIG_KMOD from documentation
In reply to Johannes BergAlso includes a few Kconfig files (xtensa, blackfin)
--- Documentation/filesystems/bfs.txt | 10 +++++----- Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl | 2 +- Documentation/telephony/ixj.txt | 13 +++---------- Documentation/video4linux/w9968cf.txt | 3 --- arch/blackfin/Kconfig | 4 ++-- arch/xtensa/Kconfig | 4 ++-- 6 files changed, 13 insertions(+), 23 deletions(-)
Documentation/filesystems/bfs.txt +5 -5
@@ -26,11 +26,11 @@ You can simplify mounting by just typing this will allocate the first available loopback device (and load loop.o kernel module if necessary) automatically. If the loopback driver is not -loaded automatically, make sure that your kernel is compiled with kmod -support (CONFIG_KMOD) enabled. Beware that umount will not -deallocate /dev/loopN device if /etc/mtab file on your system is a -symbolic link to /proc/mounts. You will need to do it manually using -"-d" switch of losetup(8). Read losetup(8) manpage for more info. +loaded automatically, make sure that you have compiled the module and +that modprobe is functioning. Beware that umount will not deallocate +/dev/loopN device if /etc/mtab file on your system is a symbolic link to +/proc/mounts. You will need to do it manually using "-d" switch of +losetup(8). Read losetup(8) manpage for more info. To create the BFS image under UnixWare you need to find out first which slice contains it. The command prtvtoc(1M) is your friend:
Documentation/telephony/ixj.txt +3 -10
@@ -305,21 +305,14 @@ driver, like this: which will result in the needed drivers getting loaded automatically. - g. if you are planning on using kerneld to automatically load the -module for you, then you need to edit /etc/conf.modules and add the + g. if you are planning on having the kernel automatically request +the module for you, then you need to edit /etc/conf.modules and add the following lines: options ixj dspio=0x340 xio=0x330 ixjdebug=0 If you do this, then when you execute an application that uses the -module kerneld will load the module for you. Note that to do this, -you need to have your kernel set to support kerneld. You can check -for this by looking at /usr/src/linux/.config and you should see this: - - # Loadable module support - # - <snip> - CONFIG_KMOD=y +module the kernel will request that it is loaded. h. if you want non-root users to be able to read and write to the ixj devices (this is a good idea!) you should do the following:
Documentation/video4linux/w9968cf.txt +0 -3
@@ -193,9 +193,6 @@ Description: Automatic 'ovcamchip' m loads that module automatically. This action is performed as once soon as the 'w9968cf' module is loaded into memory. Default: 1 -Note: The kernel must be compiled with the CONFIG_KMOD option - enabled for the 'ovcamchip' module to be loaded and for - this parameter to be present. ------------------------------------------------------------------------------- Name: simcams Type: int
Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl +1 -1
@@ -42,7 +42,7 @@ <sect1><title>Device Components</title> !Esound/core/device.c </sect1> - <sect1><title>KMOD and Device File Entries</title> + <sect1><title>Module requests and Device File Entries</title> !Esound/core/sound.c </sect1> <sect1><title>Memory Management Helpers</title>
arch/blackfin/Kconfig +2 -2
@@ -873,8 +873,8 @@ config HOTPLUG plugged into slots found on all modern laptop computers. Another example, used on modern desktops as well as laptops, is USB. - Enable HOTPLUG and KMOD, and build a modular kernel. Get agent - software (at <http://linux-hotplug.sourceforge.net/>) and install it. + Enable HOTPLUG and build a modular kernel. Get agent software + (from <http://linux-hotplug.sourceforge.net/>) and install it. Then your kernel will automatically call out to a user mode "policy agent" (/sbin/hotplug) to load modules and set up software needed to use devices as you hotplug them.
arch/xtensa/Kconfig +2 -2
@@ -194,8 +194,8 @@ config HOTPLUG plugged into slots found on all modern laptop computers. Another example, used on modern desktops as well as laptops, is USB. - Enable HOTPLUG and KMOD, and build a modular kernel. Get agent - software (at <http://linux-hotplug.sourceforge.net/>) and install it. + Enable HOTPLUG and build a modular kernel. Get agent software + (from <http://linux-hotplug.sourceforge.net/>) and install it. Then your kernel will automatically call out to a user mode "policy agent" (/sbin/hotplug) to load modules and set up software needed to use devices as you hotplug them.
Takashi Iwai
AppliedRe: [PATCH -next 07/11] remove CONFIG_KMOD from sound
In reply to Johannes BergAt Wed, 09 Jul 2008 10:28:41 +0200,
Quoted 10 lines · Johannes Berg
A bunch of things in alsa depend on
CONFIG_KMOD, useCONFIG_MODULESinstead where the dependency is needed at all.Signed-off-by Johannes Berg <[email protected]>Cc Takashi Iwai <[email protected]>---
v2: remove #ifdef aroundEXPORT_SYMBOLpointed out by
Adrian Bunk
Thanks, applied to sound-2.6 git tree.
Takashi
Quoted 3 lines · Johannes Berg
I've rebased this patch series against -next-20080708 (one conflict against ftrace, another against BKL pushdown) and fixed the things Adrian Bunk pointed out.
You forgot to say why you want to remove that?
I personally like to not set CONFIG_KMOD because the auto loader tends to load way too many modules. e.g. currently when someone requests aes on x86 you get three different aes modules (including VIA PadLock aes and an unoptimized C version), and keeping those around is just a waste.
Also if I didn't load a driver I prefer if it's not loaded at all. This is also useful for power saving for example where it's better to keep modules not loaded that you don't need and it's hard to control who accesses the respective devices.
Please keep the option.
Thanks.
-Andi
Quoted 5 lines · On Monday 14 July 2008 01:03:02 Andi Kleen wrote:
Quoted 3 lines · Johannes Berg
I've rebased this patch series against -next-20080708 (one conflict against ftrace, another against BKL pushdown) and fixed the things Adrian Bunk pointed out.
Quoted 7 lines
You forgot to say why you want to remove that?
I personally like to not set
CONFIG_KMODbecause the auto loader tends to load way too many modules. e.g. currently when someone requests aes on x86 you get three different aes modules (including VIA PadLock aes and an unoptimized C version), and keeping those around is just a waste.
Well, if you're building your own kernel anyway, don't build modules you don't want.
Quoted 6 lines
Also if I didn't load a driver I prefer if it's not loaded at all. This is also useful for power saving for example where it's better to keep modules not loaded that you don't need and it's hard to control who accesses the respective devices.
Please keep the option.
"echo /bin/true > /proc/sys/kernel/modprobe".
Given that, I don't think the config option is useful any more.
Rusty.
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Johannes Berg
I've rebased this patch series against -next-20080708 (one conflict against ftrace, another against BKL pushdown) and fixed the things Adrian Bunk pointed out.
You forgot to say why you want to remove that?
Indeed, I did. Well for one, it's pointless. As Rusty pointed out, you can achieve pretty much the same thing by putting /bin/true into the modprobe path, and the option protects only very little code.
Secondly, the option has a lot of potential for misuse. A lot of people tend to unset it because they think they can load modules manually, but then they forget all the dependencies that aren't link-time resolvable like crypto providers: if you request an encryption with RC4 the arc4 module will be loaded by the crypto provider code, but this isn't a link-time dependency so modprobe cannot resolve it. We're getting bug reports like that probably about bi-weekly or so and I suspect distros are getting many more.
Hence, it's beneficial to remove the option, those who really do need to turn off module autoloading can still do it at runtime which even benefits them because it allows them finer-grained control, and others are left with less potential to screw up their kernel config.
johannes