Skip to content

Commit 9b42f74

Browse files
lunnPaolo Abeni
authored andcommitted
net: ftgmac100: Replace all of_device_is_compatible()
Now that the priv structure includes the MAC ID, make use of it instead of the more expensive of_device_is_compatible(). Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com> Link: https://patch.msgid.link/20260206-ftgmac-cleanup-v5-3-ad28a9067ea7@aspeedtech.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 41fbe5a commit 9b42f74

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

drivers/net/ethernet/faraday/ftgmac100.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,8 +1720,8 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
17201720
if (!priv->mii_bus)
17211721
return -EIO;
17221722

1723-
if (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
1724-
of_device_is_compatible(np, "aspeed,ast2500-mac")) {
1723+
if (priv->mac_id == FTGMAC100_AST2400 ||
1724+
priv->mac_id == FTGMAC100_AST2500) {
17251725
/* The AST2600 has a separate MDIO controller */
17261726

17271727
/* For the AST2400 and AST2500 this driver only supports the
@@ -1926,9 +1926,9 @@ static int ftgmac100_probe(struct platform_device *pdev)
19261926
if (err)
19271927
goto err_phy_connect;
19281928

1929-
if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
1930-
of_device_is_compatible(np, "aspeed,ast2500-mac") ||
1931-
of_device_is_compatible(np, "aspeed,ast2600-mac"))) {
1929+
if (priv->mac_id == FTGMAC100_AST2400 ||
1930+
priv->mac_id == FTGMAC100_AST2500 ||
1931+
priv->mac_id == FTGMAC100_AST2600) {
19321932
priv->rxdes0_edorr_mask = BIT(30);
19331933
priv->txdes0_edotr_mask = BIT(30);
19341934
priv->is_aspeed = true;
@@ -1973,8 +1973,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
19731973
* available PHYs and register them.
19741974
*/
19751975
if (of_get_property(np, "phy-handle", NULL) &&
1976-
(of_device_is_compatible(np, "aspeed,ast2400-mac") ||
1977-
of_device_is_compatible(np, "aspeed,ast2500-mac"))) {
1976+
(priv->mac_id == FTGMAC100_AST2400 ||
1977+
priv->mac_id == FTGMAC100_AST2500)) {
19781978
err = ftgmac100_setup_mdio(netdev);
19791979
if (err)
19801980
goto err_setup_mdio;
@@ -2026,7 +2026,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
20262026
goto err_phy_connect;
20272027

20282028
/* Disable ast2600 problematic HW arbitration */
2029-
if (of_device_is_compatible(np, "aspeed,ast2600-mac"))
2029+
if (priv->mac_id == FTGMAC100_AST2600)
20302030
iowrite32(FTGMAC100_TM_DEFAULT,
20312031
priv->base + FTGMAC100_OFFSET_TM);
20322032
}
@@ -2044,11 +2044,11 @@ static int ftgmac100_probe(struct platform_device *pdev)
20442044
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;
20452045

20462046
/* AST2400 doesn't have working HW checksum generation */
2047-
if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac")))
2047+
if (priv->mac_id == FTGMAC100_AST2400)
20482048
netdev->hw_features &= ~NETIF_F_HW_CSUM;
20492049

20502050
/* AST2600 tx checksum with NCSI is broken */
2051-
if (priv->use_ncsi && of_device_is_compatible(np, "aspeed,ast2600-mac"))
2051+
if (priv->use_ncsi && priv->mac_id == FTGMAC100_AST2600)
20522052
netdev->hw_features &= ~NETIF_F_HW_CSUM;
20532053

20542054
if (np && of_get_property(np, "no-hw-checksum", NULL))

0 commit comments

Comments
 (0)