Re: [PATCH 22/26] dm: core: Access device ofnode through functions
Hi Patrick, On Mon, 4 Jan 2021 at 06:02, Patrick DELAUNAY 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 > > --- > > > > 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_(dev->node,...) modified to > ofnode_(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
Re: [PATCH 22/26] dm: core: Access device ofnode through functions
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 --- 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_(dev->node,...) modified to ofnode_(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. diff --git a/arch/arm/mach-stm32mp/pwr_regulator.c b/arch/arm/mach-stm32mp/pwr_regulator.c index af6ea439646..766ed95f1a6 100644 --- a/arch/arm/mach-stm32mp/pwr_regulator.c +++ b/arch/arm/mach-stm32mp/pwr_regulator.c @@ -81,7 +81,7 @@ static int stm32mp_pwr_bind(struct udevice *dev) { int children; - children = pmic_bind_children(dev, dev->node, pwr_children_info); + children = pmic_bind_children(dev, dev_ofnode(dev), pwr_children_info); if (!children) dev_dbg(dev, "no child found\n"); diff --git a/board/synopsys/hsdk/clk-lib.c b/board/synopsys/hsdk/clk-lib.c index 1c74bfb93a3..bd43179fc79 100644 --- a/board/synopsys/hsdk/clk-lib.c +++ b/board/synopsys/hsdk/clk-lib.c @@ -23,8 +23,8 @@ int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl) /* Dummy fmeas device, just to be able to use standard clk_* api */ struct udevice fmeas = { .name = "clk-fmeas", - .node = ofnode_path("/clk-fmeas"), }; + dev_set_ofnode(, ofnode_path("/clk-fmeas")); ret = clk_get_by_name(, name, ); if (ret) { diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c index cd28e0cae37..46b7677783f 100644 --- a/drivers/ata/mtk_ahci.c +++ b/drivers/ata/mtk_ahci.c @@ -68,7 +68,8 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv, SYS_CFG_SATA_MSK,
Re: [PATCH 22/26] dm: core: Access device ofnode through functions
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 --- 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(-) Applied to u-boot-dm/next, thanks!