ARM: 9416/1: amba: make amba_bustype constant
authorKunwu Chan <chentao@kylinos.cn>
Mon, 2 Sep 2024 06:43:23 +0000 (07:43 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 4 Sep 2024 14:01:17 +0000 (15:01 +0100)
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 amba_bustype 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: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
drivers/amba/bus.c
include/linux/amba/bus.h

index 34bc880ca20bd2507566bf372119aec28fb0318b..0230c43377c1da23230d7fe28833f0603f55686e 100644 (file)
@@ -435,7 +435,7 @@ static const struct dev_pm_ops amba_pm = {
  * DMA configuration for platform and AMBA bus is same. So here we reuse
  * platform's DMA config routine.
  */
-struct bus_type amba_bustype = {
+const struct bus_type amba_bustype = {
        .name           = "amba",
        .dev_groups     = amba_dev_groups,
        .match          = amba_match,
index 958a55bcc7080825e433f8fca3ef60cabf29b41d..dda2f3ea89cb5d7a9b2f8189c6c740b0c4b20532 100644 (file)
@@ -105,7 +105,7 @@ enum amba_vendor {
        AMBA_VENDOR_LSI = 0xb6,
 };
 
-extern struct bus_type amba_bustype;
+extern const struct bus_type amba_bustype;
 
 #define to_amba_device(d)      container_of_const(d, struct amba_device, dev)