Re: [PATCH 1/3] net: stmmac: use fwnode instead of of to configure driver
From: Andrew Lunn
Date: Mon Oct 10 2022 - 16:39:11 EST
> - axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en");
> - axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm");
> - axi->axi_kbbe = of_property_read_bool(np, "snps,axi_kbbe");
> - axi->axi_fb = of_property_read_bool(np, "snps,axi_fb");
> - axi->axi_mb = of_property_read_bool(np, "snps,axi_mb");
> - axi->axi_rb = of_property_read_bool(np, "snps,axi_rb");
> + axi->axi_lpi_en = fwnode_property_read_bool(fwnode, "snps,lpi_en");
> + axi->axi_xit_frm = fwnode_property_read_bool(fwnode, "snps,xit_frm");
> + axi->axi_kbbe = fwnode_property_read_bool(fwnode, "snps,axi_kbbe");
> + axi->axi_fb = fwnode_property_read_bool(fwnode, "snps,axi_fb");
> + axi->axi_mb = fwnode_property_read_bool(fwnode, "snps,axi_mb");
> + axi->axi_rb = fwnode_property_read_bool(fwnode, "snps,axi_rb");
>
> - if (of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt))
> + if (fwnode_property_read_u32(fwnode, "snps,wr_osr_lmt",
> + &axi->axi_wr_osr_lmt))
> axi->axi_wr_osr_lmt = 1;
> - if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt))
> + if (fwnode_property_read_u32(fwnode, "snps,rd_osr_lmt",
> + &axi->axi_rd_osr_lmt))
> axi->axi_rd_osr_lmt = 1;
> - of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
> - of_node_put(np);
> + fwnode_property_read_u32_array(fwnode, "snps,blen", axi->axi_blen,
> + AXI_BLEN);
> + fwnode_handle_put(fwnode);
None of these are documented as being valid in ACPI. Do you need to
ensure they only come from DT, or you document them for ACPI, and get
the ACPI maintainers to ACK that they are O.K.
>
> return axi;
> }
>
> /**
> - * stmmac_mtl_setup - parse DT parameters for multiple queues configuration
> + * stmmac_mtl_setup - parse properties for multiple queues configuration
> * @pdev: platform device
> * @plat: enet data
> */
> static int stmmac_mtl_setup(struct platform_device *pdev,
> struct plat_stmmacenet_data *plat)
> {
> - struct device_node *q_node;
> - struct device_node *rx_node;
> - struct device_node *tx_node;
> + struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev);
> + struct fwnode_handle *q_node;
> + struct fwnode_handle *rx_node;
> + struct fwnode_handle *tx_node;
> u8 queue = 0;
> int ret = 0;
>
> - /* For backwards-compatibility with device trees that don't have any
> + /* For backwards-compatibility with properties that don't have any
> * snps,mtl-rx-config or snps,mtl-tx-config properties, we fall back
> * to one RX and TX queues each.
> */
Backward compatibility only applies to DT. Anybody using ACPI should
not expect any backwards compatibility, they should be documented
mandatory properties right from the beginning.
Andrew