Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: Make host1x_context_device_bus_type constant

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the host1x_context_device_bus_type variable
to be a constant structure as well, placing it into read-only memory
which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240823080724.148423-1-kunwu.chan@linux.dev

authored by

Kunwu Chan and committed by
Thierry Reding
3d70eb8e 57d298bd

+2 -2
+1 -1
drivers/gpu/host1x/context_bus.c
··· 6 6 #include <linux/device.h> 7 7 #include <linux/of.h> 8 8 9 - struct bus_type host1x_context_device_bus_type = { 9 + const struct bus_type host1x_context_device_bus_type = { 10 10 .name = "host1x-context", 11 11 }; 12 12 EXPORT_SYMBOL_GPL(host1x_context_device_bus_type);
+1 -1
include/linux/host1x_context_bus.h
··· 9 9 #include <linux/device.h> 10 10 11 11 #ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS 12 - extern struct bus_type host1x_context_device_bus_type; 12 + extern const struct bus_type host1x_context_device_bus_type; 13 13 #endif 14 14 15 15 #endif