aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-amd8111.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: rename GPIO set callbacks back to their original namesBartosz Golaszewski2025-08-071-1/+1
| | | | | | | | | | | The conversion of all GPIO drivers to using the .set_rv() and .set_multiple_rv() callbacks from struct gpio_chip (which - unlike their predecessors - return an integer and allow the controller drivers to indicate failures to users) is now complete and the legacy ones have been removed. Rename the new callbacks back to their original names in one sweeping change. Signed-off-by: Bartosz Golaszewski <[email protected]>
* gpio: amd8111: use new line value setter callbacksBartosz Golaszewski2025-03-101-2/+4
| | | | | | | | | struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
* gpio: amd8111: Convert PCIBIOS_* return codes to errnosIlpo Järvinen2024-05-301-1/+3
| | | | | | | | | | | | | amd_gpio_init() uses pci_read_config_dword() that returns PCIBIOS_* codes. The return code is then returned as is but amd_gpio_init() is a module init function that should return normal errnos. Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning it from amd_gpio_init(). Signed-off-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
* gpio: amd8111: Fix PCI device reference count leakXiongfeng Wang2022-11-301-0/+4
| | | | | | | | | | | | | | | | | for_each_pci_dev() is implemented by pci_get_device(). The comment of pci_get_device() says that it will increase the reference count for the returned pci_dev and also decrease the reference count for the input pci_dev @from if it is not NULL. If we break for_each_pci_dev() loop with pdev not NULL, we need to call pci_dev_put() to decrease the reference count. Add the missing pci_dev_put() after the 'out' label. Since pci_dev_put() can handle NULL input parameter, there is no problem for the 'Device not found' branch. For the normal path, add pci_dev_put() in amd_gpio_exit(). Fixes: f942a7de047d ("gpio: add a driver for GPIO pins found on AMD-8111 south bridge chips") Signed-off-by: Xiongfeng Wang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
* drivers: gpio: amd8111: use SPDX-License-IdentifierEnrico Weigelt, metux IT consult2020-12-081-4/+1
| | | | | | | | Prefer SPDX-License-Identifier over hand-written texts. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
* drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printkEnrico Weigelt, metux IT consult2020-12-081-4/+2
| | | | | | | | | For logging in device contexts, dev_*() functions are preferred over raw printk(), which also print out device name. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
* gpio: amd8111: Include proper headerLinus Walleij2018-01-131-1/+1
| | | | | | | This driver has no business including <linux/gpio.h>, it is a driver so include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
* gpio: amd8111: Use devm_request_regionWilliam Breathitt Gray2016-02-151-4/+3
| | | | | | | | | | | By the time request_region is called in the AMD 8111 GPIO driver, a corresponding device structure has already been allocated. The devm_request_region function should be used to help simplify the cleanup code and reduce the possible points of failure. Signed-off-by: William Breathitt Gray <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: amd8111: use gpiochip data pointerLinus Walleij2016-01-051-9/+7
| | | | | | | | | This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Dmitry Eremin-Solenikov <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: change member .dev to .parentLinus Walleij2015-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name .dev in a struct is normally reserved for a struct device that is let us say a superclass to the thing described by the struct. struct gpio_chip stands out by confusingly using a struct device *dev to point to the parent device (such as a platform_device) that represents the hardware. As we want to give gpio_chip:s real devices, this is not working. We need to rename this member to parent. This was done by two coccinelle scripts, I guess it is possible to combine them into one, but I don't know such stuff. They look like this: @@ struct gpio_chip *var; @@ -var->dev +var->parent and: @@ struct gpio_chip var; @@ -var.dev +var.parent and: @@ struct bgpio_chip *var; @@ -var->gc.dev +var->gc.parent Plus a few instances of bgpio that I couldn't figure out how to teach Coccinelle to rewrite. This patch hits all over the place, but I *strongly* prefer this solution to any piecemal approaches that just exercise patch mechanics all over the place. It mainly hits drivers/gpio and drivers/pinctrl which is my own backyard anyway. Cc: Haavard Skinnemoen <[email protected]> Cc: Rafał Miłecki <[email protected]> Cc: Richard Purdie <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Alek Du <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Jiri Kosina <[email protected]> Acked-by: Hans-Christian Egtvedt <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio-amd8111: add release_region on ioport_map failureVarka Bhadram2015-01-191-0/+1
| | | | | | | | | | | Commit ffe4770b9b3483f74 ("gpio-amd8111: check ioport_map return value") adds the error check on ioport_map(). It doesnt release the requested region. On failure this patch release the region that has requested before. Signed-off-by: Varka Bhadram <[email protected]> Reported-by: Alexandre Courbot <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio-amd8111: check ioport_map return valueVarka Bhadram2015-01-151-0/+5
| | | | | | | ioport_map() may fail. Its safe to check the return value. Signed-off-by: Varka Bhadram <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: amd8111: unmap ioport on failure casePramod Gurav2014-10-271-0/+1
| | | | | | | | This change unmaps ioport when gpiochip_add fails Signed-off-by: Pramod Gurav <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: remove all usage of gpio_remove retval in driver/gpioabdoulaye berthe2014-07-221-2/+1
| | | | | Signed-off-by: abdoulaye berthe <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han2013-12-031-1/+1
| | | | | | | | Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro is not preferred. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
* gpio: add a driver for GPIO pins found on AMD-8111 south bridge chipsDmitry Eremin-Solenikov2012-07-121-0/+246
Add a driver to use GPIO pins available on several AMD south bridges (currently only AMD 8111 is supported). Signed-off-by: Dmitry Eremin-Solenikov <[email protected]> Signed-off-by: Linus Walleij <[email protected]>