mbox series

[00/51] rtc: stop using rtc deprecated functions

Message ID 1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org
Headers show
Series rtc: stop using rtc deprecated functions | expand

Message

Benjamin Gaignard June 20, 2017, 9:35 a.m. UTC
rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they
rely on 32bits variables and that will make rtc break in y2038/2016.

The goal of this series of patches is ti stop using those two functions
and use instead to safer 64bits ones.

It also remove change .set_mmss to set_mmss64 callback for the same reasons.

Those 51 patches almost clean all the drivers except the few that I haven't
been able to compile because of cross-toolchains issues (au1xxx, mpc5121, ps3,
puv3, sun4v, tx4939, starfire, ls1x ...)

Obviously I don't have all those hardwares in my hands so I have only check
that the patches compile without warnings but it up to each maintainer to
valid them on real hardware.

Benjamin Gaignard (51):
  x86: rtc: stop using rtc deprecated functions
  x86: intel-mid: vrtc: stop using rtc deprecated functions
  net: broadcom: stop using rtc deprecated functions
  rtc: 88pm80x: stop using rtc deprecated functions
  rtc: 88pm860x: stop using rtc deprecated functions
  rtc: ab-b5ze-s3: stop using rtc deprecated functions
  rtc: ab8500: stop using rtc deprecated functions
  rtc: armada38x: stop using rtc deprecated functions
  rtc: at32ap700x: stop using rtc deprecated functions
  rtc: at91sam9: stop using rtc deprecated functions
  rtc: bfin: stop using rtc deprecated functions
  rtc: coh901331: stop using rtc deprecated functions
  rtc: cpcap: stop using rtc deprecated functions
  rtc: da9063: stop using rtc deprecated functions
  rtc: da9063: stop using rtc deprecated functions
  rtc: davinci: stop using rtc deprecated functions
  rtc: digicolor: stop using rtc deprecated functions
  rtc: dm355evm: stop using rtc deprecated functions
  rtc: ds1305: stop using rtc deprecated functions
  rtc: ds1374: stop using rtc deprecated functions
  rtc: ds1511: stop using rtc deprecated functions
  rtc: ds1553: stop using rtc deprecated functions
  rtc: ds1672: stop using rtc deprecated functions
  rtc: ds2404: stop using rtc deprecated functions
  rtc: ep93xx: stop using rtc deprecated functions
  rtc: gemini: stop using rtc deprecated functions
  rtc: imxdi: stop using rtc deprecated functions
  rtc: jz4740: stop using rtc deprecated functions
  rtc: lpc32xx: stop using rtc deprecated functions
  rtc: mv: stop using rtc deprecated functions
  rtc: omap: stop using rtc deprecated functions
  rtc: pcap: stop using rtc deprecated functions
  rtc: pl030: stop using rtc deprecated functions
  rtc: pl031: stop using rtc deprecated functions
  rtc: pm8xxx: stop using rtc deprecated functions
  rtc: rs5c348: stop using rtc deprecated functions
  rtc: sa1100: stop using rtc deprecated functions
  rtc: sh: stop using rtc deprecated functions
  rtc: sirfsoc: stop using rtc deprecated functions
  rtc: snvs: stop using rtc deprecated functions
  rtc: stk17ta8: stop using rtc deprecated functions
  rtc: stmp3xxx: stop using rtc deprecated functions
  rtc: sun6i: stop using rtc deprecated functions
  rtc: sysfs: stop using rtc deprecated functions
  rtc: tegra stop using rtc deprecated functions
  rtc: test: stop using rtc deprecated functions
  rtc: tps6586: stop using rtc deprecated functions
  rtc: vr41xx: stop using rtc deprecated functions
  rtc: wm831x: stop using rtc deprecated functions
  rtc: xgene stop using rtc deprecated functions
  power: suspend test: stop using rtc deprecated functions

 arch/x86/kernel/rtc.c                        |  6 ++--
 arch/x86/platform/intel-mid/intel_mid_vrtc.c |  2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt.c    |  2 +-
 drivers/rtc/rtc-88pm80x.c                    | 44 +++++++++++++--------------
 drivers/rtc/rtc-88pm860x.c                   | 40 ++++++++++++-------------
 drivers/rtc/rtc-ab-b5ze-s3.c                 | 45 ++++++++--------------------
 drivers/rtc/rtc-ab8500.c                     | 26 ++++++++--------
 drivers/rtc/rtc-armada38x.c                  | 34 +++++++++------------
 drivers/rtc/rtc-at32ap700x.c                 | 29 ++++++++----------
 drivers/rtc/rtc-at91sam9.c                   | 18 ++++-------
 drivers/rtc/rtc-bfin.c                       | 24 +++++++--------
 drivers/rtc/rtc-coh901331.c                  | 14 +++++----
 drivers/rtc/rtc-cpcap.c                      |  8 ++---
 drivers/rtc/rtc-da9052.c                     |  8 ++---
 drivers/rtc/rtc-da9063.c                     |  8 ++---
 drivers/rtc/rtc-davinci.c                    |  8 ++---
 drivers/rtc/rtc-digicolor.c                  |  4 +--
 drivers/rtc/rtc-dm355evm.c                   |  6 ++--
 drivers/rtc/rtc-ds1305.c                     | 11 +++----
 drivers/rtc/rtc-ds1374.c                     |  6 ++--
 drivers/rtc/rtc-ds1511.c                     |  2 +-
 drivers/rtc/rtc-ds1553.c                     |  2 +-
 drivers/rtc/rtc-ds1672.c                     |  8 ++---
 drivers/rtc/rtc-ds2404.c                     |  8 ++---
 drivers/rtc/rtc-ep93xx.c                     | 10 +++----
 drivers/rtc/rtc-gemini.c                     |  8 ++---
 drivers/rtc/rtc-imxdi.c                      | 16 +++++-----
 drivers/rtc/rtc-jz4740.c                     | 12 ++++----
 drivers/rtc/rtc-lpc32xx.c                    | 19 +++++-------
 drivers/rtc/rtc-mv.c                         |  2 +-
 drivers/rtc/rtc-omap.c                       |  6 ++--
 drivers/rtc/rtc-pcap.c                       | 16 +++++-----
 drivers/rtc/rtc-pl030.c                      | 24 +++++++--------
 drivers/rtc/rtc-pl031.c                      | 31 ++++++++-----------
 drivers/rtc/rtc-pm8xxx.c                     | 22 +++++++-------
 drivers/rtc/rtc-rs5c348.c                    |  4 +--
 drivers/rtc/rtc-sa1100.c                     | 25 +++++++---------
 drivers/rtc/rtc-sh.c                         |  2 +-
 drivers/rtc/rtc-sirfsoc.c                    | 18 +++++------
 drivers/rtc/rtc-snvs.c                       | 14 ++++-----
 drivers/rtc/rtc-stk17ta8.c                   |  2 +-
 drivers/rtc/rtc-stmp3xxx.c                   | 12 ++++----
 drivers/rtc/rtc-sun6i.c                      | 14 ++++-----
 drivers/rtc/rtc-sysfs.c                      | 25 ++++++++--------
 drivers/rtc/rtc-tegra.c                      | 22 +++++++-------
 drivers/rtc/rtc-test.c                       | 17 +----------
 drivers/rtc/rtc-tps6586x.c                   | 26 ++++++++--------
 drivers/rtc/rtc-vr41xx.c                     |  6 ++--
 drivers/rtc/rtc-wm831x.c                     | 28 +++++++----------
 drivers/rtc/rtc-xgene.c                      | 12 ++++----
 kernel/power/suspend_test.c                  |  6 ++--
 51 files changed, 342 insertions(+), 420 deletions(-)

