Commit e5560011 authored by Ricardo B. Marliere's avatar Ricardo B. Marliere Committed by Jakub Kicinski

nfc: core: make nfc_class constant

Since commit 43a7206b ("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.
Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarRicardo B. Marliere <ricardo@marliere.net>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240302-class_cleanup-net-next-v1-6-8fa378595b93@marliere.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 070bef83
...@@ -196,7 +196,7 @@ struct nfc_dev { ...@@ -196,7 +196,7 @@ struct nfc_dev {
}; };
#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, 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, struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
u32 supported_protocols, u32 supported_protocols,
......
...@@ -1015,7 +1015,7 @@ static void nfc_check_pres_timeout(struct timer_list *t) ...@@ -1015,7 +1015,7 @@ static void nfc_check_pres_timeout(struct timer_list *t)
schedule_work(&dev->check_pres_work); schedule_work(&dev->check_pres_work);
} }
struct class nfc_class = { const struct class nfc_class = {
.name = "nfc", .name = "nfc",
.dev_release = nfc_release, .dev_release = nfc_release,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment