Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219901
b: refs/heads/master
c: 47f621d
h: refs/heads/master
i:
  219899: 021d018
v: v3
  • Loading branch information
Sven Eckelmann authored and Greg Kroah-Hartman committed Sep 20, 2010
1 parent 9f9bcb7 commit 9ea5fdd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16f9530e99f5eb35dd1adafbae854dd94f8d3751
refs/heads/master: 47f621dddc0b5ce3be4592a58e5f73707a83ad41
5 changes: 3 additions & 2 deletions trunk/drivers/staging/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ static struct batman_if *hardif_add_interface(struct net_device *net_dev)
batman_if->soft_iface = NULL;
batman_if->if_status = IF_NOT_IN_USE;
INIT_LIST_HEAD(&batman_if->list);
atomic_set(&batman_if->refcnt, 0);
hardif_hold(batman_if);

check_known_mac_addr(batman_if->net_dev->dev_addr);

Expand Down Expand Up @@ -433,8 +435,7 @@ static void hardif_remove_interface(struct batman_if *batman_if)
list_del_rcu(&batman_if->list);
synchronize_rcu();
sysfs_del_hardif(&batman_if->hardif_obj);
dev_put(batman_if->net_dev);
kfree(batman_if);
hardif_put(batman_if);
}

void hardif_remove_interfaces(void)
Expand Down
13 changes: 13 additions & 0 deletions trunk/drivers/staging/batman-adv/hard-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,17 @@ int batman_skb_recv(struct sk_buff *skb,
int hardif_min_mtu(struct net_device *soft_iface);
void update_min_mtu(struct net_device *soft_iface);

static inline void hardif_hold(struct batman_if *batman_if)
{
atomic_inc(&batman_if->refcnt);
}

static inline void hardif_put(struct batman_if *batman_if)
{
if (atomic_dec_and_test(&batman_if->refcnt)) {
dev_put(batman_if->net_dev);
kfree(batman_if);
}
}

#endif /* _NET_BATMAN_ADV_HARD_INTERFACE_H_ */
1 change: 1 addition & 0 deletions trunk/drivers/staging/batman-adv/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct batman_if {
unsigned char *packet_buff;
int packet_len;
struct kobject *hardif_obj;
atomic_t refcnt;
struct packet_type batman_adv_ptype;
struct net_device *soft_iface;
};
Expand Down

0 comments on commit 9ea5fdd

Please sign in to comment.