public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211_hwsim: change hwsim_class to a const struct
@ 2026-03-03 16:59 Jori Koolstra
  0 siblings, 0 replies; 6+ messages in thread
From: Jori Koolstra @ 2026-03-03 16:59 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Jori Koolstra, Greg Kroah-Hartman, open list:MAC80211, open list

The class_create() call has been deprecated in favor of class_register()
as the driver core now allows for a struct class to be in read-only
memory. Change hwsim_class to be a const struct class and drop the
class_create() call.

Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 drivers/net/wireless/virtual/mac80211_hwsim.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index e89173f91637..506f865075b1 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -337,7 +337,9 @@ static inline void hwsim_net_set_wmediumd(struct net *net, u32 portid)
 	hwsim_net->wmediumd = portid;
 }
 
-static struct class *hwsim_class;
+static const struct class hwsim_class = {
+	.name	= "mac80211_hwsim"
+};
 
 static struct net_device *hwsim_mon; /* global monitor netdev */
 
@@ -5424,7 +5426,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 	data = hw->priv;
 	data->hw = hw;
 
-	data->dev = device_create(hwsim_class, NULL, 0, hw, "hwsim%d", idx);
+	data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
 	if (IS_ERR(data->dev)) {
 		printk(KERN_DEBUG
 		       "mac80211_hwsim: device_create failed (%ld)\n",
@@ -5978,7 +5980,7 @@ static void mac80211_hwsim_free(void)
 		spin_lock_bh(&hwsim_radio_lock);
 	}
 	spin_unlock_bh(&hwsim_radio_lock);
-	class_destroy(hwsim_class);
+	class_unregister(&hwsim_class);
 }
 
 static const struct net_device_ops hwsim_netdev_ops = {
@@ -7083,11 +7085,9 @@ static int __init init_mac80211_hwsim(void)
 	if (err)
 		goto out_exit_netlink;
 
-	hwsim_class = class_create("mac80211_hwsim");
-	if (IS_ERR(hwsim_class)) {
-		err = PTR_ERR(hwsim_class);
+	err = class_register(&hwsim_class);
+	if (err)
 		goto out_exit_virtio;
-	}
 
 	hwsim_init_s1g_channels(hwsim_channels_s1g);
 

base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] mac80211_hwsim: change hwsim_class to a const struct
@ 2026-04-01 16:59 Jori Koolstra
  2026-04-07 13:46 ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Jori Koolstra @ 2026-04-01 16:59 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Jori Koolstra, Greg Kroah-Hartman, open list:MAC80211, open list

The class_create() call has been deprecated in favor of class_register()
as the driver core now allows for a struct class to be in read-only
memory. Change hwsim_class to be a const struct class and drop the
class_create() call.

Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 drivers/net/wireless/virtual/mac80211_hwsim.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index e89173f91637..506f865075b1 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -337,7 +337,9 @@ static inline void hwsim_net_set_wmediumd(struct net *net, u32 portid)
 	hwsim_net->wmediumd = portid;
 }
 
-static struct class *hwsim_class;
+static const struct class hwsim_class = {
+	.name	= "mac80211_hwsim"
+};
 
 static struct net_device *hwsim_mon; /* global monitor netdev */
 
@@ -5424,7 +5426,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 	data = hw->priv;
 	data->hw = hw;
 
