提交 4e790226 编写于 作者: J Johan Hedberg 提交者: Marcel Holtmann

Bluetooth: 6lowpan: Remove unnecessary RCU callback

When kfree() is all that's needed to free an object protected by RCU
there's a kfree_rcu() convenience function that can be used. This patch
updates the 6lowpan code to use this, thereby eliminating the need for
the separate peer_free() function.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 60cb49d2
...@@ -87,13 +87,6 @@ struct lowpan_dev { ...@@ -87,13 +87,6 @@ struct lowpan_dev {
struct delayed_work notify_peers; struct delayed_work notify_peers;
}; };
static inline void peer_free(struct rcu_head *head)
{
struct lowpan_peer *e = container_of(head, struct lowpan_peer, rcu);
kfree(e);
}
static inline struct lowpan_dev *lowpan_dev(const struct net_device *netdev) static inline struct lowpan_dev *lowpan_dev(const struct net_device *netdev)
{ {
return netdev_priv(netdev); return netdev_priv(netdev);
...@@ -108,7 +101,7 @@ static inline void peer_add(struct lowpan_dev *dev, struct lowpan_peer *peer) ...@@ -108,7 +101,7 @@ static inline void peer_add(struct lowpan_dev *dev, struct lowpan_peer *peer)
static inline bool peer_del(struct lowpan_dev *dev, struct lowpan_peer *peer) static inline bool peer_del(struct lowpan_dev *dev, struct lowpan_peer *peer)
{ {
list_del_rcu(&peer->list); list_del_rcu(&peer->list);
call_rcu(&peer->rcu, peer_free); kfree_rcu(peer, rcu);
module_put(THIS_MODULE); module_put(THIS_MODULE);
...@@ -1219,7 +1212,7 @@ static void disconnect_all_peers(void) ...@@ -1219,7 +1212,7 @@ static void disconnect_all_peers(void)
l2cap_chan_close(peer->chan, ENOENT); l2cap_chan_close(peer->chan, ENOENT);
list_del_rcu(&peer->list); list_del_rcu(&peer->list);
call_rcu(&peer->rcu, peer_free); kfree_rcu(peer, rcu);
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册