Commit 3ee29a44 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David S. Miller

ipvlan: Remove usage of the deprecated ida_simple_xx() API

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

This is less verbose.

Note that the upper bound of ida_alloc_range() is inclusive while the one
of ida_simple_get() was exclusive. So calls have been updated accordingly.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e900274f
...@@ -605,10 +605,10 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev, ...@@ -605,10 +605,10 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
* Assign IDs between 0x1 and 0xFFFE (used by the master) to each * Assign IDs between 0x1 and 0xFFFE (used by the master) to each
* slave link [see addrconf_ifid_eui48()]. * slave link [see addrconf_ifid_eui48()].
*/ */
err = ida_simple_get(&port->ida, port->dev_id_start, 0xFFFE, err = ida_alloc_range(&port->ida, port->dev_id_start, 0xFFFD,
GFP_KERNEL); GFP_KERNEL);
if (err < 0) if (err < 0)
err = ida_simple_get(&port->ida, 0x1, port->dev_id_start, err = ida_alloc_range(&port->ida, 0x1, port->dev_id_start - 1,
GFP_KERNEL); GFP_KERNEL);
if (err < 0) if (err < 0)
goto unregister_netdev; goto unregister_netdev;
...@@ -641,7 +641,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev, ...@@ -641,7 +641,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
unlink_netdev: unlink_netdev:
netdev_upper_dev_unlink(phy_dev, dev); netdev_upper_dev_unlink(phy_dev, dev);
remove_ida: remove_ida:
ida_simple_remove(&port->ida, dev->dev_id); ida_free(&port->ida, dev->dev_id);
unregister_netdev: unregister_netdev:
unregister_netdevice(dev); unregister_netdevice(dev);
return err; return err;
...@@ -661,7 +661,7 @@ void ipvlan_link_delete(struct net_device *dev, struct list_head *head) ...@@ -661,7 +661,7 @@ void ipvlan_link_delete(struct net_device *dev, struct list_head *head)
} }
spin_unlock_bh(&ipvlan->addrs_lock); spin_unlock_bh(&ipvlan->addrs_lock);
ida_simple_remove(&ipvlan->port->ida, dev->dev_id); ida_free(&ipvlan->port->ida, dev->dev_id);
list_del_rcu(&ipvlan->pnode); list_del_rcu(&ipvlan->pnode);
unregister_netdevice_queue(dev, head); unregister_netdevice_queue(dev, head);
netdev_upper_dev_unlink(ipvlan->phy_dev, dev); netdev_upper_dev_unlink(ipvlan->phy_dev, dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment