aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-thunderx.c
diff options
context:
space:
mode:
authorMarc Zyngier <[email protected]>2022-07-07 18:23:09 +0000
committerMarc Zyngier <[email protected]>2022-07-10 08:30:00 +0000
commit91a29af413def677495e447fb9a06957ebc8bed5 (patch)
tree8a0a10b7a95684bb0773f612088ea597ade907f7 /drivers/gpio/gpio-thunderx.c
parentLinux 5.19-rc3 (diff)
downloadkernel-91a29af413def677495e447fb9a06957ebc8bed5.tar.gz
kernel-91a29af413def677495e447fb9a06957ebc8bed5.zip
gpio: Remove dynamic allocation from populate_parent_alloc_arg()
The gpiolib is unique in the way it uses intermediate fwspecs when feeding an interrupt specifier to the parent domain, as it relies on the populate_parent_alloc_arg() callback to perform a dynamic allocation. This is pretty inefficient (we free the structure almost immediately), and the only reason this isn't a stack allocation is that our ThunderX friend uses MSIs rather than a FW-constructed structure. Let's solve it by providing a new type composed of the union of a struct irq_fwspec and a msi_info_t, which satisfies both requirements. This allows us to use a stack allocation, and we can move the handful of users to this new scheme. Also perform some additional cleanup, such as getting rid of the stub versions of the irq_domain_translate_*cell helpers, which are never used when CONFIG_IRQ_DOMAIN_HIERARCHY isn't selected. Tested on a Tegra186. Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Cc: Daniel Palmer <[email protected]> Cc: Romain Perier <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jonathan Hunter <[email protected]> Cc: Robert Richter <[email protected]> Cc: Nobuhiro Iwamatsu <[email protected]> Cc: Andy Gross <[email protected]> Cc: Bjorn Andersson <[email protected]> Acked-by: Bartosz Golaszewski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/gpio/gpio-thunderx.c')
-rw-r--r--drivers/gpio/gpio-thunderx.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
index 9f66deab46ea..e1dedbca0c85 100644
--- a/drivers/gpio/gpio-thunderx.c
+++ b/drivers/gpio/gpio-thunderx.c
@@ -408,18 +408,15 @@ static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
return 0;
}
-static void *thunderx_gpio_populate_parent_alloc_info(struct gpio_chip *chip,
- unsigned int parent_hwirq,
- unsigned int parent_type)
+static int thunderx_gpio_populate_parent_alloc_info(struct gpio_chip *chip,
+ union gpio_irq_fwspec *gfwspec,
+ unsigned int parent_hwirq,
+ unsigned int parent_type)
{
- msi_alloc_info_t *info;
-
- info = kmalloc(sizeof(*info), GFP_KERNEL);
- if (!info)
- return NULL;
+ msi_alloc_info_t *info = &gfwspec->msiinfo;
info->hwirq = parent_hwirq;
- return info;
+ return 0;
}
static int thunderx_gpio_probe(struct pci_dev *pdev,