net: constify struct class usage
Subsystems (7)
cover net: constify struct class usage
This is a simple and straight forward cleanup series that aims to make the class structures in net constant. This has been possible since 2023 [1].
[1]: https://lore.kernel.org/all/2023040248-customary-release-4aec@gregkh/
---
Ricardo B. Marliere (6):
net: hns: make hnae_class constant
net: wan: framer: make framer_class constant
net: ppp: make ppp_class constant
net: wwan: hwsim: make wwan_hwsim_class constant
net: wwan: core: make wwan_class constant
nfc: core: make nfc_class constant
drivers/net/ethernet/hisilicon/hns/hnae.c | 13 +++++++------ drivers/net/ppp/ppp_generic.c | 18 +++++++++--------- drivers/net/wan/framer/framer-core.c | 21 +++++++++------------ drivers/net/wwan/wwan_core.c | 30 +++++++++++++++--------------- drivers/net/wwan/wwan_hwsim.c | 16 ++++++++-------- include/net/nfc/nfc.h | 2 +- net/nfc/core.c | 2 +- 7 files changed, 50 insertions(+), 52 deletions(-)
---
base-commit: e960825709330cb199d209740326cec37e8c419d
change-id: 20240302-class_cleanup-net-next-e41dbdaf7f06
Best regards,
Signature · 1 line
Ricardo B. Marliere <[email protected]>
PATCH 1/6 net: hns: make hnae_class constant
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the hnae_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- drivers/net/ethernet/hisilicon/hns/hnae.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/hisilicon/hns/hnae.c +7 -6
@@ -12,7 +12,9 @@#define cls_to_ae_dev (dev) container_of(dev, struct hnae_ae_dev, cls_dev) -static struct class *hnae_class; +static const struct class hnae_class = { + .name ="hnae" , +};static void hnae_list_add (spinlock_t *lock,struct list_head *node,struct list_head *head)
@@ -111,7 +113,7 @@ static struct hnae_ae_dev *find_ae(const struct fwnode_handle *fwnode)WARN_ON (!fwnode); - dev =class_find_device (hnae_class,NULL , fwnode, __ae_match); + dev =class_find_device (&hnae_class,NULL , fwnode, __ae_match);return dev ?cls_to_ae_dev (dev) :NULL ; }
@@ -415,7 +417,7 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner) hdev->owner = owner; hdev->id = (int )atomic_inc_return (&id); hdev->cls_dev.parent = hdev->dev; - hdev->cls_dev.class = hnae_class; + hdev->cls_dev.class = &hnae_class; hdev->cls_dev.release = hnae_release; (void )dev_set_name (&hdev->cls_dev,"hnae%d" , hdev->id); ret =device_register (&hdev->cls_dev);
@@ -448,13 +450,12 @@ EXPORT_SYMBOL(hnae_ae_unregister);static int __init hnae_init (void ) { - hnae_class =class_create ("hnae" ); -return PTR_ERR_OR_ZERO (hnae_class); +return class_register (&hnae_class); } static void __exit hnae_exit(void) { -class_destroy (hnae_class); +class_unregister (&hnae_class); }subsys_initcall (hnae_init);
Signature · 1 line
2.43.0
Re: [PATCH net-next 1/6] net: hns: make hnae_class constant
+ Benjamin Tissoires <[email protected]>
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move thehnae_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Quoted 58 lines
--- drivers/net/ethernet/hisilicon/hns/hnae.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/net/ethernet/hisilicon/hns/hnae.c +7
-6@@ -12,7 +12,9 @@#define cls_to_ae_dev (dev) container_of(dev, struct hnae_ae_dev, cls_dev) -static struct class *hnae_class; +static const struct class hnae_class = { + .name ="hnae" , +};static void hnae_list_add (spinlock_t *lock,struct list_head *node,struct list_head *head)@@ -111,7 +113,7 @@ static struct hnae_ae_dev *find_ae(const struct fwnode_handle *fwnode)WARN_ON (!fwnode); - dev =class_find_device (hnae_class,NULL , fwnode, __ae_match); + dev =class_find_device (&hnae_class,NULL , fwnode, __ae_match);return dev ?cls_to_ae_dev (dev) :NULL ; }@@ -415,7 +417,7 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct module *owner) hdev->owner = owner; hdev->id = (int )atomic_inc_return (&id); hdev->cls_dev.parent = hdev->dev; - hdev->cls_dev.class = hnae_class; + hdev->cls_dev.class = &hnae_class; hdev->cls_dev.release = hnae_release; (void )dev_set_name (&hdev->cls_dev,"hnae%d" , hdev->id); ret =device_register (&hdev->cls_dev);@@ -448,13 +450,12 @@ EXPORT_SYMBOL(hnae_ae_unregister);static int __init hnae_init (void ) { - hnae_class =class_create ("hnae" ); -return PTR_ERR_OR_ZERO (hnae_class); +return class_register (&hnae_class); } static void __exit hnae_exit(void) { -class_destroy (hnae_class); +class_unregister (&hnae_class); }subsys_initcall (hnae_init);Signature · 2 lines
-- 2.43.0
PATCH 2/6 net: wan: framer: make framer_class constant
In reply to Ricardo B. MarliereSince commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the framer_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- drivers/net/wan/framer/framer-core.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/net/wan/framer/framer-core.c +9 -12
@@ -18,7 +18,12 @@#include <linux/regulator/consumer.h> #include <linux/slab.h> -static struct class *framer_class; +static void framer_release (struct device *dev); +static const struct class framer_class = { + .name ="framer" , + .dev_release = framer_release, +}; +static DEFINE_MUTEX (framer_provider_mutex);static LIST_HEAD (framer_provider_list);static DEFINE_IDA (framer_ida);
@@ -627,7 +632,7 @@ struct framer *framer_create(struct device *dev, struct device_node *node,INIT_DELAYED_WORK (&framer->polling_work, framer_polling_work);BLOCKING_INIT_NOTIFIER_HEAD (&framer->notifier_list); - framer->dev.class = framer_class; + framer->dev.class = &framer_class; framer->dev.parent = dev; framer->dev.of_node = node ? node : dev->of_node; framer->id = id;
@@ -741,7 +746,7 @@ struct framer *framer_provider_simple_of_xlate(struct device *dev,struct class_dev_iter iter;struct framer *framer; -class_dev_iter_init (&iter, framer_class,NULL ,NULL ); +class_dev_iter_init (&iter, &framer_class,NULL ,NULL );while ((dev =class_dev_iter_next (&iter))) { framer =dev_to_framer (dev);if (args->np != framer->dev.of_node)
@@ -870,14 +875,6 @@ static void framer_release(struct device *dev)static int __init framer_core_init (void ) { - framer_class =class_create ("framer" ); -if (IS_ERR (framer_class)) { -pr_err ("failed to create framer class (%pe)\n" , framer_class); -return PTR_ERR (framer_class); - } - - framer_class->dev_release = framer_release; - -return 0 ; +return class_register (&framer_class); }device_initcall (framer_core_init);
Signature · 1 line
2.43.0
Re: [PATCH net-next 2/6] net: wan: framer: make framer_class constant
+ Herve Codina <[email protected]>
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move theframer_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Quoted 61 lines
--- drivers/net/wan/framer/framer-core.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)drivers/net/wan/framer/framer-core.c +9
-12@@ -18,7 +18,12 @@#include <linux/regulator/consumer.h> #include <linux/slab.h> -static struct class *framer_class; +static void framer_release (struct device *dev); +static const struct class framer_class = { + .name ="framer" , + .dev_release = framer_release, +}; +static DEFINE_MUTEX (framer_provider_mutex);static LIST_HEAD (framer_provider_list);static DEFINE_IDA (framer_ida);@@ -627,7 +632,7 @@ struct framer *framer_create(struct device *dev, struct device_node *node,INIT_DELAYED_WORK (&framer->polling_work, framer_polling_work);BLOCKING_INIT_NOTIFIER_HEAD (&framer->notifier_list); - framer->dev.class = framer_class; + framer->dev.class = &framer_class; framer->dev.parent = dev; framer->dev.of_node = node ? node : dev->of_node; framer->id = id;@@ -741,7 +746,7 @@ struct framer *framer_provider_simple_of_xlate(struct device *dev,struct class_dev_iter iter;struct framer *framer; -class_dev_iter_init (&iter, framer_class,NULL ,NULL ); +class_dev_iter_init (&iter, &framer_class,NULL ,NULL );while ((dev =class_dev_iter_next (&iter))) { framer =dev_to_framer (dev);if (args->np != framer->dev.of_node)@@ -870,14 +875,6 @@ static void framer_release(struct device *dev)static int __init framer_core_init (void ) { - framer_class =class_create ("framer" ); -if (IS_ERR (framer_class)) { -pr_err ("failed to create framer class (%pe)\n" , framer_class); -return PTR_ERR (framer_class); - } - - framer_class->dev_release = framer_release; - -return 0 ; +return class_register (&framer_class); }device_initcall (framer_core_init);Signature · 2 lines
-- 2.43.0
Re: [PATCH net-next 2/6] net: wan: framer: make framer_class constant
Hi,
Quoted 9 lines · On Mon, 4 Mar 2024 17:52:46 +0000 Simon Horman <[email protected]> wrote:
+ Herve Codina <[email protected]>
Quoted 6 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move theframer_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
Quoted 6 lines
Quoted 3 lines
Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>Reviewed-by Simon Horman <[email protected]>
Thanks for the patch.
Best regards,
Hervé
PATCH 3/6 net: ppp: make ppp_class constant
In reply to Ricardo B. MarliereSince commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the ppp_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- drivers/net/ppp/ppp_generic.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ppp/ppp_generic.c +9 -9
@@ -295,7 +295,9 @@ static void ppp_setup(struct net_device *dev);static const struct net_device_ops ppp_netdev_ops; -static struct class *ppp_class; +static const struct class ppp_class = { + .name ="ppp" , +};/* per net-namespace data */ static inline struct ppp_net *ppp_pernet (struct net *net)
@@ -1394,11 +1396,9 @@ static int __init ppp_init(void) goto out_net; } - ppp_class =class_create ("ppp" ); -if (IS_ERR (ppp_class)) { - err =PTR_ERR (ppp_class); + err =class_register (&ppp_class); +if (err) goto out_chrdev; - } err =rtnl_link_register (&ppp_link_ops);if (err) {
@@ -1407,12 +1407,12 @@ static int __init ppp_init(void) }/* not a big deal if we fail here :-) */ -device_create (ppp_class,NULL ,MKDEV (PPP_MAJOR ,0 ),NULL ,"ppp" ); +device_create (&ppp_class,NULL ,MKDEV (PPP_MAJOR ,0 ),NULL ,"ppp" );return 0 ; out_class: -class_destroy (ppp_class); +class_unregister (&ppp_class); out_chrdev:unregister_chrdev (PPP_MAJOR ,"ppp" ); out_net:
@@ -3549,8 +3549,8 @@ static void __exit ppp_cleanup(void)pr_err ("PPP: removing module but units remain!\n" );rtnl_link_unregister (&ppp_link_ops);unregister_chrdev (PPP_MAJOR ,"ppp" ); -device_destroy (ppp_class,MKDEV (PPP_MAJOR ,0 )); -class_destroy (ppp_class); +device_destroy (&ppp_class,MKDEV (PPP_MAJOR ,0 )); +class_unregister (&ppp_class);unregister_pernet_device (&ppp_net_ops); }
Signature · 1 line
2.43.0
Re: [PATCH net-next 3/6] net: ppp: make ppp_class constant
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move theppp_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Re: [PATCH net-next 3/6] net: ppp: make ppp_class constant
In reply to Ricardo B. MarliereQuoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move theppp_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 4/6 net: wwan: hwsim: make wwan_hwsim_class constant
In reply to Ricardo B. MarliereSince commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the wwan_hwsim_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- drivers/net/wwan/wwan_hwsim.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/wwan/wwan_hwsim.c +8 -8
@@ -25,7 +25,9 @@ static int wwan_hwsim_devsnum = 2;module_param_named (devices, wwan_hwsim_devsnum, int,0444 );MODULE_PARM_DESC (devices,"Number of simulated devices" ); -static struct class *wwan_hwsim_class; +static const struct class wwan_hwsim_class = { + .name ="wwan_hwsim" , +};static struct dentry *wwan_hwsim_debugfs_topdir;static struct dentry *wwan_hwsim_debugfs_devcreate;
@@ -277,7 +279,7 @@ static struct wwan_hwsim_dev *wwan_hwsim_dev_new(void)spin_unlock (&wwan_hwsim_devs_lock); dev->dev.release = wwan_hwsim_dev_release; - dev->dev.class = wwan_hwsim_class; + dev->dev.class = &wwan_hwsim_class;dev_set_name (&dev->dev,"hwsim%u" , dev->id);spin_lock_init (&dev->ports_lock);
@@ -511,11 +513,9 @@ static int __init wwan_hwsim_init(void)if (!wwan_wq)return -ENOMEM ; - wwan_hwsim_class =class_create ("wwan_hwsim" ); -if (IS_ERR (wwan_hwsim_class)) { - err =PTR_ERR (wwan_hwsim_class); + err =class_register (&wwan_hwsim_class); +if (err) goto err_wq_destroy; - } wwan_hwsim_debugfs_topdir =debugfs_create_dir ("wwan_hwsim" ,NULL ); wwan_hwsim_debugfs_devcreate =
@@ -534,7 +534,7 @@ static int __init wwan_hwsim_init(void)wwan_hwsim_free_devs ();flush_workqueue (wwan_wq);/* Wait deletion works completion */ debugfs_remove (wwan_hwsim_debugfs_topdir); -class_destroy (wwan_hwsim_class); +class_unregister (&wwan_hwsim_class); err_wq_destroy:destroy_workqueue (wwan_wq);
@@ -547,7 +547,7 @@ static void __exit wwan_hwsim_exit(void)wwan_hwsim_free_devs ();flush_workqueue (wwan_wq);/* Wait deletion works completion */ debugfs_remove (wwan_hwsim_debugfs_topdir); -class_destroy (wwan_hwsim_class); +class_unregister (&wwan_hwsim_class);destroy_workqueue (wwan_wq); }
Signature · 1 line
2.43.0
Re: [PATCH net-next 4/6] net: wwan: hwsim: make wwan_hwsim_class constant
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move thewwan_hwsim_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Thanks!
PATCH 5/6 net: wwan: core: make wwan_class constant
In reply to Ricardo B. MarliereSince commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the wwan_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- drivers/net/wwan/wwan_core.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/net/wwan/wwan_core.c +15 -15
@@ -26,7 +26,9 @@static DEFINE_MUTEX (wwan_register_lock);/* WWAN device create|remove lock */ static DEFINE_IDA (minors);/* minors for WWAN port chardevs */ static DEFINE_IDA (wwan_dev_ids);/* for unique WWAN device IDs */ -static struct class *wwan_class; +static const struct class wwan_class = { + .name ="wwan" , +};static int wwan_major;static struct dentry *wwan_debugfs_dir;
@@ -130,7 +132,7 @@ static struct wwan_device *wwan_dev_get_by_parent(struct device *parent) {struct device *dev; - dev =class_find_device (wwan_class,NULL , parent, wwan_dev_parent_match); + dev =class_find_device (&wwan_class,NULL , parent, wwan_dev_parent_match);if (!dev)return ERR_PTR (-ENODEV );
@@ -147,7 +149,7 @@ static struct wwan_device *wwan_dev_get_by_name(const char *name) {struct device *dev; - dev =class_find_device (wwan_class,NULL , name, wwan_dev_name_match); + dev =class_find_device (&wwan_class,NULL , name, wwan_dev_name_match);if (!dev)return ERR_PTR (-ENODEV );
@@ -183,7 +185,7 @@ static struct wwan_device *wwan_dev_get_by_debugfs(struct dentry *dir) {struct device *dev; - dev =class_find_device (wwan_class,NULL , dir, wwan_dev_debugfs_match); + dev =class_find_device (&wwan_class,NULL , dir, wwan_dev_debugfs_match);if (!dev)return ERR_PTR (-ENODEV );
@@ -239,7 +241,7 @@ static struct wwan_device *wwan_create_dev(struct device *parent) } wwandev->dev.parent = parent; - wwandev->dev.class = wwan_class; + wwandev->dev.class = &wwan_class; wwandev->dev.type = &wwan_dev_type; wwandev->id = id;dev_set_name (&wwandev->dev,"wwan%d" , wwandev->id);
@@ -265,7 +267,7 @@ static struct wwan_device *wwan_create_dev(struct device *parent)static int is_wwan_child (struct device *dev,void *data) { -return dev->class == wwan_class; +return dev->class == &wwan_class; }static void wwan_remove_dev (struct wwan_device *wwandev)
@@ -375,7 +377,7 @@ static struct wwan_port *wwan_port_get_by_minor(unsigned int minor) {struct device *dev; - dev =class_find_device (wwan_class,NULL , &minor, wwan_port_minor_match); + dev =class_find_device (&wwan_class,NULL , &minor, wwan_port_minor_match);if (!dev)return ERR_PTR (-ENODEV );
@@ -405,7 +407,7 @@ static int __wwan_port_dev_assign_name(struct wwan_port *port, const char *fmt)return -ENOMEM ;/* Collect ids of same name format ports */ -class_dev_iter_init (&iter, wwan_class,NULL , &wwan_port_dev_type); +class_dev_iter_init (&iter, &wwan_class,NULL , &wwan_port_dev_type);while ((dev =class_dev_iter_next (&iter))) {if (dev->parent != &wwandev->dev)continue ;
@@ -477,7 +479,7 @@ struct wwan_port *wwan_create_port(struct device *parent,mutex_init (&port->data_lock); port->dev.parent = &wwandev->dev; - port->dev.class = wwan_class; + port->dev.class = &wwan_class; port->dev.type = &wwan_port_dev_type; port->dev.devt =MKDEV (wwan_major, minor);dev_set_drvdata (&port->dev, drvdata);
@@ -1212,11 +1214,9 @@ static int __init wwan_init(void)if (err)return err; - wwan_class =class_create ("wwan" ); -if (IS_ERR (wwan_class)) { - err =PTR_ERR (wwan_class); + err =class_register (&wwan_class); +if (err) goto unregister; - }/* chrdev used for wwan ports */ wwan_major = __register_chrdev(0, 0, WWAN_MAX_MINORS, "wwan_port",
@@ -1233,7 +1233,7 @@ static int __init wwan_init(void)return 0 ; destroy: -class_destroy (wwan_class); +class_unregister (&wwan_class); unregister:rtnl_link_unregister (&wwan_rtnl_link_ops);return err;
@@ -1244,7 +1244,7 @@ static void __exit wwan_exit(void)debugfs_remove_recursive (wwan_debugfs_dir);__unregister_chrdev (wwan_major,0 ,WWAN_MAX_MINORS ,"wwan_port" );rtnl_link_unregister (&wwan_rtnl_link_ops); -class_destroy (wwan_class); +class_unregister (&wwan_class); }module_init (wwan_init);
Signature · 1 line
2.43.0
Re: [PATCH net-next 5/6] net: wwan: core: make wwan_class constant
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move thewwan_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Thanks!
PATCH 6/6 nfc: core: make nfc_class constant
In reply to Ricardo B. MarliereSince commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the nfc_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.
--- include/net/nfc/nfc.h | 2 +- net/nfc/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/nfc/nfc.h +1 -1
@@ -196,7 +196,7 @@ struct nfc_dev { };#define to_nfc_dev (_dev) container_of(_dev, struct nfc_dev, dev) -extern struct class nfc_class; +extern const struct class nfc_class; struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops, u32 supported_protocols,
net/nfc/core.c +1 -1
@@ -1015,7 +1015,7 @@ static void nfc_check_pres_timeout(struct timer_list *t)schedule_work (&dev->check_pres_work); } -struct class nfc_class = { +const struct class nfc_class = { .name ="nfc" , .dev_release = nfc_release, };
Signature · 1 line
2.43.0
Re: [PATCH net-next 6/6] nfc: core: make nfc_class constant
Quoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move thenfc_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Re: [PATCH net-next 6/6] nfc: core: make nfc_class constant
In reply to Ricardo B. MarliereQuoted 9 lines · Ricardo B. Marliere
Since commit
43a7206b0963("driver core: class: makeclass_register()take a const *"), the driver core allows for struct class to be in read-only memory, so move thenfc_classstructure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time.Cc Greg Kroah-Hartman <[email protected]>Suggested-by Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sat, 02 Mar 2024 14:05:56 -0300 you wrote:
This is a simple and straight forward cleanup series that aims to make the class structures in net constant. This has been possible since 2023 [1].
[1]: https://lore.kernel.org/all/2023040248-customary-release-4aec@gregkh/
Signed-off-by Ricardo B. Marliere <[email protected]>[...]
Here is the summary with links:
- [net-next,1/6] net: hns: make hnae_class constant
https://git.kernel.org/netdev/net-next/c/b6e3c115efb5 - [net-next,2/6] net: wan: framer: make framer_class constant https://git.kernel.org/netdev/net-next/c/63767a76318c - [net-next,3/6] net: ppp: make ppp_class constant https://git.kernel.org/netdev/net-next/c/2ad2018aa357 - [net-next,4/6] net: wwan: hwsim: make wwan_hwsim_class constant https://git.kernel.org/netdev/net-next/c/d9567f212b15 - [net-next,5/6] net: wwan: core: make wwan_class constant https://git.kernel.org/netdev/net-next/c/070bef83f03e - [net-next,6/6] nfc: core: make nfc_class constant https://git.kernel.org/netdev/net-next/c/e55600116929
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html