linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Frank Haverkamp <haver@linux.vnet.ibm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexander Gordeev <agordeev@redhat.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] misc/GenWQE: fix pci_enable_msi usage
Date: Wed, 16 Jul 2014 15:10:52 -0600	[thread overview]
Message-ID: <20140716211052.GC14366@google.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1407091237030.1590@denkbrett>

[+cc linux-pci]

On Wed, Jul 09, 2014 at 12:46:39PM +0200, Sebastian Ott wrote:
> GenWQE used to call pci_enable_msi_block to allocate a desired number
> of MSI's. If that was not possible pci_enable_msi_block returned with a
> smaller number which might be possible to allocate. GenWQE then called
> pci_enable_msi_block with that number.
> 
> Since commit a30d0108b
> "GenWQE: Use pci_enable_msi_exact() instead of pci_enable_msi_block()"
> pci_enable_msi_exact is used which fails if the desired number of MSI's
> was not possible to allocate. Change GenWQE to use pci_enable_msi_range
> to restore the old behavior.
> 
> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>

Since this fixes a30d0108b09a, which we merged via my tree in v3.16-rc1, I
applied this with Alexander and Frank's acks to for-linus for v3.16,
thanks!

> ---
>  drivers/misc/genwqe/card_ddcb.c  |  4 +---
>  drivers/misc/genwqe/card_utils.c | 10 ++++++----
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/genwqe/card_ddcb.c b/drivers/misc/genwqe/card_ddcb.c
> index c8046db..f66d43d 100644
> --- a/drivers/misc/genwqe/card_ddcb.c
> +++ b/drivers/misc/genwqe/card_ddcb.c
> @@ -1237,9 +1237,7 @@ int genwqe_setup_service_layer(struct genwqe_dev *cd)
>  	}
>  
>  	rc = genwqe_set_interrupt_capability(cd, GENWQE_MSI_IRQS);
> -	if (rc > 0)
> -		rc = genwqe_set_interrupt_capability(cd, rc);
> -	if (rc != 0) {
> +	if (rc) {
>  		rc = -ENODEV;
>  		goto stop_kthread;
>  	}
> diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
> index 62cc6bb..6abc437 100644
> --- a/drivers/misc/genwqe/card_utils.c
> +++ b/drivers/misc/genwqe/card_utils.c
> @@ -718,10 +718,12 @@ int genwqe_set_interrupt_capability(struct genwqe_dev *cd, int count)
>  	int rc;
>  	struct pci_dev *pci_dev = cd->pci_dev;
>  
> -	rc = pci_enable_msi_exact(pci_dev, count);
> -	if (rc == 0)
> -		cd->flags |= GENWQE_FLAG_MSI_ENABLED;
> -	return rc;
> +	rc = pci_enable_msi_range(pci_dev, 1, count);
> +	if (rc < 0)
> +		return rc;
> +
> +	cd->flags |= GENWQE_FLAG_MSI_ENABLED;
> +	return 0;
>  }
>  
>  /**
> -- 
> 1.9.3
> 

       reply	other threads:[~2014-07-16 21:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LFD.2.11.1407091237030.1590@denkbrett>
2014-07-16 21:10 ` Bjorn Helgaas [this message]
2014-07-17 15:48   ` [PATCH] misc/GenWQE: fix pci_enable_msi usage Frank Haverkamp
2014-07-18  8:46     ` Sebastian Ott
2014-07-21 18:24       ` Bjorn Helgaas

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=20140716211052.GC14366@google.com \
    --to=bhelgaas@google.com \
    --cc=agordeev@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haver@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sebott@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).