diff options
author | Ricardo B. Marliere <ricardo@marliere.net> | 2024-03-05 17:13:48 -0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-03-07 00:13:28 +1100 |
commit | 83bc680e87292f78c6e823100e417d58a66dcb06 (patch) | |
tree | 3a69c103e972260f97ce1fd336812361319c65bc /drivers/macintosh/adb.c | |
parent | 35f20786c481d5ced9283ff42de5c69b65e5ed13 (diff) | |
download | lwn-83bc680e87292f78c6e823100e417d58a66dcb06.tar.gz lwn-83bc680e87292f78c6e823100e417d58a66dcb06.zip |
macintosh/adb: make adb_dev_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 adb_dev_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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240305-macintosh-v1-1-9c3f4f882045@marliere.net
Diffstat (limited to 'drivers/macintosh/adb.c')
-rw-r--r-- | drivers/macintosh/adb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 057b0221f695..b0407c5fadb2 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -74,7 +74,9 @@ static struct adb_driver *adb_driver_list[] = { NULL }; -static struct class *adb_dev_class; +static const struct class adb_dev_class = { + .name = "adb", +}; static struct adb_driver *adb_controller; BLOCKING_NOTIFIER_HEAD(adb_client_list); @@ -888,10 +890,10 @@ adbdev_init(void) return; } - adb_dev_class = class_create("adb"); - if (IS_ERR(adb_dev_class)) + if (class_register(&adb_dev_class)) return; - device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb"); + + device_create(&adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb"); platform_device_register(&adb_pfdev); platform_driver_probe(&adb_pfdrv, adb_dummy_probe); |