-- 
CC: adi-buildroot-devel@lists.sourceforge.net
CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>
CC: Gregory Clement <gregory.clement@free-electrons.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Jason Cooper <jason@lakedaemon.net>
CC: John Stultz <john.stultz@linaro.org>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-kernel@vger.kernel.org
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Michael Chan <michael.chan@broadcom.com>
CC: netdev@vger.kernel.org
CC: rtc-linux@googlegroups.com
CC: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
CC: Support Opensource <support.opensource@diasemi.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: x86@kernel.org
CC: Baruch Siach <baruch@tkos.co.il>
CC: Hans Ulli Kroll <ulli.kroll@googlemail.com>
CC: Vladimir Zapolskiy <vz@mleia.com>
CC: Sylvain Lemieux <slemieux.tyco@gmail.com>
CC: Barry Song <baohua@kernel.org>
CC: Maxime Ripard <maxime.ripard@free-electrons.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: Thierry Reding <thierry.reding@gmail.com>
CC: Jonathan Hunter <jonathanh@nvidia.com>
CC: linux-tegra@vger.kernel.org
CC: patches@opensource.wolfsonmicro.com
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
CC: Pavel Machek <pavel@ucw.cz>
CC: Len Brown <len.brown@intel.com>
CC: linux-pm@vger.kernel.org

1.9.1

Comments

Alexandre Belloni June 20, 2017, 10:03 a.m. UTC | #1
On 20/06/2017 at 11:35:08 +0200, Benjamin Gaignard wrote:
> rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they

> rely on 32bits variables and that will make rtc break in y2038/2016.


Please don't, because this hide the fact that the hardware will not
handle dates in y2038 anyway and as pointed by Russell a few month ago,
rtc_time_to_tm will be able to catch it but the 64 bit version will
silently ignore it.


> The goal of this series of patches is ti stop using those two functions

> and use instead to safer 64bits ones.

> 

