Skip to content

Commit 9352f74

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: stmmac: ingenic: pass ingenic_mac struct rather than plat_dat
It no longer makes sense to pass a pointer to struct plat_stmmacenet_data when calling the set_mode() methods to only use it to get a pointer to the ingenic_mac structure that we already had in the caller. Simplify this by passing the struct ingenic_mac pointer. Reviewed-by: Maxime Chevallier <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2284cca commit 9352f74

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,13 @@ struct ingenic_soc_info {
6464
enum ingenic_mac_version version;
6565
u32 mask;
6666

67-
int (*set_mode)(struct plat_stmmacenet_data *plat_dat, u8 phy_intf_sel);
67+
int (*set_mode)(struct ingenic_mac *mac, u8 phy_intf_sel);
6868

6969
u8 valid_phy_intf_sel;
7070
};
7171

72-
static int jz4775_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
73-
u8 phy_intf_sel)
72+
static int jz4775_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel)
7473
{
75-
struct ingenic_mac *mac = plat_dat->bsp_priv;
7674
unsigned int val;
7775

7876
val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel) |
@@ -82,19 +80,14 @@ static int jz4775_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
8280
return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, val);
8381
}
8482

85-
static int x1000_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
86-
u8 phy_intf_sel)
83+
static int x1000_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel)
8784
{
88-
struct ingenic_mac *mac = plat_dat->bsp_priv;
89-
9085
/* Update MAC PHY control register */
9186
return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, 0);
9287
}
9388

94-
static int x1600_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
95-
u8 phy_intf_sel)
89+
static int x1600_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel)
9690
{
97-
struct ingenic_mac *mac = plat_dat->bsp_priv;
9891
unsigned int val;
9992

10093
val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);
@@ -103,10 +96,8 @@ static int x1600_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
10396
return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, val);
10497
}
10598

106-
static int x1830_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
107-
u8 phy_intf_sel)
99+
static int x1830_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel)
108100
{
109-
struct ingenic_mac *mac = plat_dat->bsp_priv;
110101
unsigned int val;
111102

112103
val = FIELD_PREP(MACPHYC_MODE_SEL_MASK, MACPHYC_MODE_SEL_RMII) |
@@ -116,10 +107,8 @@ static int x1830_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
116107
return regmap_update_bits(mac->regmap, 0, mac->soc_info->mask, val);
117108
}
118109

119-
static int x2000_mac_set_mode(struct plat_stmmacenet_data *plat_dat,
120-
u8 phy_intf_sel)
110+
static int x2000_mac_set_mode(struct ingenic_mac *mac, u8 phy_intf_sel)
121111
{
122-
struct ingenic_mac *mac = plat_dat->bsp_priv;
123112
unsigned int val;
124113

125114
val = FIELD_PREP(MACPHYC_PHY_INFT_MASK, phy_intf_sel);
@@ -165,7 +154,7 @@ static int ingenic_mac_init(struct platform_device *pdev, void *bsp_priv)
165154
dev_dbg(mac->dev, "MAC PHY control register: interface %s\n",
166155
phy_modes(interface));
167156

168-
ret = mac->soc_info->set_mode(mac->plat_dat, phy_intf_sel);
157+
ret = mac->soc_info->set_mode(mac, phy_intf_sel);
169158
if (ret)
170159
return ret;
171160
}

0 commit comments

Comments
 (0)