RE: [PATCH net-next v10 09/13] net:ethernet:realtek:rtase: Implement pci_driver suspend and resume function

From: Justin Lai
Date: Wed Nov 15 2023 - 01:23:08 EST




> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Sunday, November 5, 2023 3:52 AM
> To: Justin Lai <justinlai0215@xxxxxxxxxxx>
> Cc: kuba@xxxxxxxxxx; davem@xxxxxxxxxxxxx; edumazet@xxxxxxxxxx;
> pabeni@xxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
> Ping-Ke Shih <pkshih@xxxxxxxxxxx>; Larry Chiu <larry.chiu@xxxxxxxxxxx>
> Subject: Re: [PATCH net-next v10 09/13] net:ethernet:realtek:rtase: Implement
> pci_driver suspend and resume function
>
>
> External mail.
>
>
>
> > +static int rtase_resume(struct pci_dev *pdev) {
> > + struct net_device *dev = pci_get_drvdata(pdev);
> > + struct rtase_private *tp = netdev_priv(dev);
> > + int ret;
> > +
> > + pci_set_power_state(pdev, PCI_D0);
> > + pci_restore_state(pdev);
> > + pci_enable_wake(pdev, PCI_D0, 0);
> > +
> > + /* restore last modified mac address */
> > + rtase_rar_set(tp, dev->dev_addr);
> > +
> > + if (!netif_running(dev))
> > + goto out;
> > +
> > + rtase_wait_for_quiescence(dev);
> > + netif_device_attach(dev);
> > +
> > + rtase_tx_clear(tp);
> > + rtase_rx_clear(tp);
> > +
> > + ret = rtase_init_ring(dev);
> > + if (ret)
> > + netdev_alert(dev, "unable to init ring\n");
>
> If you fail to init the ring, is it safe to keep going?
>
> Andrew


Thanks for your reply, I will add error handling of rtase_init_ring()