> It also remove change .set_mmss to set_mmss64 callback for the same reasons.

> 

> Those 51 patches almost clean all the drivers except the few that I haven't

> been able to compile because of cross-toolchains issues (au1xxx, mpc5121, ps3,

> puv3, sun4v, tx4939, starfire, ls1x ...)

> 

> Obviously I don't have all those hardwares in my hands so I have only check

> that the patches compile without warnings but it up to each maintainer to

> valid them on real hardware.

> 

> Benjamin Gaignard (51):

>   x86: rtc: stop using rtc deprecated functions

>   x86: intel-mid: vrtc: stop using rtc deprecated functions

>   net: broadcom: stop using rtc deprecated functions

>   rtc: 88pm80x: stop using rtc deprecated functions

>   rtc: 88pm860x: stop using rtc deprecated functions

>   rtc: ab-b5ze-s3: stop using rtc deprecated functions

>   rtc: ab8500: stop using rtc deprecated functions

>   rtc: armada38x: stop using rtc deprecated functions

>   rtc: at32ap700x: stop using rtc deprecated functions

>   rtc: at91sam9: stop using rtc deprecated functions

>   rtc: bfin: stop using rtc deprecated functions

>   rtc: coh901331: stop using rtc deprecated functions

>   rtc: cpcap: stop using rtc deprecated functions

>   rtc: da9063: stop using rtc deprecated functions

>   rtc: da9063: stop using rtc deprecated functions

>   rtc: davinci: stop using rtc deprecated functions

>   rtc: digicolor: stop using rtc deprecated functions

>   rtc: dm355evm: stop using rtc deprecated functions

>   rtc: ds1305: stop using rtc deprecated functions

>   rtc: ds1374: stop using rtc deprecated functions

>   rtc: ds1511: stop using rtc deprecated functions

>   rtc: ds1553: stop using rtc deprecated functions

>   rtc: ds1672: stop using rtc deprecated functions

>   rtc: ds2404: stop using rtc deprecated functions

>   rtc: ep93xx: stop using rtc deprecated functions

>   rtc: gemini: stop using rtc deprecated functions

>   rtc: imxdi: stop using rtc deprecated functions

>   rtc: jz4740: stop using rtc deprecated functions

>   rtc: lpc32xx: stop using rtc deprecated functions

>   rtc: mv: stop using rtc deprecated functions

>   rtc: omap: stop using rtc deprecated functions

>   rtc: pcap: stop using rtc deprecated functions

>   rtc: pl030: stop using rtc deprecated functions

>   rtc: pl031: stop using rtc deprecated functions

>   rtc: pm8xxx: stop using rtc deprecated functions

>   rtc: rs5c348: stop using rtc deprecated functions

>   rtc: sa1100: stop using rtc deprecated functions

>   rtc: sh: stop using rtc deprecated functions

>   rtc: sirfsoc: stop using rtc deprecated functions

>   rtc: snvs: stop using rtc deprecated functions

>   rtc: stk17ta8: stop using rtc deprecated functions

>   rtc: stmp3xxx: stop using rtc deprecated functions

>   rtc: sun6i: stop using rtc deprecated functions

>   rtc: sysfs: stop using rtc deprecated functions

>   rtc: tegra stop using rtc deprecated functions

>   rtc: test: stop using rtc deprecated functions

>   rtc: tps6586: stop using rtc deprecated functions

>   rtc: vr41xx: stop using rtc deprecated functions

>   rtc: wm831x: stop using rtc deprecated functions

>   rtc: xgene stop using rtc deprecated functions

>   power: suspend test: stop using rtc deprecated functions

> 

>  arch/x86/kernel/rtc.c                        |  6 ++--

>  arch/x86/platform/intel-mid/intel_mid_vrtc.c |  2 +-

>  drivers/net/ethernet/broadcom/bnxt/bnxt.c    |  2 +-

>  drivers/rtc/rtc-88pm80x.c                    | 44 +++++++++++++--------------

>  drivers/rtc/rtc-88pm860x.c                   | 40 ++++++++++++-------------

>  drivers/rtc/rtc-ab-b5ze-s3.c                 | 45 ++++++++--------------------

>  drivers/rtc/rtc-ab8500.c                     | 26 ++++++++--------

>  drivers/rtc/rtc-armada38x.c                  | 34 +++++++++------------

>  drivers/rtc/rtc-at32ap700x.c                 | 29 ++++++++----------

>  drivers/rtc/rtc-at91sam9.c                   | 18 ++++-------

>  drivers/rtc/rtc-bfin.c                       | 24 +++++++--------

>  drivers/rtc/rtc-coh901331.c                  | 14 +++++----

>  drivers/rtc/rtc-cpcap.c                      |  8 ++---

>  drivers/rtc/rtc-da9052.c                     |  8 ++---

>  drivers/rtc/rtc-da9063.c                     |  8 ++---

