/* Return the state of an input GPIO. Returns 0 or 1 on success, -EINVAL otherwise.  */
int lpc178x_gpin_get(const struct lpc178x_gpio_dsc *dsc)
/* Return the state of an input GPIO. Returns 0 or 1 on success, -EINVAL otherwise.  */
int lpc178x_gpin_get(const struct lpc178x_gpio_dsc *dsc)
{
	int rv;
	rv = lpc178x_validate_gpio(dsc);
	if (rv == 0)
		rv = (LPC178X_GPIO(dsc->port)->fiopin & (1 << dsc->pin)) ? 1 : 0;
	return rv;
}