-	data->dev = device_create(hwsim_class, NULL, 0, hw, "hwsim%d", idx);
+	data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
 	if (IS_ERR(data->dev)) {
 		printk(KERN_DEBUG
 		       "mac80211_hwsim: device_create failed (%ld)\n",
@@ -5978,7 +5980,7 @@ static void mac80211_hwsim_free(void)
 		spin_lock_bh(&hwsim_radio_lock);
 	}
 	spin_unlock_bh(&hwsim_radio_lock);
-	class_destroy(hwsim_class);
+	class_unregister(&hwsim_class);
 }
 
 static const struct net_device_ops hwsim_netdev_ops = {
@@ -7083,11 +7085,9 @@ static int __init init_mac80211_hwsim(void)
 	if (err)
 		goto out_exit_netlink;
 
-	hwsim_class = class_create("mac80211_hwsim");
-	if (IS_ERR(hwsim_class)) {
-		err = PTR_ERR(hwsim_class);
+	err = class_register(&hwsim_class);
+	if (err)
 		goto out_exit_virtio;
-	}
 
 	hwsim_init_s1g_channels(hwsim_channels_s1g);
 

base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211_hwsim: change hwsim_class to a const struct
  2026-04-01 16:59 [PATCH] mac80211_hwsim: change hwsim_class to a const struct Jori Koolstra
@ 2026-04-07 13:46 ` Johannes Berg
  2026-04-12 14:20   ` Jori Koolstra
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2026-04-07 13:46 UTC (permalink / raw)
  To: Jori Koolstra; +Cc: Greg Kroah-Hartman, open list:MAC80211, open list

Hi,

The subject should have a "wifi: " prefix. Maybe we need a MAINTAINERS
thing for that ...

Also, this patch doesn't apply on wireless-next, please respin.

johannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211_hwsim: change hwsim_class to a const struct
  2026-04-07 13:46 ` Johannes Berg
@ 2026-04-12 14:20   ` Jori Koolstra
  2026-04-13  6:19     ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Jori Koolstra @ 2026-04-12 14:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Greg Kroah-Hartman, open list:MAC80211, open list


> Op 07-04-2026 15:46 CEST schreef Johannes Berg <johannes@sipsolutions.net>:
> 
>  
> Hi,
> 
> The subject should have a "wifi: " prefix. Maybe we need a MAINTAINERS
> thing for that ...

Sounds like a good idea... I am just guessing because with the cleanup work
I am not familiar with the conventions of each subsystem I am cleaning up in.

> 
> Also, this patch doesn't apply on wireless-next, please respin.
> 

I just saw that it has been already applied.

> johannes

Thanks,
Jori.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211_hwsim: change hwsim_class to a const struct
  2026-04-12 14:20   ` Jori Koolstra
@ 2026-04-13  6:19     ` Johannes Berg
  2026-04-13  9:54       ` Jori Koolstra
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2026-04-13  6:19 UTC (permalink / raw)
  To: Jori Koolstra; +Cc: Greg Kroah-Hartman, open list:MAC80211, open list

On Sun, 2026-04-12 at 16:20 +0200, Jori Koolstra wrote:
> 
> 
> I just saw that it has been already applied.

I didn't apply this one though. You sent it twice:

https://lore.kernel.org/all/20260303165938.3773998-1-jkoolstra@xs4all.nl/
https://lore.kernel.org/all/20260401165938.3843784-1-jkoolstra@xs4all.nl/

and the *second* one didn't apply (and I replied to it accordingly.)

But it looks like at that point I missed there was a first one (please
add "v2" tags etc. when doing this), and then I later picked up that
first one because it had in fact compiled.

What's strange is that they look to be completely identical, so I don't
know why one didn't apply and one did.

johannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211_hwsim: change hwsim_class to a const struct
  2026-04-13  6:19     ` Johannes Berg
@ 2026-04-13  9:54       ` Jori Koolstra
  0 siblings, 0 replies; 6+ messages in thread
From: Jori Koolstra @ 2026-04-13  9:54 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Greg Kroah-Hartman, open list:MAC80211, open list


> Op 13-04-2026 08:19 CEST schreef Johannes Berg <johannes@sipsolutions.net>:
> 
>  
> On Sun, 2026-04-12 at 16:20 +0200, Jori Koolstra wrote:
> > 
> > 
> > I just saw that it has been already applied.
> 
> I didn't apply this one though. You sent it twice:
> 
> https://lore.kernel.org/all/20260303165938.3773998-1-jkoolstra@xs4all.nl/
> https://lore.kernel.org/all/20260401165938.3843784-1-jkoolstra@xs4all.nl/
> 

I think then I might know what happened. The patch was applied but I was
not aware of it, so I resend it. Then you tried to apply it, but it was
not possible because it was already applied (I had to do a three-way merge).
But maybe I am totally mistaken here.

> and the *second* one didn't apply (and I replied to it accordingly.)
> 
> But it looks like at that point I missed there was a first one (please
> add "v2" tags etc. when doing this),

I intended it as a resend.

> 
> What's strange is that they look to be completely identical, so I don't
> know why one didn't apply and one did.
> 
> johannes

Thanks,
Jori.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-13  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 16:59 [PATCH] mac80211_hwsim: change hwsim_class to a const struct Jori Koolstra
2026-04-07 13:46 ` Johannes Berg
2026-04-12 14:20   ` Jori Koolstra
2026-04-13  6:19     ` Johannes Berg
2026-04-13  9:54       ` Jori Koolstra
  -- strict thread matches above, loose matches on Subject: below --
2026-03-03 16:59 Jori Koolstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox