linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Drop unnecessary pcibio_err_to_errno()
@ 2016-11-18 11:47 Cao jin
  2016-11-18 17:02 ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: Cao jin @ 2016-11-18 11:47 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: alex.williamson

pci_user_read/write_config_xxxx() already does the translation.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 drivers/vfio/pci/vfio_pci_config.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 65d4a30..e4220ca 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -152,7 +152,7 @@ static int vfio_user_config_read(struct pci_dev *pdev, int offset,
 
 	*val = cpu_to_le32(tmp_val);
 
-	return pcibios_err_to_errno(ret);
+	return ret;
 }
 
 static int vfio_user_config_write(struct pci_dev *pdev, int offset,
@@ -173,7 +173,7 @@ static int vfio_user_config_write(struct pci_dev *pdev, int offset,
 		break;
 	}
 
-	return pcibios_err_to_errno(ret);
+	return ret;
 }
 
 static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
@@ -257,7 +257,7 @@ static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
 
 	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
 	if (ret)
-		return pcibios_err_to_errno(ret);
+		return ret;
 
 	if (pos >= PCI_CFG_SPACE_SIZE) { /* Extended cap header mangling */
 		if (offset < 4)
@@ -295,7 +295,7 @@ static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
 
 	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
 	if (ret)
-		return pcibios_err_to_errno(ret);
+		return ret;
 
 	return count;
 }
@@ -1089,7 +1089,7 @@ static int vfio_msi_config_write(struct vfio_pci_device *vdev, int pos,
 						 start + PCI_MSI_FLAGS,
 						 flags);
 		if (ret)
-			return pcibios_err_to_errno(ret);
+			return ret;
 	}
 
 	return count;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Drop unnecessary pcibio_err_to_errno()
  2016-11-18 11:47 [PATCH] Drop unnecessary pcibio_err_to_errno() Cao jin
@ 2016-11-18 17:02 ` Alex Williamson
  2016-11-19  9:20   ` Cao jin
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2016-11-18 17:02 UTC (permalink / raw)
  To: Cao jin; +Cc: linux-kernel, kvm


Please prefix patches with their functional area, for instance I'll
prepend "vfio/pci" to this.  Had you not cc'd me, I wouldn't have
noticed this patch w/o some mention of vfio in the subject.


On Fri, 18 Nov 2016 19:47:38 +0800
Cao jin <caoj.fnst@cn.fujitsu.com> wrote:
> pci_user_read/write_config_xxxx() already does the translation.
> 

It would be helpful to mention in the commit where this translation was
added to those functions, d97ffe236894 ("PCI: Fix return value from
pci_user_{read,write}_config_*()")

It's also worthwhile to mention that no change in behavior is expected
since pcibios_err_to_errno() will not mangle existing errno values, the
call is simply unnecessary given the previous conversion.

I'll modify the title and commit log as described and apply.  Thanks,

Alex

> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  drivers/vfio/pci/vfio_pci_config.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
> index 65d4a30..e4220ca 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -152,7 +152,7 @@ static int vfio_user_config_read(struct pci_dev *pdev, int offset,
>  
>  	*val = cpu_to_le32(tmp_val);
>  
> -	return pcibios_err_to_errno(ret);
> +	return ret;
>  }
>  
>  static int vfio_user_config_write(struct pci_dev *pdev, int offset,
> @@ -173,7 +173,7 @@ static int vfio_user_config_write(struct pci_dev *pdev, int offset,
>  		break;
>  	}
>  
> -	return pcibios_err_to_errno(ret);
> +	return ret;
>  }
>  
>  static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
> @@ -257,7 +257,7 @@ static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
>  
>  	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
>  	if (ret)
> -		return pcibios_err_to_errno(ret);
> +		return ret;
>  
>  	if (pos >= PCI_CFG_SPACE_SIZE) { /* Extended cap header mangling */
>  		if (offset < 4)
> @@ -295,7 +295,7 @@ static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
>  
>  	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
>  	if (ret)
> -		return pcibios_err_to_errno(ret);
> +		return ret;
>  
>  	return count;
>  }
> @@ -1089,7 +1089,7 @@ static int vfio_msi_config_write(struct vfio_pci_device *vdev, int pos,
>  						 start + PCI_MSI_FLAGS,
>  						 flags);
>  		if (ret)
> -			return pcibios_err_to_errno(ret);
> +			return ret;
>  	}
>  
>  	return count;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Drop unnecessary pcibio_err_to_errno()
  2016-11-18 17:02 ` Alex Williamson
@ 2016-11-19  9:20   ` Cao jin
  0 siblings, 0 replies; 3+ messages in thread
