aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIonut Alexa <ionut.m.alexa@gmail.com>2014-11-09 18:01:29 -0500
committerRusty Russell <rusty@rustcorp.com.au>2014-11-11 01:37:47 -0500
commit6da0b565150b32318757062bc75834113f0508d6 (patch)
tree2e6b3aeeeace3f4a43bbbfd1749818695b068ac8 /kernel
parente513cc1c07e2ab93a4514eec9833e031df3e30bb (diff)
kernel:module Fix coding style errors and warnings.
Fixed codin style errors and warnings. Changes printk with print_debug/warn. Changed seq_printf to seq_puts. Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (removed bogus KERN_DEFAULT conversion)
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/kernel/module.c b/kernel/module.c
index e772595d73db..381105b2aaae 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -157,13 +157,13 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
157 * Protected by module_mutex. */ 157 * Protected by module_mutex. */
158static unsigned long module_addr_min = -1UL, module_addr_max = 0; 158static unsigned long module_addr_min = -1UL, module_addr_max = 0;
159 159
160int register_module_notifier(struct notifier_block * nb) 160int register_module_notifier(struct notifier_block *nb)
161{ 161{
162 return blocking_notifier_chain_register(&module_notify_list, nb); 162 return blocking_notifier_chain_register(&module_notify_list, nb);
163} 163}
164EXPORT_SYMBOL(register_module_notifier); 164EXPORT_SYMBOL(register_module_notifier);
165 165
166int unregister_module_notifier(struct notifier_block * nb) 166int unregister_module_notifier(struct notifier_block *nb)
167{ 167{
168 return blocking_notifier_chain_unregister(&module_notify_list, nb); 168 return blocking_notifier_chain_unregister(&module_notify_list, nb);
169} 169}
@@ -858,8 +858,10 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
858 858
859 seq_printf(m, " %lu ", module_refcount(mod)); 859 seq_printf(m, " %lu ", module_refcount(mod));
860 860
861 /* Always include a trailing , so userspace can differentiate 861 /*
862 between this and the old multi-field proc format. */ 862 * Always include a trailing , so userspace can differentiate
863 * between this and the old multi-field proc format.
864 */
863 list_for_each_entry(use, &mod->source_list, source_list) { 865 list_for_each_entry(use, &mod->source_list, source_list) {
864 printed_something = 1; 866 printed_something = 1;
865 seq_printf(m, "%s,", use->source->name); 867 seq_printf(m, "%s,", use->source->name);
@@ -867,11 +869,11 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
867 869
868 if (mod->init != NULL && mod->exit == NULL) { 870 if (mod->init != NULL && mod->exit == NULL) {
869 printed_something = 1; 871 printed_something = 1;
870 seq_printf(m, "[permanent],"); 872 seq_puts(m, "[permanent],");
871 } 873 }
872 874
873 if (!printed_something) 875 if (!printed_something)
874 seq_printf(m, "-"); 876 seq_puts(m, "-");
875} 877}
876 878
877void __symbol_put(const char *symbol) 879void __symbol_put(const char *symbol)
@@ -960,7 +962,7 @@ EXPORT_SYMBOL(module_put);
960static inline void print_unload_info(struct seq_file *m, struct module *mod) 962static inline void print_unload_info(struct seq_file *m, struct module *mod)
961{ 963{
962 /* We don't know the usage count, or what modules are using. */ 964 /* We don't know the usage count, or what modules are using. */
963 seq_printf(m, " - -"); 965 seq_puts(m, " - -");
964} 966}
965 967
966static inline void module_unload_free(struct module *mod) 968static inline void module_unload_free(struct module *mod)
@@ -1113,7 +1115,7 @@ static unsigned long maybe_relocated(unsigned long crc,
1113static int check_version(Elf_Shdr *sechdrs, 1115static int check_version(Elf_Shdr *sechdrs,
1114 unsigned int versindex, 1116 unsigned int versindex,
1115 const char *symname, 1117 const char *symname,
1116 struct module *mod, 1118 struct module *mod,
1117 const unsigned long *crc, 1119 const unsigned long *crc,
1118 const struct module *crc_owner) 1120 const struct module *crc_owner)
1119{ 1121{
@@ -1147,7 +1149,7 @@ static int check_version(Elf_Shdr *sechdrs,
1147 return 0; 1149 return 0;
1148 1150
1149bad_version: 1151bad_version:
1150 printk("%s: disagrees about version of symbol %s\n", 1152 pr_warn("%s: disagrees about version of symbol %s\n",
1151 mod->name, symname); 1153 mod->name, symname);
1152 return 0; 1154 return 0;
1153} 1155}
@@ -1182,7 +1184,7 @@ static inline int same_magic(const char *amagic, const char *bmagic,
1182static inline int check_version(Elf_Shdr *sechdrs, 1184static inline int check_version(Elf_Shdr *sechdrs,
1183 unsigned int versindex, 1185 unsigned int versindex,
1184 const char *symname, 1186 const char *symname,
1185 struct module *mod, 1187 struct module *mod,
1186 const unsigned long *crc, 1188 const unsigned long *crc,
1187 const struct module *crc_owner) 1189 const struct module *crc_owner)
1188{ 1190{
@@ -1270,15 +1272,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
1270 return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; 1272 return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
1271} 1273}
1272 1274
1273struct module_sect_attr 1275struct module_sect_attr {
1274{
1275 struct module_attribute mattr; 1276 struct module_attribute mattr;
1276 char *name; 1277 char *name;
1277 unsigned long address; 1278 unsigned long address;
1278}; 1279};
1279 1280
1280struct module_sect_attrs 1281struct module_sect_attrs {
1281{
1282 struct attribute_group grp; 1282 struct attribute_group grp;
1283 unsigned int nsections; 1283 unsigned int nsections;
1284 struct module_sect_attr attrs[0]; 1284 struct module_sect_attr attrs[0];
@@ -1532,7 +1532,8 @@ static int module_add_modinfo_attrs(struct module *mod)
1532 (attr->test && attr->test(mod))) { 1532 (attr->test && attr->test(mod))) {
1533 memcpy(temp_attr, attr, sizeof(*temp_attr)); 1533 memcpy(temp_attr, attr, sizeof(*temp_attr));
1534 sysfs_attr_init(&temp_attr->attr); 1534 sysfs_attr_init(&temp_attr->attr);
1535 error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); 1535 error = sysfs_create_file(&mod->mkobj.kobj,
1536 &temp_attr->attr);
1536 ++temp_attr; 1537 ++temp_attr;
1537 } 1538 }
1538 } 1539 }
@@ -1548,7 +1549,7 @@ static void module_remove_modinfo_attrs(struct module *mod)
1548 /* pick a field to test for end of list */ 1549 /* pick a field to test for end of list */
1549 if (!attr->attr.name) 1550 if (!attr->attr.name)
1550 break; 1551 break;
1551 sysfs_remove_file(&mod->mkobj.kobj,&attr->attr); 1552 sysfs_remove_file(&mod->mkobj.kobj, &attr->attr);
1552 if (attr->free) 1553 if (attr->free)
1553 attr->free(mod); 1554 attr->free(mod);
1554 } 1555 }
@@ -1930,7 +1931,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
1930 /* We compiled with -fno-common. These are not 1931 /* We compiled with -fno-common. These are not
1931 supposed to happen. */ 1932 supposed to happen. */
1932 pr_debug("Common symbol: %s\n", name); 1933 pr_debug("Common symbol: %s\n", name);
1933 printk("%s: please compile with -fno-common\n", 1934 pr_warn("%s: please compile with -fno-common\n",
1934 mod->name); 1935 mod->name);
1935 ret = -ENOEXEC; 1936 ret = -ENOEXEC;
1936 break; 1937 break;
@@ -2234,7 +2235,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info)
2234} 2235}
2235 2236
2236static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, 2237static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs,
2237 unsigned int shnum) 2238 unsigned int shnum)
2238{ 2239{
2239 const Elf_Shdr *sec; 2240 const Elf_Shdr *sec;
2240 2241
@@ -2710,7 +2711,7 @@ static int find_module_sections(struct module *mod, struct load_info *info)
2710 * This shouldn't happen with same compiler and binutils 2711 * This shouldn't happen with same compiler and binutils
2711 * building all parts of the module. 2712 * building all parts of the module.
2712 */ 2713 */
2713 printk(KERN_WARNING "%s: has both .ctors and .init_array.\n", 2714 pr_warn("%s: has both .ctors and .init_array.\n",
2714 mod->name); 2715 mod->name);
2715 return -EINVAL; 2716 return -EINVAL;
2716 } 2717 }
@@ -2998,8 +2999,10 @@ static int do_init_module(struct module *mod)
2998 if (mod->init != NULL) 2999 if (mod->init != NULL)
2999 ret = do_one_initcall(mod->init); 3000 ret = do_one_initcall(mod->init);
3000 if (ret < 0) { 3001 if (ret < 0) {
3001 /* Init routine failed: abort. Try to protect us from 3002 /*
3002 buggy refcounters. */ 3003 * Init routine failed: abort. Try to protect us from
3004 * buggy refcounters.
3005 */
3003 mod->state = MODULE_STATE_GOING; 3006 mod->state = MODULE_STATE_GOING;
3004 synchronize_sched(); 3007 synchronize_sched();
3005 module_put(mod); 3008 module_put(mod);
@@ -3151,7 +3154,7 @@ out:
3151 3154
3152static int unknown_module_param_cb(char *param, char *val, const char *modname) 3155static int unknown_module_param_cb(char *param, char *val, const char *modname)
3153{ 3156{
3154 /* Check for magic 'dyndbg' arg */ 3157 /* Check for magic 'dyndbg' arg */
3155 int ret = ddebug_dyndbg_module_param_cb(param, val, modname); 3158 int ret = ddebug_dyndbg_module_param_cb(param, val, modname);
3156 if (ret != 0) 3159 if (ret != 0)
3157 pr_warn("%s: unknown parameter '%s' ignored\n", modname, param); 3160 pr_warn("%s: unknown parameter '%s' ignored\n", modname, param);
@@ -3636,8 +3639,8 @@ static int m_show(struct seq_file *m, void *p)
3636 3639
3637 /* Informative for users. */ 3640 /* Informative for users. */
3638 seq_printf(m, " %s", 3641 seq_printf(m, " %s",
3639 mod->state == MODULE_STATE_GOING ? "Unloading": 3642 mod->state == MODULE_STATE_GOING ? "Unloading" :
3640 mod->state == MODULE_STATE_COMING ? "Loading": 3643 mod->state == MODULE_STATE_COMING ? "Loading" :
3641 "Live"); 3644 "Live");
3642 /* Used by oprofile and other similar tools. */ 3645 /* Used by oprofile and other similar tools. */
3643 seq_printf(m, " 0x%pK", mod->module_core); 3646 seq_printf(m, " 0x%pK", mod->module_core);
@@ -3646,7 +3649,7 @@ static int m_show(struct seq_file *m, void *p)
3646 if (mod->taints) 3649 if (mod->taints)
3647 seq_printf(m, " %s", module_flags(mod, buf)); 3650 seq_printf(m, " %s", module_flags(mod, buf));
3648 3651
3649 seq_printf(m, "\n"); 3652 seq_puts(m, "\n");
3650 return 0; 3653 return 0;
3651} 3654}
3652 3655