mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Mergnat <amergnat@baylibre.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>
Subject: Re: [PATCH v4 0/5] Fix pre-1970 date handling
Date: Mon, 28 Apr 2025 12:55:39 +0200	[thread overview]
Message-ID: <4f5bb188-1232-4642-ab7b-d985192f5085@baylibre.com> (raw)
In-Reply-To: <20250428-enable-rtc-v4-0-2b2f7e3f9349@baylibre.com>

Hi Angelo,

I failed to Cc: you for this new revision because it doesn't touch the mtk rtc driver any more. 
Still you might be interested as it fixes the issues for this driver. I'm looking forward to feedback.

On 28/04/2025 12:06, Alexandre Mergnat wrote:
> This series fixes pre-1970 date handling in the RTC subsystem. The changes
> are particularly important for MediaTek platforms using the rtc-mt6397
> driver, which can only store dates from 1900-01-01 to 2027-12-31.
> 
> The handling of pre-1970 dates in time conversion functions is improved, which
> is essential for hardware that must reuse earlier dates once their native format
> limits are reached. Sign-related comparison issues causing incorrect offset
> calculations are fixed, and the test infrastructure is enhanced to validate time
> conversions across the entire date range.
> 
> These improvements ensure the RTC subsystem functions correctly when hardware
> date limits are reached, particularly relevant as the rtc-mt6397 driver will
> hit its upper limit in less than three years.
> 
> ---
> Changes in v4:
> - Remove "rtc: mt6359: Add mt6357 support" to send it in another serie.
> - Change title serie to "Fix pre-1970 date handling " because MT6357
>    support is no more related to this.
> - Remove "arm64: dts: mediatek: Set RTC start year property" because it
>    is not requiered to have MTK RTC working.
> - Remove "rtc: mt6397: Remove start time parameters".
> - Rework time comparison fix to avoid cast.
> - Remove change in rtc_valid_tm.
> - Improve rtc_time64_to_tm change for readability and efficiency.
> - Extend conversion test cover to reach 1900 year value.
> - Link to v3: https://lore.kernel.org/r/20250109-enable-rtc-v3-0-f003e8144419@baylibre.com
> 
> Changes in v3:
> - Rebase on top of rtc-6.15
> - Added explicit start-year property in DTSIs for MT6357, MT6358, and
>    MT6359 PMIC RTCs to ensure consistent values between hardware
>    registers and the RTC framework.
> - Removed hardcoded offset and start_secs parameter in mt6397 driver
>    in favor of using the DTS start-year property.
> - Fixed type comparison issues between signed time64_t and unsigned
>    range values to correctly handle dates before 1970.
> - Added proper handling of negative time values (pre-1970 dates) in
>    time conversion functions.
> - Modified rtc_time64_to_tm() to correctly handle negative timestamp
>    values.
> - Removed the tm_year < 70 restriction in rtc_valid_tm() to allow
>    pre-1970 dates to be validated correctly .
> - Link to v2: https://lore.kernel.org/all/20250109-enable-rtc-v2-0-d7ddc3e73c57@baylibre.com/
> 
> Changes in v2:
> - Split the patch to have:
>    - Add MT6357 support
>    - Fix hwclock issue
> - Handle the year offset in another way, but the V1 way still viable.
> - Link to v1: https://lore.kernel.org/r/20250109-enable-rtc-v1-0-e8223bf55bb8@baylibre.com
> 
> ---
> Alexandre Mergnat (2):
>        rtc: Make rtc_time64_to_tm() support dates before 1970
>        rtc: Fix offset calculation for .start_secs < 0
> 
> Uwe Kleine-König (3):
>        rtc: test: Emit the seconds-since-1970 value instead of days-since-1970
>        rtc: test: Also test time and wday outcome of rtc_time64_to_tm()
>        rtc: test: Test date conversion for dates starting in 1900
> 
>   drivers/rtc/class.c    |  2 +-
>   drivers/rtc/lib.c      | 24 +++++++++++++++++++-----
>   drivers/rtc/lib_test.c | 27 ++++++++++++++++-----------
>   3 files changed, 36 insertions(+), 17 deletions(-)
> ---
> base-commit: 424dfcd441f035769890e6d1faec2081458627b9
> change-id: 20250109-enable-rtc-b2ff435af2d5
> 
> Best regards,

-- 
Regards,
Alexandre

  parent reply	other threads:[~2025-04-28 10:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 10:06 Alexandre Mergnat
2025-04-28 10:06 ` [PATCH v4 1/5] rtc: Make rtc_time64_to_tm() support dates before 1970 Alexandre Mergnat
2025-04-28 16:59   ` Uwe Kleine-König
2025-05-06  7:58     ` Uwe Kleine-König
2025-05-28 10:33       ` Uwe Kleine-König
2025-04-28 10:06 ` [PATCH v4 2/5] rtc: Fix offset calculation for .start_secs < 0 Alexandre Mergnat
2025-04-28 17:00   ` Uwe Kleine-König
2025-04-28 10:06 ` [PATCH v4 3/5] rtc: test: Emit the seconds-since-1970 value instead of days-since-1970 amergnat
2025-04-28 10:06 ` [PATCH v4 4/5] rtc: test: Also test time and wday outcome of rtc_time64_to_tm() amergnat
2025-04-28 10:06 ` [PATCH v4 5/5] rtc: test: Test date conversion for dates starting in 1900 amergnat
2025-04-28 10:55 ` Alexandre Mergnat [this message]
2025-06-01 22:14 ` [PATCH v4 0/5] Fix pre-1970 date handling Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f5bb188-1232-4642-ab7b-d985192f5085@baylibre.com \
    --to=amergnat@baylibre.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®