devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] of: Constify DT structs
@ 2024-10-10 16:27 Rob Herring (Arm)
  2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

This series constifies many usages of DT structs in the DT core code. 
Many uses of struct device_node where the node refcount is not 
changed can be const. Most uses of struct property can also be const.

The first 2 patches are dependencies. The functions called by the 
DT core where the fwnode_handle needs to be const to make the containing 
device_node const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
Rob Herring (Arm) (7):
      PCI: Constify pci_register_io_range() fwnode_handle
      logic_pio: Constify fwnode_handle
      of: Constify struct device_node function arguments
      of: Constify struct property pointers
      of: Constify of_changeset_entry function arguments
      of: Constify safe_name() kobject arg
      of/address: Constify of_busses[] array and pointers

 drivers/of/address.c       | 22 +++++++++++-----------
 drivers/of/base.c          | 20 ++++++++++----------
 drivers/of/cpu.c           |  2 +-
 drivers/of/dynamic.c       |  4 ++--
 drivers/of/irq.c           |  4 ++--
 drivers/of/kobj.c          |  8 ++++----
 drivers/of/of_private.h    | 12 ++++++------
 drivers/of/overlay.c       | 19 ++++++++++---------
 drivers/of/property.c      | 10 +++++-----
 drivers/of/resolver.c      | 12 ++++++------
 drivers/pci/pci.c          |  2 +-
 include/linux/logic_pio.h  |  6 +++---
 include/linux/of.h         | 28 ++++++++++++++--------------
 include/linux/of_address.h |  6 +++---
 include/linux/of_irq.h     |  4 ++--
 include/linux/pci.h        |  2 +-
 lib/logic_pio.c            |  4 ++--
 17 files changed, 83 insertions(+), 82 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241010-dt-const-7ceef73df29c

Best regards,
-- 
Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-10 22:07   ` Bjorn Helgaas
  2024-10-11 14:58   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 2/7] logic_pio: Constify fwnode_handle Rob Herring (Arm)
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

pci_register_io_range() does not modify the passed in fwnode_handle, so
make it const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
Please ack and I'll take with the rest of the series.
---
 drivers/pci/pci.c   | 2 +-
 include/linux/pci.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7d85c04fbba2..4b102bd1cfea 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4163,7 +4163,7 @@ EXPORT_SYMBOL(pci_request_regions_exclusive);
  * Record the PCI IO range (expressed as CPU physical address + size).
  * Return a negative value if an error has occurred, zero otherwise
  */
-int pci_register_io_range(struct fwnode_handle *fwnode, phys_addr_t addr,
+int pci_register_io_range(const struct fwnode_handle *fwnode, phys_addr_t addr,
 			resource_size_t	size)
 {
 	int ret = 0;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 573b4c4c2be6..11421ae5c558 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1556,7 +1556,7 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
 			void *alignf_data);
 
 
-int pci_register_io_range(struct fwnode_handle *fwnode, phys_addr_t addr,
+int pci_register_io_range(const struct fwnode_handle *fwnode, phys_addr_t addr,
 			resource_size_t size);
 unsigned long pci_address_to_pio(phys_addr_t addr);
 phys_addr_t pci_pio_to_address(unsigned long pio);

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/7] logic_pio: Constify fwnode_handle
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
  2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 14:59   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 3/7] of: Constify struct device_node function arguments Rob Herring (Arm)
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

The fwnode_handle passed into find_io_range_by_fwnode() and
logic_pio_trans_hwaddr() are not modified, so make them const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
Please ack and I'll take with the rest of the series.
---
 include/linux/logic_pio.h | 6 +++---
 lib/logic_pio.c           | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/logic_pio.h b/include/linux/logic_pio.h
index babf4e3c28ba..8f1a9408302f 100644
--- a/include/linux/logic_pio.h
+++ b/include/linux/logic_pio.h
@@ -17,7 +17,7 @@ enum {
 
 struct logic_pio_hwaddr {
 	struct list_head list;
-	struct fwnode_handle *fwnode;
+	const struct fwnode_handle *fwnode;
 	resource_size_t hw_start;
 	resource_size_t io_start;
 	resource_size_t size; /* range size populated */
@@ -110,8 +110,8 @@ void logic_outsl(unsigned long addr, const void *buffer, unsigned int count);
 #endif /* CONFIG_INDIRECT_PIO */
 #define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE)
 
-struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode);
-unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode,
+struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwnode);
+unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode,
 			resource_size_t hw_addr, resource_size_t size);
 int logic_pio_register_range(struct logic_pio_hwaddr *newrange);
 void logic_pio_unregister_range(struct logic_pio_hwaddr *range);
diff --git a/lib/logic_pio.c b/lib/logic_pio.c
index 2ea564a40064..e29496a38d06 100644
--- a/lib/logic_pio.c
+++ b/lib/logic_pio.c
@@ -122,7 +122,7 @@ void logic_pio_unregister_range(struct logic_pio_hwaddr *range)
  *
  * Traverse the io_range_list to find the registered node for @fwnode.
  */
-struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode)
+struct logic_pio_hwaddr *find_io_range_by_fwnode(const struct fwnode_handle *fwnode)
 {
 	struct logic_pio_hwaddr *range, *found_range = NULL;
 
@@ -186,7 +186,7 @@ resource_size_t logic_pio_to_hwaddr(unsigned long pio)
  *
  * Returns Logical PIO value if successful, ~0UL otherwise
  */
-unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode,
+unsigned long logic_pio_trans_hwaddr(const struct fwnode_handle *fwnode,
 				     resource_size_t addr, resource_size_t size)
 {
 	struct logic_pio_hwaddr *range;

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/7] of: Constify struct device_node function arguments
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
  2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
  2024-10-10 16:27 ` [PATCH 2/7] logic_pio: Constify fwnode_handle Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 15:13   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 4/7] of: Constify struct property pointers Rob Herring (Arm)
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

