aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/bat_sysfs.c')
-rw-r--r--net/batman-adv/bat_sysfs.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 561ec31fdfb9..680caca697e2 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -559,12 +559,17 @@ static ssize_t batadv_show_mesh_iface(struct kobject *kobj,
559 struct net_device *net_dev = batadv_kobj_to_netdev(kobj); 559 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
560 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev); 560 struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
561 ssize_t length; 561 ssize_t length;
562 const char *ifname;
562 563
563 if (!hard_iface) 564 if (!hard_iface)
564 return 0; 565 return 0;
565 566
566 length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ? 567 if (hard_iface->if_status == BATADV_IF_NOT_IN_USE)
567 "none" : hard_iface->soft_iface->name); 568 ifname = "none";
569 else
570 ifname = hard_iface->soft_iface->name;
571
572 length = sprintf(buff, "%s\n", ifname);
568 573
569 batadv_hardif_free_ref(hard_iface); 574 batadv_hardif_free_ref(hard_iface);
570 575
@@ -594,9 +599,9 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
594 } 599 }
595 600
596 if (strncmp(buff, "none", 4) == 0) 601 if (strncmp(buff, "none", 4) == 0)
597 status_tmp = IF_NOT_IN_USE; 602 status_tmp = BATADV_IF_NOT_IN_USE;
598 else 603 else
599 status_tmp = IF_I_WANT_YOU; 604 status_tmp = BATADV_IF_I_WANT_YOU;
600 605
601 if (hard_iface->if_status == status_tmp) 606 if (hard_iface->if_status == status_tmp)
602 goto out; 607 goto out;
@@ -610,13 +615,13 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
610 goto out; 615 goto out;
611 } 616 }
612 617
613 if (status_tmp == IF_NOT_IN_USE) { 618 if (status_tmp == BATADV_IF_NOT_IN_USE) {
614 batadv_hardif_disable_interface(hard_iface); 619 batadv_hardif_disable_interface(hard_iface);
615 goto unlock; 620 goto unlock;
616 } 621 }
617 622
618 /* if the interface already is in use */ 623 /* if the interface already is in use */
619 if (hard_iface->if_status != IF_NOT_IN_USE) 624 if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
620 batadv_hardif_disable_interface(hard_iface); 625 batadv_hardif_disable_interface(hard_iface);
621 626
622 ret = batadv_hardif_enable_interface(hard_iface, buff); 627 ret = batadv_hardif_enable_interface(hard_iface, buff);
@@ -639,19 +644,19 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj,
639 return 0; 644 return 0;
640 645
641 switch (hard_iface->if_status) { 646 switch (hard_iface->if_status) {
642 case IF_TO_BE_REMOVED: 647 case BATADV_IF_TO_BE_REMOVED:
643 length = sprintf(buff, "disabling\n"); 648 length = sprintf(buff, "disabling\n");
644 break; 649 break;
645 case IF_INACTIVE: 650 case BATADV_IF_INACTIVE:
646 length = sprintf(buff, "inactive\n"); 651 length = sprintf(buff, "inactive\n");
647 break; 652 break;
648 case IF_ACTIVE: 653 case BATADV_IF_ACTIVE:
649 length = sprintf(buff, "active\n"); 654 length = sprintf(buff, "active\n");
650 break; 655 break;
651 case IF_TO_BE_ACTIVATED: 656 case BATADV_IF_TO_BE_ACTIVATED:
652 length = sprintf(buff, "enabling\n"); 657 length = sprintf(buff, "enabling\n");
653 break; 658 break;
654 case IF_NOT_IN_USE: 659 case BATADV_IF_NOT_IN_USE:
655 default: 660 default:
656 length = sprintf(buff, "not in use\n"); 661 length = sprintf(buff, "not in use\n");
657 break; 662 break;