On Sun, Oct 8, 2017 at 6:20 PM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote: > On Tue, Sep 26, 2017 at 01:09:11AM +0200, Linus Walleij wrote: >> static int fan_alarm_init(struct gpio_fan_data *fan_data) >> { >> - int err; >> int alarm_irq; >> struct device *dev = fan_data->dev; >> >> - err = devm_gpio_request(dev, fan_data->alarm_gpio, "GPIO fan alarm"); >> - if (err) >> - return err; >> - >> - err = gpio_direction_input(fan_data->alarm_gpio); >> - if (err) >> - return err; >> - > Followup question: I assume this is no longer necessary because the pin > is used as interrupt pin ? It is not longer necessary because it is requested as input in probe(): /* Alarm GPIO if one exists */ fan_data->alarm_gpio = devm_gpiod_get_optional(dev, "alarm", GPIOD_IN); if (IS_ERR(fan_data->alarm_gpio)) return PTR_ERR(fan_data->alarm_gpio); GPIOD_IN takes care of setting the line as input. > If so, what if it can not be used as interrupt pin (ie gpiod_to_irq() > fails) ? It now looks like this: /* * If the alarm GPIO don't support interrupts, just leave * without initializing the fail notification support. */ alarm_irq = gpiod_to_irq(fan_data->alarm_gpio); if (alarm_irq < 0) return 0; That should be <= 0 since 0 is not a legal IRQ number though so fixing that too. (And hoping noone is using the illegal 0 irq anymore.) It was essentially the same before though. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html