diff options
| author | Kay Sievers <kay.sievers@vrfy.org> | 2011-07-24 08:36:04 -0400 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-07-24 08:36:04 -0400 |
| commit | 4befb026cf74b52fc7d382142bbfc0e9b6aab5e7 (patch) | |
| tree | 48c4954f8eb9ab43f449750c3f4b0685fd323c03 /kernel | |
| parent | 66574cc05438dd0907029075d7e6ec5ac0036fbc (diff) | |
module: change attr callbacks to take struct module_kobject
This simplifies the next patch, where we have an attribute on a
builtin module (ie. module == NULL).
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (split into 2)
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/module.c | 14 | ||||
| -rw-r--r-- | kernel/params.c | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/kernel/module.c b/kernel/module.c index 6301d6e173ca..a4295e67dd83 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -545,9 +545,9 @@ static void setup_modinfo_##field(struct module *mod, const char *s) \ | |||
| 545 | mod->field = kstrdup(s, GFP_KERNEL); \ | 545 | mod->field = kstrdup(s, GFP_KERNEL); \ |
| 546 | } \ | 546 | } \ |
| 547 | static ssize_t show_modinfo_##field(struct module_attribute *mattr, \ | 547 | static ssize_t show_modinfo_##field(struct module_attribute *mattr, \ |
| 548 | struct module *mod, char *buffer) \ | 548 | struct module_kobject *mk, char *buffer) \ |
| 549 | { \ | 549 | { \ |
| 550 | return sprintf(buffer, "%s\n", mod->field); \ | 550 | return sprintf(buffer, "%s\n", mk->mod->field); \ |
| 551 | } \ | 551 | } \ |
| 552 | static int modinfo_##field##_exists(struct module *mod) \ | 552 | static int modinfo_##field##_exists(struct module *mod) \ |
| 553 | { \ | 553 | { \ |
| @@ -902,9 +902,9 @@ void symbol_put_addr(void *addr) | |||
| 902 | EXPORT_SYMBOL_GPL(symbol_put_addr); | 902 | EXPORT_SYMBOL_GPL(symbol_put_addr); |
| 903 | 903 | ||
| 904 | static ssize_t show_refcnt(struct module_attribute *mattr, | 904 | static ssize_t show_refcnt(struct module_attribute *mattr, |
| 905 | struct module *mod, char *buffer) | 905 | struct module_kobject *mk, char *buffer) |
| 906 | { | 906 | { |
| 907 | return sprintf(buffer, "%u\n", module_refcount(mod)); | 907 | return sprintf(buffer, "%u\n", module_refcount(mk->mod)); |
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | static struct module_attribute refcnt = { | 910 | static struct module_attribute refcnt = { |
| @@ -952,11 +952,11 @@ static inline int module_unload_init(struct module *mod) | |||
| 952 | #endif /* CONFIG_MODULE_UNLOAD */ | 952 | #endif /* CONFIG_MODULE_UNLOAD */ |
| 953 | 953 | ||
| 954 | static ssize_t show_initstate(struct module_attribute *mattr, | 954 | static ssize_t show_initstate(struct module_attribute *mattr, |
| 955 | struct module *mod, char *buffer) | 955 | struct module_kobject *mk, char *buffer) |
| 956 | { | 956 | { |
| 957 | const char *state = "unknown"; | 957 | const char *state = "unknown"; |
| 958 | 958 | ||
| 959 | switch (mod->state) { | 959 | switch (mk->mod->state) { |
| 960 | case MODULE_STATE_LIVE: | 960 | case MODULE_STATE_LIVE: |
| 961 | state = "live"; | 961 | state = "live"; |
| 962 | break; | 962 | break; |
| @@ -1187,7 +1187,7 @@ struct module_sect_attrs | |||
| 1187 | }; | 1187 | }; |
| 1188 | 1188 | ||
| 1189 | static ssize_t module_sect_show(struct module_attribute *mattr, | 1189 | static ssize_t module_sect_show(struct module_attribute *mattr, |
| 1190 | struct module *mod, char *buf) | 1190 | struct module_kobject *mk, char *buf) |
| 1191 | { | 1191 | { |
| 1192 | struct module_sect_attr *sattr = | 1192 | struct module_sect_attr *sattr = |
| 1193 | container_of(mattr, struct module_sect_attr, mattr); | 1193 | container_of(mattr, struct module_sect_attr, mattr); |
diff --git a/kernel/params.c b/kernel/params.c index 2a4ba258f04f..37e9b20a718b 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
| @@ -511,7 +511,7 @@ struct module_param_attrs | |||
| 511 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr) | 511 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr) |
| 512 | 512 | ||
| 513 | static ssize_t param_attr_show(struct module_attribute *mattr, | 513 | static ssize_t param_attr_show(struct module_attribute *mattr, |
| 514 | struct module *mod, char *buf) | 514 | struct module_kobject *mk, char *buf) |
| 515 | { | 515 | { |
| 516 | int count; | 516 | int count; |
| 517 | struct param_attribute *attribute = to_param_attr(mattr); | 517 | struct param_attribute *attribute = to_param_attr(mattr); |
| @@ -531,7 +531,7 @@ static ssize_t param_attr_show(struct module_attribute *mattr, | |||
| 531 | 531 | ||
| 532 | /* sysfs always hands a nul-terminated string in buf. We rely on that. */ | 532 | /* sysfs always hands a nul-terminated string in buf. We rely on that. */ |
| 533 | static ssize_t param_attr_store(struct module_attribute *mattr, | 533 | static ssize_t param_attr_store(struct module_attribute *mattr, |
| 534 | struct module *owner, | 534 | struct module_kobject *km, |
| 535 | const char *buf, size_t len) | 535 | const char *buf, size_t len) |
| 536 | { | 536 | { |
| 537 | int err; | 537 | int err; |
| @@ -807,7 +807,7 @@ static void __init param_sysfs_builtin(void) | |||
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | ssize_t __modver_version_show(struct module_attribute *mattr, | 809 | ssize_t __modver_version_show(struct module_attribute *mattr, |
| 810 | struct module *mod, char *buf) | 810 | struct module_kobject *mk, char *buf) |
| 811 | { | 811 | { |
| 812 | struct module_version_attribute *vattr = | 812 | struct module_version_attribute *vattr = |
| 813 | container_of(mattr, struct module_version_attribute, mattr); | 813 | container_of(mattr, struct module_version_attribute, mattr); |
| @@ -852,7 +852,7 @@ static ssize_t module_attr_show(struct kobject *kobj, | |||
| 852 | if (!attribute->show) | 852 | if (!attribute->show) |
| 853 | return -EIO; | 853 | return -EIO; |
| 854 | 854 | ||
| 855 | ret = attribute->show(attribute, mk->mod, buf); | 855 | ret = attribute->show(attribute, mk, buf); |
| 856 | 856 | ||
| 857 | return ret; | 857 | return ret; |
| 858 | } | 858 | } |
| @@ -871,7 +871,7 @@ static ssize_t module_attr_store(struct kobject *kobj, | |||
| 871 | if (!attribute->store) | 871 | if (!attribute->store) |
| 872 | return -EIO; | 872 | return -EIO; |
| 873 | 873 | ||
| 874 | ret = attribute->store(attribute, mk->mod, buf, len); | 874 | ret = attribute->store(attribute, mk, buf, len); |
| 875 | 875 | ||
| 876 | return ret; | 876 | return ret; |
| 877 | } | 877 | } |
