diff mbox

[v2,RESEND,4/4] xhci: Use pci_enable_msix_exact() instead of pci_enable_msix()

Message ID 606a52afdccf627b6273379b21daffc460b9559a.1394128952.git.agordeev@redhat.com
State Not Applicable
Headers show

Commit Message

Alexander Gordeev March 6, 2014, 8:11 p.m. UTC
As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range()  or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

This update also cleans up a bit xhci_setup_msi() and
xhci_setup_msix() returning of success.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-pci@vger.kernel.org
---
 drivers/usb/host/xhci.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Comments

Sarah Sharp March 6, 2014, 9:56 p.m. UTC | #1
On Thu, Mar 06, 2014 at 09:11:24PM +0100, Alexander Gordeev wrote:
> As result of deprecation of MSI-X/MSI enablement functions
> pci_enable_msix() and pci_enable_msi_block() all drivers
> using these two interfaces need to be updated to use the
> new pci_enable_msi_range()  or pci_enable_msi_exact()
> and pci_enable_msix_range() or pci_enable_msix_exact()
> interfaces.
> 
> This update also cleans up a bit xhci_setup_msi() and
> xhci_setup_msix() returning of success.

What do you mean by this sentence?  Are you fixing some bug in those two
functions, or just cleaning up how they look?  Either way, this should
really be two patches.

Sarah Sharp

> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-usb@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> ---
>  drivers/usb/host/xhci.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 6fe577d..dc7cfb5 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -232,9 +232,10 @@ static int xhci_setup_msi(struct xhci_hcd *xhci)
>  		xhci_dbg_trace(xhci, trace_xhci_dbg_init,
>  				"disable MSI interrupt");
>  		pci_disable_msi(pdev);
> +		return ret;
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  /*
> @@ -291,7 +292,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci)
>  		xhci->msix_entries[i].vector = 0;
>  	}
>  
> -	ret = pci_enable_msix(pdev, xhci->msix_entries, xhci->msix_count);
> +	ret = pci_enable_msix_exact(pdev, xhci->msix_entries, xhci->msix_count);
>  	if (ret) {
>  		xhci_dbg_trace(xhci, trace_xhci_dbg_init,
>  				"Failed to enable MSI-X");
> @@ -307,7 +308,7 @@ static int xhci_setup_msix(struct xhci_hcd *xhci)
>  	}
>  
>  	hcd->msix_enabled = 1;
> -	return ret;
> +	return 0;
>  
>  disable_msix:
>  	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt");
> -- 
> 1.7.7.6
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Gordeev March 25, 2014, 2:27 p.m. UTC | #2
On Thu, Mar 06, 2014 at 01:56:46PM -0800, Sarah Sharp wrote:
> What do you mean by this sentence?  Are you fixing some bug in those two
> functions, or just cleaning up how they look?  Either way, this should
> really be two patches.

Hi Sarah,

Any feedback on v2?

Thanks!

> Sarah Sharp
Alexander Gordeev April 2, 2014, 11:41 a.m. UTC | #3
On Tue, Mar 25, 2014 at 03:27:30PM +0100, Alexander Gordeev wrote:
> On Thu, Mar 06, 2014 at 01:56:46PM -0800, Sarah Sharp wrote:
> > What do you mean by this sentence?  Are you fixing some bug in those two
> > functions, or just cleaning up how they look?  Either way, this should
> > really be two patches.
> 
> Hi Sarah,
> 
> Any feedback on v2?

Sarah?

> Thanks!
> 
> > Sarah Sharp
> 
> -- 
> Regards,
> Alexander Gordeev
> agordeev@redhat.com
Mathias Nyman April 2, 2014, 2:05 p.m. UTC | #4
On 04/02/2014 02:41 PM, Alexander Gordeev wrote:
> On Tue, Mar 25, 2014 at 03:27:30PM +0100, Alexander Gordeev wrote:
>> On Thu, Mar 06, 2014 at 01:56:46PM -0800, Sarah Sharp wrote:
>>> What do you mean by this sentence?  Are you fixing some bug in those two
>>> functions, or just cleaning up how they look?  Either way, this should
>>> really be two patches.
>> Hi Sarah,
>>
>> Any feedback on v2?
>

Hi

Thanks for the patches,
I'll  queue patch 2/2  for usb-linus once 3.15-rc1 comes out.

But I'm going to omit patch 1/2 because it doesn't really improve
code readability and doesn't change functionality.
At this stage I'd like to avoid extra patches as much as possible.
And besides, it adds one extra line of code

-Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Gordeev April 2, 2014, 3:20 p.m. UTC | #5
On Wed, Apr 02, 2014 at 05:05:13PM +0300, Mathias Nyman wrote:
> On 04/02/2014 02:41 PM, Alexander Gordeev wrote:
> >On Tue, Mar 25, 2014 at 03:27:30PM +0100, Alexander Gordeev wrote:
> >>On Thu, Mar 06, 2014 at 01:56:46PM -0800, Sarah Sharp wrote:
> >>>What do you mean by this sentence?  Are you fixing some bug in those two
> >>>functions, or just cleaning up how they look?  Either way, this should
> >>>really be two patches.
> >>Hi Sarah,
> >>
> >>Any feedback on v2?
> >
> 
> Hi

Thank you for the review, Mathias.

> Thanks for the patches,
> I'll  queue patch 2/2  for usb-linus once 3.15-rc1 comes out.
> 
> But I'm going to omit patch 1/2 because it doesn't really improve
> code readability and doesn't change functionality.

I fail to see how it does not improve the readability. It makes the
way the result returned consistent with the rest of the code and
explicitly returns succeess where it is known 'ret' contains zero.

But it surely up to you :)

> At this stage I'd like to avoid extra patches as much as possible.
> And besides, it adds one extra line of code
> 
> -Mathias
diff mbox

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6fe577d..dc7cfb5 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -232,9 +232,10 @@  static int xhci_setup_msi(struct xhci_hcd *xhci)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 				"disable MSI interrupt");
 		pci_disable_msi(pdev);
+		return ret;
 	}
 
-	return ret;
+	return 0;
 }
 
 /*
@@ -291,7 +292,7 @@  static int xhci_setup_msix(struct xhci_hcd *xhci)
 		xhci->msix_entries[i].vector = 0;
 	}
 
-	ret = pci_enable_msix(pdev, xhci->msix_entries, xhci->msix_count);
+	ret = pci_enable_msix_exact(pdev, xhci->msix_entries, xhci->msix_count);
 	if (ret) {
 		xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 				"Failed to enable MSI-X");
@@ -307,7 +308,7 @@  static int xhci_setup_msix(struct xhci_hcd *xhci)
 	}
 
 	hcd->msix_enabled = 1;
-	return ret;
+	return 0;
 
 disable_msix:
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init, "disable MSI-X interrupt");