The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos
@ 2025-11-17  3:33 Haotian Zhang
  2025-11-17 17:30 ` srinivas pandruvada
  2025-11-18  8:11 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Haotian Zhang @ 2025-11-17  3:33 UTC (permalink / raw)
  To: srinivas.pandruvada, hansg, ilpo.jarvinen
  Cc: platform-driver-x86, linux-kernel, Haotian Zhang

isst_if_probe() uses pci_read_config_dword() that returns PCIBIOS_*
codes. The return code is returned from the probe function as is but
probe functions should return normal errnos. A proper implementation
can be found in drivers/leds/leds-ss4200.c.

Convert PCIBIOS_* return codes using pcibios_err_to_errno() into
normal errno before returning.

Fixes: d3a23584294c ("platform/x86: ISST: Add Intel Speed Select mmio interface")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
index 3f4343147dad..950ede5eab76 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
@@ -108,11 +108,11 @@ static int isst_if_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	ret = pci_read_config_dword(pdev, 0xD0, &mmio_base);
 	if (ret)
-		return ret;
+		return pcibios_err_to_errno(ret);
 
 	ret = pci_read_config_dword(pdev, 0xFC, &pcu_base);
 	if (ret)
-		return ret;
+		return pcibios_err_to_errno(ret);
 
 	pcu_base &= GENMASK(10, 0);
 	base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12;
-- 
2.50.1.windows.1


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

* Re: [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos
  2025-11-17  3:33 [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos Haotian Zhang
@ 2025-11-17 17:30 ` srinivas pandruvada
  2025-11-18  8:11 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: srinivas pandruvada @ 2025-11-17 17:30 UTC (permalink / raw)
  To: Haotian Zhang, hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel

On Mon, 2025-11-17 at 11:33 +0800, Haotian Zhang wrote:
> isst_if_probe() uses pci_read_config_dword() that returns PCIBIOS_*
> codes. The return code is returned from the probe function as is but
> probe functions should return normal errnos. A proper implementation
> can be found in drivers/leds/leds-ss4200.c.
> 
> Convert PCIBIOS_* return codes using pcibios_err_to_errno() into
> normal errno before returning.
> 
> Fixes: d3a23584294c ("platform/x86: ISST: Add Intel Speed Select mmio
> interface")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> index 3f4343147dad..950ede5eab76 100644
> --- a/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> +++ b/drivers/platform/x86/intel/speed_select_if/isst_if_mmio.c
> @@ -108,11 +108,11 @@ static int isst_if_probe(struct pci_dev *pdev,
> const struct pci_device_id *ent)
>  
>  	ret = pci_read_config_dword(pdev, 0xD0, &mmio_base);
>  	if (ret)
> -		return ret;
> +		return pcibios_err_to_errno(ret);
>  
>  	ret = pci_read_config_dword(pdev, 0xFC, &pcu_base);
>  	if (ret)
> -		return ret;
> +		return pcibios_err_to_errno(ret);
>  
>  	pcu_base &= GENMASK(10, 0);
>  	base_addr = (u64)mmio_base << 23 | (u64) pcu_base << 12;

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

* Re: [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos
  2025-11-17  3:33 [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos Haotian Zhang
  2025-11-17 17:30 ` srinivas pandruvada
@ 2025-11-18  8:11 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2025-11-18  8:11 UTC (permalink / raw)
  To: srinivas.pandruvada, hansg, Haotian Zhang
  Cc: platform-driver-x86, linux-kernel

On Mon, 17 Nov 2025 11:33:54 +0800, Haotian Zhang wrote:

> isst_if_probe() uses pci_read_config_dword() that returns PCIBIOS_*
> codes. The return code is returned from the probe function as is but
> probe functions should return normal errnos. A proper implementation
> can be found in drivers/leds/leds-ss4200.c.
> 
> Convert PCIBIOS_* return codes using pcibios_err_to_errno() into
> normal errno before returning.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos
      commit: d8bb447efc5622577994287dc77c684fa8840b30

--
 i.


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

end of thread, other threads:[~2025-11-18  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17  3:33 [PATCH] platform/x86/intel/speed_select_if: Convert PCIBIOS_* return codes to errnos Haotian Zhang
2025-11-17 17:30 ` srinivas pandruvada
2025-11-18  8:11 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox