/* get general purpose IO pin state and direction  */
static int get_gpio(struct slgt_info *info, struct gpio_desc __user *gpio)
/* get general purpose IO pin state and direction  */
static int get_gpio(struct slgt_info *info, struct gpio_desc __user *gpio)
{
	struct gpio_desc gpio;
	if (!info->gpio_present)
		return -EINVAL;
	gpio.state = rd_reg32(info, IOVR);
	gpio.smask = 0xffffffff;
	gpio.dir   = rd_reg32(info, IODR);
	gpio.dmask = 0xffffffff;
	if (copy_to_user(user_gpio, &gpio, sizeof(gpio)))
		return -EFAULT;
	DBGINFO(("%s get_gpio state=%08x dir=%08x\n",
		 info->device_name, gpio.state, gpio.dir));
	return 0;
}