diff options
author | Sven Eckelmann <sven.eckelmann@gmx.de> | 2010-07-06 21:05:17 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-08 12:23:29 -0700 |
commit | c1641862f88367602f8f34a17b21bdf1eee912ee (patch) | |
tree | 22cf98b87d41bf5437ca8fcf7d53f29ebc544809 /drivers/staging/batman-adv/hard-interface.c | |
parent | 84ec08640786592a045b783fb28b542415521bf9 (diff) |
Staging: batman-adv: Move printk to simplified macros
Each general printk which is not informative by itself for a specific
batX device were moved to pr_(info|warning|err) as it provides an easy
interface which for example resolves the problem to add the prefix
"batman-adv: " before each line.
All information which is specific to a batX device will be printed using
a bat_(info|err|warning) macro to prefix it also with "batman-adv:
batX:" in each line.
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/batman-adv/hard-interface.c')
-rw-r--r-- | drivers/staging/batman-adv/hard-interface.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index e50246e51610..41721554d624 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c @@ -150,12 +150,10 @@ static void check_known_mac_addr(uint8_t *addr) if (!compare_orig(batman_if->net_dev->dev_addr, addr)) continue; - printk(KERN_WARNING "batman-adv:" - "The newly added mac address (%pM) already exists on: %s\n", - addr, batman_if->dev); - printk(KERN_WARNING "batman-adv:" - "It is strongly recommended to keep mac addresses unique" - "to avoid problems!\n"); + pr_warning("The newly added mac address (%pM) already exists " + "on: %s\n", addr, batman_if->dev); + pr_warning("It is strongly recommended to keep mac addresses " + "unique to avoid problems!\n"); } rcu_read_unlock(); } @@ -189,7 +187,8 @@ void update_min_mtu(void) soft_device->mtu = min_mtu; } -static void hardif_activate_interface(struct bat_priv *bat_priv, +static void hardif_activate_interface(struct net_device *net_dev, + struct bat_priv *bat_priv, struct batman_if *batman_if) { if (batman_if->if_status != IF_INACTIVE) @@ -207,8 +206,7 @@ static void hardif_activate_interface(struct bat_priv *bat_priv, if (!bat_priv->primary_if) set_primary_if(bat_priv, batman_if); - printk(KERN_INFO "batman-adv:Interface activated: %s\n", - batman_if->dev); + bat_info(net_dev, "Interface activated: %s\n", batman_if->dev); if (atomic_read(&module_state) == MODULE_INACTIVE) activate_module(); @@ -217,7 +215,8 @@ static void hardif_activate_interface(struct bat_priv *bat_priv, return; } -static void hardif_deactivate_interface(struct batman_if *batman_if) +static void hardif_deactivate_interface(struct net_device *net_dev, + struct batman_if *batman_if) { if ((batman_if->if_status != IF_ACTIVE) && (batman_if->if_status != IF_TO_BE_ACTIVATED)) @@ -227,8 +226,7 @@ static void hardif_deactivate_interface(struct batman_if *batman_if) batman_if->if_status = IF_INACTIVE; - printk(KERN_INFO "batman-adv:Interface deactivated: %s\n", - batman_if->dev); + bat_info(net_dev, "Interface deactivated: %s\n", batman_if->dev); update_min_mtu(); } @@ -246,9 +244,8 @@ int hardif_enable_interface(struct batman_if *batman_if) batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_ATOMIC); if (!batman_if->packet_buff) { - printk(KERN_ERR "batman-adv:" - "Can't add interface packet (%s): out of memory\n", - batman_if->dev); + bat_err(soft_device, "Can't add interface packet (%s): " + "out of memory\n", batman_if->dev); goto err; } @@ -266,15 +263,14 @@ int hardif_enable_interface(struct batman_if *batman_if) orig_hash_add_if(batman_if, bat_priv->num_ifaces); atomic_set(&batman_if->seqno, 1); - printk(KERN_INFO "batman-adv:Adding interface: %s\n", batman_if->dev); + bat_info(soft_device, "Adding interface: %s\n", batman_if->dev); if (hardif_is_iface_up(batman_if)) - hardif_activate_interface(bat_priv, batman_if); + hardif_activate_interface(soft_device, bat_priv, batman_if); else - printk(KERN_ERR "batman-adv:" - "Not using interface %s " - "(retrying later): interface not active\n", - batman_if->dev); + bat_err(soft_device, "Not using interface %s " + "(retrying later): interface not active\n", + batman_if->dev); /* begin scheduling originator messages on that interface */ schedule_own_packet(batman_if); @@ -292,12 +288,12 @@ void hardif_disable_interface(struct batman_if *batman_if) struct bat_priv *bat_priv = netdev_priv(soft_device); if (batman_if->if_status == IF_ACTIVE) - hardif_deactivate_interface(batman_if); + hardif_deactivate_interface(soft_device, batman_if); if (batman_if->if_status != IF_INACTIVE) return; - printk(KERN_INFO "batman-adv:Removing interface: %s\n", batman_if->dev); + bat_info(soft_device, "Removing interface: %s\n", batman_if->dev); bat_priv->num_ifaces--; orig_hash_del_if(batman_if, bat_priv->num_ifaces); @@ -324,8 +320,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev) batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC); if (!batman_if) { - printk(KERN_ERR "batman-adv:" - "Can't add interface (%s): out of memory\n", + pr_err("Can't add interface (%s): out of memory\n", net_dev->name); goto out; } @@ -408,11 +403,11 @@ static int hard_if_event(struct notifier_block *this, case NETDEV_REGISTER: break; case NETDEV_UP: - hardif_activate_interface(bat_priv, batman_if); + hardif_activate_interface(soft_device, bat_priv, batman_if); break; case NETDEV_GOING_DOWN: case NETDEV_DOWN: - hardif_deactivate_interface(batman_if); + hardif_deactivate_interface(soft_device, batman_if); break; case NETDEV_UNREGISTER: hardif_remove_interface(batman_if); |