rtc: class: make rtc_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 rtc_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240305-class_cleanup-abelloni-v1-1-944c026137c8@marliere.net
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Ricardo B. Marliere
2024-03-05 15:22:28 -03:00
committed by Alexandre Belloni
parent 32a6be0858
commit 6b6ca09611
5 changed files with 17 additions and 12 deletions

View File

@@ -696,7 +696,7 @@ struct rtc_device *rtc_class_open(const char *name)
struct device *dev;
struct rtc_device *rtc = NULL;
dev = class_find_device_by_name(rtc_class, name);
dev = class_find_device_by_name(&rtc_class, name);
if (dev)
rtc = to_rtc_device(dev);