Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3107910pxb; Mon, 18 Oct 2021 08:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrHa7GEcxCZK035ib0qzRasSi2n/GHxKWR+/oLEFFIJ0lOkNu2Z6L+3TiAuIMFmsqL9Sna X-Received: by 2002:a63:ef57:: with SMTP id c23mr24207744pgk.60.1634570526320; Mon, 18 Oct 2021 08:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634570526; cv=none; d=google.com; s=arc-20160816; b=YzSxBROWpuwCEed2aNRDZcYsIa5wvAOyxgwH+8GQRK+H8DJx/fyx83wmjGpLyM+JC1 0ijbtN4jJCx6yLmSDGZnGEb+t6VMJNoWdcyv5PvKIBsmC8CRvoPQ734Xwr47ZQdMKsLh XnV4kamKWFaSsvyj6jedIKHtm6l2w5PRdB9iWwdW4Gy7KxjEihyN6Qu8DwK8EKhaH3de fqjlNR2QUC0AiM4YOQDV8y3uZ00iDyssfOYBboiBmqTnjC8te4cqEElLgp4tK1xoivlt 0lfSWjaTqVgWQ3AxduQLYhlEuHGhuN6ZaSzDp6cHoCYKcd7uUzkBkOMUASkuC72cAE5Z gwmw== 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=E6Ed4xLsKvcr1JSG3E8l1wmkPNeIRGOLf+lYOF0vfJk=; b=khjyy0Vuc5c3CXhHF65+SQNr6orxpF7Jrma0W8VWzos1qGOubUWHlCVrTscCNpAb1f FETVFnjxvzEl1wzDFAOEduu4zTDAnLwGYUSqw4nbV8Hz2NKW7uHNMcIWMP7LgKLo5/gT syh2w5MCPOuRVBDJiTAMOY9k3aaPYQ1L+d8wE3fZ0+0zxAR6a1yjV85+brqL5eNxck1t LIRREdYmzZ1LcC0GJBcoNfSidsLdI3tWzk2aEnXZoxZd0LxTMrLoUvhi4148ZkpT0/2p sD4rYkDbpQWPXXyTECGHcYmF01ZaTxavabzlSg5tMfbU2VB2HUwJlgWMbxs1Vn823oZ7 Kl6A== 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 j190si150607pgd.450.2021.10.18.08.21.52; Mon, 18 Oct 2021 08:22:06 -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 S233278AbhJRPV7 (ORCPT + 99 others); Mon, 18 Oct 2021 11:21:59 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:36321 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233262AbhJRPVy (ORCPT ); Mon, 18 Oct 2021 11:21:54 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id AB4B210000D; Mon, 18 Oct 2021 15:19:41 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] rtc: add correction parameter Date: Mon, 18 Oct 2021 17:19:30 +0200 Message-Id: <20211018151933.76865-5-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018151933.76865-1-alexandre.belloni@bootlin.com> References: <20211018151933.76865-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 c83bb9a4fa4f..5debe82439c2 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