Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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"

+18 -34
+18 -34
drivers/gpio/gpio-mlxbf3.c
··· 190 190 struct mlxbf3_gpio_context *gs; 191 191 struct gpio_irq_chip *girq; 192 192 struct gpio_chip *gc; 193 - char *colon_ptr; 194 193 int ret, irq; 195 - long num; 196 194 197 195 gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); 198 196 if (!gs) ··· 227 229 gc->owner = THIS_MODULE; 228 230 gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges; 229 231 230 - colon_ptr = strchr(dev_name(dev), ':'); 231 - if (!colon_ptr) { 232 - dev_err(dev, "invalid device name format\n"); 233 - return -EINVAL; 234 - } 232 + irq = platform_get_irq_optional(pdev, 0); 233 + if (irq >= 0) { 234 + girq = &gs->gc.irq; 235 + gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); 236 + girq->default_type = IRQ_TYPE_NONE; 237 + /* This will let us handle the parent IRQ in the driver */ 238 + girq->num_parents = 0; 239 + girq->parents = NULL; 240 + girq->parent_handler = NULL; 241 + girq->handler = handle_bad_irq; 235 242 236 - ret = kstrtol(++colon_ptr, 16, &num); 237 - if (ret) { 238 - dev_err(dev, "invalid device instance\n"); 239 - return ret; 240 - } 241 - 242 - if (!num) { 243 - irq = platform_get_irq(pdev, 0); 244 - if (irq >= 0) { 245 - girq = &gs->gc.irq; 246 - gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); 247 - girq->default_type = IRQ_TYPE_NONE; 248 - /* This will let us handle the parent IRQ in the driver */ 249 - girq->num_parents = 0; 250 - girq->parents = NULL; 251 - girq->parent_handler = NULL; 252 - girq->handler = handle_bad_irq; 253 - 254 - /* 255 - * Directly request the irq here instead of passing 256 - * a flow-handler because the irq is shared. 257 - */ 258 - ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, 259 - IRQF_SHARED, dev_name(dev), gs); 260 - if (ret) 261 - return dev_err_probe(dev, ret, "failed to request IRQ"); 262 - } 243 + /* 244 + * Directly request the irq here instead of passing 245 + * a flow-handler because the irq is shared. 246 + */ 247 + ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, 248 + IRQF_SHARED, dev_name(dev), gs); 249 + if (ret) 250 + return dev_err_probe(dev, ret, "failed to request IRQ"); 263 251 } 264 252 265 253 platform_set_drvdata(pdev, gs);