mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
net: altera-tse: Warn on bad revision at probe time
Instead of reading the core revision at probe time, and print a warning for an unexecpected version at .ndo_open() time, let's print that warning directly in .probe(). This allows getting rid of the "revision" private field, and also prevent a potential race between reading the revision in .probe() after netdev registration, and accessing that revision in .ndo_open(). By printing the warning after register_netdev(), we are sure that we have a netdev name, and that we try to print the revision after having read it from the internal registers. Suggested-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20251103104928.58461-3-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6874520518
commit
dd2619d38d
|
|
@ -401,9 +401,6 @@ struct altera_tse_private {
|
|||
/* MAC address space */
|
||||
struct altera_tse_mac __iomem *mac_dev;
|
||||
|
||||
/* TSE Revision */
|
||||
u32 revision;
|
||||
|
||||
/* mSGDMA Rx Dispatcher address space */
|
||||
void __iomem *rx_dma_csr;
|
||||
void __iomem *rx_dma_desc;
|
||||
|
|
|
|||
|
|
@ -892,9 +892,6 @@ static int tse_open(struct net_device *dev)
|
|||
netdev_warn(dev, "device MAC address %pM\n",
|
||||
dev->dev_addr);
|
||||
|
||||
if ((priv->revision < 0xd00) || (priv->revision > 0xe00))
|
||||
netdev_warn(dev, "TSE revision %x\n", priv->revision);
|
||||
|
||||
spin_lock(&priv->mac_cfg_lock);
|
||||
|
||||
ret = reset_mac(priv);
|
||||
|
|
@ -1142,6 +1139,7 @@ static int altera_tse_probe(struct platform_device *pdev)
|
|||
struct net_device *ndev;
|
||||
void __iomem *descmap;
|
||||
int ret = -ENODEV;
|
||||
u32 revision;
|
||||
|
||||
ndev = alloc_etherdev(sizeof(struct altera_tse_private));
|
||||
if (!ndev) {
|
||||
|
|
@ -1395,12 +1393,14 @@ static int altera_tse_probe(struct platform_device *pdev)
|
|||
goto err_register_netdev;
|
||||
}
|
||||
|
||||
priv->revision = ioread32(&priv->mac_dev->megacore_revision);
|
||||
revision = ioread32(&priv->mac_dev->megacore_revision);
|
||||
|
||||
if (revision < 0xd00 || revision > 0xe00)
|
||||
netdev_warn(ndev, "TSE revision %x\n", revision);
|
||||
|
||||
if (netif_msg_probe(priv))
|
||||
dev_info(&pdev->dev, "Altera TSE MAC version %d.%d at 0x%08lx irq %d/%d\n",
|
||||
(priv->revision >> 8) & 0xff,
|
||||
priv->revision & 0xff,
|
||||
(revision >> 8) & 0xff, revision & 0xff,
|
||||
(unsigned long) control_port->start, priv->rx_irq,
|
||||
priv->tx_irq);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user