/* Same for RTC */ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen, void *oldval, size_t *oldlenp, void *newval, size_t newlen) { int r; rtctmp = read_persistent_clock(); if (rtctmp < 0) rtctmp = 0; r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen); if (r < 0) return r; if (newval && newlen) rtc_mips_set_mmss(rtctmp); return r; }
/* proc function to read/write RealTime Clock */ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, void *buffer, size_t *lenp, loff_t *ppos) { int r; if (!write) { rtctmp = read_persistent_clock(); /* check for time < 0 and set to 0 */ if (rtctmp < 0) rtctmp = 0; } r = proc_dointvec(table, write, filp, buffer, lenp, ppos); if (r) return r; if (write) rtc_mips_set_mmss(rtctmp); return 0; }
/* proc function to read/write RealTime Clock */ int proc_dolasatrtc(ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { struct timespec ts; int r; if (!write) { read_persistent_clock(&ts); rtctmp = ts.tv_sec; /* check for time < 0 and set to 0 */ if (rtctmp < 0) rtctmp = 0; } r = proc_dointvec(table, write, buffer, lenp, ppos); if (r) return r; if (write) rtc_mips_set_mmss(rtctmp); return 0; }
int update_persistent_clock(struct timespec now) { return rtc_mips_set_mmss(now.tv_sec); }