Commit 6da0b565 authored by Ionut Alexa's avatar Ionut Alexa Committed by Rusty Russell

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: default avatarIonut Alexa <ionut.m.alexa@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (removed bogus KERN_DEFAULT conversion)
parent e513cc1c
...@@ -157,13 +157,13 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list); ...@@ -157,13 +157,13 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
* Protected by module_mutex. */ * Protected by module_mutex. */
static unsigned long module_addr_min = -1UL, module_addr_max = 0; static unsigned long module_addr_min = -1UL, module_addr_max = 0;
int register_module_notifier(struct notifier_block * nb) int register_module_notifier(struct notifier_block *nb)
{ {
return blocking_notifier_chain_register(&module_notify_list, nb); return blocking_notifier_chain_register(&module_notify_list, nb);
} }
EXPORT_SYMBOL(register_module_notifier); EXPORT_SYMBOL(register_module_notifier);
int unregister_module_notifier(struct notifier_block * nb) int unregister_module_notifier(struct notifier_block *nb)
{ {
return blocking_notifier_chain_unregister(&module_notify_list, nb); return blocking_notifier_chain_unregister(&module_notify_list, nb);
} }
...@@ -858,8 +858,10 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod) ...@@ -858,8 +858,10 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
seq_printf(m, " %lu ", module_refcount(mod)); seq_printf(m, " %lu ", module_refcount(mod));
/* Always include a trailing , so userspace can differentiate /*
between this and the old multi-field proc format. */ * Always include a trailing , so userspace can differentiate
* between this and the old multi-field proc format.
*/
list_for_each_entry(use, &mod->source_list, source_list) { list_for_each_entry(use, &mod->source_list, source_list) {
printed_something = 1; printed_something = 1;
seq_printf(m, "%s,", use->source->name); 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,11 +869,11 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
if (mod->init != NULL && mod->exit == NULL) { if (mod->init != NULL && mod->exit == NULL) {
printed_something = 1; printed_something = 1;
seq_printf(m, "[permanent],"); seq_puts(m, "[permanent],");
} }
if (!printed_something) if (!printed_something)
seq_printf(m, "-"); seq_puts(m, "-");
} }
void __symbol_put(const char *symbol) void __symbol_put(const char *symbol)
...@@ -960,7 +962,7 @@ EXPORT_SYMBOL(module_put); ...@@ -960,7 +962,7 @@ EXPORT_SYMBOL(module_put);
static inline void print_unload_info(struct seq_file *m, struct module *mod) static inline void print_unload_info(struct seq_file *m, struct module *mod)
{ {
/* We don't know the usage count, or what modules are using. */ /* We don't know the usage count, or what modules are using. */
seq_printf(m, " - -"); seq_puts(m, " - -");
} }
static inline void module_unload_free(struct module *mod) static inline void module_unload_free(struct module *mod)
...@@ -1113,7 +1115,7 @@ static unsigned long maybe_relocated(unsigned long crc, ...@@ -1113,7 +1115,7 @@ static unsigned long maybe_relocated(unsigned long crc,
static int check_version(Elf_Shdr *sechdrs, static int check_version(Elf_Shdr *sechdrs,
unsigned int versindex, unsigned int versindex,
const char *symname, const char *symname,
struct module *mod, struct module *mod,
const unsigned long *crc, const unsigned long *crc,
const struct module *crc_owner) const struct module *crc_owner)
{ {
...@@ -1147,7 +1149,7 @@ static int check_version(Elf_Shdr *sechdrs, ...@@ -1147,7 +1149,7 @@ static int check_version(Elf_Shdr *sechdrs,
return 0; return 0;
bad_version: bad_version:
printk("%s: disagrees about version of symbol %s\n", pr_warn("%s: disagrees about version of symbol %s\n",
mod->name, symname); mod->name, symname);
return 0; return 0;
} }
...@@ -1182,7 +1184,7 @@ static inline int same_magic(const char *amagic, const char *bmagic, ...@@ -1182,7 +1184,7 @@ static inline int same_magic(const char *amagic, const char *bmagic,
static inline int check_version(Elf_Shdr *sechdrs, static inline int check_version(Elf_Shdr *sechdrs,
unsigned int versindex, unsigned int versindex,
const char *symname, const char *symname,
struct module *mod, struct module *mod,
const unsigned long *crc, const unsigned long *crc,
const struct module *crc_owner) const struct module *crc_owner)
{ {
...@@ -1270,15 +1272,13 @@ static inline bool sect_empty(const Elf_Shdr *sect) ...@@ -1270,15 +1272,13 @@ static inline bool sect_empty(const Elf_Shdr *sect)
return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0; return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
} }
struct module_sect_attr struct module_sect_attr {
{
struct module_attribute mattr; struct module_attribute mattr;
char *name; char *name;
unsigned long address; unsigned long address;
}; };
struct module_sect_attrs struct module_sect_attrs {
{
struct attribute_group grp; struct attribute_group grp;
unsigned int nsections; unsigned int nsections;
struct module_sect_attr attrs[0]; struct module_sect_attr attrs[0];
...@@ -1532,7 +1532,8 @@ static int module_add_modinfo_attrs(struct module *mod) ...@@ -1532,7 +1532,8 @@ static int module_add_modinfo_attrs(struct module *mod)
(attr->test && attr->test(mod))) { (attr->test && attr->test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr)); memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(&temp_attr->attr); sysfs_attr_init(&temp_attr->attr);
error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); error = sysfs_create_file(&mod->mkobj.kobj,
&temp_attr->attr);
++temp_attr; ++temp_attr;
} }
} }
...@@ -1548,7 +1549,7 @@ static void module_remove_modinfo_attrs(struct module *mod) ...@@ -1548,7 +1549,7 @@ static void module_remove_modinfo_attrs(struct module *mod)
/* pick a field to test for end of list */ /* pick a field to test for end of list */
if (!attr->attr.name) if (!attr->attr.name)
break; break;
sysfs_remove_file(&mod->mkobj.kobj,&attr->attr); sysfs_remove_file(&mod->mkobj.kobj, &attr->attr);
if (attr->free) if (attr->free)
attr->free(mod); attr->free(mod);
} }
...@@ -1930,7 +1931,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) ...@@ -1930,7 +1931,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
/* We compiled with -fno-common. These are not /* We compiled with -fno-common. These are not
supposed to happen. */ supposed to happen. */
pr_debug("Common symbol: %s\n", name); pr_debug("Common symbol: %s\n", name);
printk("%s: please compile with -fno-common\n", pr_warn("%s: please compile with -fno-common\n",
mod->name); mod->name);
ret = -ENOEXEC; ret = -ENOEXEC;
break; break;
...@@ -2234,7 +2235,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) ...@@ -2234,7 +2235,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info)
} }
static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs,
unsigned int shnum) unsigned int shnum)
{ {
const Elf_Shdr *sec; const Elf_Shdr *sec;
...@@ -2710,7 +2711,7 @@ static int find_module_sections(struct module *mod, struct load_info *info) ...@@ -2710,7 +2711,7 @@ static int find_module_sections(struct module *mod, struct load_info *info)
* This shouldn't happen with same compiler and binutils * This shouldn't happen with same compiler and binutils
* building all parts of the module. * building all parts of the module.
*/ */
printk(KERN_WARNING "%s: has both .ctors and .init_array.\n", pr_warn("%s: has both .ctors and .init_array.\n",
mod->name); mod->name);
return -EINVAL; return -EINVAL;
} }
...@@ -2998,8 +2999,10 @@ static int do_init_module(struct module *mod) ...@@ -2998,8 +2999,10 @@ static int do_init_module(struct module *mod)
if (mod->init != NULL) if (mod->init != NULL)
ret = do_one_initcall(mod->init); ret = do_one_initcall(mod->init);
if (ret < 0) { if (ret < 0) {
/* Init routine failed: abort. Try to protect us from /*
buggy refcounters. */ * Init routine failed: abort. Try to protect us from
* buggy refcounters.
*/
mod->state = MODULE_STATE_GOING; mod->state = MODULE_STATE_GOING;
synchronize_sched(); synchronize_sched();
module_put(mod); module_put(mod);
...@@ -3151,7 +3154,7 @@ static int complete_formation(struct module *mod, struct load_info *info) ...@@ -3151,7 +3154,7 @@ static int complete_formation(struct module *mod, struct load_info *info)
static int unknown_module_param_cb(char *param, char *val, const char *modname) static int unknown_module_param_cb(char *param, char *val, const char *modname)
{ {
/* Check for magic 'dyndbg' arg */ /* Check for magic 'dyndbg' arg */
int ret = ddebug_dyndbg_module_param_cb(param, val, modname); int ret = ddebug_dyndbg_module_param_cb(param, val, modname);
if (ret != 0) if (ret != 0)
pr_warn("%s: unknown parameter '%s' ignored\n", modname, param); 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,8 +3639,8 @@ static int m_show(struct seq_file *m, void *p)
/* Informative for users. */ /* Informative for users. */
seq_printf(m, " %s", seq_printf(m, " %s",
mod->state == MODULE_STATE_GOING ? "Unloading": mod->state == MODULE_STATE_GOING ? "Unloading" :
mod->state == MODULE_STATE_COMING ? "Loading": mod->state == MODULE_STATE_COMING ? "Loading" :
"Live"); "Live");
/* Used by oprofile and other similar tools. */ /* Used by oprofile and other similar tools. */
seq_printf(m, " 0x%pK", mod->module_core); seq_printf(m, " 0x%pK", mod->module_core);
...@@ -3646,7 +3649,7 @@ static int m_show(struct seq_file *m, void *p) ...@@ -3646,7 +3649,7 @@ static int m_show(struct seq_file *m, void *p)
if (mod->taints) if (mod->taints)
seq_printf(m, " %s", module_flags(mod, buf)); seq_printf(m, " %s", module_flags(mod, buf));
seq_printf(m, "\n"); seq_puts(m, "\n");
return 0; return 0;
} }
......
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