gpio: mlxbf3: only get IRQ for device instance 0
[ Upstream commit 10af0273a35ab4513ca1546644b8c853044da134 ]
The gpio-mlxbf3 driver interfaces with two GPIO controllers,
device instance 0 and 1. There is a single IRQ resource shared
between the two controllers, and it is found in the ACPI table for
device instance 0. The driver should not attempt to get an IRQ
resource when probing device instance 1, otherwise the following
error is logged:
mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
Signed-off-by: David Thompson <davthompson@nvidia.com>
Reviewed-by: Shravan Kumar Ramani <shravankr@nvidia.com>
Fixes: cd33f216d2
("gpio: mlxbf3: Add gpio driver support")
Link: https://lore.kernel.org/r/20250613163443.1065217-1-davthompson@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f6071c3cfe
commit
6b4311f78a
@@ -190,7 +190,9 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
|
|||||||
struct mlxbf3_gpio_context *gs;
|
struct mlxbf3_gpio_context *gs;
|
||||||
struct gpio_irq_chip *girq;
|
struct gpio_irq_chip *girq;
|
||||||
struct gpio_chip *gc;
|
struct gpio_chip *gc;
|
||||||
|
char *colon_ptr;
|
||||||
int ret, irq;
|
int ret, irq;
|
||||||
|
long num;
|
||||||
|
|
||||||
gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL);
|
gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL);
|
||||||
if (!gs)
|
if (!gs)
|
||||||
@@ -227,25 +229,39 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
|
|||||||
gc->owner = THIS_MODULE;
|
gc->owner = THIS_MODULE;
|
||||||
gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
|
gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
colon_ptr = strchr(dev_name(dev), ':');
|
||||||
if (irq >= 0) {
|
if (!colon_ptr) {
|
||||||
girq = &gs->gc.irq;
|
dev_err(dev, "invalid device name format\n");
|
||||||
gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
|
return -EINVAL;
|
||||||
girq->default_type = IRQ_TYPE_NONE;
|
}
|
||||||
/* This will let us handle the parent IRQ in the driver */
|
|
||||||
girq->num_parents = 0;
|
|
||||||
girq->parents = NULL;
|
|
||||||
girq->parent_handler = NULL;
|
|
||||||
girq->handler = handle_bad_irq;
|
|
||||||
|
|
||||||
/*
|
ret = kstrtol(++colon_ptr, 16, &num);
|
||||||
* Directly request the irq here instead of passing
|
if (ret) {
|
||||||
* a flow-handler because the irq is shared.
|
dev_err(dev, "invalid device instance\n");
|
||||||
*/
|
return ret;
|
||||||
ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
|
}
|
||||||
IRQF_SHARED, dev_name(dev), gs);
|
|
||||||
if (ret)
|
if (!num) {
|
||||||
return dev_err_probe(dev, ret, "failed to request IRQ");
|
irq = platform_get_irq(pdev, 0);
|
||||||
|
if (irq >= 0) {
|
||||||
|
girq = &gs->gc.irq;
|
||||||
|
gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
|
||||||
|
girq->default_type = IRQ_TYPE_NONE;
|
||||||
|
/* This will let us handle the parent IRQ in the driver */
|
||||||
|
girq->num_parents = 0;
|
||||||
|
girq->parents = NULL;
|
||||||
|
girq->parent_handler = NULL;
|
||||||
|
girq->handler = handle_bad_irq;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Directly request the irq here instead of passing
|
||||||
|
* a flow-handler because the irq is shared.
|
||||||
|
*/
|
||||||
|
ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
|
||||||
|
IRQF_SHARED, dev_name(dev), gs);
|
||||||
|
if (ret)
|
||||||
|
return dev_err_probe(dev, ret, "failed to request IRQ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, gs);
|
platform_set_drvdata(pdev, gs);
|
||||||
|
Reference in New Issue
Block a user