Skip to contentSkip to conversation

mac80211: Directly use ida_alloc()/free()

PATCH In review keliu 3 participants 4 messages May 27, 2022

Subsystems (3)
lore
Share & tools
lore

keliu

author
#0 lore raw

PATCH 1/1 mac80211: Directly use ida_alloc()/free()

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

---
 drivers/net/wireless/mac80211_hwsim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +3 -3
index e9ec63e0e395..6ad884d9e9a4 100644
@@ -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);
 	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 = {
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Le 27/05/2022 à 09:41, keliu a écrit :

Quoted 13 lines

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

---
  drivers/net/wireless/mac80211_hwsim.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +0 -0
index e9ec63e0e395..6ad884d9e9a4 100644

drivers/net/wireless/mac80211_hwsim.c static inline int hwsim_net_set_netgroup(struct net *net) · line 294

Quoted 7 lines
drivers/net/wireless/mac80211_hwsim.c +2 -2
@@ -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

Quoted 12 lines
drivers/net/wireless/mac80211_hwsim.c +1 -1
  	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 = {
#2 lore raw
Quoted 5 lines · Christophe JAILLET

Le 27/05/2022 à 09:41, keliu a écrit :

Quoted 4 lines

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Heh, this email address got me confused :) I guess you (Christophe) use gmane and it's just some obfuscation done by gmane?

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

Le 27/05/2022 à 09:42, Kalle Valo a écrit :

Quoted 11 lines
Quoted 5 lines · Christophe JAILLET

Le 27/05/2022 à 09:41, keliu a écrit :

Quoted 4 lines

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Heh, this email address got me confused :) I guess you (Christophe) use gmane and it's just some obfuscation done by gmane?

Yes, I use gname and thunderbird as a client. I also think that it is some obfuscation done by gname.

This kind of obfuscation is not done on all messages, and not done consistently on the message of the same ML. I don't know the rule that is applied.

CJ