lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH/RFC net-next v3] net: dec: tulip: de2104x: Add shutdown handler to stop NIC
On Fri, 23 Oct 2020 13:28:34 -0700 Moritz Fischer wrote:
> diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
> index d9f6c19940ef..ea7442cc8e75 100644
> --- a/drivers/net/ethernet/dec/tulip/de2104x.c
> +++ b/drivers/net/ethernet/dec/tulip/de2104x.c
> @@ -2175,11 +2175,19 @@ static int __maybe_unused de_resume(struct device *dev_d)
>
> static SIMPLE_DEV_PM_OPS(de_pm_ops, de_suspend, de_resume);
>
> +static void de_shutdown(struct pci_dev *pdev)
> +{
> + struct net_device *dev = pci_get_drvdata(pdev);
> +
> + de_close(dev);

Apparently I get all the best ideas when I'm about to apply something..

I don't think you can just call de_close() like that, because
(a) it may expect rtnl_lock() to be held, and (b) it may not be open.

Perhaps call unregister_netdev(dev) - that'll close the device.
Or rtnl_lock(); dev_close(dev); rtnl_unlock();

> +}
> +
> static struct pci_driver de_driver = {
> .name = DRV_NAME,
> .id_table = de_pci_tbl,
> .probe = de_init_one,
> .remove = de_remove_one,
> + .shutdown = de_shutdown,
> .driver.pm = &de_pm_ops,
> };
>

\
 
 \ /
  Last update: 2020-10-28 02:49    [W:0.209 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site