diff mbox series

[1/3] HID: make hid_bus_type const

Message ID 2023122045-pellet-eggbeater-8d2f@gregkh (mailing list archive)
State Mainlined
Commit 37d158d0b05144f696323ae5bbfe1e137f7c06d3
Headers show
Series [1/3] HID: make hid_bus_type const | expand

Commit Message

Greg KH Dec. 20, 2023, 7:38 a.m. UTC
Now that the driver core can properly handle constant struct bus_type,
move the hid_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hid/hid-core.c | 2 +-
 include/linux/hid.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jiri Kosina Jan. 2, 2024, 10:30 a.m. UTC | #1
On Wed, 20 Dec 2023, Greg Kroah-Hartman wrote:

> Now that the driver core can properly handle constant struct bus_type,
> move the hid_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.

I have applied all three patches to hid.git now. Thanks,
Greg KH Jan. 4, 2024, 3:51 p.m. UTC | #2
On Tue, Jan 02, 2024 at 11:30:05AM +0100, Jiri Kosina wrote:
> On Wed, 20 Dec 2023, Greg Kroah-Hartman wrote:
> 
> > Now that the driver core can properly handle constant struct bus_type,
> > move the hid_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
> 
> I have applied all three patches to hid.git now. Thanks,

Thanks!
diff mbox series

Patch

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index e0181218ad85..de7a477d6665 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2749,7 +2749,7 @@  static int hid_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
-struct bus_type hid_bus_type = {
+const struct bus_type hid_bus_type = {
 	.name		= "hid",
 	.dev_groups	= hid_dev_groups,
 	.drv_groups	= hid_drv_groups,
diff --git a/include/linux/hid.h b/include/linux/hid.h
index bf43f3ff6664..7c26db874ff0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -912,7 +912,7 @@  extern bool hid_ignore(struct hid_device *);
 extern int hid_add_device(struct hid_device *);
 extern void hid_destroy_device(struct hid_device *);
 
-extern struct bus_type hid_bus_type;
+extern const struct bus_type hid_bus_type;
 
 extern int __must_check __hid_register_driver(struct hid_driver *,
 		struct module *, const char *mod_name);