From 61598093bbdd283a7edc367d900f223070ead8d2 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Fri, 10 May 2024 07:43:03 +0000 Subject: [PATCH] add ax88772C AX88772C_eeprom_tools --- kernel/drivers/rtc/rtc-vr41xx.c | 32 ++++++++++++-------------------- 1 files changed, 12 insertions(+), 20 deletions(-) diff --git a/kernel/drivers/rtc/rtc-vr41xx.c b/kernel/drivers/rtc/rtc-vr41xx.c index 70f013e..c367104 100644 --- a/kernel/drivers/rtc/rtc-vr41xx.c +++ b/kernel/drivers/rtc/rtc-vr41xx.c @@ -1,22 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver for NEC VR4100 series Real Time Clock unit. * * Copyright (C) 2003-2008 Yoichi Yuasa <yuasa@linux-mips.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/compat.h> #include <linux/err.h> #include <linux/fs.h> #include <linux/init.h> @@ -79,6 +67,9 @@ #define rtc2_read(offset) readw(rtc2_base + (offset)) #define rtc2_write(offset, value) writew((value), rtc2_base + (offset)) +/* 32-bit compat for ioctls that nobody else uses */ +#define RTC_EPOCH_READ32 _IOR('p', 0x0d, __u32) + static unsigned long epoch = 1970; /* Jan 1 1970 00:00:00 */ static DEFINE_SPINLOCK(rtc_lock); @@ -136,8 +127,7 @@ time64_t epoch_sec, current_sec; epoch_sec = mktime64(epoch, 1, 1, 0, 0, 0); - current_sec = mktime64(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, - time->tm_hour, time->tm_min, time->tm_sec); + current_sec = rtc_tm_to_time64(time); write_elapsed_second(current_sec - epoch_sec); @@ -158,7 +148,7 @@ spin_unlock_irq(&rtc_lock); - rtc_time_to_tm((high << 17) | (mid << 1) | (low >> 15), time); + rtc_time64_to_tm((high << 17) | (mid << 1) | (low >> 15), time); return 0; } @@ -166,10 +156,8 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) { time64_t alarm_sec; - struct rtc_time *time = &wkalrm->time; - alarm_sec = mktime64(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, - time->tm_hour, time->tm_min, time->tm_sec); + alarm_sec = rtc_tm_to_time64(&wkalrm->time); spin_lock_irq(&rtc_lock); @@ -195,6 +183,10 @@ switch (cmd) { case RTC_EPOCH_READ: return put_user(epoch, (unsigned long __user *)arg); +#ifdef CONFIG_64BIT + case RTC_EPOCH_READ32: + return put_user(epoch, (unsigned int __user *)arg); +#endif case RTC_EPOCH_SET: /* Doesn't support before 1900 */ if (arg < 1900) -- Gitblit v1.6.2