From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C2CCC43461 for ; Thu, 10 Sep 2020 21:40:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 10BC7208E4 for ; Thu, 10 Sep 2020 21:40:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="YoliJ6Je" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728293AbgIJVkP (ORCPT ); Thu, 10 Sep 2020 17:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730483AbgIJNHI (ORCPT ); Thu, 10 Sep 2020 09:07:08 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBB4DC0617B1 for ; Thu, 10 Sep 2020 06:05:11 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id k15so6597943wrn.10 for ; Thu, 10 Sep 2020 06:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IaFL4VbleH+05IhE/GIVwUyyev+mD5pCupMa3HimnAo=; b=YoliJ6JeT2neyUocbOYQQihpuvFv4h8l53gM/tq0UflJbtP6YafXg0NGQ7bfgUSJI3 SdzIP9QQ3KkUryWMROvFYJ+1qTi4fKcfk2awLiC49Ee0rmvAEbKURBmsvOKEfWriVVrg TxyqLKiW86HzWh9/AOEbTWByvs9sLGpEzzyFnqNHFDb8Wu9MVvl/GqyJ4udi03Ivsspk 2UeKt7RYbDNGOxtBLiOigz3NIDU9VCghlf0PGRHBgmqDFmEkuBgf864tYZF37xLC1Ay/ 1vin1mlRzHtlTgEOHrbV52a+Y4zwMHJgjO2V7B/gkUPIL7t+IwjCjMf74/O7eRGkUDTz F1oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IaFL4VbleH+05IhE/GIVwUyyev+mD5pCupMa3HimnAo=; b=iW0DPZjBcGKv5fn+Lh2ypwtQ5Pa0jGnQZIOLLWh4SY7CBwOLax1hxaAf5Orpq5HIqQ wZtzdST2zo1naK8j7Qe/Hg6jgtG4s8V/ktihIin2g7aeJn5gxA2VNV1xGmOFPllu0Dup fAcCxwM3G3+AxvThBVaFt5F4X3sYxs/bu1c13MWHKKJJJBH8qpMzXpQwqLcWQM418Zv7 Krq2qicTcApLcIH82N1iu2UKv6Q4ccaYM8Tv9cTroJLZXXr2+0vz2YoNPs1UefdLiJw9 boMqLqRXEE6ZMHU0Cy6YTkmLKePX2bpDhHniFukBov6AONSLqIqovToYspPyOImcM55a Btyg== X-Gm-Message-State: AOAM533U2nFF4h/8K5uFhYg20Mbd2l4Zas2M5LpV30BsfdQ25mEHHlgn ZnyoiHfFsd/aw12LLIFgHa9uQw== X-Google-Smtp-Source: ABdhPJxBNAf5uTgzeBjmrtbqSIw0BM3oe+/GacCg08mmFuQ5ITOtCe4FBYRkVweYGuig/JUs6vtymg== X-Received: by 2002:adf:fa0c:: with SMTP id m12mr8678090wrr.406.1599743110489; Thu, 10 Sep 2020 06:05:10 -0700 (PDT) Received: from debian-brgl.home (lfbn-nic-1-68-20.w2-15.abo.wanadoo.fr. [2.15.159.20]) by smtp.gmail.com with ESMTPSA id p16sm9321988wro.71.2020.09.10.06.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 06:05:09 -0700 (PDT) From: Bartosz Golaszewski To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 11/11] rtc: rx8010: use range checking provided by core RTC code Date: Thu, 10 Sep 2020 15:04:46 +0200 Message-Id: <20200910130446.5689-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200910130446.5689-1-brgl@bgdev.pl> References: <20200910130446.5689-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski We don't need to check the time range manually in set_time(), we can use range_min and range_max exposed by struct rtc_device. Signed-off-by: Bartosz Golaszewski --- drivers/rtc/rtc-rx8010.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c index 636e0de02d9b..e78f0808bdff 100644 --- a/drivers/rtc/rtc-rx8010.c +++ b/drivers/rtc/rtc-rx8010.c @@ -140,9 +140,6 @@ static int rx8010_set_time(struct device *dev, struct rtc_time *dt) u8 date[RX8010_YEAR - RX8010_SEC + 1]; int err; - if ((dt->tm_year < 100) || (dt->tm_year > 199)) - return -EINVAL; - /* set STOP bit before changing clock/calendar */ err = regmap_set_bits(rx8010->regs, RX8010_CTRL, RX8010_CTRL_STOP); if (err) @@ -415,6 +412,8 @@ static int rx8010_probe(struct i2c_client *client, rx8010->rtc->ops = &rx8010_rtc_ops; rx8010->rtc->max_user_freq = 1; + rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; + rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099; err = rtc_register_device(rx8010->rtc); if (err) { -- 2.26.1