mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
realtek: eth: move netdev_ops to config structure
Simplify netdev_ops initialization by moving the data into the configuration structure. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/21345 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
2d8212e8a4
commit
f14fed9a92
2 changed files with 12 additions and 23 deletions
|
|
@ -1450,7 +1450,7 @@ static struct phylink_pcs *rtl838x_mac_select_pcs(struct phylink_config *config,
|
|||
return &priv->pcs;
|
||||
}
|
||||
|
||||
static const struct net_device_ops rtl838x_eth_netdev_ops = {
|
||||
static const struct net_device_ops rteth_838x_netdev_ops = {
|
||||
.ndo_open = rtl838x_eth_open,
|
||||
.ndo_stop = rtl838x_eth_stop,
|
||||
.ndo_start_xmit = rtl838x_eth_tx,
|
||||
|
|
@ -1489,9 +1489,10 @@ static const struct rteth_config rteth_838x_cfg = {
|
|||
.update_cntr = rtl838x_update_cntr,
|
||||
.create_tx_header = rtl838x_create_tx_header,
|
||||
.decode_tag = rtl838x_decode_tag,
|
||||
.netdev_ops = &rteth_838x_netdev_ops,
|
||||
};
|
||||
|
||||
static const struct net_device_ops rtl839x_eth_netdev_ops = {
|
||||
static const struct net_device_ops rteth_839x_netdev_ops = {
|
||||
.ndo_open = rtl838x_eth_open,
|
||||
.ndo_stop = rtl838x_eth_stop,
|
||||
.ndo_start_xmit = rtl838x_eth_tx,
|
||||
|
|
@ -1530,9 +1531,10 @@ static const struct rteth_config rteth_839x_cfg = {
|
|||
.update_cntr = rtl839x_update_cntr,
|
||||
.create_tx_header = rtl839x_create_tx_header,
|
||||
.decode_tag = rtl839x_decode_tag,
|
||||
.netdev_ops = &rteth_839x_netdev_ops,
|
||||
};
|
||||
|
||||
static const struct net_device_ops rtl930x_eth_netdev_ops = {
|
||||
static const struct net_device_ops rteth_930x_netdev_ops = {
|
||||
.ndo_open = rtl838x_eth_open,
|
||||
.ndo_stop = rtl838x_eth_stop,
|
||||
.ndo_start_xmit = rtl838x_eth_tx,
|
||||
|
|
@ -1577,9 +1579,10 @@ static const struct rteth_config rteth_930x_cfg = {
|
|||
.update_cntr = rtl930x_update_cntr,
|
||||
.create_tx_header = rtl930x_create_tx_header,
|
||||
.decode_tag = rtl930x_decode_tag,
|
||||
.netdev_ops = &rteth_930x_netdev_ops,
|
||||
};
|
||||
|
||||
static const struct net_device_ops rtl931x_eth_netdev_ops = {
|
||||
static const struct net_device_ops rteth_931x_netdev_ops = {
|
||||
.ndo_open = rtl838x_eth_open,
|
||||
.ndo_stop = rtl838x_eth_stop,
|
||||
.ndo_start_xmit = rtl838x_eth_tx,
|
||||
|
|
@ -1623,6 +1626,7 @@ static const struct rteth_config rteth_931x_cfg = {
|
|||
.update_cntr = rtl931x_update_cntr,
|
||||
.create_tx_header = rtl931x_create_tx_header,
|
||||
.decode_tag = rtl931x_decode_tag,
|
||||
.netdev_ops = &rteth_931x_netdev_ops,
|
||||
};
|
||||
|
||||
static const struct phylink_pcs_ops rtl838x_pcs_ops = {
|
||||
|
|
@ -1698,27 +1702,11 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
|
|||
dev->max_mtu = DEFAULT_MTU;
|
||||
dev->features = NETIF_F_RXCSUM | NETIF_F_HW_CSUM;
|
||||
dev->hw_features = NETIF_F_RXCSUM;
|
||||
dev->netdev_ops = priv->r->netdev_ops;
|
||||
|
||||
pr_info("Found SoC family %x\n", priv->r->family_id);
|
||||
|
||||
switch (priv->r->family_id) {
|
||||
case RTL8380_FAMILY_ID:
|
||||
dev->netdev_ops = &rtl838x_eth_netdev_ops;
|
||||
break;
|
||||
case RTL8390_FAMILY_ID:
|
||||
dev->netdev_ops = &rtl839x_eth_netdev_ops;
|
||||
break;
|
||||
case RTL9300_FAMILY_ID:
|
||||
dev->netdev_ops = &rtl930x_eth_netdev_ops;
|
||||
break;
|
||||
case RTL9310_FAMILY_ID:
|
||||
dev->netdev_ops = &rtl931x_eth_netdev_ops;
|
||||
if (priv->r->family_id == RTL9310_FAMILY_ID)
|
||||
rtl931x_chip_init(priv);
|
||||
break;
|
||||
default:
|
||||
pr_err("Unknown SoC family\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
priv->rxringlen = rxringlen;
|
||||
priv->rxrings = rxrings;
|
||||
|
||||
|
|
|
|||
|
|
@ -480,6 +480,7 @@ struct rteth_config {
|
|||
void (*update_cntr)(int r, int work_done);
|
||||
void (*create_tx_header)(struct p_hdr *h, unsigned int dest_port, int prio);
|
||||
bool (*decode_tag)(struct p_hdr *h, struct dsa_tag *tag);
|
||||
const struct net_device_ops *netdev_ops;
|
||||
};
|
||||
|
||||
#endif /* _RTL838X_ETH_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue