mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
gpib: common: change gpib_class to a const struct
The class_create() call has been deprecated in favor of class_register() as the driver core now allows for a struct class to be in read-only memory. Change gpib_class to be a const struct class and drop the class_create() call. Link: https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/ Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl> Link: https://patch.msgid.link/20260303192124.3855792-1-jkoolstra@xs4all.nl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
42df3a519a
commit
0457681354
|
|
@ -2169,10 +2169,13 @@ void init_gpib_status_queue(struct gpib_status_queue *device)
|
|||
device->dropped_byte = 0;
|
||||
}
|
||||
|
||||
static struct class *gpib_class;
|
||||
static const struct class gpib_class = {
|
||||
.name = "gpib_common",
|
||||
};
|
||||
|
||||
static int __init gpib_common_init_module(void)
|
||||
{
|
||||
int err;
|
||||
int i;
|
||||
|
||||
pr_info("GPIB core driver\n");
|
||||
|
|
@ -2181,14 +2184,14 @@ static int __init gpib_common_init_module(void)
|
|||
pr_err("gpib: can't get major %d\n", GPIB_CODE);
|
||||
return -EIO;
|
||||
}
|
||||
gpib_class = class_create("gpib_common");
|
||||
if (IS_ERR(gpib_class)) {
|
||||
err = class_register(&gpib_class);
|
||||
if (err) {
|
||||
pr_err("gpib: failed to create gpib class\n");
|
||||
unregister_chrdev(GPIB_CODE, "gpib");
|
||||
return PTR_ERR(gpib_class);
|
||||
return err;
|
||||
}
|
||||
for (i = 0; i < GPIB_MAX_NUM_BOARDS; ++i)
|
||||
board_array[i].gpib_dev = device_create(gpib_class, NULL,
|
||||
board_array[i].gpib_dev = device_create(&gpib_class, NULL,
|
||||
MKDEV(GPIB_CODE, i), NULL, "gpib%i", i);
|
||||
|
||||
return 0;
|
||||
|
|
@ -2199,9 +2202,9 @@ static void __exit gpib_common_exit_module(void)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < GPIB_MAX_NUM_BOARDS; ++i)
|
||||
device_destroy(gpib_class, MKDEV(GPIB_CODE, i));
|
||||
device_destroy(&gpib_class, MKDEV(GPIB_CODE, i));
|
||||
|
||||
class_destroy(gpib_class);
|
||||
class_unregister(&gpib_class);
|
||||
unregister_chrdev(GPIB_CODE, "gpib");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user