Commit 2f1de254 authored by Ke Liu's avatar Ke Liu Committed by David S. Miller

net: phy: Directly use ida_alloc()/free()

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove().
Signed-off-by: default avatarKe Liu <liuke94@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e225c9a5
...@@ -180,7 +180,7 @@ static void fixed_phy_del(int phy_addr) ...@@ -180,7 +180,7 @@ static void fixed_phy_del(int phy_addr)
if (fp->link_gpiod) if (fp->link_gpiod)
gpiod_put(fp->link_gpiod); gpiod_put(fp->link_gpiod);
kfree(fp); kfree(fp);
ida_simple_remove(&phy_fixed_ida, phy_addr); ida_free(&phy_fixed_ida, phy_addr);
return; return;
} }
} }
...@@ -244,13 +244,13 @@ static struct phy_device *__fixed_phy_register(unsigned int irq, ...@@ -244,13 +244,13 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
} }
/* Get the next available PHY address, up to PHY_MAX_ADDR */ /* Get the next available PHY address, up to PHY_MAX_ADDR */
phy_addr = ida_simple_get(&phy_fixed_ida, 0, PHY_MAX_ADDR, GFP_KERNEL); phy_addr = ida_alloc_max(&phy_fixed_ida, PHY_MAX_ADDR - 1, GFP_KERNEL);
if (phy_addr < 0) if (phy_addr < 0)
return ERR_PTR(phy_addr); return ERR_PTR(phy_addr);
ret = fixed_phy_add_gpiod(irq, phy_addr, status, gpiod); ret = fixed_phy_add_gpiod(irq, phy_addr, status, gpiod);
if (ret < 0) { if (ret < 0) {
ida_simple_remove(&phy_fixed_ida, phy_addr); ida_free(&phy_fixed_ida, phy_addr);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
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