return *priv->port; 
ret =  *priv->port; 
gpio_ioctl(struct inode *inode, struct file *file,	   unsigned int cmd, unsigned long arg){	unsigned long flags;	unsigned long val;	struct gpio_private *priv = (struct gpio_private *)file->private_data;	if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {		return -EINVAL;	}	switch (_IOC_NR(cmd)) {	case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */		// read the port		if (USE_PORTS(priv)) {			return *priv->port;		} else if (priv->minor == GPIO_MINOR_G) {			return (*R_PORT_G_DATA) & 0x7FFFFFFF;		}		break;	case IO_SETBITS:		local_irq_save(flags); local_irq_disable();		// set changeable bits with a 1 in arg		if (USE_PORTS(priv)) {			*priv->port = *priv->shadow |= 			  ((unsigned char)arg & priv->changeable_bits);		} else if (priv->minor == GPIO_MINOR_G) {			*R_PORT_G_DATA = port_g_data_shadow |= (arg & dir_g_out_bits);		}		local_irq_restore(flags);		break;	case IO_CLRBITS:		local_irq_save(flags); local_irq_disable();		// clear changeable bits with a 1 in arg		if (USE_PORTS(priv)) {			*priv->port = *priv->shadow &= 			 ~((unsigned char)arg & priv->changeable_bits);		} else if (priv->minor == GPIO_MINOR_G) {			*R_PORT_G_DATA = port_g_data_shadow &= ~((unsigned long)arg & dir_g_out_bits);		}		local_irq_restore(flags);		break;	case IO_HIGHALARM:		// set alarm when bits with 1 in arg go high		priv->highalarm |= arg;		gpio_some_alarms = 1;		break;	case IO_LOWALARM:		// set alarm when bits with 1 in arg go low		priv->lowalarm |= arg;		gpio_some_alarms = 1;		break;	case IO_CLRALARM:		// clear alarm for bits with 1 in arg		priv->highalarm &= ~arg;		priv->lowalarm  &= ~arg;		{			/* Must update gpio_some_alarms */			struct gpio_private *p = alarmlist;			int some_alarms;			some_alarms = 0;			while (p) {				if (p->highalarm | p->lowalarm) {					some_alarms = 1;					break;				}				p = p->next;			}			gpio_some_alarms = some_alarms;		}		break;	case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */		/* Read direction 0=input 1=output */		if (USE_PORTS(priv)) {			return *priv->dir_shadow;		} else if (priv->minor == GPIO_MINOR_G) {			/* Note: Some bits are both in and out,			 * Those that are dual is set here as well.			 */			return (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF;		}	case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */		/* Set direction 0=unchanged 1=input, 		 * return mask with 1=input 		 */		return setget_input(priv, arg) & 0x7FFFFFFF;		break;	case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */		/* Set direction 0=unchanged 1=output, 		 * return mask with 1=output 		 */		return setget_output(priv, arg) & 0x7FFFFFFF;	case IO_SHUTDOWN:		SOFT_SHUTDOWN();		break;	case IO_GET_PWR_BT:#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN)		return (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT));#else		return 0;#endif		break;	case IO_CFG_WRITE_MODE:		priv->clk_mask = arg & 0xFF;		priv->data_mask = (arg >> 8) & 0xFF;		priv->write_msb = (arg >> 16) & 0x01;		/* Check if we're allowed to change the bits and		 * the direction is correct		 */		if (!((priv->clk_mask & priv->changeable_bits) &&		      (priv->data_mask & priv->changeable_bits) &&		      (priv->clk_mask & *priv->dir_shadow) &&		      (priv->data_mask & *priv->dir_shadow)))		{			priv->clk_mask = 0;			priv->data_mask = 0;			return -EPERM;		}		break;	case IO_READ_INBITS: 		/* *arg is result of reading the input pins */		if (USE_PORTS(priv)) {			val = *priv->port;		} else if (priv->minor == GPIO_MINOR_G) {			val = *R_PORT_G_DATA;		}		if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))			return -EFAULT;		return 0;		break;	case IO_READ_OUTBITS:		 /* *arg is result of reading the output shadow */		if (USE_PORTS(priv)) {			val = *priv->shadow;		} else if (priv->minor == GPIO_MINOR_G) {			val = port_g_data_shadow;		}		if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))			return -EFAULT;		break;	case IO_SETGET_INPUT: 		/* bits set in *arg is set to input,		 * *arg updated with current input pins.		 */		if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))			return -EFAULT;		val = setget_input(priv, val);		if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))			return -EFAULT;		break;	case IO_SETGET_OUTPUT:		/* bits set in *arg is set to output,		 * *arg updated with current output pins.		 */		if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))			return -EFAULT;		val = setget_output(priv, val);		if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))			return -EFAULT;		break;	default:		if (priv->minor == GPIO_MINOR_LEDS)			return gpio_leds_ioctl(cmd, arg);		else			return -EINVAL;	} /* switch */		return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7e9204265b4ec6680fad9abc7a78b94087983916/gpio.c/buggy/arch/cris/arch-v10/drivers/gpio.c