All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Subject: Re: [PATCH net] net: fealnx: fix missing pci_disable_device()
Date: Tue, 25 Oct 2022 10:47:42 +0300	[thread overview]
Message-ID: <Y1eUnh/DiEvYvVdO@unreal> (raw)
In-Reply-To: <20221024135728.2894863-1-yangyingliang@huawei.com>

On Mon, Oct 24, 2022 at 09:57:28PM +0800, Yang Yingliang wrote:
> pci_disable_device() need be called while module exiting, switch
> to use pcim_enable(), pci_disable_device() and pci_release_regions()
> will be called in pcim_release() while unbinding device.

I didn't understand the description at all, maybe people in CC will.
Most likely, you wanted something like this:

diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
index ed18450fd2cc..78107dd4aa57 100644
--- a/drivers/net/ethernet/fealnx.c
+++ b/drivers/net/ethernet/fealnx.c
@@ -690,6 +690,7 @@ static void fealnx_remove_one(struct pci_dev *pdev)
                pci_iounmap(pdev, np->mem);
                free_netdev(dev);
                pci_release_regions(pdev);
+               pci_disable_device(pdev);
        } else
                printk(KERN_ERR "fealnx: remove for unknown device\n");


> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/ethernet/fealnx.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
> index ed18450fd2cc..fb139f295b67 100644
> --- a/drivers/net/ethernet/fealnx.c
> +++ b/drivers/net/ethernet/fealnx.c
> @@ -494,7 +494,7 @@ static int fealnx_init_one(struct pci_dev *pdev,
>  
>  	option = card_idx < MAX_UNITS ? options[card_idx] : 0;
>  
> -	i = pci_enable_device(pdev);
> +	i = pcim_enable_device(pdev);
>  	if (i) return i;
>  	pci_set_master(pdev);
>  
> @@ -670,7 +670,6 @@ static int fealnx_init_one(struct pci_dev *pdev,
>  err_out_unmap:
>  	pci_iounmap(pdev, ioaddr);
>  err_out_res:
> -	pci_release_regions(pdev);
>  	return err;
>  }
>  
> @@ -689,7 +688,6 @@ static void fealnx_remove_one(struct pci_dev *pdev)
>  		unregister_netdev(dev);
>  		pci_iounmap(pdev, np->mem);
>  		free_netdev(dev);
> -		pci_release_regions(pdev);
>  	} else
>  		printk(KERN_ERR "fealnx: remove for unknown device\n");
>  }
> -- 
> 2.25.1
> 

  parent reply	other threads:[~2022-10-25  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 13:57 [PATCH net] net: fealnx: fix missing pci_disable_device() Yang Yingliang
2022-10-25  6:42 ` Leon Romanovsky
2022-10-25  7:47 ` Leon Romanovsky [this message]
2022-10-25  9:01   ` Yang Yingliang
2022-10-25 10:27     ` Leon Romanovsky
2022-10-25 11:25       ` Yang Yingliang
2022-10-25 11:48         ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1eUnh/DiEvYvVdO@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.