>  drivers/rtc/rtc-davinci.c                    |  8 ++---

>  drivers/rtc/rtc-digicolor.c                  |  4 +--

>  drivers/rtc/rtc-dm355evm.c                   |  6 ++--

>  drivers/rtc/rtc-ds1305.c                     | 11 +++----

>  drivers/rtc/rtc-ds1374.c                     |  6 ++--

>  drivers/rtc/rtc-ds1511.c                     |  2 +-

>  drivers/rtc/rtc-ds1553.c                     |  2 +-

>  drivers/rtc/rtc-ds1672.c                     |  8 ++---

>  drivers/rtc/rtc-ds2404.c                     |  8 ++---

>  drivers/rtc/rtc-ep93xx.c                     | 10 +++----

>  drivers/rtc/rtc-gemini.c                     |  8 ++---

>  drivers/rtc/rtc-imxdi.c                      | 16 +++++-----

>  drivers/rtc/rtc-jz4740.c                     | 12 ++++----

>  drivers/rtc/rtc-lpc32xx.c                    | 19 +++++-------

>  drivers/rtc/rtc-mv.c                         |  2 +-

>  drivers/rtc/rtc-omap.c                       |  6 ++--

>  drivers/rtc/rtc-pcap.c                       | 16 +++++-----

>  drivers/rtc/rtc-pl030.c                      | 24 +++++++--------

>  drivers/rtc/rtc-pl031.c                      | 31 ++++++++-----------

>  drivers/rtc/rtc-pm8xxx.c                     | 22 +++++++-------

>  drivers/rtc/rtc-rs5c348.c                    |  4 +--

>  drivers/rtc/rtc-sa1100.c                     | 25 +++++++---------

>  drivers/rtc/rtc-sh.c                         |  2 +-

>  drivers/rtc/rtc-sirfsoc.c                    | 18 +++++------

>  drivers/rtc/rtc-snvs.c                       | 14 ++++-----

>  drivers/rtc/rtc-stk17ta8.c                   |  2 +-

>  drivers/rtc/rtc-stmp3xxx.c                   | 12 ++++----

>  drivers/rtc/rtc-sun6i.c                      | 14 ++++-----

>  drivers/rtc/rtc-sysfs.c                      | 25 ++++++++--------

>  drivers/rtc/rtc-tegra.c                      | 22 +++++++-------

>  drivers/rtc/rtc-test.c                       | 17 +----------

>  drivers/rtc/rtc-tps6586x.c                   | 26 ++++++++--------

>  drivers/rtc/rtc-vr41xx.c                     |  6 ++--

>  drivers/rtc/rtc-wm831x.c                     | 28 +++++++----------

>  drivers/rtc/rtc-xgene.c                      | 12 ++++----

>  kernel/power/suspend_test.c                  |  6 ++--

>  51 files changed, 342 insertions(+), 420 deletions(-)

> 

> -- 

> CC: adi-buildroot-devel@lists.sourceforge.net

> CC: Alessandro Zummo <a.zummo@towertech.it>

> CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> CC: Gregory Clement <gregory.clement@free-electrons.com>

> CC: Ingo Molnar <mingo@redhat.com>

> CC: Jason Cooper <jason@lakedaemon.net>

> CC: John Stultz <john.stultz@linaro.org>

> CC: linux-arm-kernel@lists.infradead.org

> CC: linux-kernel@vger.kernel.org

> CC: Linus Walleij <linus.walleij@linaro.org>

> CC: Michael Chan <michael.chan@broadcom.com>

> CC: netdev@vger.kernel.org

> CC: rtc-linux@googlegroups.com

> CC: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

> CC: Support Opensource <support.opensource@diasemi.com>

> CC: Thomas Gleixner <tglx@linutronix.de>

> CC: x86@kernel.org

> CC: Baruch Siach <baruch@tkos.co.il>

> CC: Hans Ulli Kroll <ulli.kroll@googlemail.com>

> CC: Vladimir Zapolskiy <vz@mleia.com>

> CC: Sylvain Lemieux <slemieux.tyco@gmail.com>

> CC: Barry Song <baohua@kernel.org>

> CC: Maxime Ripard <maxime.ripard@free-electrons.com>

> CC: Chen-Yu Tsai <wens@csie.org>

> CC: Thierry Reding <thierry.reding@gmail.com>

> CC: Jonathan Hunter <jonathanh@nvidia.com>

> CC: linux-tegra@vger.kernel.org

> CC: patches@opensource.wolfsonmicro.com

> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>

> CC: Pavel Machek <pavel@ucw.cz>

> CC: Len Brown <len.brown@intel.com>

> CC: linux-pm@vger.kernel.org

> 

> 1.9.1

