mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
net: stmmac: reorganise stmmac_hwif_init()
Reorganise stmmac_hwif_init() to handle the error case of stmmac_hwif_find() in the indented block, which follows normal programming pattern. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vDtfG-0000000CCCX-2YwQ@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f9326b139b
commit
6436f408eb
|
|
@ -366,41 +366,45 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
|
|||
|
||||
/* Use synopsys_id var because some setups can override this */
|
||||
entry = stmmac_hwif_find(core_type, priv->synopsys_id, version.dev_id);
|
||||
if (entry) {
|
||||
/* Only use generic HW helpers if needed */
|
||||
mac->desc = mac->desc ? : entry->desc;
|
||||
mac->dma = mac->dma ? : entry->dma;
|
||||
mac->mac = mac->mac ? : entry->mac;
|
||||
mac->ptp = mac->ptp ? : entry->hwtimestamp;
|
||||
mac->mode = mac->mode ? : entry->mode;
|
||||
mac->tc = mac->tc ? : entry->tc;
|
||||
mac->mmc = mac->mmc ? : entry->mmc;
|
||||
mac->est = mac->est ? : entry->est;
|
||||
mac->vlan = mac->vlan ? : entry->vlan;
|
||||
if (!entry) {
|
||||
dev_err(priv->device,
|
||||
"Failed to find HW IF (id=0x%x, gmac=%d/%d)\n",
|
||||
version.snpsver, core_type == DWMAC_CORE_GMAC,
|
||||
core_type == DWMAC_CORE_GMAC4);
|
||||
|
||||
priv->hw = mac;
|
||||
priv->fpe_cfg.reg = entry->regs.fpe_reg;
|
||||
priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;
|
||||
priv->mmcaddr = priv->ioaddr + entry->regs.mmc_off;
|
||||
memcpy(&priv->ptp_clock_ops, entry->ptp,
|
||||
sizeof(struct ptp_clock_info));
|
||||
if (entry->est)
|
||||
priv->estaddr = priv->ioaddr + entry->regs.est_off;
|
||||
|
||||
/* Entry found */
|
||||
if (needs_setup) {
|
||||
ret = entry->setup(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Save quirks, if needed for posterior use */
|
||||
priv->hwif_quirks = entry->quirks;
|
||||
return 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_err(priv->device, "Failed to find HW IF (id=0x%x, gmac=%d/%d)\n",
|
||||
version.snpsver, core_type == DWMAC_CORE_GMAC,
|
||||
core_type == DWMAC_CORE_GMAC4);
|
||||
return -EINVAL;
|
||||
/* Only use generic HW helpers if needed */
|
||||
mac->desc = mac->desc ? : entry->desc;
|
||||
mac->dma = mac->dma ? : entry->dma;
|
||||
mac->mac = mac->mac ? : entry->mac;
|
||||
mac->ptp = mac->ptp ? : entry->hwtimestamp;
|
||||
mac->mode = mac->mode ? : entry->mode;
|
||||
mac->tc = mac->tc ? : entry->tc;
|
||||
mac->mmc = mac->mmc ? : entry->mmc;
|
||||
mac->est = mac->est ? : entry->est;
|
||||
mac->vlan = mac->vlan ? : entry->vlan;
|
||||
|
||||
priv->hw = mac;
|
||||
priv->fpe_cfg.reg = entry->regs.fpe_reg;
|
||||
priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;
|
||||
priv->mmcaddr = priv->ioaddr + entry->regs.mmc_off;
|
||||
memcpy(&priv->ptp_clock_ops, entry->ptp,
|
||||
sizeof(struct ptp_clock_info));
|
||||
|
||||
if (entry->est)
|
||||
priv->estaddr = priv->ioaddr + entry->regs.est_off;
|
||||
|
||||
/* Entry found */
|
||||
if (needs_setup) {
|
||||
ret = entry->setup(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Save quirks, if needed for posterior use */
|
||||
priv->hwif_quirks = entry->quirks;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user