diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/net/netconsole.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index ba2f5e7..adeee61 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -34,8 +34,6 @@ * ****************************************************************/ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - #include <linux/mm.h> #include <linux/init.h> #include <linux/module.h> @@ -312,7 +310,6 @@ static ssize_t store_enabled(struct netconsole_target *nt, const char *buf, size_t count) { - unsigned long flags; int enabled; int err; @@ -322,12 +319,14 @@ static ssize_t store_enabled(struct netconsole_target *nt, if (enabled < 0 || enabled > 1) return -EINVAL; if (enabled == nt->enabled) { - pr_info("network logging has already %s\n", - nt->enabled ? "started" : "stopped"); + printk(KERN_INFO "netconsole: network logging has already %s\n", + nt->enabled ? "started" : "stopped"); return -EINVAL; } + mutex_lock(&nt->mutex); if (enabled) { /* 1 */ + /* * Skip netpoll_parse_options() -- all the attributes are * already configured via configfs. Just print them out. @@ -335,22 +334,19 @@ static ssize_t store_enabled(struct netconsole_target *nt, netpoll_print_options(&nt->np); err = netpoll_setup(&nt->np); - if (err) + if (err) { + mutex_unlock(&nt->mutex); return err; + } + + printk(KERN_INFO "netconsole: network logging started\n"); - pr_info("netconsole: network logging started\n"); } else { /* 0 */ - /* We need to disable the netconsole before cleaning it up - * otherwise we might end up in write_msg() with - * nt->np.dev == NULL and nt->enabled == 1 - */ - spin_lock_irqsave(&target_list_lock, flags); - nt->enabled = 0; - spin_unlock_irqrestore(&target_list_lock, flags); netpoll_cleanup(&nt->np); } nt->enabled = enabled; + mutex_unlock(&nt->mutex); return strnlen(buf, count); } @@ -362,8 +358,9 @@ static ssize_t store_dev_name(struct netconsole_target *nt, size_t len; if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -384,8 +381,9 @@ static ssize_t store_local_port(struct netconsole_target *nt, int rv; if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -402,8 +400,9 @@ static ssize_t store_remote_port(struct netconsole_target *nt, int rv; if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -418,8 +417,9 @@ static ssize_t store_local_ip(struct netconsole_target *nt, size_t count) { if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -427,7 +427,7 @@ static ssize_t store_local_ip(struct netconsole_target *nt, const char *end; if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) { if (*end && *end != '\n') { - pr_err("invalid IPv6 address at: <%c>\n", *end); + printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); return -EINVAL; } nt->np.ipv6 = true; @@ -448,8 +448,9 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, size_t count) { if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -457,7 +458,7 @@ static ssize_t store_remote_ip(struct netconsole_target *nt, const char *end; if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) { if (*end && *end != '\n') { - pr_err("invalid IPv6 address at: <%c>\n", *end); + printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end); return -EINVAL; } nt->np.ipv6 = true; @@ -480,8 +481,9 @@ static ssize_t store_remote_mac(struct netconsole_target *nt, u8 remote_mac[ETH_ALEN]; if (nt->enabled) { - pr_err("target (%s) is enabled, disable to update parameters\n", - config_item_name(&nt->item)); + printk(KERN_ERR "netconsole: target (%s) is enabled, " + "disable to update parameters\n", + config_item_name(&nt->item)); return -EINVAL; } @@ -561,10 +563,8 @@ static ssize_t netconsole_target_attr_store(struct config_item *item, struct netconsole_target_attr *na = container_of(attr, struct netconsole_target_attr, attr); - mutex_lock(&nt->mutex); if (na->store) ret = na->store(nt, buf, count); - mutex_unlock(&nt->mutex); return ret; } @@ -704,20 +704,19 @@ restart: } spin_unlock_irqrestore(&target_list_lock, flags); if (stopped) { - const char *msg = "had an event"; + printk(KERN_INFO "netconsole: network logging stopped on " + "interface %s as it ", dev->name); switch (event) { case NETDEV_UNREGISTER: - msg = "unregistered"; + printk(KERN_CONT "unregistered\n"); break; case NETDEV_RELEASE: - msg = "released slaves"; + printk(KERN_CONT "released slaves\n"); break; case NETDEV_JOIN: - msg = "is joining a master device"; + printk(KERN_CONT "is joining a master device\n"); break; } - pr_info("network logging stopped on interface %s as it %s\n", - dev->name, msg); } done: @@ -803,7 +802,7 @@ static int __init init_netconsole(void) goto undonotifier; register_console(&netconsole); - pr_info("network logging started\n"); + printk(KERN_INFO "netconsole: network logging started\n"); return err; @@ -811,7 +810,7 @@ undonotifier: unregister_netdevice_notifier(&netconsole_netdev_notifier); fail: - pr_err("cleaning up\n"); + printk(KERN_ERR "netconsole: cleaning up\n"); /* * Remove all targets and destroy them (only targets created |