> 


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Alexandre Belloni June 20, 2017, 10:07 a.m. UTC | #2
On 20/06/2017 at 12:03:48 +0200, Alexandre Belloni wrote:
> On 20/06/2017 at 11:35:08 +0200, Benjamin Gaignard wrote:

> > rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they

> > rely on 32bits variables and that will make rtc break in y2038/2016.

> 

> Please don't, because this hide the fact that the hardware will not

> handle dates in y2038 anyway and as pointed by Russell a few month ago,

> rtc_time_to_tm will be able to catch it but the 64 bit version will

> silently ignore it.

> 


Just to be clear, it is fine on your ST hardware because it uses a 64bit
counter. Most of the one you patched are using 32 bit counters and so
will break anyway.

> 

> > The goal of this series of patches is ti stop using those two functions

> > and use instead to safer 64bits ones.

> > 

> > It also remove change .set_mmss to set_mmss64 callback for the same reasons.

> > 

> > Those 51 patches almost clean all the drivers except the few that I haven't

> > been able to compile because of cross-toolchains issues (au1xxx, mpc5121, ps3,

> > puv3, sun4v, tx4939, starfire, ls1x ...)

> > 

> > Obviously I don't have all those hardwares in my hands so I have only check

> > that the patches compile without warnings but it up to each maintainer to

> > valid them on real hardware.

> > 

> > Benjamin Gaignard (51):

> >   x86: rtc: stop using rtc deprecated functions

> >   x86: intel-mid: vrtc: stop using rtc deprecated functions

> >   net: broadcom: stop using rtc deprecated functions

> >   rtc: 88pm80x: stop using rtc deprecated functions

> >   rtc: 88pm860x: stop using rtc deprecated functions

> >   rtc: ab-b5ze-s3: stop using rtc deprecated functions

> >   rtc: ab8500: stop using rtc deprecated functions

> >   rtc: armada38x: stop using rtc deprecated functions

> >   rtc: at32ap700x: stop using rtc deprecated functions

> >   rtc: at91sam9: stop using rtc deprecated functions

> >   rtc: bfin: stop using rtc deprecated functions

> >   rtc: coh901331: stop using rtc deprecated functions

> >   rtc: cpcap: stop using rtc deprecated functions

> >   rtc: da9063: stop using rtc deprecated functions

> >   rtc: da9063: stop using rtc deprecated functions

> >   rtc: davinci: stop using rtc deprecated functions

> >   rtc: digicolor: stop using rtc deprecated functions

> >   rtc: dm355evm: stop using rtc deprecated functions

> >   rtc: ds1305: stop using rtc deprecated functions

> >   rtc: ds1374: stop using rtc deprecated functions

> >   rtc: ds1511: stop using rtc deprecated functions

> >   rtc: ds1553: stop using rtc deprecated functions

> >   rtc: ds1672: stop using rtc deprecated functions

> >   rtc: ds2404: stop using rtc deprecated functions

> >   rtc: ep93xx: stop using rtc deprecated functions

> >   rtc: gemini: stop using rtc deprecated functions

> >   rtc: imxdi: stop using rtc deprecated functions

> >   rtc: jz4740: stop using rtc deprecated functions

> >   rtc: lpc32xx: stop using rtc deprecated functions

> >   rtc: mv: stop using rtc deprecated functions

> >   rtc: omap: stop using rtc deprecated functions

> >   rtc: pcap: stop using rtc deprecated functions

> >   rtc: pl030: stop using rtc deprecated functions

> >   rtc: pl031: stop using rtc deprecated functions

> >   rtc: pm8xxx: stop using rtc deprecated functions

> >   rtc: rs5c348: stop using rtc deprecated functions

> >   rtc: sa1100: stop using rtc deprecated functions

> >   rtc: sh: stop using rtc deprecated functions

> >   rtc: sirfsoc: stop using rtc deprecated functions

> >   rtc: snvs: stop using rtc deprecated functions

> >   rtc: stk17ta8: stop using rtc deprecated functions

> >   rtc: stmp3xxx: stop using rtc deprecated functions

> >   rtc: sun6i: stop using rtc deprecated functions

> >   rtc: sysfs: stop using rtc deprecated functions

> >   rtc: tegra stop using rtc deprecated functions

> >   rtc: test: stop using rtc deprecated functions

> >   rtc: tps6586: stop using rtc deprecated functions

> >   rtc: vr41xx: stop using rtc deprecated functions

> >   rtc: wm831x: stop using rtc deprecated functions

> >   rtc: xgene stop using rtc deprecated functions

> >   power: suspend test: stop using rtc deprecated functions

> > 

> >  arch/x86/kernel/rtc.c                        |  6 ++--

> >  arch/x86/platform/intel-mid/intel_mid_vrtc.c |  2 +-

> >  drivers/net/ethernet/broadcom/bnxt/bnxt.c    |  2 +-

> >  drivers/rtc/rtc-88pm80x.c                    | 44 +++++++++++++--------------

