Skip to content

Commit 7bb7780

Browse files
committed
Merge tag 'gpio-fixes-for-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fix from Bartosz Golaszewski: - fix the way optional interrupts are retrieved from firmware in gpio-mlxbf3 * tag 'gpio-fixes-for-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mlxbf3: use platform_get_irq_optional() Revert "gpio: mlxbf3: only get IRQ for device instance 0"
2 parents 66ba63d + 810bd90 commit 7bb7780

File tree

1 file changed

+19
-35
lines changed

1 file changed

+19
-35
lines changed

drivers/gpio/gpio-mlxbf3.c

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
190190
struct mlxbf3_gpio_context *gs;
191191
struct gpio_irq_chip *girq;
192192
struct gpio_chip *gc;
193-
char *colon_ptr;
194193
int ret, irq;
195-
long num;
196194

197195
gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL);
198196
if (!gs)
@@ -229,39 +227,25 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
229227
gc->owner = THIS_MODULE;
230228
gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
231229

232-
colon_ptr = strchr(dev_name(dev), ':');
233-
if (!colon_ptr) {
234-
dev_err(dev, "invalid device name format\n");
235-
return -EINVAL;
236-
}
237-
238-
ret = kstrtol(++colon_ptr, 16, &num);
239-
if (ret) {
240-
dev_err(dev, "invalid device instance\n");
241-
return ret;
242-
}
243-
244-
if (!num) {
245-
irq = platform_get_irq(pdev, 0);
246-
if (irq >= 0) {
247-
girq = &gs->gc.irq;
248-
gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
249-
girq->default_type = IRQ_TYPE_NONE;
250-
/* This will let us handle the parent IRQ in the driver */
251-
girq->num_parents = 0;
252-
girq->parents = NULL;
253-
girq->parent_handler = NULL;
254-
girq->handler = handle_bad_irq;
255-
256-
/*
257-
* Directly request the irq here instead of passing
258-
* a flow-handler because the irq is shared.
259-
*/
260-
ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
261-
IRQF_SHARED, dev_name(dev), gs);
262-
if (ret)
263-
return dev_err_probe(dev, ret, "failed to request IRQ");
264-
}
230+
irq = platform_get_irq_optional(pdev, 0);
231+
if (irq >= 0) {
232+
girq = &gs->gc.irq;
233+
gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
234+
girq->default_type = IRQ_TYPE_NONE;
235+
/* This will let us handle the parent IRQ in the driver */
236+
girq->num_parents = 0;
237+
girq->parents = NULL;
238+
girq->parent_handler = NULL;
239+
girq->handler = handle_bad_irq;
240+
241+
/*
242+
* Directly request the irq here instead of passing
243+
* a flow-handler because the irq is shared.
244+
*/
245+
ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
246+
IRQF_SHARED, dev_name(dev), gs);
247+
if (ret)
248+
return dev_err_probe(dev, ret, "failed to request IRQ");
265249
}
266250

267251
platform_set_drvdata(pdev, gs);

0 commit comments

Comments
 (0)