Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: rdc321x: Convert PCIBIOS_* return codes to errnos

rdc_gpio_config() uses pci_{read,write}_config_dword() that return
PCIBIOS_* codes. rdc_gpio_config() is used for
direction_{input,output}() in the struct gpio_chip which both require
normal errnos to be returned.

Similarly, rdc321x_gpio_probe() that is probe function returns
PCIBIOS_* codes without converting them first into normal errnos.

Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning them to fix both issues.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240527132345.13956-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Ilpo Järvinen and committed by
Bartosz Golaszewski
9a73e037 d4cde6e4

+3 -3
+3 -3
drivers/gpio/gpio-rdc321x.c
··· 102 102 unlock: 103 103 spin_unlock(&gpch->lock); 104 104 105 - return err; 105 + return pcibios_err_to_errno(err); 106 106 } 107 107 108 108 /* configure GPIO pin as input */ ··· 170 170 rdc321x_gpio_dev->reg1_data_base, 171 171 &rdc321x_gpio_dev->data_reg[0]); 172 172 if (err) 173 - return err; 173 + return pcibios_err_to_errno(err); 174 174 175 175 err = pci_read_config_dword(rdc321x_gpio_dev->sb_pdev, 176 176 rdc321x_gpio_dev->reg2_data_base, 177 177 &rdc321x_gpio_dev->data_reg[1]); 178 178 if (err) 179 - return err; 179 + return pcibios_err_to_errno(err); 180 180 181 181 dev_info(&pdev->dev, "registering %d GPIOs\n", 182 182 rdc321x_gpio_dev->chip.ngpio);