mbox series

[0/7] of: Constify DT structs

Message ID 20241010-dt-const-v1-0-87a51f558425@kernel.org
Headers show
Series of: Constify DT structs | expand

Message

Rob Herring Oct. 10, 2024, 4:27 p.m. UTC
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,

Comments

Krzysztof Kozlowski Oct. 11, 2024, 2:58 p.m. UTC | #1
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
Krzysztof Kozlowski Oct. 11, 2024, 2:59 p.m. UTC | #2
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
Rob Herring Oct. 11, 2024, 3:08 p.m. UTC | #3
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
Krzysztof Kozlowski Oct. 11, 2024, 3:20 p.m. UTC | #4
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