Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Krzysztof Kozlowski
Sat, 21 Nov 2026 17:07
[PATCH net-next] net: stmmac: eic7700: Use syscon_regmap_lookup_by_phandle_args
Author: Krzysztof Kozlowski
Date: Sat, 21 Nov 2026 17:07
Date: Sat, 21 Nov 2026 17:07
73 lines
18021 bytes
18021 bytes
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over syscon_regmap_lookup_by_phandle() combined with getting the syscon argument. Except simpler code this annotates within one line that given phandle has arguments, so grepping for code would be easier. There is also no real benefit in printing errors of missing individual syscon arguments, because this is done just too late: runtime check on static/build-time data. Dtschema and Devicetree bindings offer the static/build-time check for this already. OTOH, syscon_regmap_lookup_by_phandle_args() already handles error case if the number of arguments is too low, thus switch is safe. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> --- .../ethernet/stmicro/stmmac/dwmac-eic7700.c | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c index c229275b11b3..287f717ab3ed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c @@ -170,6 +170,7 @@ static int eic7700_dwmac_probe(struct platform_device *pdev) struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; struct eic7700_qos_priv *dwc_priv; + unsigned int hsp_args[3]; u32 delay_ps, val; int i, ret; @@ -254,33 +255,18 @@ static int eic7700_dwmac_probe(struct platform_device *pdev) } dwc_priv->eic7700_hsp_regmap = - syscon_regmap_lookup_by_phandle(pdev->dev.of_node, - "eswin,hsp-sp-csr"); + syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, + "eswin,hsp-sp-csr", + ARRAY_SIZE(hsp_args), + hsp_args); if (IS_ERR(dwc_priv->eic7700_hsp_regmap)) return dev_err_probe(&pdev->dev, PTR_ERR(dwc_priv->eic7700_hsp_regmap), "Failed to get hsp-sp-csr regmap\n"); - ret = of_property_read_u32_index(pdev->dev.of_node, - "eswin,hsp-sp-csr", - 1, &dwc_priv->eth_phy_ctrl_offset); - if (ret) - return dev_err_probe(&pdev->dev, ret, - "can't get eth_phy_ctrl_offset\n"); - - ret = of_property_read_u32_index(pdev->dev.of_node, - "eswin,hsp-sp-csr", - 2, &dwc_priv->eth_axi_lp_ctrl_offset); - if (ret) - return dev_err_probe(&pdev->dev, ret, - "can't get eth_axi_lp_ctrl_offset\n"); - - ret = of_property_read_u32_index(pdev->dev.of_node, - "eswin,hsp-sp-csr", - 3, &dwc_priv->eth_clk_offset); - if (ret) - return dev_err_probe(&pdev->dev, ret, - "can't get eth_clk_offset\n"); + dwc_priv->eth_phy_ctrl_offset = hsp_args[0]; + dwc_priv->eth_axi_lp_ctrl_offset = hsp_args[1]; + dwc_priv->eth_clk_offset = hsp_args[2]; ret = of_property_read_u32_index(pdev->dev.of_node, "eswin,hsp-sp-csr", -- 2.53.0
Re: [PATCH net-next] net: stmmac: eic7700: Use syscon_regmap_lookup_by_phandle_args
Author: Lorenzo Bianconi
Date: Sat, 21 Nov 2026 17:20
Date: Sat, 21 Nov 2026 17:20
99 lines
18766 bytes
18766 bytes
--0OvQp1Mflhl1IUn0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over > syscon_regmap_lookup_by_phandle() combined with getting the syscon > argument. Except simpler code this annotates within one line that given > phandle has arguments, so grepping for code would be easier. >=20 > There is also no real benefit in printing errors of missing individual > syscon arguments, because this is done just too late: runtime check on > static/build-time data. Dtschema and Devicetree bindings offer the > static/build-time check for this already. OTOH, > syscon_regmap_lookup_by_phandle_args() already handles error case if the > number of arguments is too low, thus switch is safe. >=20 > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com> > --- > .../ethernet/stmicro/stmmac/dwmac-eic7700.c | 30 +++++-------------- > 1 file changed, 8 insertions(+), 22 deletions(-) >=20 > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c b/driver= s/net/ethernet/stmicro/stmmac/dwmac-eic7700.c > index c229275b11b3..287f717ab3ed 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c > @@ -170,6 +170,7 @@ static int eic7700_dwmac_probe(struct platform_device= *pdev) > struct plat_stmmacenet_data *plat_dat; > struct stmmac_resources stmmac_res; > struct eic7700_qos_priv *dwc_priv; > + unsigned int hsp_args[3]; > u32 delay_ps, val; > int i, ret; > =20 > @@ -254,33 +255,18 @@ static int eic7700_dwmac_probe(struct platform_devi= ce *pdev) > } > =20 > dwc_priv->eic7700_hsp_regmap =3D > - syscon_regmap_lookup_by_phandle(pdev->dev.of_node, > - "eswin,hsp-sp-csr"); > + syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, > + "eswin,hsp-sp-csr", > + ARRAY_SIZE(hsp_args), > + hsp_args); > if (IS_ERR(dwc_priv->eic7700_hsp_regmap)) > return dev_err_probe(&pdev->dev, > PTR_ERR(dwc_priv->eic7700_hsp_regmap), > "Failed to get hsp-sp-csr regmap\n"); > =20 > - ret =3D of_property_read_u32_index(pdev->dev.of_node, > - "eswin,hsp-sp-csr", > - 1, &dwc_priv->eth_phy_ctrl_offset); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, > - "can't get eth_phy_ctrl_offset\n"); > - > - ret =3D of_property_read_u32_index(pdev->dev.of_node, > - "eswin,hsp-sp-csr", > - 2, &dwc_priv->eth_axi_lp_ctrl_offset); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, > - "can't get eth_axi_lp_ctrl_offset\n"); > - > - ret =3D of_property_read_u32_index(pdev->dev.of_node, > - "eswin,hsp-sp-csr", > - 3, &dwc_priv->eth_clk_offset); > - if (ret) > - return dev_err_probe(&pdev->dev, ret, > - "can't get eth_clk_offset\n"); > + dwc_priv->eth_phy_ctrl_offset =3D hsp_args[0]; > + dwc_priv->eth_axi_lp_ctrl_offset =3D hsp_args[1]; > + dwc_priv->eth_clk_offset =3D hsp_args[2]; > =20 > ret =3D of_property_read_u32_index(pdev->dev.of_node, > "eswin,hsp-sp-csr", > --=20 > 2.53.0 >=20 >=20 --0OvQp1Mflhl1IUn0 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCawHSyAAKCRA6cBh0uS2t rPlnAQDvFThEV0w9sN0ihzSOFueg0SkPnLH7gOu/w6OxmOIKFQD/ecz5Rb5UjmPu wcE4gdPGntcwSBsNbPzD5kliXTV/+A0= =TTZe -----END PGP SIGNATURE----- --0OvQp1Mflhl1IUn0--
Re: [PATCH net-next] net: stmmac: eic7700: Use syscon_regmap_lookup_by_phandle_args
Author: patchwork-bot+netdevbpf
Date: Wed, 25 Nov 2026 02:40
Date: Wed, 25 Nov 2026 02:40
29 lines
9159 bytes
9159 bytes
Hello:
This patch was applied to netdev/net-next.git (main)
by Willem de Bruijn <willemb@google.com>:
On Sat, 21 Nov 2026 18:07:54 +0100 you wrote:
> Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
> syscon_regmap_lookup_by_phandle() combined with getting the syscon
> argument. Except simpler code this annotates within one line that given
> phandle has arguments, so grepping for code would be easier.
>
> There is also no real benefit in printing errors of missing individual
> syscon arguments, because this is done just too late: runtime check on
> static/build-time data. Dtschema and Devicetree bindings offer the
> static/build-time check for this already. OTOH,
> syscon_regmap_lookup_by_phandle_args() already handles error case if the
> number of arguments is too low, thus switch is safe.
>
> [...]
Here is the summary with links:
- [net-next] net: stmmac: eic7700: Use syscon_regmap_lookup_by_phandle_args
https://git.kernel.org/netdev/net-next/c/882f4ba39863
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads