diff mbox series

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

Message ID 20220527074000.2474792-1-liuke94@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: Directly use ida_alloc()/free() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Ke Liu May 27, 2022, 7:40 a.m. UTC
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
---
 drivers/net/phy/fixed_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christophe JAILLET May 27, 2022, 7:35 a.m. UTC | #1
Hi,

Le 27/05/2022 à 09:40, keliu a écrit :
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>
> ---
>   drivers/net/phy/fixed_phy.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
> index c65fb5f5d2dc..63e7922bf257 100644
> --- a/drivers/net/phy/fixed_phy.c
> +++ b/drivers/net/phy/fixed_phy.c
> @@ -180,7 +180,7 @@ static void fixed_phy_del(int phy_addr)
>   			if (fp->link_gpiod)
>   				gpiod_put(fp->link_gpiod);
>   			kfree(fp);
> -			ida_simple_remove(&phy_fixed_ida, phy_addr);
> +			ida_free(&phy_fixed_ida, phy_addr);
>   			return;
>   		}
>   	}
> @@ -250,7 +250,7 @@ static struct phy_device *__fixed_phy_register(unsigned int irq,
>   
>   	ret = fixed_phy_add_gpiod(irq, phy_addr, status, gpiod);
>   	if (ret < 0) {
> -		ida_simple_remove(&phy_fixed_ida, phy_addr);
> +		ida_free(&phy_fixed_ida, phy_addr);
>   		return ERR_PTR(ret);
>   	}
>   

Hi,

You missed ida_simple_get() that shoud become ida_alloc_max() here.

CJ
diff mbox series

Patch

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index c65fb5f5d2dc..63e7922bf257 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -180,7 +180,7 @@  static void fixed_phy_del(int phy_addr)
 			if (fp->link_gpiod)
 				gpiod_put(fp->link_gpiod);
 			kfree(fp);
-			ida_simple_remove(&phy_fixed_ida, phy_addr);
+			ida_free(&phy_fixed_ida, phy_addr);
 			return;
 		}
 	}
@@ -250,7 +250,7 @@  static struct phy_device *__fixed_phy_register(unsigned int irq,
 
 	ret = fixed_phy_add_gpiod(irq, phy_addr, status, gpiod);
 	if (ret < 0) {
-		ida_simple_remove(&phy_fixed_ida, phy_addr);
+		ida_free(&phy_fixed_ida, phy_addr);
 		return ERR_PTR(ret);
 	}