[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3e0df04-fb94-ef38-c2dc-1c41e6c721d9@wanadoo.fr>
Date: Fri, 27 May 2022 09:32:30 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: liuke94@...wei.com
Cc: davem@...emloft.net, edumazet@...gle.com,
johannes@...solutions.net, kuba@...nel.org, kvalo@...nel.org,
linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, pabeni@...hat.com
Subject: Re: [PATCH] mac80211: Directly use ida_alloc()/free()
Hi,
Le 27/05/2022 à 09:41, keliu a écrit :
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
>
> Signed-off-by: keliu <liuke94-hv44wF8Li93QT0dZR+AlfA@...lic.gmane.org>
> ---
> drivers/net/wireless/mac80211_hwsim.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index e9ec63e0e395..6ad884d9e9a4 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -290,8 +290,8 @@ static inline int hwsim_net_set_netgroup(struct net *net)
> {
> struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id);
>
> - hwsim_net->netgroup = ida_simple_get(&hwsim_netgroup_ida,
> - 0, 0, GFP_KERNEL);
> + hwsim_net->netgroup = ida_alloc(&hwsim_netgroup_ida,
> + GFP_KERNEL);
Nitpick: GFP_KERNEL should be on the same line if there is enough space
or aligned with &hwsim_netgroup_ida
Out of curiosity, how do you generate these patches?
(coccinelle should be the perfect tool for it, but I thought it would
already deal with alignment)
CJ
> return hwsim_net->netgroup >= 0 ? 0 : -ENOMEM;
> }
>
> @@ -4733,7 +4733,7 @@ static void __net_exit hwsim_exit_net(struct net *net)
> NULL);
> }
>
> - ida_simple_remove(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net));
> + ida_free(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net));
> }
>
> static struct pernet_operations hwsim_net_ops = {
Powered by blists - more mailing lists