> >  drivers/rtc/rtc-88pm860x.c                   | 40 ++++++++++++-------------

> >  drivers/rtc/rtc-ab-b5ze-s3.c                 | 45 ++++++++--------------------

> >  drivers/rtc/rtc-ab8500.c                     | 26 ++++++++--------

> >  drivers/rtc/rtc-armada38x.c                  | 34 +++++++++------------

> >  drivers/rtc/rtc-at32ap700x.c                 | 29 ++++++++----------

> >  drivers/rtc/rtc-at91sam9.c                   | 18 ++++-------

> >  drivers/rtc/rtc-bfin.c                       | 24 +++++++--------

> >  drivers/rtc/rtc-coh901331.c                  | 14 +++++----

> >  drivers/rtc/rtc-cpcap.c                      |  8 ++---

> >  drivers/rtc/rtc-da9052.c                     |  8 ++---

> >  drivers/rtc/rtc-da9063.c                     |  8 ++---

> >  drivers/rtc/rtc-davinci.c                    |  8 ++---

> >  drivers/rtc/rtc-digicolor.c                  |  4 +--

> >  drivers/rtc/rtc-dm355evm.c                   |  6 ++--

> >  drivers/rtc/rtc-ds1305.c                     | 11 +++----

> >  drivers/rtc/rtc-ds1374.c                     |  6 ++--

> >  drivers/rtc/rtc-ds1511.c                     |  2 +-

> >  drivers/rtc/rtc-ds1553.c                     |  2 +-

> >  drivers/rtc/rtc-ds1672.c                     |  8 ++---

> >  drivers/rtc/rtc-ds2404.c                     |  8 ++---

> >  drivers/rtc/rtc-ep93xx.c                     | 10 +++----

> >  drivers/rtc/rtc-gemini.c                     |  8 ++---

> >  drivers/rtc/rtc-imxdi.c                      | 16 +++++-----

> >  drivers/rtc/rtc-jz4740.c                     | 12 ++++----

> >  drivers/rtc/rtc-lpc32xx.c                    | 19 +++++-------

> >  drivers/rtc/rtc-mv.c                         |  2 +-

> >  drivers/rtc/rtc-omap.c                       |  6 ++--

> >  drivers/rtc/rtc-pcap.c                       | 16 +++++-----

> >  drivers/rtc/rtc-pl030.c                      | 24 +++++++--------

> >  drivers/rtc/rtc-pl031.c                      | 31 ++++++++-----------

> >  drivers/rtc/rtc-pm8xxx.c                     | 22 +++++++-------

> >  drivers/rtc/rtc-rs5c348.c                    |  4 +--

> >  drivers/rtc/rtc-sa1100.c                     | 25 +++++++---------

> >  drivers/rtc/rtc-sh.c                         |  2 +-

> >  drivers/rtc/rtc-sirfsoc.c                    | 18 +++++------

> >  drivers/rtc/rtc-snvs.c                       | 14 ++++-----

> >  drivers/rtc/rtc-stk17ta8.c                   |  2 +-

> >  drivers/rtc/rtc-stmp3xxx.c                   | 12 ++++----

> >  drivers/rtc/rtc-sun6i.c                      | 14 ++++-----

> >  drivers/rtc/rtc-sysfs.c                      | 25 ++++++++--------

> >  drivers/rtc/rtc-tegra.c                      | 22 +++++++-------

> >  drivers/rtc/rtc-test.c                       | 17 +----------

> >  drivers/rtc/rtc-tps6586x.c                   | 26 ++++++++--------

> >  drivers/rtc/rtc-vr41xx.c                     |  6 ++--

> >  drivers/rtc/rtc-wm831x.c                     | 28 +++++++----------

> >  drivers/rtc/rtc-xgene.c                      | 12 ++++----

> >  kernel/power/suspend_test.c                  |  6 ++--

> >  51 files changed, 342 insertions(+), 420 deletions(-)

> > 

> > -- 

> > CC: adi-buildroot-devel@lists.sourceforge.net

> > CC: Alessandro Zummo <a.zummo@towertech.it>

> > CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> > CC: Gregory Clement <gregory.clement@free-electrons.com>

> > CC: Ingo Molnar <mingo@redhat.com>

> > CC: Jason Cooper <jason@lakedaemon.net>

> > CC: John Stultz <john.stultz@linaro.org>

> > CC: linux-arm-kernel@lists.infradead.org

> > CC: linux-kernel@vger.kernel.org

> > CC: Linus Walleij <linus.walleij@linaro.org>

> > CC: Michael Chan <michael.chan@broadcom.com>

> > CC: netdev@vger.kernel.org

> > CC: rtc-linux@googlegroups.com

> > CC: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

> > CC: Support Opensource <support.opensource@diasemi.com>

> > CC: Thomas Gleixner <tglx@linutronix.de>

