unsigned long mregs = mstk48t02_regs; 
void * __iomem mregs = mstk48t02_regs; 
static int set_rtc_mmss(unsigned long nowtime){	int real_seconds, real_minutes, chip_minutes;	unsigned long mregs = mstk48t02_regs;#ifdef CONFIG_PCI	unsigned long dregs = ds1287_regs;#else	unsigned long dregs = 0UL;#endif	unsigned long flags;	u8 tmp;	/* 	 * Not having a register set can lead to trouble.	 * Also starfire doesn't have a tod clock.	 */	if (!mregs && !dregs) 		return -1;	if (mregs) {		spin_lock_irqsave(&mostek_lock, flags);		/* Read the current RTC minutes. */		tmp = mostek_read(mregs + MOSTEK_CREG);		tmp |= MSTK_CREG_READ;		mostek_write(mregs + MOSTEK_CREG, tmp);		chip_minutes = MSTK_REG_MIN(mregs);		tmp = mostek_read(mregs + MOSTEK_CREG);		tmp &= ~MSTK_CREG_READ;		mostek_write(mregs + MOSTEK_CREG, tmp);		/*		 * since we're only adjusting minutes and seconds,		 * don't interfere with hour overflow. This avoids		 * messing with unknown time zones but requires your		 * RTC not to be off by more than 15 minutes		 */		real_seconds = nowtime % 60;		real_minutes = nowtime / 60;		if (((abs(real_minutes - chip_minutes) + 15)/30) & 1)			real_minutes += 30;	/* correct for half hour time zone */		real_minutes %= 60;		if (abs(real_minutes - chip_minutes) < 30) {			tmp = mostek_read(mregs + MOSTEK_CREG);			tmp |= MSTK_CREG_WRITE;			mostek_write(mregs + MOSTEK_CREG, tmp);			MSTK_SET_REG_SEC(mregs,real_seconds);			MSTK_SET_REG_MIN(mregs,real_minutes);			tmp = mostek_read(mregs + MOSTEK_CREG);			tmp &= ~MSTK_CREG_WRITE;			mostek_write(mregs + MOSTEK_CREG, tmp);			spin_unlock_irqrestore(&mostek_lock, flags);			return 0;		} else {			spin_unlock_irqrestore(&mostek_lock, flags);			return -1;		}	} else {		int retval = 0;		unsigned char save_control, save_freq_select;		/* Stolen from arch/i386/kernel/time.c, see there for		 * credits and descriptive comments.		 */		spin_lock_irqsave(&rtc_lock, flags);		save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */		CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);		save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */		CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);		chip_minutes = CMOS_READ(RTC_MINUTES);		if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)			BCD_TO_BIN(chip_minutes);		real_seconds = nowtime % 60;		real_minutes = nowtime / 60;		if (((abs(real_minutes - chip_minutes) + 15)/30) & 1)			real_minutes += 30;		real_minutes %= 60;		if (abs(real_minutes - chip_minutes) < 30) {			if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {				BIN_TO_BCD(real_seconds);				BIN_TO_BCD(real_minutes);			}			CMOS_WRITE(real_seconds,RTC_SECONDS);			CMOS_WRITE(real_minutes,RTC_MINUTES);		} else {			printk(KERN_WARNING			       "set_rtc_mmss: can't update from %d to %d\n",			       chip_minutes, real_minutes);			retval = -1;		}		CMOS_WRITE(save_control, RTC_CONTROL);		CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);		spin_unlock_irqrestore(&rtc_lock, flags);		return retval;	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b4bca26c0160f48b4eb04f21d31a229832732013/time.c/clean/arch/sparc64/kernel/time.c