Skip to content

Commit 56bdf72

Browse files
dthompsoBartosz Golaszewski
authored andcommitted
Revert "gpio: mlxbf3: only get IRQ for device instance 0"
This reverts commit 10af027. While this change was merged, it is not the preferred solution. During review of a similar change to the gpio-mlxbf2 driver, the use of "platform_get_irq_optional" was identified as the preferred solution, so let's use it for gpio-mlxbf3 driver as well. Cc: [email protected] Fixes: 10af027 ("gpio: mlxbf3: only get IRQ for device instance 0") Signed-off-by: David Thompson <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/8d2b630c71b3742f2c74242cf7d602706a6108e6.1754928650.git.davthompson@nvidia.com Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 8f5ae30 commit 56bdf72

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(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)