macintosh/adb: make adb_dev_class constant

Since commit 43a7206b09 ("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 <[email protected]>
Signed-off-by: "Ricardo B. Marliere" <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
This commit is contained in:
Ricardo B. Marliere
2024-03-07 00:13:28 +11:00
committed by Michael Ellerman
parent 35f20786c4
commit 83bc680e87
+6 -4
View File
@@ -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);