From: Cao jin @ 2016-11-19  9:20 UTC (permalink / raw)
  To: Alex Williamson; +Cc: linux-kernel, kvm

I made this patch so quickly that I forget the details you mentioned.
Thanks a lot for your help.

Sincerely,
Cao jin

On 11/19/2016 01:02 AM, Alex Williamson wrote:
>
> Please prefix patches with their functional area, for instance I'll
> prepend "vfio/pci" to this.  Had you not cc'd me, I wouldn't have
> noticed this patch w/o some mention of vfio in the subject.
>
>
> On Fri, 18 Nov 2016 19:47:38 +0800
> Cao jin <caoj.fnst@cn.fujitsu.com> wrote:
>> pci_user_read/write_config_xxxx() already does the translation.
>>
>
> It would be helpful to mention in the commit where this translation was
> added to those functions, d97ffe236894 ("PCI: Fix return value from
> pci_user_{read,write}_config_*()")
>
> It's also worthwhile to mention that no change in behavior is expected
> since pcibios_err_to_errno() will not mangle existing errno values, the
> call is simply unnecessary given the previous conversion.
>
> I'll modify the title and commit log as described and apply.  Thanks,
>
> Alex
>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   drivers/vfio/pci/vfio_pci_config.c | 10 +++++-----
>>   1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
>> index 65d4a30..e4220ca 100644
>> --- a/drivers/vfio/pci/vfio_pci_config.c
>> +++ b/drivers/vfio/pci/vfio_pci_config.c
>> @@ -152,7 +152,7 @@ static int vfio_user_config_read(struct pci_dev *pdev, int offset,
>>
>>   	*val = cpu_to_le32(tmp_val);
>>
>> -	return pcibios_err_to_errno(ret);
>> +	return ret;
>>   }
>>
>>   static int vfio_user_config_write(struct pci_dev *pdev, int offset,
>> @@ -173,7 +173,7 @@ static int vfio_user_config_write(struct pci_dev *pdev, int offset,
>>   		break;
>>   	}
>>
>> -	return pcibios_err_to_errno(ret);
>> +	return ret;
>>   }
>>
>>   static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
>> @@ -257,7 +257,7 @@ static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
>>
>>   	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
>>   	if (ret)
>> -		return pcibios_err_to_errno(ret);
>> +		return ret;
>>
>>   	if (pos >= PCI_CFG_SPACE_SIZE) { /* Extended cap header mangling */
>>   		if (offset < 4)
>> @@ -295,7 +295,7 @@ static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
>>
>>   	ret = vfio_user_config_read(vdev->pdev, pos, val, count);
>>   	if (ret)
>> -		return pcibios_err_to_errno(ret);
>> +		return ret;
>>
>>   	return count;
>>   }
>> @@ -1089,7 +1089,7 @@ static int vfio_msi_config_write(struct vfio_pci_device *vdev, int pos,
>>   						 start + PCI_MSI_FLAGS,
>>   						 flags);
>>   		if (ret)
>> -			return pcibios_err_to_errno(ret);
>> +			return ret;
>>   	}
>>
>>   	return count;
>
>
>
> .
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-19  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 11:47 [PATCH] Drop unnecessary pcibio_err_to_errno() Cao jin
2016-11-18 17:02 ` Alex Williamson
2016-11-19  9:20   ` Cao jin

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