Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2408600pxb; Sun, 17 Oct 2021 14:08:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeUFj+yu2SnIzmkETVYv6ymufPXI/02ITdTQSRMSs5P/WfZa76n1626oYnE6HZYw8lprKT X-Received: by 2002:aa7:8d09:0:b0:44b:fd25:dd8a with SMTP id j9-20020aa78d09000000b0044bfd25dd8amr25249606pfe.41.1634504880688; Sun, 17 Oct 2021 14:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634504880; cv=none; d=google.com; s=arc-20160816; b=XO9qnYXI01Hv0tnrvq/awn2Plyjcy1pKki9/wQBh5ZQt+KelEDZWesITRykNJB7wiI 0hZ5XrprCMxCjOE8oepB7MCCmCC9cUxdLzw1JI5NXKNhF8R29Ll4A2bBK4t8Gh51h262 SXyLTxQ9RH05YUm0xN/Mw4kTBzbssUc5lP2p0e/EYNc8eJBKMOtHXQc6P8afyFGzmGBW tAVym+Xw7etvYC6wP3RImKPilhFpJ5ZRtRzEiRe9Zgzc/jyWywLJy+aTDZtv4pqdA48x lm7/e4Nh4dMCHmF2g9PFTFioqX6bpSSRIEVQQMCT68vK3BewREjkXOmGKXrXHzOFb2hG 57zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rc5GU3hFjVj79bmnXbQJYqfC8bzePUY3oLskNiPg5Ro=; b=wv/wh61+/nzEhDE1Hdhx8iZD8HFAox9LMGjMDmnsvBvz+icU0v3teU8S8+fgF3FYcc GqGMjEDNnw/LGUA/HUno4Hyr9ijANkj8xwdfMLfhMgL8M4tkOGUtrksiMq8Uez6LIGkd ex6ryxEApddnA/6AKjR+gAp/NlXCpDm4zEhR0D/SwGNh1aVxy195ceziltLGrHXBsZuP zgEC9LqglI58CssDfPC5nhuc4CYxnEloZEjsRFoOIOkIO+A25rCipYtOlO61A7zZoiYl K0BmI2Se0CJrsi0AZWloKffGb7UHTZ2CmU36McLihjH6LkR98IG4m4pos1qbE+h5Ydcb eDGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si20512407plh.2.2021.10.17.14.07.45; Sun, 17 Oct 2021 14:08:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242667AbhJOTXh (ORCPT + 99 others); Fri, 15 Oct 2021 15:23:37 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:50585 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbhJOTXg (ORCPT ); Fri, 15 Oct 2021 15:23:36 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id B12A4240002; Fri, 15 Oct 2021 19:21:28 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] rtc: add correction parameter Date: Fri, 15 Oct 2021 21:21:17 +0200 Message-Id: <20211015192121.817642-5-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211015192121.817642-1-alexandre.belloni@bootlin.com> References: <20211015192121.817642-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new parameter allowing the get and set the correction using ioctls instead of just sysfs. Signed-off-by: Alexandre Belloni --- drivers/rtc/dev.c | 19 +++++++++++++++++++ include/uapi/linux/rtc.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c index 143c097eff0f..abee1fc4705e 100644 --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -398,6 +398,16 @@ static long rtc_dev_ioctl(struct file *file, param.uvalue = rtc->features[0]; break; + case RTC_PARAM_CORRECTION: + mutex_unlock(&rtc->ops_lock); + if (param.index != 0) + return -EINVAL; + err = rtc_read_offset(rtc, &offset); + mutex_lock(&rtc->ops_lock); + if (err == 0) + param.svalue = offset; + break; + default: err = -EINVAL; } @@ -416,6 +426,15 @@ static long rtc_dev_ioctl(struct file *file, switch(param.param) { case RTC_PARAM_FEATURES: + err = -EINVAL; + break; + + case RTC_PARAM_CORRECTION: + mutex_unlock(&rtc->ops_lock); + if (param.index != 0) + return -EINVAL; + return rtc_set_offset(rtc, param.svalue); + default: err = -EINVAL; } diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h index ded2aaab7ec7..04da6c3082b3 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -136,6 +136,7 @@ struct rtc_param { /* parameter list */ #define RTC_PARAM_FEATURES 0 +#define RTC_PARAM_CORRECTION 1 #define RTC_MAX_FREQ 8192 -- 2.31.1