> > CC: x86@kernel.org

> > CC: Baruch Siach <baruch@tkos.co.il>

> > CC: Hans Ulli Kroll <ulli.kroll@googlemail.com>

> > CC: Vladimir Zapolskiy <vz@mleia.com>

> > CC: Sylvain Lemieux <slemieux.tyco@gmail.com>

> > CC: Barry Song <baohua@kernel.org>

> > CC: Maxime Ripard <maxime.ripard@free-electrons.com>

> > CC: Chen-Yu Tsai <wens@csie.org>

> > CC: Thierry Reding <thierry.reding@gmail.com>

> > CC: Jonathan Hunter <jonathanh@nvidia.com>

> > CC: linux-tegra@vger.kernel.org

> > CC: patches@opensource.wolfsonmicro.com

> > CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>

> > CC: Pavel Machek <pavel@ucw.cz>

> > CC: Len Brown <len.brown@intel.com>

> > CC: linux-pm@vger.kernel.org

> > 

> > 1.9.1

> > 

> 

> -- 

> Alexandre Belloni, Free Electrons

> Embedded Linux and Kernel engineering

> http://free-electrons.com


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Alexandre Belloni June 20, 2017, 12:24 p.m. UTC | #3
On 20/06/2017 at 14:10:11 +0200, Pavel Machek wrote:
> On Tue 2017-06-20 12:03:48, Alexandre Belloni wrote:

> > On 20/06/2017 at 11:35:08 +0200, Benjamin Gaignard wrote:

> > > rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they

> > > rely on 32bits variables and that will make rtc break in y2038/2016.

> > 

> > Please don't, because this hide the fact that the hardware will not

> > handle dates in y2038 anyway and as pointed by Russell a few month ago,

> > rtc_time_to_tm will be able to catch it but the 64 bit version will

> > silently ignore it.

> 

> Reference? Because rtc on PCs stores date in binary coded decimal, so

> it is likely to break in 2100, not 2038...


I'm not saying it should be done but clearly, that is not the correct
thing to do for RTCs that are using a single 32 bits register to store
the time.
You give one example, I can give you three: armada38x, at91sam9,
at32ap700x and that just in the beginning of the series.

And yes, on PC, they will break in 2100, other in 2106, some in 2070.
I've delayed the tree wide patching until I manage to finish reworking
the infrastructure needed to handle the limits of the RTCs.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Steve Twiss June 20, 2017, 1:37 p.m. UTC | #4
Hi Pavel,

On 20 June 2017 14:26, Pavel Machek wrote:

> Subject: Re: [PATCH 00/51] rtc: stop using rtc deprecated functions

> 

> On Tue 2017-06-20 14:24:00, Alexandre Belloni wrote:

> > On 20/06/2017 at 14:10:11 +0200, Pavel Machek wrote:

> > > On Tue 2017-06-20 12:03:48, Alexandre Belloni wrote:

> > > > On 20/06/2017 at 11:35:08 +0200, Benjamin Gaignard wrote:

> > > > > rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they

> > > > > rely on 32bits variables and that will make rtc break in y2038/2016.

> > > >

> > > > Please don't, because this hide the fact that the hardware will not

> > > > handle dates in y2038 anyway and as pointed by Russell a few month ago,

> > > > rtc_time_to_tm will be able to catch it but the 64 bit version will

> > > > silently ignore it.

> > >

> > > Reference? Because rtc on PCs stores date in binary coded decimal, so

> > > it is likely to break in 2100, not 2038...

> >

> > I'm not saying it should be done but clearly, that is not the correct

> > thing to do for RTCs that are using a single 32 bits register to store

> > the time.

> > You give one example, I can give you three: armada38x, at91sam9,

> > at32ap700x and that just in the beginning of the series.

> 

> I wanted reference to Russell's mail.


This is it.
https://patchwork.kernel.org/patch/6219401/

Regards,
Steve
Pavel Machek June 20, 2017, 1:44 p.m. UTC | #5
On Tue 2017-06-20 13:37:22, Steve Twiss wrote:
> Hi Pavel,

> 

> On 20 June 2017 14:26, Pavel Machek wrote:

> 

> > Subject: Re: [PATCH 00/51] rtc: stop using rtc deprecated functions

> > 

> > On Tue 2017-06-20 14:24:00, Alexandre Belloni wrote:

> > > On 20/06/2017 at 14:10:11 +0200, Pavel Machek wrote:

> > > > On Tue 2017-06-20 12:03:48, Alexandre Belloni wrote:

> > > > > On 20/06/2017 at 11:35:08 +0200, Benjamin Gaignard wrote:

> > > > > > rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they

> > > > > > rely on 32bits variables and that will make rtc break in y2038/2016.

> > > > >

> > > > > Please don't, because this hide the fact that the hardware will not

> > > > > handle dates in y2038 anyway and as pointed by Russell a few month ago,

