On Tue, Sep 22, 2015 at 09:37:20PM +0200, Sebastian Reichel wrote: > Hi, > > On Fri, Sep 18, 2015 at 04:39:53PM -0500, Andreas Dannenberg wrote: > > - state->power_good = !gpiod_get_value_cansleep(bq->pg); > > + if (bq->pg_gpio_disable) > > + /* > > + * If we have a chip without a dedicated power-good GPIO or > > + * some other explicit bit that would provide this information > > + * assume the power is good if there is no supply related > > + * fault - and not good otherwise. There is a possibility for > > + * other errors to mask that power in fact is not good but this > > + * is probably the best we can do here. > > + */ > > + switch (state->fault) { > > + case FAULT_INPUT_OVP: > > + case FAULT_INPUT_UVLO: > > + case FAULT_INPUT_LDO_LOW: > > + state->power_good = false; > > + break; > > + default: > > + state->power_good = true; > > + } > > + else > > + state->power_good = !gpiod_get_value_cansleep(bq->pg); > > I guess you can just handle this like an optional gpio > > if(bq->pg) > state->power_good = !gpiod_get_value_cansleep(bq->pg); > else > ... What happens when somebody wants to use GPIO number 0? According to gpio_is_valid() this is a valid GPIO so technically I should not use a check against zero to see whether the user has configured a GPIO for this purpose and wants to use it, no? Regards, -- Andreas Dannenberg Texas Instruments Inc -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html