/* Check that the given (port, pin) pair is a valid LPC178x/7x GPIO pin. Returns 0 on success, -EINVAL otherwise.  */
static int lpc178x_validate_gpio(const struct lpc178x_gpio_dsc *dsc)
/* Check that the given (port, pin) pair is a valid LPC178x/7x GPIO pin. Returns 0 on success, -EINVAL otherwise.  */
static int lpc178x_validate_gpio(const struct lpc178x_gpio_dsc *dsc)
{
	int rv;
	rv = 0;
	if (!dsc || dsc->port >= LPC178X_GPIO_PORTS ||
	    dsc->pin >= LPC178X_GPIO_NORMAL_PORT_PINS ||
	    (dsc->port == LPC178X_GPIO_PORTS - 1 &&
	     dsc->pin >= LPC178X_GPIO_LAST_PORT_PINS)) {
		if (gd->have_console) {
			printf("GPIO: incorrect params %d.%d.\n",
				dsc ? dsc->port : -1,
				dsc ? dsc->pin  : -1);
		}
		rv = -EINVAL;
	}
	return rv;
}