> > > > > rtc_time_to_tm will be able to catch it but the 64 bit version will

> > > > > silently ignore it.

> > > >

> > > > Reference? Because rtc on PCs stores date in binary coded decimal, so

> > > > it is likely to break in 2100, not 2038...

> > >

> > > I'm not saying it should be done but clearly, that is not the correct

> > > thing to do for RTCs that are using a single 32 bits register to store

> > > the time.

> > > You give one example, I can give you three: armada38x, at91sam9,

> > > at32ap700x and that just in the beginning of the series.

> > 

> > I wanted reference to Russell's mail.

> 

> This is it.

> https://patchwork.kernel.org/patch/6219401/


Thanks.

Yes, that's argument against changing rtc _drivers_ for hardware that
can not do better than 32bit. For generic code (such as 44/51 sysfs,
51/51 suspend test), the change still makes sense.

								Pavel

-- (english)
http://www.livejournal.com/~pavelmachek (cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Russell King (Oracle) June 20, 2017, 9:15 p.m. UTC | #6
On Tue, Jun 20, 2017 at 05:07:46PM +0200, Benjamin Gaignard wrote:
> 2017-06-20 15:48 GMT+02:00 Alexandre Belloni

> <alexandre.belloni@free-electrons.com>:

> >> Yes, that's argument against changing rtc _drivers_ for hardware that

> >> can not do better than 32bit. For generic code (such as 44/51 sysfs,

> >> 51/51 suspend test), the change still makes sense.

> 

> What I had in mind when writing those patches was to remove the limitations

> coming from those functions usage, even more since they been marked has

> deprecated.


I'd say that they should not be marked as deprecated.  They're entirely
appropriate for use with hardware that only supports a 32-bit
representation of time.

It's entirely reasonable to fix the ones that use other representations
that exceed that, but for those which do not, we need to keep using the
32-bit versions.  Doing so actually gives us _more_ flexibility in the
future.

Consider that at the moment, we define the 32-bit RTC representation to
start at a well known epoch.  We _could_ decide that when it wraps to
0x80000000 seconds, we'll define the lower 0x40000000 seconds to mean
dates in the future - and keep rolling that forward each time we cross
another 0x40000000 seconds.  Unless someone invents a real time machine,
we shouldn't need to set a modern RTC back to 1970.

If we convert the 32-bit counter RTC drivers to use 64-bit conversions,
then we're completely stuffed, because the lower 32-bits will always
be relative to the epoch, and we can't change that without breaking
the 64-bit users.

So, keep the 32-bit conversion functions, do not deprecate them, and
think about the future possibilities.

I really think this "get rid of 32-bit time representations" is a much
to narrow focus on the wrong problem.  You can't ever fix 32-bit time
representations by just adding additional zeros into the MSB bits.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
Pavel Machek June 20, 2017, 10:08 p.m. UTC | #7
Hi!

> >> > This is it.

> >> > https://patchwork.kernel.org/patch/6219401/

> >>

> >> Thanks.

> >>

> >> Yes, that's argument against changing rtc _drivers_ for hardware that

> >> can not do better than 32bit. For generic code (such as 44/51 sysfs,

> >> 51/51 suspend test), the change still makes sense.

> 

> What I had in mind when writing those patches was to remove the limitations

> coming from those functions usage, even more since they been marked has

> deprecated.

> 

> I agree that will change nothing of hardware limitation but at least

> the limit will

> not come from the framework.


> > Yes, we agree on that but I won't cherry pick working patches from a 51

> > patches series.


Well, it would be actually nice for you to do the cherry
picking. That's something maintainers do, because it is hard for
contributors to guess maintainer's taste.

Anyway, it looks like someone should go through all the RTC drivers,
and document their limitations of each driver (date in future when
hardware ceases to be useful). If Benjamin has time to do that, I
guess that removes all the objections to the series.

Regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
David Laight June 21, 2017, 9:26 a.m. UTC | #8
From: Russell King - ARM Linux

> Sent: 20 June 2017 22:16

..
> Consider that at the moment, we define the 32-bit RTC representation to

> start at a well known epoch.  We _could_ decide that when it wraps to

> 0x80000000 seconds, we'll define the lower 0x40000000 seconds to mean

> dates in the future - and keep rolling that forward each time we cross

> another 0x40000000 seconds.  Unless someone invents a real time machine,

> we shouldn't need to set a modern RTC back to 1970.


True, just treating the value as unsigned gives another 67 years.

If a 32bit RTC is programmed with the low 32bits of the 64bit 'seconds
since 1970' the kernel should have no real difficulty sorting out the
high bits from other available information.

Problems with things like the x86 bios setting the rtc to stupid values
are another matter.
ISTR the rtc chip has a bit for 'summertime' that is never set, on a
multi-os system you can get multiple summer time changes.

	David