aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h53
1 files changed, 44 insertions, 9 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 419d3ef293dd..95679eb8571e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -76,8 +76,6 @@ void sort_extable(struct exception_table_entry *start,
76 struct exception_table_entry *finish); 76 struct exception_table_entry *finish);
77void sort_main_extable(void); 77void sort_main_extable(void);
78 78
79extern struct subsystem module_subsys;
80
81#ifdef MODULE 79#ifdef MODULE
82#define MODULE_GENERIC_TABLE(gtype,name) \ 80#define MODULE_GENERIC_TABLE(gtype,name) \
83extern const struct gtype##_id __mod_##gtype##_table \ 81extern const struct gtype##_id __mod_##gtype##_table \
@@ -467,10 +465,6 @@ int unregister_module_notifier(struct notifier_block * nb);
467 465
468extern void print_modules(void); 466extern void print_modules(void);
469 467
470struct device_driver;
471void module_add_driver(struct module *, struct device_driver *);
472void module_remove_driver(struct device_driver *);
473
474#else /* !CONFIG_MODULES... */ 468#else /* !CONFIG_MODULES... */
475#define EXPORT_SYMBOL(sym) 469#define EXPORT_SYMBOL(sym)
476#define EXPORT_SYMBOL_GPL(sym) 470#define EXPORT_SYMBOL_GPL(sym)
@@ -568,18 +562,59 @@ static inline void print_modules(void)
568{ 562{
569} 563}
570 564
565#endif /* CONFIG_MODULES */
566
571struct device_driver; 567struct device_driver;
568#ifdef CONFIG_SYSFS
572struct module; 569struct module;
573 570
574static inline void module_add_driver(struct module *module, struct device_driver *driver) 571extern struct subsystem module_subsys;
572
573int mod_sysfs_init(struct module *mod);
574int mod_sysfs_setup(struct module *mod,
575 struct kernel_param *kparam,
576 unsigned int num_params);
577int module_add_modinfo_attrs(struct module *mod);
578void module_remove_modinfo_attrs(struct module *mod);
579
580#else /* !CONFIG_SYSFS */
581
582static inline int mod_sysfs_init(struct module *mod)
575{ 583{
584 return 0;
576} 585}
577 586
578static inline void module_remove_driver(struct device_driver *driver) 587static inline int mod_sysfs_setup(struct module *mod,
588 struct kernel_param *kparam,
589 unsigned int num_params)
579{ 590{
591 return 0;
580} 592}
581 593
582#endif /* CONFIG_MODULES */ 594static inline int module_add_modinfo_attrs(struct module *mod)
595{
596 return 0;
597}
598
599static inline void module_remove_modinfo_attrs(struct module *mod)
600{ }
601
602#endif /* CONFIG_SYSFS */
603
604#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
605
606void module_add_driver(struct module *mod, struct device_driver *drv);
607void module_remove_driver(struct device_driver *drv);
608
609#else /* not both CONFIG_SYSFS && CONFIG_MODULES */
610
611static inline void module_add_driver(struct module *mod, struct device_driver *drv)
612{ }
613
614static inline void module_remove_driver(struct device_driver *drv)
615{ }
616
617#endif
583 618
584#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 619#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
585 620