diff mbox

[4/8] PCI: Rationalize pci_ats_queue_depth() error checking

Message ID 20150717213215.18379.59848.stgit@bhelgaas-glaptop2.roam.corp.google.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Bjorn Helgaas July 17, 2015, 9:32 p.m. UTC
We previously returned -ENODEV for devices that don't support ATS (except
that we always returned 0 for VFs, whether or not they support ATS).

For consistency, always return -EINVAL (not -ENODEV) if the device doesn't
support ATS.  Return zero for VFs that support ATS.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/ats.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


--
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

Comments

Joerg Roedel July 20, 2015, 2:15 p.m. UTC | #1
On Fri, Jul 17, 2015 at 04:32:16PM -0500, Bjorn Helgaas wrote:
> We previously returned -ENODEV for devices that don't support ATS (except
> that we always returned 0 for VFs, whether or not they support ATS).
> 
> For consistency, always return -EINVAL (not -ENODEV) if the device doesn't
> support ATS.  Return zero for VFs that support ATS.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/ats.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
> index 2f1fb9c..ea459b3 100644
> --- a/drivers/pci/ats.c
> +++ b/drivers/pci/ats.c
> @@ -121,13 +121,13 @@ EXPORT_SYMBOL_GPL(pci_restore_ats_state);
>   */
>  int pci_ats_queue_depth(struct pci_dev *dev)
>  {
> +	if (!dev->ats_cap)
> +		return -EINVAL;
> +
>  	if (dev->is_virtfn)
>  		return 0;
>  
> -	if (dev->ats_cap)
> -		return dev->ats_qdep;
> -
> -	return -ENODEV;
> +	return dev->ats_qdep;
>  }
>  EXPORT_SYMBOL_GPL(pci_ats_queue_depth);

Reviewed-by: Joerg Roedel <jroedel@suse.de>

--
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
diff mbox

Patch

diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 2f1fb9c..ea459b3 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -121,13 +121,13 @@  EXPORT_SYMBOL_GPL(pci_restore_ats_state);
  */
 int pci_ats_queue_depth(struct pci_dev *dev)
 {
+	if (!dev->ats_cap)
+		return -EINVAL;
+
 	if (dev->is_virtfn)
 		return 0;
 
-	if (dev->ats_cap)
-		return dev->ats_qdep;
-
-	return -ENODEV;
+	return dev->ats_qdep;
 }
 EXPORT_SYMBOL_GPL(pci_ats_queue_depth);