diff options
author | Sven Eckelmann <sven.eckelmann@gmx.de> | 2010-07-06 15:05:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-08 15:23:29 -0400 |
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 e50246e5161..41721554d62 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) | |||
150 | if (!compare_orig(batman_if->net_dev->dev_addr, addr)) | 150 | if (!compare_orig(batman_if->net_dev->dev_addr, addr)) |
151 | continue; | 151 | continue; |
152 | 152 | ||
153 | printk(KERN_WARNING "batman-adv:" | 153 | pr_warning("The newly added mac address (%pM) already exists " |
154 | "The newly added mac address (%pM) already exists on: %s\n", | 154 | "on: %s\n", addr, batman_if->dev); |
155 | addr, batman_if->dev); | 155 | pr_warning("It is strongly recommended to keep mac addresses " |
156 | printk(KERN_WARNING "batman-adv:" | 156 | "unique to avoid problems!\n"); |
157 | "It is strongly recommended to keep mac addresses unique" | ||
158 | "to avoid problems!\n"); | ||
159 | } | 157 | } |
160 | rcu_read_unlock(); | 158 | rcu_read_unlock(); |
161 | } | 159 | } |
@@ -189,7 +187,8 @@ void update_min_mtu(void) | |||
189 | soft_device->mtu = min_mtu; | 187 | soft_device->mtu = min_mtu; |
190 | } | 188 | } |
191 | 189 | ||
192 | static void hardif_activate_interface(struct bat_priv *bat_priv, | 190 | static void hardif_activate_interface(struct net_device *net_dev, |
191 | struct bat_priv *bat_priv, | ||
193 | struct batman_if *batman_if) | 192 | struct batman_if *batman_if) |
194 | { | 193 | { |
195 | if (batman_if->if_status != IF_INACTIVE) | 194 | if (batman_if->if_status != IF_INACTIVE) |
@@ -207,8 +206,7 @@ static void hardif_activate_interface(struct bat_priv *bat_priv, | |||
207 | if (!bat_priv->primary_if) | 206 | if (!bat_priv->primary_if) |
208 | set_primary_if(bat_priv, batman_if); | 207 | set_primary_if(bat_priv, batman_if); |
209 | 208 | ||
210 | printk(KERN_INFO "batman-adv:Interface activated: %s\n", | 209 | bat_info(net_dev, "Interface activated: %s\n", batman_if->dev); |
211 | batman_if->dev); | ||
212 | 210 | ||
213 | if (atomic_read(&module_state) == MODULE_INACTIVE) | 211 | if (atomic_read(&module_state) == MODULE_INACTIVE) |
214 | activate_module(); | 212 | activate_module(); |
@@ -217,7 +215,8 @@ static void hardif_activate_interface(struct bat_priv *bat_priv, | |||
217 | return; | 215 | return; |
218 | } | 216 | } |
219 | 217 | ||
220 | static void hardif_deactivate_interface(struct batman_if *batman_if) | 218 | static void hardif_deactivate_interface(struct net_device *net_dev, |
219 | struct batman_if *batman_if) | ||
221 | { | 220 | { |
222 | if ((batman_if->if_status != IF_ACTIVE) && | 221 | if ((batman_if->if_status != IF_ACTIVE) && |
223 | (batman_if->if_status != IF_TO_BE_ACTIVATED)) | 222 | (batman_if->if_status != IF_TO_BE_ACTIVATED)) |
@@ -227,8 +226,7 @@ static void hardif_deactivate_interface(struct batman_if *batman_if) | |||
227 | 226 | ||
228 | batman_if->if_status = IF_INACTIVE; | 227 | batman_if->if_status = IF_INACTIVE; |
229 | 228 | ||
230 | printk(KERN_INFO "batman-adv:Interface deactivated: %s\n", | 229 | bat_info(net_dev, "Interface deactivated: %s\n", batman_if->dev); |
231 | batman_if->dev); | ||
232 | 230 | ||
233 | update_min_mtu(); | 231 | update_min_mtu(); |
234 | } | 232 | } |
@@ -246,9 +244,8 @@ int hardif_enable_interface(struct batman_if *batman_if) | |||
246 | batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_ATOMIC); | 244 | batman_if->packet_buff = kmalloc(batman_if->packet_len, GFP_ATOMIC); |
247 | 245 | ||
248 | if (!batman_if->packet_buff) { | 246 | if (!batman_if->packet_buff) { |
249 | printk(KERN_ERR "batman-adv:" | 247 | bat_err(soft_device, "Can't add interface packet (%s): " |
250 | "Can't add interface packet (%s): out of memory\n", | 248 | "out of memory\n", batman_if->dev); |
251 | batman_if->dev); | ||
252 | goto err; | 249 | goto err; |
253 | } | 250 | } |
254 | 251 | ||
@@ -266,15 +263,14 @@ int hardif_enable_interface(struct batman_if *batman_if) | |||
266 | orig_hash_add_if(batman_if, bat_priv->num_ifaces); | 263 | orig_hash_add_if(batman_if, bat_priv->num_ifaces); |
267 | 264 | ||
268 | atomic_set(&batman_if->seqno, 1); | 265 | atomic_set(&batman_if->seqno, 1); |
269 | printk(KERN_INFO "batman-adv:Adding interface: %s\n", batman_if->dev); | 266 | bat_info(soft_device, "Adding interface: %s\n", batman_if->dev); |
270 | 267 | ||
271 | if (hardif_is_iface_up(batman_if)) | 268 | if (hardif_is_iface_up(batman_if)) |
272 | hardif_activate_interface(bat_priv, batman_if); | 269 | hardif_activate_interface(soft_device, bat_priv, batman_if); |
273 | else | 270 | else |
274 | printk(KERN_ERR "batman-adv:" | 271 | bat_err(soft_device, "Not using interface %s " |
275 | "Not using interface %s " | 272 | "(retrying later): interface not active\n", |
276 | "(retrying later): interface not active\n", | 273 | batman_if->dev); |
277 | batman_if->dev); | ||
278 | 274 | ||
279 | /* begin scheduling originator messages on that interface */ | 275 | /* begin scheduling originator messages on that interface */ |
280 | schedule_own_packet(batman_if); | 276 | schedule_own_packet(batman_if); |
@@ -292,12 +288,12 @@ void hardif_disable_interface(struct batman_if *batman_if) | |||
292 | struct bat_priv *bat_priv = netdev_priv(soft_device); | 288 | struct bat_priv *bat_priv = netdev_priv(soft_device); |
293 | 289 | ||
294 | if (batman_if->if_status == IF_ACTIVE) | 290 | if (batman_if->if_status == IF_ACTIVE) |
295 | hardif_deactivate_interface(batman_if); | 291 | hardif_deactivate_interface(soft_device, batman_if); |
296 | 292 | ||
297 | if (batman_if->if_status != IF_INACTIVE) | 293 | if (batman_if->if_status != IF_INACTIVE) |
298 | return; | 294 | return; |
299 | 295 | ||
300 | printk(KERN_INFO "batman-adv:Removing interface: %s\n", batman_if->dev); | 296 | bat_info(soft_device, "Removing interface: %s\n", batman_if->dev); |
301 | bat_priv->num_ifaces--; | 297 | bat_priv->num_ifaces--; |
302 | orig_hash_del_if(batman_if, bat_priv->num_ifaces); | 298 | orig_hash_del_if(batman_if, bat_priv->num_ifaces); |
303 | 299 | ||
@@ -324,8 +320,7 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev) | |||
324 | 320 | ||
325 | batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC); | 321 | batman_if = kmalloc(sizeof(struct batman_if), GFP_ATOMIC); |
326 | if (!batman_if) { | 322 | if (!batman_if) { |
327 | printk(KERN_ERR "batman-adv:" | 323 | pr_err("Can't add interface (%s): out of memory\n", |
328 | "Can't add interface (%s): out of memory\n", | ||
329 | net_dev->name); | 324 | net_dev->name); |
330 | goto out; | 325 | goto out; |
331 | } | 326 | } |
@@ -408,11 +403,11 @@ static int hard_if_event(struct notifier_block *this, | |||
408 | case NETDEV_REGISTER: | 403 | case NETDEV_REGISTER: |
409 | break; | 404 | break; |
410 | case NETDEV_UP: | 405 | case NETDEV_UP: |
411 | hardif_activate_interface(bat_priv, batman_if); | 406 | hardif_activate_interface(soft_device, bat_priv, batman_if); |
412 | break; | 407 | break; |
413 | case NETDEV_GOING_DOWN: | 408 | case NETDEV_GOING_DOWN: |
414 | case NETDEV_DOWN: | 409 | case NETDEV_DOWN: |
415 | hardif_deactivate_interface(batman_if); | 410 | hardif_deactivate_interface(soft_device, batman_if); |
416 | break; | 411 | break; |
417 | case NETDEV_UNREGISTER: | 412 | case NETDEV_UNREGISTER: |
418 | hardif_remove_interface(batman_if); | 413 | hardif_remove_interface(batman_if); |