Skip to content

Commit 3ee29a4

Browse files
tititiou36davem330
authored andcommitted
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e900274 commit 3ee29a4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,11 +605,11 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
605605
* Assign IDs between 0x1 and 0xFFFE (used by the master) to each
606606
* slave link [see addrconf_ifid_eui48()].
607607
*/
608-
err = ida_simple_get(&port->ida, port->dev_id_start, 0xFFFE,
609-
GFP_KERNEL);
608+
err = ida_alloc_range(&port->ida, port->dev_id_start, 0xFFFD,
609+
GFP_KERNEL);
610610
if (err < 0)
611-
err = ida_simple_get(&port->ida, 0x1, port->dev_id_start,
612-
GFP_KERNEL);
611+
err = ida_alloc_range(&port->ida, 0x1, port->dev_id_start - 1,
612+
GFP_KERNEL);
613613
if (err < 0)
614614
goto unregister_netdev;
615615
dev->dev_id = err;
@@ -641,7 +641,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
641641
unlink_netdev:
642642
netdev_upper_dev_unlink(phy_dev, dev);
643643
remove_ida:
644-
ida_simple_remove(&port->ida, dev->dev_id);
644+
ida_free(&port->ida, dev->dev_id);
645645
unregister_netdev:
646646
unregister_netdevice(dev);
647647
return err;
@@ -661,7 +661,7 @@ void ipvlan_link_delete(struct net_device *dev, struct list_head *head)
661661
}
662662
spin_unlock_bh(&ipvlan->addrs_lock);
663663

664-
ida_simple_remove(&ipvlan->port->ida, dev->dev_id);
664+
ida_free(&ipvlan->port->ida, dev->dev_id);
665665
list_del_rcu(&ipvlan->pnode);
666666
unregister_netdevice_queue(dev, head);
667667
netdev_upper_dev_unlink(ipvlan->phy_dev, dev);

0 commit comments

Comments
 (0)