diff mbox series

[7/7] of/address: Constify of_busses[] array and pointers

Message ID 20241010-dt-const-v1-7-87a51f558425@kernel.org (mailing list archive)
State New
Delegated to: Rob Herring
Headers show
Series of: Constify DT structs | expand

Commit Message

Rob Herring (Arm) Oct. 10, 2024, 4:27 p.m. UTC
The of_busses array is fixed, so it and all struct of_bus pointers can
be const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/of/address.c       | 12 ++++++------
 include/linux/of_address.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/of/address.c b/drivers/of/address.c
index aa1a4e381461..824bb449e007 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -340,7 +340,7 @@  static int of_bus_default_flags_match(struct device_node *np)
  * Array of bus specific translators
  */
 
-static struct of_bus of_busses[] = {
+static const struct of_bus of_busses[] = {
 #ifdef CONFIG_PCI
 	/* PCI */
 	{
@@ -388,7 +388,7 @@  static struct of_bus of_busses[] = {
 	},
 };
 
-static struct of_bus *of_match_bus(struct device_node *np)
+static const struct of_bus *of_match_bus(struct device_node *np)
 {
 	int i;
 
@@ -419,8 +419,8 @@  static int of_empty_ranges_quirk(const struct device_node *np)
 	return false;
 }
 
-static int of_translate_one(struct device_node *parent, struct of_bus *bus,
-			    struct of_bus *pbus, __be32 *addr,
+static int of_translate_one(const struct device_node *parent, const struct of_bus *bus,
+			    const struct of_bus *pbus, __be32 *addr,
 			    int na, int ns, int pna, const char *rprop)
 {
 	const __be32 *ranges;
@@ -505,7 +505,7 @@  static u64 __of_translate_address(struct device_node *node,
 {
 	struct device_node *dev __free(device_node) = of_node_get(node);
 	struct device_node *parent __free(device_node) = get_parent(dev);
-	struct of_bus *bus, *pbus;
+	const struct of_bus *bus, *pbus;
 	__be32 addr[OF_MAX_ADDR_CELLS];
 	int na, ns, pna, pns;
 
@@ -690,7 +690,7 @@  const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no,
 	const __be32 *prop;
 	unsigned int psize;
 	struct device_node *parent __free(device_node) = of_get_parent(dev);
-	struct of_bus *bus;
+	const struct of_bus *bus;
 	int onesize, i, na, ns;
 
 	if (parent == NULL)
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index bd46dbcc6e88..9e034363788a 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -10,7 +10,7 @@  struct of_bus;
 
 struct of_pci_range_parser {
 	struct device_node *node;
-	struct of_bus *bus;
+	const struct of_bus *bus;
 	const __be32 *range;
 	const __be32 *end;
 	int na;