Functions which don't change the refcount or otherwise modify struct
device_node can make struct device_node const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/of/address.c       | 10 +++++-----
 drivers/of/base.c          |  8 ++++----
 drivers/of/cpu.c           |  2 +-
 drivers/of/irq.c           |  4 ++--
 drivers/of/of_private.h    |  2 +-
 drivers/of/overlay.c       | 14 +++++++-------
 drivers/of/resolver.c      |  4 ++--
 include/linux/of.h         | 14 +++++++-------
 include/linux/of_address.h |  4 ++--
 include/linux/of_irq.h     |  4 ++--
 10 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 286f0c161e33..aa1a4e381461 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -147,7 +147,7 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
  * PCI bus specific translator
  */
 
-static bool of_node_is_pcie(struct device_node *np)
+static bool of_node_is_pcie(const struct device_node *np)
 {
 	bool is_pcie = of_node_name_eq(np, "pcie");
 
@@ -230,8 +230,8 @@ static int __of_address_resource_bounds(struct resource *r, u64 start, u64 size)
  * To guard against that we try to register the IO range first.
  * If that fails we know that pci_address_to_pio() will do too.
  */
-int of_pci_range_to_resource(struct of_pci_range *range,
-			     struct device_node *np, struct resource *res)
+int of_pci_range_to_resource(const struct of_pci_range *range,
+			     const struct device_node *np, struct resource *res)
 {
 	u64 start;
 	int err;
@@ -399,7 +399,7 @@ static struct of_bus *of_match_bus(struct device_node *np)
 	return NULL;
 }
 
-static int of_empty_ranges_quirk(struct device_node *np)
+static int of_empty_ranges_quirk(const struct device_node *np)
 {
 	if (IS_ENABLED(CONFIG_PPC)) {
 		/* To save cycles, we cache the result for global "Mac" setting */
@@ -1030,7 +1030,7 @@ EXPORT_SYMBOL_GPL(of_dma_is_coherent);
  * This is currently only enabled on builds that support Apple ARM devices, as
  * an optimization.
  */
-static bool of_mmio_is_nonposted(struct device_node *np)
+static bool of_mmio_is_nonposted(const struct device_node *np)
 {
 	if (!IS_ENABLED(CONFIG_ARCH_APPLE))
 		return false;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 20603d3c9931..d1aebb979522 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -771,7 +771,7 @@ struct device_node *of_get_child_by_name(const struct device_node *node,
 }
 EXPORT_SYMBOL(of_get_child_by_name);
 
-struct device_node *__of_find_node_by_path(struct device_node *parent,
+struct device_node *__of_find_node_by_path(const struct device_node *parent,
 						const char *path)
 {
 	struct device_node *child;
@@ -1840,7 +1840,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
  *
  * Return: The alias id if found.
  */
-int of_alias_get_id(struct device_node *np, const char *stem)
+int of_alias_get_id(const struct device_node *np, const char *stem)
 {
 	struct alias_prop *app;
 	int id = -ENODEV;
@@ -1898,7 +1898,7 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_id);
  *
  * Return: TRUE if console successfully setup. Otherwise return FALSE.
  */
-bool of_console_check(struct device_node *dn, char *name, int index)
+bool of_console_check(const struct device_node *dn, char *name, int index)
 {
 	if (!dn || dn != of_stdout || console_set_on_cmdline)
 		return false;
@@ -1986,7 +1986,7 @@ int of_find_last_cache_level(unsigned int cpu)
  *
  * Return: 0 on success or a standard error code on failure.
  */
-int of_map_id(struct device_node *np, u32 id,
+int of_map_id(const struct device_node *np, u32 id,
 	       const char *map_name, const char *map_mask_name,
 	       struct device_node **target, u32 *id_out)
 {
diff --git a/drivers/of/cpu.c b/drivers/of/cpu.c
index d17b2f851082..5214dc3d05ae 100644
--- a/drivers/of/cpu.c
+++ b/drivers/of/cpu.c
@@ -188,7 +188,7 @@ EXPORT_SYMBOL(of_cpu_node_to_id);
  * Return: An idle state node if found at @index. The refcount is incremented
  * for it, so call of_node_put() on it when done. Returns NULL if not found.
  */
-struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
+struct device_node *of_get_cpu_state_node(const struct device_node *cpu_node,
 					  int index)
 {
 	struct of_phandle_args args;
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index a494f56a0d0e..67fc0ceaa5f5 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -720,7 +720,7 @@ struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id,
  * Returns: the MSI domain for this device (or NULL on failure).
  */
 struct irq_domain *of_msi_get_domain(struct device *dev,
-				     struct device_node *np,
+				     const struct device_node *np,
 				     enum irq_domain_bus_token token)
 {
 	struct of_phandle_iterator it;
@@ -742,7 +742,7 @@ EXPORT_SYMBOL_GPL(of_msi_get_domain);
  * @dev: device structure to associate with an MSI irq domain
  * @np: device node for that device
  */
-void of_msi_configure(struct device *dev, struct device_node *np)
+void of_msi_configure(struct device *dev, const struct device_node *np)
 {
 	dev_set_msi_domain(dev,
 			   of_msi_get_domain(dev, np, DOMAIN_BUS_PLATFORM_MSI));
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 04aa2a91f851..d957cc6ce437 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -127,7 +127,7 @@ void __of_prop_free(struct property *prop);
 struct device_node *__of_node_dup(const struct device_node *np,
 				  const char *full_name);
 
-struct device_node *__of_find_node_by_path(struct device_node *parent,
+struct device_node *__of_find_node_by_path(const struct device_node *parent,
 						const char *path);
 struct device_node *__of_find_node_by_full_path(struct device_node *node,
 						const char *path);
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index cbdecccca097..19aaa96ee817 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -398,7 +398,7 @@ static int add_changeset_property(struct overlay_changeset *ovcs,
  * invalid @overlay.
  */
 static int add_changeset_node(struct overlay_changeset *ovcs,
-		struct target *target, struct device_node *node)
+		struct target *target, const struct device_node *node)
 {
 	const char *node_kbasename;
 	const __be32 *phandle;
@@ -675,8 +675,8 @@ static int build_changeset(struct overlay_changeset *ovcs)
  * 1) "target" property containing the phandle of the target
  * 2) "target-path" property containing the path of the target
  */
-static struct device_node *find_target(struct device_node *info_node,
-				       struct device_node *target_base)
+static struct device_node *find_target(const struct device_node *info_node,
+				       const struct device_node *target_base)
 {
 	struct device_node *node;
 	char *target_path;
@@ -735,7 +735,7 @@ static struct device_node *find_target(struct device_node *info_node,
  * init_overlay_changeset() must call free_overlay_changeset().
  */
 static int init_overlay_changeset(struct overlay_changeset *ovcs,
-				  struct device_node *target_base)
+				  const struct device_node *target_base)
 {
 	struct device_node *node, *overlay_node;
 	struct fragment *fragment;
@@ -910,7 +910,7 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs)
  */
 
 static int of_overlay_apply(struct overlay_changeset *ovcs,
-			    struct device_node *base)
+			    const struct device_node *base)
 {
 	int ret = 0, ret_revert, ret_tmp;
 
@@ -978,7 +978,7 @@ static int of_overlay_apply(struct overlay_changeset *ovcs,
  */
 
 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
-			 int *ret_ovcs_id, struct device_node *base)
+			 int *ret_ovcs_id, const struct device_node *base)
 {
 	void *new_fdt;
 	void *new_fdt_align;
@@ -1074,7 +1074,7 @@ EXPORT_SYMBOL_GPL(of_overlay_fdt_apply);
  *
  * Returns 1 if @np is @tree or is contained in @tree, else 0
  */
-static int find_node(struct device_node *tree, struct device_node *np)
+static int find_node(const struct device_node *tree, struct device_node *np)
 {
 	if (tree == np)
 		return 1;
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 5cf96776dd7d..ee7769525bb2 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -147,8 +147,8 @@ static int node_name_cmp(const struct device_node *dn1,
  * of offsets of the phandle reference(s) within the respective property
  * value(s).  The values at these offsets will be fixed up.
  */
-static int adjust_local_phandle_references(struct device_node *local_fixups,
-		struct device_node *overlay, int phandle_delta)
+static int adjust_local_phandle_references(const struct device_node *local_fixups,
+		const struct device_node *overlay, int phandle_delta)
 {
 	struct device_node *overlay_child;
 	struct property *prop_fix, *prop;
diff --git a/include/linux/of.h b/include/linux/of.h
index 85b60ac9eec5..7875b308f13c 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -357,7 +357,7 @@ extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
 extern struct device_node *of_cpu_device_node_get(int cpu);
 extern int of_cpu_node_to_id(struct device_node *np);
 extern struct device_node *of_get_next_cpu_node(struct device_node *prev);
-extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node,
+extern struct device_node *of_get_cpu_state_node(const struct device_node *cpu_node,
 						 int index);
 extern u64 of_get_cpu_hwid(struct device_node *cpun, unsigned int thread);
 
@@ -395,7 +395,7 @@ extern int of_phandle_iterator_args(struct of_phandle_iterator *it,
 				    int size);
 
 extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
-extern int of_alias_get_id(struct device_node *np, const char *stem);
+extern int of_alias_get_id(const struct device_node *np, const char *stem);
 extern int of_alias_get_highest_id(const char *stem);
 
 bool of_machine_compatible_match(const char *const *compats);
@@ -446,9 +446,9 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
  */
 const char *of_prop_next_string(struct property *prop, const char *cur);
 
-bool of_console_check(struct device_node *dn, char *name, int index);
+bool of_console_check(const struct device_node *dn, char *name, int index);
 
-int of_map_id(struct device_node *np, u32 id,
+int of_map_id(const struct device_node *np, u32 id,
 	       const char *map_name, const char *map_mask_name,
 	       struct device_node **target, u32 *id_out);
 
@@ -871,7 +871,7 @@ static inline void of_property_clear_flag(struct property *p, unsigned long flag
 {
 }
 
-static inline int of_map_id(struct device_node *np, u32 id,
+static inline int of_map_id(const struct device_node *np, u32 id,
 			     const char *map_name, const char *map_mask_name,
 			     struct device_node **target, u32 *id_out)
 {
@@ -1734,7 +1734,7 @@ struct of_overlay_notify_data {
 #ifdef CONFIG_OF_OVERLAY
 
 int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
-			 int *ovcs_id, struct device_node *target_base);
+			 int *ovcs_id, const struct device_node *target_base);
 int of_overlay_remove(int *ovcs_id);
 int of_overlay_remove_all(void);
 
@@ -1744,7 +1744,7 @@ int of_overlay_notifier_unregister(struct notifier_block *nb);
 #else
 
 static inline int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
-				       int *ovcs_id, struct device_node *target_base)
+				       int *ovcs_id, const struct device_node *target_base)
 {
 	return -ENOTSUPP;
 }
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 26a19daf0d09..bd46dbcc6e88 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -83,8 +83,8 @@ extern struct of_pci_range *of_pci_range_parser_one(
 					struct of_pci_range *range);
 extern int of_pci_address_to_resource(struct device_node *dev, int bar,
 				      struct resource *r);
-extern int of_pci_range_to_resource(struct of_pci_range *range,
-				    struct device_node *np,
+extern int of_pci_range_to_resource(const struct of_pci_range *range,
+				    const struct device_node *np,
 				    struct resource *res);
 extern int of_range_to_resource(struct device_node *np, int index,
 				struct resource *res);
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d6d3eae2f145..6337ad4e5fe8 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -48,12 +48,12 @@ extern int of_irq_to_resource_table(struct device_node *dev,
 		struct resource *res, int nr_irqs);
 extern struct device_node *of_irq_find_parent(struct device_node *child);
 extern struct irq_domain *of_msi_get_domain(struct device *dev,
-					    struct device_node *np,
+					    const struct device_node *np,
 					    enum irq_domain_bus_token token);
 extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
 							u32 id,
 							u32 bus_token);
-extern void of_msi_configure(struct device *dev, struct device_node *np);
+extern void of_msi_configure(struct device *dev, const struct device_node *np);
 u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in);
 #else
 static inline void of_irq_init(const struct of_device_id *matches)

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/7] of: Constify struct property pointers
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
                   ` (2 preceding siblings ...)
  2024-10-10 16:27 ` [PATCH 3/7] of: Constify struct device_node function arguments Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 15:17   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 5/7] of: Constify of_changeset_entry function arguments Rob Herring (Arm)
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

Most accesses to struct property do not modify it, so constify struct
property pointers where ever possible in the DT core code.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/of/base.c       | 12 ++++++------
 drivers/of/kobj.c       |  6 +++---
 drivers/of/of_private.h | 10 +++++-----
 drivers/of/overlay.c    |  5 +++--
 drivers/of/property.c   | 10 +++++-----
 drivers/of/resolver.c   |  8 ++++----
 include/linux/of.h      | 14 +++++++-------
 7 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index d1aebb979522..d94efee4a7fc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -270,7 +270,7 @@ EXPORT_SYMBOL(of_find_all_nodes);
 const void *__of_get_property(const struct device_node *np,
 			      const char *name, int *lenp)
 {
-	struct property *pp = __of_find_property(np, name, lenp);
+	const struct property *pp = __of_find_property(np, name, lenp);
 
 	return pp ? pp->value : NULL;
 }
@@ -282,7 +282,7 @@ const void *__of_get_property(const struct device_node *np,
 const void *of_get_property(const struct device_node *np, const char *name,
 			    int *lenp)
 {
-	struct property *pp = of_find_property(np, name, lenp);
+	const struct property *pp = of_find_property(np, name, lenp);
 
 	return pp ? pp->value : NULL;
 }
@@ -321,7 +321,7 @@ EXPORT_SYMBOL(of_get_property);
 static int __of_device_is_compatible(const struct device_node *device,
 				     const char *compat, const char *type, const char *name)
 {
-	struct property *prop;
+	const struct property *prop;
 	const char *cp;
 	int index = 0, score = 0;
 
@@ -828,7 +828,7 @@ struct device_node *__of_find_node_by_full_path(struct device_node *node,
 struct device_node *of_find_node_opts_by_path(const char *path, const char **opts)
 {
 	struct device_node *np = NULL;
-	struct property *pp;
+	const struct property *pp;
 	unsigned long flags;
 	const char *separator = strchr(path, ':');
 
@@ -974,7 +974,7 @@ struct device_node *of_find_node_with_property(struct device_node *from,
 	const char *prop_name)
 {
 	struct device_node *np;
-	struct property *pp;
+	const struct property *pp;
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&devtree_lock, flags);
@@ -1769,7 +1769,7 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np,
  */
 void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
 {
-	struct property *pp;
+	const struct property *pp;
 
 	of_aliases = of_find_node_by_path("/aliases");
 	of_chosen = of_find_node_by_path("/chosen");
diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index 3dbce1e6f184..aeb1709d4e85 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -84,7 +84,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
 	return rc;
 }
 
-void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop)
+void __of_sysfs_remove_bin_file(struct device_node *np, const struct property *prop)
 {
 	if (!IS_ENABLED(CONFIG_SYSFS))
 		return;
@@ -93,7 +93,7 @@ void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop)
 	kfree(prop->attr.attr.name);
 }
 
-void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
+void __of_remove_property_sysfs(struct device_node *np, const struct property *prop)
 {
 	/* at early boot, bail here and defer setup to of_init() */
 	if (of_kset && of_node_is_attached(np))
@@ -101,7 +101,7 @@ void __of_remove_property_sysfs(struct device_node *np, struct property *prop)
 }
 
 void __of_update_property_sysfs(struct device_node *np, struct property *newprop,
-		struct property *oldprop)
+		const struct property *oldprop)
 {
 	/* At early boot, bail out and defer setup to of_init() */
 	if (!of_kset)
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index d957cc6ce437..53a4a5be9997 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -69,9 +69,9 @@ static inline void of_platform_register_reconfig_notifier(void) { }
 #if defined(CONFIG_OF_KOBJ)
 int of_node_is_attached(const struct device_node *node);
 int __of_add_property_sysfs(struct device_node *np, struct property *pp);
-void __of_remove_property_sysfs(struct device_node *np, struct property *prop);
+void __of_remove_property_sysfs(struct device_node *np, const struct property *prop);
 void __of_update_property_sysfs(struct device_node *np, struct property *newprop,
-		struct property *oldprop);
+		const struct property *oldprop);
 int __of_attach_node_sysfs(struct device_node *np);
 void __of_detach_node_sysfs(struct device_node *np);
 #else
@@ -79,9 +79,9 @@ static inline int __of_add_property_sysfs(struct device_node *np, struct propert
 {
 	return 0;
 }
-static inline void __of_remove_property_sysfs(struct device_node *np, struct property *prop) {}
+static inline void __of_remove_property_sysfs(struct device_node *np, const struct property *prop) {}
 static inline void __of_update_property_sysfs(struct device_node *np,
-		struct property *newprop, struct property *oldprop) {}
+		struct property *newprop, const struct property *oldprop) {}
 static inline int __of_attach_node_sysfs(struct device_node *np)
 {
 	return 0;
@@ -142,7 +142,7 @@ extern int __of_update_property(struct device_node *np,
 extern void __of_detach_node(struct device_node *np);
 
 extern void __of_sysfs_remove_bin_file(struct device_node *np,
-				       struct property *prop);
+				       const struct property *prop);
 
 /* illegal phandle value (set when unresolved) */
 #define OF_PHANDLE_ILLEGAL	0xdeadbeef
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 19aaa96ee817..434f6dd6a86c 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -296,10 +296,11 @@ static struct property *dup_and_fixup_symbol_prop(
  * invalid @overlay.
  */
 static int add_changeset_property(struct overlay_changeset *ovcs,
-		struct target *target, struct property *overlay_prop,
+		struct target *target, const struct property *overlay_prop,
 		bool is_symbols_prop)
 {
-	struct property *new_prop = NULL, *prop;
+	struct property *new_prop = NULL;
+	const struct property *prop;
 	int ret = 0;
 
 	if (target->in_livetree)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 11b922fde7af..33dd72cad4ab 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(of_graph_is_present);
 int of_property_count_elems_of_size(const struct device_node *np,
 				const char *propname, int elem_size)
 {
-	struct property *prop = of_find_property(np, propname, NULL);
+	const struct property *prop = of_find_property(np, propname, NULL);
 
 	if (!prop)
 		return -EINVAL;
@@ -104,7 +104,7 @@ EXPORT_SYMBOL_GPL(of_property_count_elems_of_size);
 static void *of_find_property_value_of_size(const struct device_node *np,
 			const char *propname, u32 min, u32 max, size_t *len)
 {
-	struct property *prop = of_find_property(np, propname, NULL);
+	const struct property *prop = of_find_property(np, propname, NULL);
 
 	if (!prop)
 		return ERR_PTR(-EINVAL);
@@ -530,7 +530,7 @@ int of_property_read_string_helper(const struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(of_property_read_string_helper);
 
-const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
+const __be32 *of_prop_next_u32(const struct property *prop, const __be32 *cur,
 			       u32 *pu)
 {
 	const void *curv = cur;
@@ -553,7 +553,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
 }
 EXPORT_SYMBOL_GPL(of_prop_next_u32);
 
-const char *of_prop_next_string(struct property *prop, const char *cur)
+const char *of_prop_next_string(const struct property *prop, const char *cur)
 {
 	const void *curv = cur;
 
@@ -1466,7 +1466,7 @@ static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
 
 static int of_fwnode_add_links(struct fwnode_handle *fwnode)
 {
-	struct property *p;
+	const struct property *p;
 	struct device_node *con_np = to_of_node(fwnode);
 
 	if (IS_ENABLED(CONFIG_X86))
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index ee7769525bb2..779db058c42f 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -42,7 +42,7 @@ static void adjust_overlay_phandles(struct device_node *overlay,
 		int phandle_delta)
 {
 	struct device_node *child;
-	struct property *prop;
+	const struct property *prop;
 	phandle phandle;
 
 	/* adjust node's phandle in node */
@@ -71,10 +71,10 @@ static void adjust_overlay_phandles(struct device_node *overlay,
 }
 
 static int update_usages_of_a_phandle_reference(struct device_node *overlay,
-		struct property *prop_fixup, phandle phandle)
+		const struct property *prop_fixup, phandle phandle)
 {
 	struct device_node *refnode;
-	struct property *prop;
+	const struct property *prop;
 	char *value __free(kfree) = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
 	char *cur, *end, *node_path, *prop_name, *s;
 	int offset, len;
@@ -151,7 +151,7 @@ static int adjust_local_phandle_references(const struct device_node *local_fixup
 		const struct device_node *overlay, int phandle_delta)
 {
 	struct device_node *overlay_child;
-	struct property *prop_fix, *prop;
+	const struct property *prop_fix, *prop;
 	int err, i, count;
 	unsigned int off;
 
diff --git a/include/linux/of.h b/include/linux/of.h
index 7875b308f13c..086a60f3b8a6 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -435,7 +435,7 @@ extern int of_detach_node(struct device_node *);
  * of_property_for_each_u32(np, "propname", u)
  *         printk("U32 value: %x\n", u);
  */
-const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
+const __be32 *of_prop_next_u32(const struct property *prop, const __be32 *cur,
 			       u32 *pu);
 /*
  * struct property *prop;
@@ -444,7 +444,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
  * of_property_for_each_string(np, "propname", prop, s)
  *         printk("String value: %s\n", s);
  */
-const char *of_prop_next_string(struct property *prop, const char *cur);
+const char *of_prop_next_string(const struct property *prop, const char *cur);
 
 bool of_console_check(const struct device_node *dn, char *name, int index);
 
@@ -826,13 +826,13 @@ static inline bool of_console_check(const struct device_node *dn, const char *na
 	return false;
 }
 
-static inline const __be32 *of_prop_next_u32(struct property *prop,
+static inline const __be32 *of_prop_next_u32(const struct property *prop,
 		const __be32 *cur, u32 *pu)
 {
 	return NULL;
 }
 
-static inline const char *of_prop_next_string(struct property *prop,
+static inline const char *of_prop_next_string(const struct property *prop,
 		const char *cur)
 {
 	return NULL;
@@ -899,7 +899,7 @@ static inline const void *of_device_get_match_data(const struct device *dev)
 #define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
 #endif
 
-static inline int of_prop_val_eq(struct property *p1, struct property *p2)
+static inline int of_prop_val_eq(const struct property *p1, const struct property *p2)
 {
 	return p1->length == p2->length &&
 	       !memcmp(p1->value, p2->value, (size_t)p1->length);
@@ -1252,7 +1252,7 @@ static inline int of_property_read_string_index(const struct device_node *np,
 static inline bool of_property_read_bool(const struct device_node *np,
 					 const char *propname)
 {
-	struct property *prop = of_find_property(np, propname, NULL);
+	const struct property *prop = of_find_property(np, propname, NULL);
 
 	return prop ? true : false;
 }
@@ -1430,7 +1430,7 @@ static inline int of_property_read_s32(const struct device_node *np,
 	     err = of_phandle_iterator_next(it))
 
 #define of_property_for_each_u32(np, propname, u)			\
-	for (struct {struct property *prop; const __be32 *item; } _it =	\
+	for (struct {const struct property *prop; const __be32 *item; } _it =	\
 		{of_find_property(np, propname, NULL),			\
 		 of_prop_next_u32(_it.prop, NULL, &u)};			\
 	     _it.item;							\

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/7] of: Constify of_changeset_entry function arguments
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
                   ` (3 preceding siblings ...)
  2024-10-10 16:27 ` [PATCH 4/7] of: Constify struct property pointers Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 15:18   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 6/7] of: Constify safe_name() kobject arg Rob Herring (Arm)
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

__of_changeset_entry_invert() and __of_changeset_entry_revert() don't
modify struct of_changeset_entry arguments, so they can be const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/of/dynamic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 110104a936d9..d45a8df61380 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -536,7 +536,7 @@ static void __of_changeset_entry_destroy(struct of_changeset_entry *ce)
 	kfree(ce);
 }
 
-static void __of_changeset_entry_invert(struct of_changeset_entry *ce,
+static void __of_changeset_entry_invert(const struct of_changeset_entry *ce,
 					  struct of_changeset_entry *rce)
 {
 	memcpy(rce, ce, sizeof(*rce));
@@ -636,7 +636,7 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
 	return 0;
 }
 
-static inline int __of_changeset_entry_revert(struct of_changeset_entry *ce)
+static inline int __of_changeset_entry_revert(const struct of_changeset_entry *ce)
 {
 	struct of_changeset_entry ce_inverted;
 

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/7] of: Constify safe_name() kobject arg
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
                   ` (4 preceding siblings ...)
  2024-10-10 16:27 ` [PATCH 5/7] of: Constify of_changeset_entry function arguments Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 15:18   ` Krzysztof Kozlowski
  2024-10-10 16:27 ` [PATCH 7/7] of/address: Constify of_busses[] array and pointers Rob Herring (Arm)
  2024-10-11 15:20 ` [PATCH 0/7] of: Constify DT structs Krzysztof Kozlowski
  7 siblings, 1 reply; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

The kobject is not modified by safe_name() function, so make it const.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/of/kobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index aeb1709d4e85..cab9b169dc67 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -37,7 +37,7 @@ static ssize_t of_node_property_read(struct file *filp, struct kobject *kobj,
 }
 
 /* always return newly allocated name, caller must free after use */
-static const char *safe_name(struct kobject *kobj, const char *orig_name)
+static const char *safe_name(const struct kobject *kobj, const char *orig_name)
 {
 	const char *name = orig_name;
 	struct kernfs_node *kn;

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/7] of/address: Constify of_busses[] array and pointers
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
                   ` (5 preceding siblings ...)
  2024-10-10 16:27 ` [PATCH 6/7] of: Constify safe_name() kobject arg Rob Herring (Arm)
@ 2024-10-10 16:27 ` Rob Herring (Arm)
  2024-10-11 15:20 ` [PATCH 0/7] of: Constify DT structs Krzysztof Kozlowski
  7 siblings, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 16:27 UTC (permalink / raw)
  To: Bjorn Helgaas, Andrew Morton, Saravana Kannan
  Cc: linux-pci, linux-kernel, devicetree

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 --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;

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle
  2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
@ 2024-10-10 22:07   ` Bjorn Helgaas
  2024-10-11 14:58   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2024-10-10 22:07 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:14AM -0500, Rob Herring (Arm) wrote:
> pci_register_io_range() does not modify the passed in fwnode_handle, so
> make it const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
> Please ack and I'll take with the rest of the series.

Thank you!

> ---
>  drivers/pci/pci.c   | 2 +-
>  include/linux/pci.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7d85c04fbba2..4b102bd1cfea 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4163,7 +4163,7 @@ EXPORT_SYMBOL(pci_request_regions_exclusive);
>   * Record the PCI IO range (expressed as CPU physical address + size).
>   * Return a negative value if an error has occurred, zero otherwise
>   */
> -int pci_register_io_range(struct fwnode_handle *fwnode, phys_addr_t addr,
> +int pci_register_io_range(const struct fwnode_handle *fwnode, phys_addr_t addr,
>  			resource_size_t	size)
>  {
>  	int ret = 0;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 573b4c4c2be6..11421ae5c558 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1556,7 +1556,7 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
>  			void *alignf_data);
>  
>  
> -int pci_register_io_range(struct fwnode_handle *fwnode, phys_addr_t addr,
> +int pci_register_io_range(const struct fwnode_handle *fwnode, phys_addr_t addr,
>  			resource_size_t size);
>  unsigned long pci_address_to_pio(phys_addr_t addr);
>  phys_addr_t pci_pio_to_address(unsigned long pio);
> 
> -- 
> 2.45.2
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle
  2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
  2024-10-10 22:07   ` Bjorn Helgaas
@ 2024-10-11 14:58   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 14:58 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:14AM -0500, Rob Herring (Arm) wrote:
> pci_register_io_range() does not modify the passed in fwnode_handle, so
> make it const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
> Please ack and I'll take with the rest of the series.
> ---
>  drivers/pci/pci.c   | 2 +-
>  include/linux/pci.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7d85c04fbba2..4b102bd1cfea 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4163,7 +4163,7 @@ EXPORT_SYMBOL(pci_request_regions_exclusive);
>   * Record the PCI IO range (expressed as CPU physical address + size).
>   * Return a negative value if an error has occurred, zero otherwise
>   */
> -int pci_register_io_range(struct fwnode_handle *fwnode, phys_addr_t addr,
> +int pci_register_io_range(const struct fwnode_handle *fwnode, phys_addr_t addr,
>  			resource_size_t	size)

Either I look at wrong tree (next) or something is missing and this is
not bisectable. The fwnode is assigned to range->fwnode which is not
const.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/7] logic_pio: Constify fwnode_handle
  2024-10-10 16:27 ` [PATCH 2/7] logic_pio: Constify fwnode_handle Rob Herring (Arm)
@ 2024-10-11 14:59   ` Krzysztof Kozlowski
  2024-10-11 15:08     ` Rob Herring
  0 siblings, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 14:59 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:15AM -0500, Rob Herring (Arm) wrote:
> The fwnode_handle passed into find_io_range_by_fwnode() and
> logic_pio_trans_hwaddr() are not modified, so make them const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
> Please ack and I'll take with the rest of the series.

Now I see. This one should be before #1.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/7] logic_pio: Constify fwnode_handle
  2024-10-11 14:59   ` Krzysztof Kozlowski
@ 2024-10-11 15:08     ` Rob Herring
  0 siblings, 0 replies; 17+ messages in thread
From: Rob Herring @ 2024-10-11 15:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Fri, Oct 11, 2024 at 9:59 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Thu, Oct 10, 2024 at 11:27:15AM -0500, Rob Herring (Arm) wrote:
> > The fwnode_handle passed into find_io_range_by_fwnode() and
> > logic_pio_trans_hwaddr() are not modified, so make them const.
> >
> > Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> > ---
> > Please ack and I'll take with the rest of the series.
>
> Now I see. This one should be before #1.

Yes, you are right. Will swap 1 and 2 when applying.

Rob

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] of: Constify struct device_node function arguments
  2024-10-10 16:27 ` [PATCH 3/7] of: Constify struct device_node function arguments Rob Herring (Arm)
@ 2024-10-11 15:13   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 15:13 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:16AM -0500, Rob Herring (Arm) wrote:
> Functions which don't change the refcount or otherwise modify struct
> device_node can make struct device_node const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/7] of: Constify struct property pointers
  2024-10-10 16:27 ` [PATCH 4/7] of: Constify struct property pointers Rob Herring (Arm)
@ 2024-10-11 15:17   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 15:17 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:17AM -0500, Rob Herring (Arm) wrote:
> Most accesses to struct property do not modify it, so constify struct
> property pointers where ever possible in the DT core code.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/7] of: Constify of_changeset_entry function arguments
  2024-10-10 16:27 ` [PATCH 5/7] of: Constify of_changeset_entry function arguments Rob Herring (Arm)
@ 2024-10-11 15:18   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 15:18 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:18AM -0500, Rob Herring (Arm) wrote:
> __of_changeset_entry_invert() and __of_changeset_entry_revert() don't
> modify struct of_changeset_entry arguments, so they can be const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/of/dynamic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/7] of: Constify safe_name() kobject arg
  2024-10-10 16:27 ` [PATCH 6/7] of: Constify safe_name() kobject arg Rob Herring (Arm)
@ 2024-10-11 15:18   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 15:18 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:19AM -0500, Rob Herring (Arm) wrote:
> The kobject is not modified by safe_name() function, so make it const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/of/kobj.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/7] of: Constify DT structs
  2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
                   ` (6 preceding siblings ...)
  2024-10-10 16:27 ` [PATCH 7/7] of/address: Constify of_busses[] array and pointers Rob Herring (Arm)
@ 2024-10-11 15:20 ` Krzysztof Kozlowski
  7 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-11 15:20 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Bjorn Helgaas, Andrew Morton, Saravana Kannan, linux-pci,
	linux-kernel, devicetree

On Thu, Oct 10, 2024 at 11:27:13AM -0500, Rob Herring (Arm) wrote:
> This series constifies many usages of DT structs in the DT core code. 
> Many uses of struct device_node where the node refcount is not 
> changed can be const. Most uses of struct property can also be const.
> 
> The first 2 patches are dependencies. The functions called by the 
> DT core where the fwnode_handle needs to be const to make the containing 
> device_node const.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---

I gave reviewes for individual patches, but all look correct except
order between #1 and #2.

Therefore with the order fixed:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-10-11 15:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 16:27 [PATCH 0/7] of: Constify DT structs Rob Herring (Arm)
2024-10-10 16:27 ` [PATCH 1/7] PCI: Constify pci_register_io_range() fwnode_handle Rob Herring (Arm)
2024-10-10 22:07   ` Bjorn Helgaas
2024-10-11 14:58   ` Krzysztof Kozlowski
2024-10-10 16:27 ` [PATCH 2/7] logic_pio: Constify fwnode_handle Rob Herring (Arm)
2024-10-11 14:59   ` Krzysztof Kozlowski
2024-10-11 15:08     ` Rob Herring
2024-10-10 16:27 ` [PATCH 3/7] of: Constify struct device_node function arguments Rob Herring (Arm)
2024-10-11 15:13   ` Krzysztof Kozlowski
2024-10-10 16:27 ` [PATCH 4/7] of: Constify struct property pointers Rob Herring (Arm)
2024-10-11 15:17   ` Krzysztof Kozlowski
2024-10-10 16:27 ` [PATCH 5/7] of: Constify of_changeset_entry function arguments Rob Herring (Arm)
2024-10-11 15:18   ` Krzysztof Kozlowski
2024-10-10 16:27 ` [PATCH 6/7] of: Constify safe_name() kobject arg Rob Herring (Arm)
2024-10-11 15:18   ` Krzysztof Kozlowski
2024-10-10 16:27 ` [PATCH 7/7] of/address: Constify of_busses[] array and pointers Rob Herring (Arm)
2024-10-11 15:20 ` [PATCH 0/7] of: Constify DT structs Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).