 spin_unlock(&rtc_lock); 
pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg){	/* Some sanity checks. */	if (_IOC_TYPE(cmd) != RTC_MAGIC)		return -ENOTTY;	if (_IOC_NR(cmd) > RTC_MAX_IOCTL)		return -ENOTTY;	switch (cmd) {		case RTC_RD_TIME:			{				struct rtc_time tm;				get_rtc_time(&tm);				if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) {					return -EFAULT;				}				return 0;			}			break;		case RTC_SET_TIME:			{#ifdef CONFIG_ETRAX_RTC_READONLY				return -EPERM;#else				int leap;				int century;				struct rtc_time tm;				memset(&tm, 0, sizeof (struct rtc_time));				if (!capable(CAP_SYS_TIME))					return -EPERM;				if (copy_from_user(&tm, (struct rtc_time *) arg, sizeof(struct rtc_time)))					return -EFAULT;				/* Convert from struct tm to struct rtc_time. */				tm.tm_year += 1900;				tm.tm_mon += 1;								leap = ((tm.tm_mon == 2) && ((tm.tm_year % 4) == 0)) ? 1 : 0;				/* Perform some sanity checks. */				if ((tm.tm_year < 1970) ||				    (tm.tm_mon > 12) ||				    (tm.tm_mday == 0) ||				    (tm.tm_mday > days_in_month[tm.tm_mon] + leap) ||				    (tm.tm_hour >= 24) ||				    (tm.tm_min >= 60) ||				    (tm.tm_sec >= 60))					return -EINVAL;				century = (tm.tm_year >= 2000) ? 0x80 : 0;				tm.tm_year = tm.tm_year % 100;				BIN_TO_BCD(tm.tm_year);				BIN_TO_BCD(tm.tm_mday);				BIN_TO_BCD(tm.tm_hour);				BIN_TO_BCD(tm.tm_min);				BIN_TO_BCD(tm.tm_sec);				tm.tm_mon |= century;								rtc_write(RTC_YEAR, tm.tm_year);				rtc_write(RTC_MONTH, tm.tm_mon);				rtc_write(RTC_DAY_OF_MONTH, tm.tm_mday);				rtc_write(RTC_HOURS, tm.tm_hour);				rtc_write(RTC_MINUTES, tm.tm_min);				rtc_write(RTC_SECONDS, tm.tm_sec);				return 0;#endif /* !CONFIG_ETRAX_RTC_READONLY */			}		case RTC_VLOW_RD:		{			int vl_bit = 0;			if (rtc_read(RTC_SECONDS) & 0x80) {				vl_bit = 1;				printk(KERN_WARNING "%s: RTC Voltage Low - reliable "				       "date/time information is no longer guaranteed!\n",				       PCF8563_NAME);			}			if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))				return -EFAULT;			return 0;		}		case RTC_VLOW_SET:		{			/* Clear the VL bit in the seconds register */			int ret = rtc_read(RTC_SECONDS);			rtc_write(RTC_SECONDS, (ret & 0x7F));			return 0;		}		default:				return -ENOTTY;	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7e9204265b4ec6680fad9abc7a78b94087983916/pcf8563.c/clean/arch/cris/arch-v10/drivers/pcf8563.c