[PATCH 22/26] dm: core: Access device ofnode through functions

Simon Glass sjg at chromium.org
Thu Jan 7 13:36:14 CET 2021


Hi Patrick,

On Mon, 4 Jan 2021 at 06:02, Patrick DELAUNAY
<patrick.delaunay at foss.st.com> wrote:
>
> Hi Simon,
>
>
> On 12/19/20 6:40 PM, Simon Glass wrote:
> > At present ofnode is present in the device even if it is never used. With
> > of-platdata this field is not used, so can be removed. In preparation for
> > this, change the access to go through inline functions.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >   arch/arm/mach-stm32mp/pwr_regulator.c     |  2 +-
> >   board/synopsys/hsdk/clk-lib.c             |  2 +-
> >   drivers/ata/mtk_ahci.c                    |  3 ++-
> >   drivers/clk/meson/axg.c                   |  2 +-
> >   drivers/clk/meson/g12a.c                  |  2 +-
> >   drivers/clk/meson/gxbb.c                  |  2 +-
> >   drivers/core/device.c                     |  2 +-
> >   drivers/core/root.c                       |  2 +-
> >   drivers/gpio/mpc8xxx_gpio.c               |  4 ++--
> >   drivers/gpio/octeon_gpio.c                |  2 +-
> >   drivers/misc/swap_case.c                  |  2 +-
> >   drivers/mmc/octeontx_hsmmc.c              | 23 +++++++++++++----------
> >   drivers/mtd/nand/raw/octeontx_nand.c      |  2 +-
> >   drivers/mtd/nand/spi/core.c               |  2 +-
> >   drivers/net/fm/eth.c                      |  4 ++--
> >   drivers/net/fsl_enetc.c                   |  8 ++++----
> >   drivers/net/fsl_enetc_mdio.c              |  2 +-
> >   drivers/net/mdio-ipq4019.c                |  4 ++--
> >   drivers/net/mdio_mux_i2creg.c             |  2 +-
> >   drivers/net/mvmdio.c                      |  4 ++--
> >   drivers/net/octeontx/smi.c                |  2 +-
> >   drivers/net/tsec.c                        |  3 ++-
> >   drivers/phy/phy-ti-am654.c                |  2 +-
> >   drivers/power/domain/meson-ee-pwrc.c      |  4 ++--
> >   drivers/power/domain/meson-gx-pwrc-vpu.c  |  4 ++--
> >   drivers/power/regulator/pbias_regulator.c |  3 ++-
> >   drivers/pwm/pwm-meson.c                   |  9 ++++++---
> >   drivers/reset/reset-socfpga.c             |  2 +-
> >   drivers/spi/fsl_dspi.c                    |  6 ++++--
> >   drivers/tee/optee/core.c                  |  2 +-
> >   drivers/usb/cdns3/core.c                  |  4 ++--
> >   drivers/usb/dwc3/core.c                   |  2 +-
> >   drivers/usb/dwc3/dwc3-generic.c           |  6 +++---
> >   drivers/usb/dwc3/dwc3-meson-g12a.c        |  2 +-
> >   drivers/usb/dwc3/dwc3-meson-gxl.c         |  2 +-
> >   drivers/usb/gadget/dwc2_udc_otg.c         |  4 ++--
> >   drivers/usb/host/dwc3-octeon-glue.c       |  2 +-
> >   drivers/usb/host/dwc3-sti-glue.c          |  5 +++--
> >   drivers/usb/host/ehci-mx6.c               |  2 +-
> >   drivers/usb/host/xhci-dwc3.c              |  2 +-
> >   drivers/usb/mtu3/mtu3_core.c              |  2 +-
> >   drivers/usb/mtu3/mtu3_plat.c              |  4 ++--
> >   drivers/usb/musb-new/ti-musb.c            |  2 +-
> >   drivers/video/nexell_display.c            |  2 +-
> >   drivers/video/rockchip/rk_mipi.c          |  2 +-
> >   include/dm/device.h                       | 23 +++++++++++++++++++++--
> >   include/dm/read.h                         |  2 +-
> >   include/linux/mtd/mtd.h                   |  4 ++--
> >   net/mdio-mux-uclass.c                     |  2 +-
> >   net/mdio-uclass.c                         |  8 ++++----
> >   50 files changed, 113 insertions(+), 82 deletions(-)
>
> in all the modified drivers,
> for the functions ofnode_XXXX(dev->node,...) modified to ofnode_XXXX(dev_ofnode(dev),
> they can also modified to dev_XXX function :
>
> ofnode_read_u32(dev_ofnode(dev), ...) => dev_read_u32(dev,....)
> ofnode_read_string(dev_ofnode(dev), ...) => dev_read_string(dev,....)
> ofnode_valid(dev_ofnode(dev)) => dev_has_ofnode(dev)
>
> but you prefer perhaps minizes the modifications in this patchset and if
> it is the case :
>
> Reviewed-by: Patrick Delaunay
>
>
> You can found some other examples below.

Thanks for that.

I wonder if we can press coccinelle into service here. I think the
dev_read() API came later so people didn't know about it?

Regards,
Simon


More information about the U-Boot mailing list