2018-02-21 21:25:42

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 000/100] rtc: remove cargo culted code

Hello,

This series:
- removes useless calls to rtc_valid_tm in .read_time, .set_time and
.set_alarm
- removes code setting default values for RTCs (and lets the core
handle it)
- removes useless "time is invalid" messages at probe time
- removes useless indirect calls

Those were mostly copy pasted from other drivers

Alexandre Belloni (100):
rtc: ds1511: let the core handle invalid time
rtc: ds1553: let the core handle invalid time
rtc: cmos: let the core handle invalid time
rtc: rs5c348: let the core handle invalid time
rtc: stk17ta8: let the core handle invalid time
rtc: ab-b5ze-s3: stop validating rtc_time in .read_time
rtc: ab3100: stop validating rtc_time in .read_time
rtc: ab8500: stop validating rtc_time in .read_time
rtc: ac100: stop validating rtc_time in .read_time
rtc: au1xxx: stop validating rtc_time in .read_time
rtc: bq32k: stop validating rtc_time in .read_time
rtc: coh901331: stop validating rtc_time in .read_time
rtc: cpcap: stop validating rtc_time in .read_time
rtc: da9052: stop validating rtc_time in .read_time
rtc: da9055: stop validating rtc_time in .read_time
rtc: da9063: stop validating rtc_time in .read_time
rtc: ds1216: stop validating rtc_time in .read_time
rtc: ds1286: stop validating rtc_time in .read_time
rtc: ds1302: stop validating rtc_time in .read_time
rtc: ds1305: stop validating rtc_time in .read_time
rtc: ds1307: stop validating rtc_time in .read_time
rtc: ds1343: stop validating rtc_time in .read_time
rtc: ds1347: stop validating rtc_time in .read_time
rtc: ds1390: stop validating rtc_time in .read_time
rtc: ds1685: stop validating rtc_time in .read_time
rtc: ds1742: stop validating rtc_time in .read_time
rtc: ds2404: stop validating rtc_time in .read_time
rtc: ds3232: stop validating rtc_time in .read_time
rtc: efi: stop validating rtc_time in .read_time
rtc: fm3130: stop validating rtc_time in .read_time
rtc: jz4740: stop validating rtc_time in .read_time
rtc: lpc24xx: stop validating rtc_time in .read_time
rtc: lpc32xx: stop validating rtc_time in .read_time
rtc: ls1x: stop validating rtc_time in .read_time
rtc: m41t94: stop validating rtc_time in .read_time
rtc: m48t35: stop validating rtc_time in .read_time
rtc: m48t59: stop validating rtc_time in .read_time
rtc: m48t86: stop validating rtc_time in .read_time
rtc: max6902: stop validating rtc_time in .read_time
rtc: max6916: stop validating rtc_time in .read_time
rtc: max8997: stop validating rtc_time in .read_time
rtc: max8998: stop validating rtc_time in .read_time
rtc: mc13xxx: stop validating rtc_time in .read_time
rtc: mcp795: stop validating rtc_time in .read_time
rtc: mpc5121: stop validating rtc_time in .read_time
rtc: mrst: stop validating rtc_time in .read_time
rtc: msm6242: stop validating rtc_time in .read_time
rtc: mt7622: stop validating rtc_time in .read_time
rtc: mv: stop validating rtc_time in .read_time
rtc: nuc900: stop validating rtc_time in .read_time
rtc: pcap: stop validating rtc_time in .read_time
rtc: pcf2123: stop validating rtc_time in .read_time
rtc: pcf2127: stop validating rtc_time in .read_time
rtc: pcf50633: stop validating rtc_time in .read_time
rtc: pcf8523: stop validating rtc_time in .read_time
rtc: pic32: stop validating rtc_time in .read_time
rtc: ps3: stop validating rtc_time in .read_time
rtc: r7301: stop validating rtc_time in .read_time
rtc: r9701: stop validating rtc_time in .read_time
rtc: rp5c01: stop validating rtc_time in .read_time
rtc: rx6110: stop validating rtc_time in .read_time
rtc: rx8010: stop validating rtc_time in .read_time
rtc: rx8025: stop validating rtc_time in .read_time
rtc: s3c: stop validating rtc_time in .read_time
rtc: s5m: stop validating rtc_time in .read_time
rtc: sc27xx: stop validating rtc_time in .read_time
rtc: sh: stop validating rtc_time in .read_time
rtc: starfire: stop validating rtc_time in .read_time
rtc: sun6i: stop validating rtc_time in .read_time
rtc: sunxi: stop validating rtc_time in .read_time
rtc: tps6586x: stop validating rtc_time in .read_time
rtc: tx4939: stop validating rtc_time in .read_time
rtc: wm831x: stop validating rtc_time in .read_time
rtc: xgene: stop validating rtc_time in .read_time
rtc: zynqmp: stop validating rtc_time in .read_time
rtc: isl12022: stop validating rtc_time in .read_time
rtc: isl12022: remove useless indirection
rtc: m41t80: stop validating rtc_time in .read_time
rtc: m41t93: stop validating rtc_time in .read_time
rtc: max77686: stop validating rtc_time in .read_time
rtc: omap: stop validating rtc_time in .set_time and .set_alarm
rtc: spear: stop validating rtc_time in .set_time and .set_alarm
rtc: tegra: stop validating rtc_time in .set_time
rtc: abx80x: remove useless message
rtc: pm8xxx: remove useless message
rtc: rx4581: remove useless message
rtc: rx8581: remove useless message
rtc: tile: remove useless message
rtc: rk808: remove useless debug message
rtc: rk808: fix possible race condition
rtc: s35390a: remove useless message
rtc: s35390a: stop validating rtc_time in .read_time
rtc: s35390a: remove useless indirection
rtc: rs5c372: remove useless message
rtc: rs5c372: stop validating rtc_time in .read_time
rtc: rs5c372: remove useless indirection
rtc: max6900: stop validating rtc_time in .read_time
rtc: max6900: remove useless indirection
rtc: pcf85063: stop validating rtc_time in .read_time
rtc: pcf85063: remove useless indirection

drivers/rtc/rtc-ab-b5ze-s3.c | 4 +---
drivers/rtc/rtc-ab3100.c | 2 +-
drivers/rtc/rtc-ab8500.c | 2 +-
drivers/rtc/rtc-abx80x.c | 6 +-----
drivers/rtc/rtc-ac100.c | 2 +-
drivers/rtc/rtc-au1xxx.c | 2 +-
drivers/rtc/rtc-bq32k.c | 2 +-
drivers/rtc/rtc-cmos.c | 12 ------------
drivers/rtc/rtc-coh901331.c | 2 +-
drivers/rtc/rtc-cpcap.c | 2 +-
drivers/rtc/rtc-da9052.c | 3 +--
drivers/rtc/rtc-da9055.c | 2 +-
drivers/rtc/rtc-da9063.c | 2 +-
drivers/rtc/rtc-ds1216.c | 2 +-
drivers/rtc/rtc-ds1286.c | 2 +-
drivers/rtc/rtc-ds1302.c | 3 +--
drivers/rtc/rtc-ds1305.c | 3 +--
drivers/rtc/rtc-ds1307.c | 3 +--
drivers/rtc/rtc-ds1343.c | 2 +-
drivers/rtc/rtc-ds1347.c | 2 +-
drivers/rtc/rtc-ds1390.c | 2 +-
drivers/rtc/rtc-ds1511.c | 4 ----
drivers/rtc/rtc-ds1553.c | 4 ----
drivers/rtc/rtc-ds1685.c | 2 +-
drivers/rtc/rtc-ds1742.c | 2 +-
drivers/rtc/rtc-ds2404.c | 2 +-
drivers/rtc/rtc-ds3232.c | 2 +-
drivers/rtc/rtc-efi.c | 2 +-
drivers/rtc/rtc-fm3130.c | 3 +--
drivers/rtc/rtc-isl12022.c | 18 +++++-------------
drivers/rtc/rtc-jz4740.c | 2 +-
drivers/rtc/rtc-lpc24xx.c | 2 +-
drivers/rtc/rtc-lpc32xx.c | 2 +-
drivers/rtc/rtc-ls1x.c | 2 +-
drivers/rtc/rtc-m41t80.c | 2 +-
drivers/rtc/rtc-m41t93.c | 2 +-
drivers/rtc/rtc-m41t94.c | 3 +--
drivers/rtc/rtc-m48t35.c | 2 +-
drivers/rtc/rtc-m48t59.c | 2 +-
drivers/rtc/rtc-m48t86.c | 2 +-
drivers/rtc/rtc-max6900.c | 19 +++++--------------
drivers/rtc/rtc-max6902.c | 2 +-
drivers/rtc/rtc-max6916.c | 2 +-
drivers/rtc/rtc-max77686.c | 4 +---
drivers/rtc/rtc-max8997.c | 2 +-
drivers/rtc/rtc-max8998.c | 2 +-
drivers/rtc/rtc-mc13xxx.c | 2 +-
drivers/rtc/rtc-mcp795.c | 2 +-
drivers/rtc/rtc-mpc5121.c | 2 +-
drivers/rtc/rtc-mrst.c | 2 +-
drivers/rtc/rtc-msm6242.c | 2 +-
drivers/rtc/rtc-mt7622.c | 2 +-
drivers/rtc/rtc-mv.c | 2 +-
drivers/rtc/rtc-nuc900.c | 14 ++++++++------
drivers/rtc/rtc-omap.c | 3 ---
drivers/rtc/rtc-pcap.c | 2 +-
drivers/rtc/rtc-pcf2123.c | 2 +-
drivers/rtc/rtc-pcf2127.c | 2 +-
drivers/rtc/rtc-pcf50633.c | 2 +-
drivers/rtc/rtc-pcf85063.c | 18 +++++-------------
drivers/rtc/rtc-pcf8523.c | 2 +-
drivers/rtc/rtc-pic32.c | 2 +-
drivers/rtc/rtc-pm8xxx.c | 6 ------
drivers/rtc/rtc-ps3.c | 2 +-
drivers/rtc/rtc-r7301.c | 2 +-
drivers/rtc/rtc-r9701.c | 2 +-
drivers/rtc/rtc-rk808.c | 25 +++++++------------------
drivers/rtc/rtc-rp5c01.c | 2 +-
drivers/rtc/rtc-rs5c348.c | 5 -----
drivers/rtc/rtc-rs5c372.c | 24 +++++-------------------
drivers/rtc/rtc-rx4581.c | 6 +-----
drivers/rtc/rtc-rx6110.c | 2 +-
drivers/rtc/rtc-rx8010.c | 2 +-
drivers/rtc/rtc-rx8025.c | 2 +-
drivers/rtc/rtc-rx8581.c | 6 +-----
drivers/rtc/rtc-s35390a.c | 38 +++++++++-----------------------------
drivers/rtc/rtc-s3c.c | 2 +-
drivers/rtc/rtc-s5m.c | 2 +-
drivers/rtc/rtc-sc27xx.c | 2 +-
drivers/rtc/rtc-sh.c | 2 +-
drivers/rtc/rtc-spear.c | 12 +++---------
drivers/rtc/rtc-starfire.c | 2 +-
drivers/rtc/rtc-stk17ta8.c | 4 ----
drivers/rtc/rtc-sun6i.c | 2 +-
drivers/rtc/rtc-sunxi.c | 2 +-
drivers/rtc/rtc-tegra.c | 4 ----
drivers/rtc/rtc-tile.c | 3 ---
drivers/rtc/rtc-tps6586x.c | 2 +-
drivers/rtc/rtc-tx4939.c | 2 +-
drivers/rtc/rtc-wm831x.c | 2 +-
drivers/rtc/rtc-xgene.c | 2 +-
drivers/rtc/rtc-zynqmp.c | 2 +-
92 files changed, 122 insertions(+), 263 deletions(-)

--
2.16.1



2018-02-21 20:58:05

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 001/100] rtc: ds1511: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1511.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 5f55214db9f8..a7d5ca428d68 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -277,10 +277,6 @@ static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)

rtc_tm->tm_mon--;

- if (rtc_valid_tm(rtc_tm) < 0) {
- dev_err(dev, "retrieved date/time is not valid.\n");
- rtc_time_to_tm(0, rtc_tm);
- }
return 0;
}

--
2.16.1


2018-02-21 20:59:01

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 029/100] rtc: efi: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
index 0130afd7fe88..3454e7814524 100644
--- a/drivers/rtc/rtc-efi.c
+++ b/drivers/rtc/rtc-efi.c
@@ -176,7 +176,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm)
if (!convert_from_efi_time(&eft, tm))
return -EIO;

- return rtc_valid_tm(tm);
+ return 0;
}

static int efi_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 20:59:12

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 092/100] rtc: s35390a: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-s35390a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 604f527a1235..18c1d8a9f447 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -271,7 +271,7 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
--
2.16.1


2018-02-21 20:59:42

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 098/100] rtc: max6900: remove useless indirection

max6900_i2c_read_time and max6900_i2c_set_time are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max6900.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
index 84f06106f5ba..ab60f13fa3ef 100644
--- a/drivers/rtc/rtc-max6900.c
+++ b/drivers/rtc/rtc-max6900.c
@@ -139,8 +139,9 @@ static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf)
return -EIO;
}

-static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
+static int max6900_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
int rc;
u8 regs[MAX6900_REG_LEN];

@@ -165,9 +166,9 @@ static int max6900_i2c_clear_write_protect(struct i2c_client *client)
return i2c_smbus_write_byte_data(client, MAX6900_REG_CONTROL_WRITE, 0);
}

-static int
-max6900_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm)
+static int max6900_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
u8 regs[MAX6900_REG_LEN];
int rc;

@@ -193,16 +194,6 @@ max6900_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm)
return 0;
}

-static int max6900_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- return max6900_i2c_read_time(to_i2c_client(dev), tm);
-}
-
-static int max6900_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- return max6900_i2c_set_time(to_i2c_client(dev), tm);
-}
-
static const struct rtc_class_ops max6900_rtc_ops = {
.read_time = max6900_rtc_read_time,
.set_time = max6900_rtc_set_time,
--
2.16.1


2018-02-21 21:00:10

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 091/100] rtc: s35390a: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-s35390a.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 7067bca5c20d..604f527a1235 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -450,7 +450,6 @@ static int s35390a_probe(struct i2c_client *client,
int err, err_read;
unsigned int i;
struct s35390a *s35390a;
- struct rtc_time tm;
char buf, status1;

if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -508,9 +507,6 @@ static int s35390a_probe(struct i2c_client *client,
}
}

- if (err_read > 0 || s35390a_get_datetime(client, &tm) < 0)
- dev_warn(&client->dev, "clock needs to be set\n");
-
device_set_wakeup_capable(&client->dev, 1);

s35390a->rtc = devm_rtc_device_register(&client->dev,
--
2.16.1


2018-02-21 21:00:25

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 094/100] rtc: rs5c372: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rs5c372.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index d4eff8d7131f..37aa78fd2c4d 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -581,7 +581,6 @@ static int rs5c372_probe(struct i2c_client *client,
int err = 0;
int smbus_mode = 0;
struct rs5c372 *rs5c372;
- struct rtc_time tm;

dev_dbg(&client->dev, "%s\n", __func__);

@@ -662,9 +661,6 @@ static int rs5c372_probe(struct i2c_client *client,
goto exit;
}

- if (rs5c372_get_datetime(client, &tm) < 0)
- dev_warn(&client->dev, "clock needs to be set\n");
-
dev_info(&client->dev, "%s found, %s\n",
({ char *s; switch (rs5c372->type) {
case rtc_r2025sd: s = "r2025sd"; break;
--
2.16.1


2018-02-21 21:00:41

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 100/100] rtc: pcf85063: remove useless indirection

pcf85063_get_datetime and pcf85063_set_datetime are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf85063.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 6ad4511d7ee1..3558433e8787 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -81,8 +81,9 @@ static int pcf85063_start_clock(struct i2c_client *client, u8 ctrl1)
return 0;
}

-static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int pcf85063_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
int rc;
u8 regs[7];

@@ -117,8 +118,9 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int pcf85063_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
int rc;
u8 regs[7];
u8 ctrl1;
@@ -172,16 +174,6 @@ static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int pcf85063_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- return pcf85063_get_datetime(to_i2c_client(dev), tm);
-}
-
-static int pcf85063_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- return pcf85063_set_datetime(to_i2c_client(dev), tm);
-}
-
static const struct rtc_class_ops pcf85063_rtc_ops = {
.read_time = pcf85063_rtc_read_time,
.set_time = pcf85063_rtc_set_time
--
2.16.1


2018-02-21 21:04:24

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 095/100] rtc: rs5c372: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rs5c372.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 37aa78fd2c4d..ae7fa4324b0a 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -234,8 +234,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- /* rtc might need initialization */
- return rtc_valid_tm(tm);
+ return 0;
}

static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:04:53

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 097/100] rtc: max6900: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max6900.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c
index cbdc86a560ba..84f06106f5ba 100644
--- a/drivers/rtc/rtc-max6900.c
+++ b/drivers/rtc/rtc-max6900.c
@@ -157,7 +157,7 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm)
bcd2bin(regs[MAX6900_REG_CENTURY]) * 100 - 1900;
tm->tm_wday = bcd2bin(regs[MAX6900_REG_DW]);

- return rtc_valid_tm(tm);
+ return 0;
}

static int max6900_i2c_clear_write_protect(struct i2c_client *client)
--
2.16.1


2018-02-21 21:04:55

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 096/100] rtc: rs5c372: remove useless indirection

rs5c372_get_datetime and rs5c372_set_datetime are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rs5c372.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index ae7fa4324b0a..c5038329058c 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -207,8 +207,9 @@ static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour)
return bin2bcd(hour);
}

-static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int rs5c372_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct rs5c372 *rs5c = i2c_get_clientdata(client);
int status = rs5c_get_regs(rs5c);

@@ -237,8 +238,9 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int rs5c372_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct rs5c372 *rs5c = i2c_get_clientdata(client);
unsigned char buf[7];
int addr;
@@ -304,17 +306,6 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim)
}
#endif

-static int rs5c372_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- return rs5c372_get_datetime(to_i2c_client(dev), tm);
-}
-
-static int rs5c372_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- return rs5c372_set_datetime(to_i2c_client(dev), tm);
-}
-
-
static int rs5c_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
struct i2c_client *client = to_i2c_client(dev);
--
2.16.1


2018-02-21 21:05:04

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 087/100] rtc: rx8581: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx8581.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index 9998d7937688..32caadf912ca 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -164,11 +164,7 @@ static int rx8581_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- err = rtc_valid_tm(tm);
- if (err < 0)
- dev_err(&client->dev, "retrieved date/time is not valid.\n");
-
- return err;
+ return 0;
}

static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:05:19

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 078/100] rtc: m41t80: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m41t80.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index c90fba3ed861..1103cdc33bfa 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -230,7 +230,7 @@ static int m41t80_get_datetime(struct i2c_client *client,

/* assume 20YY not 19YY, and ignore the Century Bit */
tm->tm_year = bcd2bin(buf[M41T80_REG_YEAR]) + 100;
- return rtc_valid_tm(tm);
+ return 0;
}

/* Sets the given date and time to the real time clock. */
--
2.16.1


2018-02-21 21:05:29

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 080/100] rtc: max77686: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max77686.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 182fdd00e290..cefde273fae6 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -364,11 +364,9 @@ static int max77686_rtc_read_time(struct device *dev, struct rtc_time *tm)

max77686_rtc_data_to_tm(data, tm, info);

- ret = rtc_valid_tm(tm);
-
out:
mutex_unlock(&info->lock);
- return ret;
+ return 0;
}

static int max77686_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:05:58

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 093/100] rtc: s35390a: remove useless indirection

s35390a_set_datetime, s35390a_get_datetime, s35390a_set_alarm and
s35390a_read_alarm are only used after casting dev to an i2c_client. Remove
that useless indirection.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-s35390a.c | 32 ++++++++------------------------
1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 18c1d8a9f447..77feb603cd4c 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -210,8 +210,9 @@ static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
return hour;
}

-static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct s35390a *s35390a = i2c_get_clientdata(client);
int i, err;
char buf[7], status;
@@ -241,8 +242,9 @@ static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm)
return err;
}

-static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct s35390a *s35390a = i2c_get_clientdata(client);
char buf[7], status;
int i, err;
@@ -274,8 +276,9 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
+static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct s35390a *s35390a = i2c_get_clientdata(client);
char buf[3], sts = 0;
int err, i;
@@ -329,8 +332,9 @@ static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
return err;
}

-static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
+static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct s35390a *s35390a = i2c_get_clientdata(client);
char buf[3], sts;
int i, err;
@@ -384,26 +388,6 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
return 0;
}

-static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
-{
- return s35390a_read_alarm(to_i2c_client(dev), alm);
-}
-
-static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
-{
- return s35390a_set_alarm(to_i2c_client(dev), alm);
-}
-
-static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- return s35390a_get_datetime(to_i2c_client(dev), tm);
-}
-
-static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- return s35390a_set_datetime(to_i2c_client(dev), tm);
-}
-
static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd,
unsigned long arg)
{
--
2.16.1


2018-02-21 21:05:59

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 099/100] rtc: pcf85063: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf85063.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index a06dff994c83..6ad4511d7ee1 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -114,7 +114,7 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_year = bcd2bin(regs[6]);
tm->tm_year += 100;

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:06:11

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 085/100] rtc: pm8xxx: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pm8xxx.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index fac835530671..8e0128796824 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -190,12 +190,6 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)

rtc_time_to_tm(secs, tm);

- rc = rtc_valid_tm(tm);
- if (rc < 0) {
- dev_err(dev, "Invalid time read from RTC\n");
- return rc;
- }
-
dev_dbg(dev, "secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n",
secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
tm->tm_mday, tm->tm_mon, tm->tm_year);
--
2.16.1


2018-02-21 21:06:23

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 088/100] rtc: tile: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-tile.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/rtc/rtc-tile.c b/drivers/rtc/rtc-tile.c
index 0b60867d8390..ef1cdabf05b4 100644
--- a/drivers/rtc/rtc-tile.c
+++ b/drivers/rtc/rtc-tile.c
@@ -39,9 +39,6 @@ static int read_rtc_time(struct device *dev, struct rtc_time *tm)
tm->tm_yday = 0;
tm->tm_isdst = 0;

- if (rtc_valid_tm(tm) < 0)
- dev_warn(dev, "Read invalid date/time from RTC\n");
-
return 0;
}

--
2.16.1


2018-02-21 21:06:40

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 090/100] rtc: rk808: fix possible race condition

The probe function is not allowed to fail after registering the RTC because
the following may happen:

CPU0: CPU1:
sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */

Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
as late as possible.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rk808.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
index e40f35d1ced3..739c0d42e835 100644
--- a/drivers/rtc/rtc-rk808.c
+++ b/drivers/rtc/rtc-rk808.c
@@ -405,12 +405,11 @@ static int rk808_rtc_probe(struct platform_device *pdev)

device_init_wakeup(&pdev->dev, 1);

- rk808_rtc->rtc = devm_rtc_device_register(&pdev->dev, "rk808-rtc",
- &rk808_rtc_ops, THIS_MODULE);
- if (IS_ERR(rk808_rtc->rtc)) {
- ret = PTR_ERR(rk808_rtc->rtc);
- return ret;
- }
+ rk808_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rk808_rtc->rtc))
+ return PTR_ERR(rk808_rtc->rtc);
+
+ rk808_rtc->rtc->ops = &rk808_rtc_ops;

rk808_rtc->irq = platform_get_irq(pdev, 0);
if (rk808_rtc->irq < 0) {
@@ -427,9 +426,10 @@ static int rk808_rtc_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "Failed to request alarm IRQ %d: %d\n",
rk808_rtc->irq, ret);
+ return ret;
}

- return ret;
+ return rtc_register_device(rk808_rtc->rtc);
}

static struct platform_driver rk808_rtc_driver = {
--
2.16.1


2018-02-21 21:06:51

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 083/100] rtc: tegra: stop validating rtc_time in .set_time

The RTC core is always validating the rtc_time struct before calling
.set_time. It is not necessary to do it again in .set_time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-tegra.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index d30d57b048d3..66efff60c4d5 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -144,10 +144,6 @@ static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm)
int ret;

/* convert tm to seconds. */
- ret = rtc_valid_tm(tm);
- if (ret)
- return ret;
-
rtc_tm_to_time(tm, &sec);

dev_vdbg(dev, "time set to %lu. %d/%d/%d %d:%02u:%02u\n",
--
2.16.1


2018-02-21 21:06:52

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 075/100] rtc: zynqmp: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-zynqmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index da18a8ae3c1d..fba994dc31eb 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -122,7 +122,7 @@ static int xlnx_rtc_read_time(struct device *dev, struct rtc_time *tm)
rtc_time64_to_tm(read_time, tm);
}

- return rtc_valid_tm(tm);
+ return 0;
}

static int xlnx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
--
2.16.1


2018-02-21 21:06:53

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 089/100] rtc: rk808: remove useless debug message

At probe time, printing a message when the time is invalid doesn't have
much value. Also, as the comment suggest, this is a leftover from
development wherhe this was used to set the RTc to a default time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rk808.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
index 35c9aada07c8..e40f35d1ced3 100644
--- a/drivers/rtc/rtc-rk808.c
+++ b/drivers/rtc/rtc-rk808.c
@@ -375,7 +375,6 @@ static int rk808_rtc_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
struct rk808_rtc *rk808_rtc;
- struct rtc_time tm;
int ret;

rk808_rtc = devm_kzalloc(&pdev->dev, sizeof(*rk808_rtc), GFP_KERNEL);
@@ -404,16 +403,6 @@ static int rk808_rtc_probe(struct platform_device *pdev)
return ret;
}

- /* set init time */
- ret = rk808_rtc_readtime(&pdev->dev, &tm);
- if (ret) {
- dev_err(&pdev->dev, "Failed to read RTC time\n");
- return ret;
- }
- ret = rtc_valid_tm(&tm);
- if (ret)
- dev_warn(&pdev->dev, "invalid date/time\n");
-
device_init_wakeup(&pdev->dev, 1);

rk808_rtc->rtc = devm_rtc_device_register(&pdev->dev, "rk808-rtc",
--
2.16.1


2018-02-21 21:06:57

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 076/100] rtc: isl12022: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-isl12022.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
index 38586a024ee8..46093cd13d5e 100644
--- a/drivers/rtc/rtc-isl12022.c
+++ b/drivers/rtc/rtc-isl12022.c
@@ -149,7 +149,7 @@ static int isl12022_get_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:07:25

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 082/100] rtc: spear: stop validating rtc_time in .set_time and .set_alarm

The RTC core is always validating the rtc_time struct before calling
.set_time or .set_alarm. It is not necessary to do it again.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-spear.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index e377f42abae7..0567944fd4f8 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -170,18 +170,14 @@ static irqreturn_t spear_rtc_irq(int irq, void *dev_id)

}

-static int tm2bcd(struct rtc_time *tm)
+static void tm2bcd(struct rtc_time *tm)
{
- if (rtc_valid_tm(tm) != 0)
- return -EINVAL;
tm->tm_sec = bin2bcd(tm->tm_sec);
tm->tm_min = bin2bcd(tm->tm_min);
tm->tm_hour = bin2bcd(tm->tm_hour);
tm->tm_mday = bin2bcd(tm->tm_mday);
tm->tm_mon = bin2bcd(tm->tm_mon + 1);
tm->tm_year = bin2bcd(tm->tm_year);
-
- return 0;
}

static void bcd2tm(struct rtc_time *tm)
@@ -237,8 +233,7 @@ static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
struct spear_rtc_config *config = dev_get_drvdata(dev);
unsigned int time, date;

- if (tm2bcd(tm) < 0)
- return -EINVAL;
+ tm2bcd(tm);

rtc_wait_not_busy(config);
time = (tm->tm_sec << SECOND_SHIFT) | (tm->tm_min << MINUTE_SHIFT) |
@@ -295,8 +290,7 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
unsigned int time, date;
int err;

- if (tm2bcd(&alm->time) < 0)
- return -EINVAL;
+ tm2bcd(&alm->time);

rtc_wait_not_busy(config);

--
2.16.1


2018-02-21 21:07:31

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 077/100] rtc: isl12022: remove useless indirection

isl12022_get_datetime and isl12022_set_datetime are only used after casting
dev to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-isl12022.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
index 46093cd13d5e..fa5c15d45070 100644
--- a/drivers/rtc/rtc-isl12022.c
+++ b/drivers/rtc/rtc-isl12022.c
@@ -104,8 +104,9 @@ static int isl12022_write_reg(struct i2c_client *client,
* In the routines that deal directly with the isl12022 hardware, we use
* rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
*/
-static int isl12022_get_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int isl12022_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
uint8_t buf[ISL12022_REG_INT + 1];
int ret;

@@ -152,8 +153,9 @@ static int isl12022_get_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int isl12022_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct isl12022 *isl12022 = i2c_get_clientdata(client);
size_t i;
int ret;
@@ -228,16 +230,6 @@ static int isl12022_set_datetime(struct i2c_client *client, struct rtc_time *tm)
return 0;
}

-static int isl12022_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- return isl12022_get_datetime(to_i2c_client(dev), tm);
-}
-
-static int isl12022_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- return isl12022_set_datetime(to_i2c_client(dev), tm);
-}
-
static const struct rtc_class_ops isl12022_rtc_ops = {
.read_time = isl12022_rtc_read_time,
.set_time = isl12022_rtc_set_time,
--
2.16.1


2018-02-21 21:07:38

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 081/100] rtc: omap: stop validating rtc_time in .set_time and .set_alarm

The RTC core is always validating the rtc_time struct before calling
.set_time or .set_alarm. It is not necessary to do it again.
Also, rtc_time_to_tm never generates an invalid rtc_tm (it can be out of
range though).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-omap.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index e53cb27f4118..39086398833e 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -273,9 +273,6 @@ static int omap_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
/* this hardware doesn't support "don't care" alarm fields */
static int tm2bcd(struct rtc_time *tm)
{
- if (rtc_valid_tm(tm) != 0)
- return -EINVAL;
-
tm->tm_sec = bin2bcd(tm->tm_sec);
tm->tm_min = bin2bcd(tm->tm_min);
tm->tm_hour = bin2bcd(tm->tm_hour);
--
2.16.1


2018-02-21 21:07:44

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 084/100] rtc: abx80x: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-abx80x.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index b033bc556f5d..2cefa67a1132 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -172,11 +172,7 @@ static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mon = bcd2bin(buf[ABX8XX_REG_MO] & 0x1F) - 1;
tm->tm_year = bcd2bin(buf[ABX8XX_REG_YR]) + 100;

- err = rtc_valid_tm(tm);
- if (err < 0)
- dev_err(&client->dev, "retrieved date/time is not valid.\n");
-
- return err;
+ return 0;
}

static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:07:44

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 079/100] rtc: m41t93: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m41t93.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c
index 5ac45fc1a787..4a08a9dabc82 100644
--- a/drivers/rtc/rtc-m41t93.c
+++ b/drivers/rtc/rtc-m41t93.c
@@ -159,7 +159,7 @@ static int m41t93_get_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour, tm->tm_mday,
tm->tm_mon, tm->tm_year, tm->tm_wday);

- return ret < 0 ? ret : rtc_valid_tm(tm);
+ return ret;
}


--
2.16.1


2018-02-21 21:08:30

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 086/100] rtc: rx4581: remove useless message

It is not necessary to print a message when the time is invalid as
userspace will already get an error (and an optional dev_dbg message).

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx4581.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-rx4581.c b/drivers/rtc/rtc-rx4581.c
index de3fe4f8d133..c59a218bdd87 100644
--- a/drivers/rtc/rtc-rx4581.c
+++ b/drivers/rtc/rtc-rx4581.c
@@ -172,11 +172,7 @@ static int rx4581_get_datetime(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- err = rtc_valid_tm(tm);
- if (err < 0)
- dev_err(dev, "retrieved date/time is not valid.\n");
-
- return err;
+ return 0;
}

static int rx4581_set_datetime(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:08:50

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 072/100] rtc: tx4939: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-tx4939.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-tx4939.c b/drivers/rtc/rtc-tx4939.c
index 1f351308afdc..438bed6f3b28 100644
--- a/drivers/rtc/rtc-tx4939.c
+++ b/drivers/rtc/rtc-tx4939.c
@@ -112,7 +112,7 @@ static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm)
sec = ((unsigned long)buf[5] << 24) | (buf[4] << 16) |
(buf[3] << 8) | buf[2];
rtc_time_to_tm(sec, tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int tx4939_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
--
2.16.1


2018-02-21 21:08:58

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 070/100] rtc: sunxi: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-sunxi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index abada609ddc7..dadbf8b324ad 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -261,7 +261,7 @@ static int sunxi_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
*/
rtc_tm->tm_year += SUNXI_YEAR_OFF(chip->data_year);

- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
--
2.16.1


2018-02-21 21:09:04

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 067/100] rtc: sh: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-sh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 6c2d3989f967..4e8ab370ce63 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -414,7 +414,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:09:28

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 073/100] rtc: wm831x: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-wm831x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 75aea4c4d334..7b824dabf104 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -156,7 +156,7 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm)
u32 time = (time1[0] << 16) | time1[1];

rtc_time_to_tm(time, tm);
- return rtc_valid_tm(tm);
+ return 0;
}

} while (++count < WM831X_GET_TIME_RETRIES);
--
2.16.1


2018-02-21 21:09:52

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 074/100] rtc: xgene: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-xgene.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-xgene.c b/drivers/rtc/rtc-xgene.c
index 0c34d3b81279..153820876a82 100644
--- a/drivers/rtc/rtc-xgene.c
+++ b/drivers/rtc/rtc-xgene.c
@@ -60,7 +60,7 @@ static int xgene_rtc_read_time(struct device *dev, struct rtc_time *tm)
struct xgene_rtc_dev *pdata = dev_get_drvdata(dev);

rtc_time_to_tm(readl(pdata->csr_base + RTC_CCVR), tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int xgene_rtc_set_mmss(struct device *dev, unsigned long secs)
--
2.16.1


2018-02-21 21:10:00

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 068/100] rtc: starfire: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-starfire.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-starfire.c b/drivers/rtc/rtc-starfire.c
index 7fc36973fa33..a7d49329d626 100644
--- a/drivers/rtc/rtc-starfire.c
+++ b/drivers/rtc/rtc-starfire.c
@@ -28,7 +28,7 @@ static u32 starfire_get_time(void)
static int starfire_read_time(struct device *dev, struct rtc_time *tm)
{
rtc_time_to_tm(starfire_get_time(), tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static const struct rtc_class_ops starfire_rtc_ops = {
--
2.16.1


2018-02-21 21:10:08

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 064/100] rtc: s3c: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-s3c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index a8992c227f61..75c8c5033e08 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -232,7 +232,7 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)

rtc_tm->tm_mon -= 1;

- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:10:22

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 065/100] rtc: s5m: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-s5m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 0477678d968f..6deae10c14ac 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -407,7 +407,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:10:23

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 063/100] rtc: rx8025: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx8025.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index 91857d8d2df8..41127adf5765 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -214,7 +214,7 @@ static int rx8025_get_time(struct device *dev, struct rtc_time *dt)
dt->tm_sec, dt->tm_min, dt->tm_hour,
dt->tm_mday, dt->tm_mon, dt->tm_year);

- return rtc_valid_tm(dt);
+ return 0;
}

static int rx8025_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:10:28

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 071/100] rtc: tps6586x: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-tps6586x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c
index a3418a8a3796..d7785ae0a2b4 100644
--- a/drivers/rtc/rtc-tps6586x.c
+++ b/drivers/rtc/rtc-tps6586x.c
@@ -90,7 +90,7 @@ static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm)
seconds = ticks >> 10;
seconds += rtc->epoch_start;
rtc_time_to_tm(seconds, tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int tps6586x_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:11:06

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 069/100] rtc: sun6i: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-sun6i.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index 5bc28eed1adf..2e6fb275acc8 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -349,7 +349,7 @@ static int sun6i_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
*/
rtc_tm->tm_year += SUN6I_YEAR_OFF;

- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int sun6i_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
--
2.16.1


2018-02-21 21:11:12

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 066/100] rtc: sc27xx: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-sc27xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
index d544d5268757..00d87d138984 100644
--- a/drivers/rtc/rtc-sc27xx.c
+++ b/drivers/rtc/rtc-sc27xx.c
@@ -376,7 +376,7 @@ static int sprd_rtc_read_time(struct device *dev, struct rtc_time *tm)
return ret;

rtc_time64_to_tm(secs, tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int sprd_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:11:32

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 043/100] rtc: mc13xxx: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mc13xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 30b8ef6a3676..1f892b238ddb 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -85,7 +85,7 @@ static int mc13xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)

rtc_time64_to_tm((time64_t)days1 * SEC_PER_DAY + seconds, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int mc13xxx_rtc_set_mmss(struct device *dev, time64_t secs)
--
2.16.1


2018-02-21 21:11:41

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 061/100] rtc: rx6110: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx6110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rx6110.c b/drivers/rtc/rtc-rx6110.c
index 7c9c08eab5e5..8e322d884cc2 100644
--- a/drivers/rtc/rtc-rx6110.c
+++ b/drivers/rtc/rtc-rx6110.c
@@ -252,7 +252,7 @@ static int rx6110_get_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year);

- return rtc_valid_tm(tm);
+ return 0;
}

static const struct reg_sequence rx6110_default_regs[] = {
--
2.16.1


2018-02-21 21:12:15

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 058/100] rtc: r7301: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-r7301.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-r7301.c b/drivers/rtc/rtc-r7301.c
index 500e8c8a2605..169704b2ce13 100644
--- a/drivers/rtc/rtc-r7301.c
+++ b/drivers/rtc/rtc-r7301.c
@@ -224,7 +224,7 @@ static int rtc7301_read_time(struct device *dev, struct rtc_time *tm)

spin_unlock_irqrestore(&priv->lock, flags);

- return err ? err : rtc_valid_tm(tm);
+ return err;
}

static int rtc7301_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:12:32

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 057/100] rtc: ps3: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ps3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index 6a8f5d758eac..347288bff438 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -41,7 +41,7 @@ static u64 read_rtc(void)
static int ps3_get_time(struct device *dev, struct rtc_time *tm)
{
rtc_time_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int ps3_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:12:44

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 062/100] rtc: rx8010: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rx8010.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 5c5938ab3d86..7ddc22eb5b0f 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -138,7 +138,7 @@ static int rx8010_get_time(struct device *dev, struct rtc_time *dt)
dt->tm_year = bcd2bin(date[RX8010_YEAR - RX8010_SEC]) + 100;
dt->tm_wday = ffs(date[RX8010_WDAY - RX8010_SEC] & 0x7f);

- return rtc_valid_tm(dt);
+ return 0;
}

static int rx8010_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:12:47

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 060/100] rtc: rp5c01: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rp5c01.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c
index 2c0605132ac0..e469955b688f 100644
--- a/drivers/rtc/rtc-rp5c01.c
+++ b/drivers/rtc/rtc-rp5c01.c
@@ -115,7 +115,7 @@ static int rp5c01_read_time(struct device *dev, struct rtc_time *tm)
rp5c01_unlock(priv);
spin_unlock_irq(&priv->lock);

- return rtc_valid_tm(tm);
+ return 0;
}

static int rp5c01_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:13:16

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 041/100] rtc: max8997: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max8997.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c
index db984d4bf952..e8cee123e8aa 100644
--- a/drivers/rtc/rtc-max8997.c
+++ b/drivers/rtc/rtc-max8997.c
@@ -153,7 +153,7 @@ static int max8997_rtc_read_time(struct device *dev, struct rtc_time *tm)

max8997_rtc_data_to_tm(data, tm, info->rtc_24hr_mode);

- return rtc_valid_tm(tm);
+ return 0;
}

static int max8997_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:13:25

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 044/100] rtc: mcp795: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mcp795.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
index 77f21331ae21..79e24eadbe99 100644
--- a/drivers/rtc/rtc-mcp795.c
+++ b/drivers/rtc/rtc-mcp795.c
@@ -262,7 +262,7 @@ static int mcp795_read_time(struct device *dev, struct rtc_time *tim)
tim->tm_year + 1900, tim->tm_mon, tim->tm_mday,
tim->tm_wday, tim->tm_hour, tim->tm_min, tim->tm_sec);

- return rtc_valid_tm(tim);
+ return 0;
}

static int mcp795_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
--
2.16.1


2018-02-21 21:13:29

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 040/100] rtc: max6916: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max6916.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max6916.c b/drivers/rtc/rtc-max6916.c
index 623ab27b2757..7e908a490cf6 100644
--- a/drivers/rtc/rtc-max6916.c
+++ b/drivers/rtc/rtc-max6916.c
@@ -75,7 +75,7 @@ static int max6916_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_wday = bcd2bin(buf[5]) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100;

- return rtc_valid_tm(dt);
+ return 0;
}

static int max6916_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:13:51

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 055/100] rtc: pcf8523: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf8523.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index c312af0db729..453615f8ac9a 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -192,7 +192,7 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mon = bcd2bin(regs[5] & 0x1f) - 1;
tm->tm_year = bcd2bin(regs[6]) + 100;

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:13:55

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 059/100] rtc: r9701: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-r9701.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index b6c5eb97051c..a39ccd1cf6e8 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -92,7 +92,7 @@ static int r9701_get_datetime(struct device *dev, struct rtc_time *dt)
* according to the data sheet. make sure they are valid.
*/

- return rtc_valid_tm(dt);
+ return 0;
}

static int r9701_set_datetime(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:13:58

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 054/100] rtc: pcf50633: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf50633.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 00c31c91b245..ef72b0c389d7 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -135,7 +135,7 @@ static int pcf50633_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec);

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcf50633_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:14:28

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 053/100] rtc: pcf2127: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf2127.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index f33447c5db85..e83be1852c2f 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -111,7 +111,7 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcf2127_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:14:44

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 042/100] rtc: max8998: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max8998.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c
index 30804b00985e..d8c0f9b3f87d 100644
--- a/drivers/rtc/rtc-max8998.c
+++ b/drivers/rtc/rtc-max8998.c
@@ -120,7 +120,7 @@ static int max8998_rtc_read_time(struct device *dev, struct rtc_time *tm)

max8998_data_to_tm(data, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int max8998_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:15:12

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 050/100] rtc: nuc900: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-nuc900.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c
index 4ed81117cf5f..7da664a77181 100644
--- a/drivers/rtc/rtc-nuc900.c
+++ b/drivers/rtc/rtc-nuc900.c
@@ -102,8 +102,8 @@ static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc)
return NULL;
}

-static int nuc900_rtc_bcd2bin(unsigned int timereg,
- unsigned int calreg, struct rtc_time *tm)
+static void nuc900_rtc_bcd2bin(unsigned int timereg,
+ unsigned int calreg, struct rtc_time *tm)
{
tm->tm_mday = bcd2bin(calreg >> 0);
tm->tm_mon = bcd2bin(calreg >> 8);
@@ -112,8 +112,6 @@ static int nuc900_rtc_bcd2bin(unsigned int timereg,
tm->tm_sec = bcd2bin(timereg >> 0);
tm->tm_min = bcd2bin(timereg >> 8);
tm->tm_hour = bcd2bin(timereg >> 16);
-
- return rtc_valid_tm(tm);
}

static void nuc900_rtc_bin2bcd(struct device *dev, struct rtc_time *settm,
@@ -156,7 +154,9 @@ static int nuc900_rtc_read_time(struct device *dev, struct rtc_time *tm)
timeval = __raw_readl(rtc->rtc_reg + REG_RTC_TLR);
clrval = __raw_readl(rtc->rtc_reg + REG_RTC_CLR);

- return nuc900_rtc_bcd2bin(timeval, clrval, tm);
+ nuc900_rtc_bcd2bin(timeval, clrval, tm);
+
+ return 0;
}

static int nuc900_rtc_set_time(struct device *dev, struct rtc_time *tm)
@@ -189,7 +189,9 @@ static int nuc900_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
timeval = __raw_readl(rtc->rtc_reg + REG_RTC_TAR);
carval = __raw_readl(rtc->rtc_reg + REG_RTC_CAR);

- return nuc900_rtc_bcd2bin(timeval, carval, &alrm->time);
+ nuc900_rtc_bcd2bin(timeval, carval, &alrm->time);
+
+ return rtc_valid_tm(&alrm->time);
}

static int nuc900_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
--
2.16.1


2018-02-21 21:15:15

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 056/100] rtc: pic32: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pic32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pic32.c b/drivers/rtc/rtc-pic32.c
index 5cfb6df5c430..3c08eab4f1a8 100644
--- a/drivers/rtc/rtc-pic32.c
+++ b/drivers/rtc/rtc-pic32.c
@@ -175,7 +175,7 @@ static int pic32_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);

clk_disable(pdata->clk);
- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int pic32_rtc_settime(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:15:25

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 048/100] rtc: mt7622: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mt7622.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mt7622.c b/drivers/rtc/rtc-mt7622.c
index d79b9ae4d237..da213278f343 100644
--- a/drivers/rtc/rtc-mt7622.c
+++ b/drivers/rtc/rtc-mt7622.c
@@ -232,7 +232,7 @@ static int mtk_rtc_gettime(struct device *dev, struct rtc_time *tm)

mtk_rtc_get_alarm_or_time(hw, tm, MTK_TC);

- return rtc_valid_tm(tm);
+ return 0;
}

static int mtk_rtc_settime(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:15:36

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 038/100] rtc: m48t86: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m48t86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index 8d17be1e6650..a9533535c3b7 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -100,7 +100,7 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (m48t86_readb(dev, M48T86_HOUR) & 0x80)
tm->tm_hour += 12;

- return rtc_valid_tm(tm);
+ return 0;
}

static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:15:47

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 039/100] rtc: max6902: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-max6902.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 315d09e0f2c1..745827463367 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -85,7 +85,7 @@ static int max6902_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_year += century;
dt->tm_year -= 1900;

- return rtc_valid_tm(dt);
+ return 0;
}

static int max6902_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:16:01

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 052/100] rtc: pcf2123: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcf2123.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 8895f77726e8..e5222c5d8223 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -289,7 +289,7 @@ static int pcf2123_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcf2123_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:16:26

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 046/100] rtc: mrst: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mrst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index 7334c44fa7c3..901a8d170f68 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -105,7 +105,7 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time)
/* Adjust for the 1972/1900 */
time->tm_year += 72;
time->tm_mon--;
- return rtc_valid_tm(time);
+ return 0;
}

static int mrst_set_time(struct device *dev, struct rtc_time *time)
--
2.16.1


2018-02-21 21:16:35

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 047/100] rtc: msm6242: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-msm6242.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c
index c1c5c4e3b3b4..0c72a2e8ec67 100644
--- a/drivers/rtc/rtc-msm6242.c
+++ b/drivers/rtc/rtc-msm6242.c
@@ -155,7 +155,7 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm)

msm6242_unlock(priv);

- return rtc_valid_tm(tm);
+ return 0;
}

static int msm6242_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:17:12

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 049/100] rtc: mv: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 79bb28617d45..944c5c0fadd0 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -94,7 +94,7 @@ static int mv_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* hw counts from year 2000, but tm_year is relative to 1900 */
tm->tm_year = bcd2bin(year) + 100;

- return rtc_valid_tm(tm);
+ return 0;
}

static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
--
2.16.1


2018-02-21 21:17:24

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 028/100] rtc: ds3232: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds3232.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 0550f7ba464f..7184e5145f12 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -145,7 +145,7 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time)

time->tm_year = bcd2bin(year) + add_century;

- return rtc_valid_tm(time);
+ return 0;
}

static int ds3232_set_time(struct device *dev, struct rtc_time *time)
--
2.16.1


2018-02-21 21:17:29

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 045/100] rtc: mpc5121: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-mpc5121.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 4ca4daa0b8f3..dd0364293bc0 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -122,7 +122,7 @@ static int mpc5121_rtc_read_time(struct device *dev, struct rtc_time *tm)
*/
mpc5121_rtc_update_smh(regs, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int mpc5121_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:17:31

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 051/100] rtc: pcap: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-pcap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
index c4433240d8a9..c05f524ba9af 100644
--- a/drivers/rtc/rtc-pcap.c
+++ b/drivers/rtc/rtc-pcap.c
@@ -95,7 +95,7 @@ static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)

rtc_time_to_tm(secs, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int pcap_rtc_set_mmss(struct device *dev, unsigned long secs)
--
2.16.1


2018-02-21 21:17:47

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 023/100] rtc: ds1347: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1347.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index ccfc9d43eb1e..938512c676ee 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -66,7 +66,7 @@ static int ds1347_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_wday = bcd2bin(buf[5]) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100;

- return rtc_valid_tm(dt);
+ return 0;
}

static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:17:57

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 036/100] rtc: m48t35: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m48t35.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index 810f4ea481e4..0cf6507de3c7 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -84,7 +84,7 @@ static int m48t35_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year += 100;

tm->tm_mon--;
- return rtc_valid_tm(tm);
+ return 0;
}

static int m48t35_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:17:58

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 026/100] rtc: ds1742: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1742.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 52baf925a690..2d781180e968 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -112,7 +112,7 @@ static int ds1742_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* year is 1900 + tm->tm_year */
tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900;

- return rtc_valid_tm(tm);
+ return 0;
}

static const struct rtc_class_ops ds1742_rtc_ops = {
--
2.16.1


2018-02-21 21:18:39

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 033/100] rtc: lpc32xx: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-lpc32xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c
index 887871c3d526..3ba87239aacc 100644
--- a/drivers/rtc/rtc-lpc32xx.c
+++ b/drivers/rtc/rtc-lpc32xx.c
@@ -70,7 +70,7 @@ static int lpc32xx_rtc_read_time(struct device *dev, struct rtc_time *time)
elapsed_sec = rtc_readl(rtc, LPC32XX_RTC_UCOUNT);
rtc_time_to_tm(elapsed_sec, time);

- return rtc_valid_tm(time);
+ return 0;
}

static int lpc32xx_rtc_set_mmss(struct device *dev, unsigned long secs)
--
2.16.1


2018-02-21 21:18:42

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 032/100] rtc: lpc24xx: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-lpc24xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-lpc24xx.c b/drivers/rtc/rtc-lpc24xx.c
index 59d99596fdeb..14dc7b04fae0 100644
--- a/drivers/rtc/rtc-lpc24xx.c
+++ b/drivers/rtc/rtc-lpc24xx.c
@@ -110,7 +110,7 @@ static int lpc24xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year = CT1_YEAR(ct1);
tm->tm_yday = CT2_DOY(ct2);

- return rtc_valid_tm(tm);
+ return 0;
}

static int lpc24xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
--
2.16.1


2018-02-21 21:18:54

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 034/100] rtc: ls1x: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ls1x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c
index e04ca54f21e2..045af1135e48 100644
--- a/drivers/rtc/rtc-ls1x.c
+++ b/drivers/rtc/rtc-ls1x.c
@@ -98,7 +98,7 @@ static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm)
ls1x_get_min(v), ls1x_get_sec(v));
rtc_time_to_tm(t, rtm);

- return rtc_valid_tm(rtm);
+ return 0;
}

static int ls1x_rtc_set_time(struct device *dev, struct rtc_time *rtm)
--
2.16.1


2018-02-21 21:19:18

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 024/100] rtc: ds1390: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1390.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index 4d5b007d7fc6..3b095401f848 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -153,7 +153,7 @@ static int ds1390_read_time(struct device *dev, struct rtc_time *dt)
/* adjust for century bit */
dt->tm_year = bcd2bin(chip->txrx_buf[6]) + ((chip->txrx_buf[5] & 0x80) ? 100 : 0);

- return rtc_valid_tm(dt);
+ return 0;
}

static int ds1390_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:19:25

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 037/100] rtc: m48t59: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m48t59.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index c6af83505448..52c7e35a5860 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -105,7 +105,7 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm)
dev_dbg(dev, "RTC read time %04d-%02d-%02d %02d/%02d/%02d\n",
tm->tm_year + 1900, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
- return rtc_valid_tm(tm);
+ return 0;
}

static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:19:28

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 035/100] rtc: m41t94: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-m41t94.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index 1f0eb79e69f9..bab82b4be356 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -99,8 +99,7 @@ static int m41t94_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour, tm->tm_mday,
tm->tm_mon, tm->tm_year, tm->tm_wday);

- /* initial clock setting can be undefined */
- return rtc_valid_tm(tm);
+ return 0;
}

static const struct rtc_class_ops m41t94_rtc_ops = {
--
2.16.1


2018-02-21 21:19:38

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 027/100] rtc: ds2404: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds2404.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index 9a1582ed7070..b886b6a5c178 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -207,7 +207,7 @@ static int ds2404_read_time(struct device *dev, struct rtc_time *dt)
time = le32_to_cpu(time);

rtc_time_to_tm(time, dt);
- return rtc_valid_tm(dt);
+ return 0;
}

static int ds2404_set_mmss(struct device *dev, unsigned long secs)
--
2.16.1


2018-02-21 21:20:00

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 030/100] rtc: fm3130: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-fm3130.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
index 576eadbba296..e1137670d4d2 100644
--- a/drivers/rtc/rtc-fm3130.c
+++ b/drivers/rtc/rtc-fm3130.c
@@ -136,8 +136,7 @@ static int fm3130_get_time(struct device *dev, struct rtc_time *t)
t->tm_hour, t->tm_mday,
t->tm_mon, t->tm_year, t->tm_wday);

- /* initial clock setting can be undefined */
- return rtc_valid_tm(t);
+ return 0;
}


--
2.16.1


2018-02-21 21:20:10

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 031/100] rtc: jz4740: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-jz4740.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index ff65a7d2b9c9..d0a891777f44 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -173,7 +173,7 @@ static int jz4740_rtc_read_time(struct device *dev, struct rtc_time *time)

rtc_time_to_tm(secs, time);

- return rtc_valid_tm(time);
+ return 0;
}

static int jz4740_rtc_set_mmss(struct device *dev, unsigned long secs)
--
2.16.1


2018-02-21 21:20:10

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 025/100] rtc: ds1685: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1685.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index ed43b4311660..1a39829d2b40 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -306,7 +306,7 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
tm->tm_isdst = 0; /* RTC has hardcoded timezone, so don't use. */

- return rtc_valid_tm(tm);
+ return 0;
}

/**
--
2.16.1


2018-02-21 21:20:21

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 022/100] rtc: ds1343: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1343.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index 59d27db2fd37..5208da4cf94a 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -254,7 +254,7 @@ static int ds1343_read_time(struct device *dev, struct rtc_time *dt)
dt->tm_mon = bcd2bin(buf[5] & 0x1F) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100; /* year offset from 1900 */

- return rtc_valid_tm(dt);
+ return 0;
}

static int ds1343_set_time(struct device *dev, struct rtc_time *dt)
--
2.16.1


2018-02-21 21:21:02

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 017/100] rtc: ds1216: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1216.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index 9c82b1da2d45..5f158715fb4c 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -99,7 +99,7 @@ static int ds1216_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (tm->tm_year < 70)
tm->tm_year += 100;

- return rtc_valid_tm(tm);
+ return 0;
}

static int ds1216_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:21:05

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 020/100] rtc: ds1305: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1305.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 3d2400a39da9..2d502fc85698 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -203,8 +203,7 @@ static int ds1305_get_time(struct device *dev, struct rtc_time *time)
time->tm_hour, time->tm_mday,
time->tm_mon, time->tm_year, time->tm_wday);

- /* Time may not be set */
- return rtc_valid_tm(time);
+ return 0;
}

static int ds1305_set_time(struct device *dev, struct rtc_time *time)
--
2.16.1


2018-02-21 21:21:07

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 021/100] rtc: ds1307: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1307.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 4021d478b9f3..a13e59edff53 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -437,8 +437,7 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t)
t->tm_hour, t->tm_mday,
t->tm_mon, t->tm_year, t->tm_wday);

- /* initial clock setting can be undefined */
- return rtc_valid_tm(t);
+ return 0;
}

static int ds1307_set_time(struct device *dev, struct rtc_time *t)
--
2.16.1


2018-02-21 21:21:23

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 019/100] rtc: ds1302: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1302.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index 43bcb17c922e..2a881150d51c 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -98,8 +98,7 @@ static int ds1302_rtc_get_time(struct device *dev, struct rtc_time *time)
time->tm_mon = bcd2bin(buf[RTC_ADDR_MON]) - 1;
time->tm_year = bcd2bin(buf[RTC_ADDR_YEAR]) + 100;

- /* Time may not be set */
- return rtc_valid_tm(time);
+ return 0;
}

static const struct rtc_class_ops ds1302_rtc_ops = {
--
2.16.1


2018-02-21 21:21:27

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 018/100] rtc: ds1286: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1286.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index ef75c349dff9..0744916b79c5 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -211,7 +211,7 @@ static int ds1286_read_time(struct device *dev, struct rtc_time *tm)

tm->tm_mon--;

- return rtc_valid_tm(tm);
+ return 0;
}

static int ds1286_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:21:48

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 015/100] rtc: da9055: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-da9055.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
index 678af8648c45..e08cd8130c23 100644
--- a/drivers/rtc/rtc-da9055.c
+++ b/drivers/rtc/rtc-da9055.c
@@ -158,7 +158,7 @@ static int da9055_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_min = v[1] & DA9055_RTC_MIN;
rtc_tm->tm_sec = v[0] & DA9055_RTC_SEC;

- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int da9055_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:21:55

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 013/100] rtc: cpcap: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-cpcap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-cpcap.c b/drivers/rtc/rtc-cpcap.c
index 3a0333e1f21a..a8856f2b9bc2 100644
--- a/drivers/rtc/rtc-cpcap.c
+++ b/drivers/rtc/rtc-cpcap.c
@@ -119,7 +119,7 @@ static int cpcap_rtc_read_time(struct device *dev, struct rtc_time *tm)

cpcap2rtc_time(tm, &cpcap_tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int cpcap_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:22:09

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 011/100] rtc: bq32k: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-bq32k.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index 98ac8d5c7901..e8698e9870fe 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -110,7 +110,7 @@ static int bq32k_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year = bcd2bin(regs.years) +
((regs.cent_hours & BQ32K_CENT) ? 100 : 0);

- return rtc_valid_tm(tm);
+ return 0;
}

static int bq32k_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:22:20

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 012/100] rtc: coh901331: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-coh901331.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index cfc4141d99cd..2fc517498a5d 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -82,7 +82,7 @@ static int coh901331_read_time(struct device *dev, struct rtc_time *tm)
if (readl(rtap->virtbase + COH901331_VALID)) {
rtc_time_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
clk_disable(rtap->clk);
- return rtc_valid_tm(tm);
+ return 0;
}
clk_disable(rtap->clk);
return -EINVAL;
--
2.16.1


2018-02-21 21:23:14

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 010/100] rtc: au1xxx: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-au1xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-au1xxx.c b/drivers/rtc/rtc-au1xxx.c
index 2ba44ccb9c3a..7c5530c71285 100644
--- a/drivers/rtc/rtc-au1xxx.c
+++ b/drivers/rtc/rtc-au1xxx.c
@@ -36,7 +36,7 @@ static int au1xtoy_rtc_read_time(struct device *dev, struct rtc_time *tm)

rtc_time_to_tm(t, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int au1xtoy_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:23:15

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 016/100] rtc: da9063: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-da9063.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
index f85cae240f12..b4e054c64bad 100644
--- a/drivers/rtc/rtc-da9063.c
+++ b/drivers/rtc/rtc-da9063.c
@@ -256,7 +256,7 @@ static int da9063_rtc_read_time(struct device *dev, struct rtc_time *tm)
else
rtc->rtc_sync = false;

- return rtc_valid_tm(tm);
+ return 0;
}

static int da9063_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:23:26

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 005/100] rtc: stk17ta8: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-stk17ta8.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index b670e44306a8..c66ec6ae233c 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -129,10 +129,6 @@ static int stk17ta8_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* year is 1900 + tm->tm_year */
tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900;

- if (rtc_valid_tm(tm) < 0) {
- dev_err(dev, "retrieved date/time is not valid.\n");
- rtc_time_to_tm(0, tm);
- }
return 0;
}

--
2.16.1


2018-02-21 21:23:35

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 006/100] rtc: ab-b5ze-s3: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ab-b5ze-s3.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ab-b5ze-s3.c b/drivers/rtc/rtc-ab-b5ze-s3.c
index a319bf1e49de..e55f35fa0b58 100644
--- a/drivers/rtc/rtc-ab-b5ze-s3.c
+++ b/drivers/rtc/rtc-ab-b5ze-s3.c
@@ -217,7 +217,7 @@ static int _abb5zes3_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
struct abb5zes3_rtc_data *data = dev_get_drvdata(dev);
u8 regs[ABB5ZES3_REG_RTC_SC + ABB5ZES3_RTC_SEC_LEN];
- int ret;
+ int ret = 0;

/*
* As we need to read CTRL1 register anyway to access 24/12h
@@ -255,8 +255,6 @@ static int _abb5zes3_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_mon = bcd2bin(regs[ABB5ZES3_REG_RTC_MO]) - 1; /* starts at 1 */
tm->tm_year = bcd2bin(regs[ABB5ZES3_REG_RTC_YR]) + 100;

- ret = rtc_valid_tm(tm);
-
err:
return ret;
}
--
2.16.1


2018-02-21 21:23:47

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 014/100] rtc: da9052: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-da9052.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 4273377562ec..03044e1bc497 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -187,8 +187,7 @@ static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_min = v[0][1] & DA9052_RTC_MIN;
rtc_tm->tm_sec = v[0][0] & DA9052_RTC_SEC;

- ret = rtc_valid_tm(rtc_tm);
- return ret;
+ return 0;
}

idx = (1-idx);
--
2.16.1


2018-02-21 21:24:12

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 008/100] rtc: ab8500: stop validating rtc_time in .read_time

rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ab8500.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 24a0af650a1b..98c7123cd7ba 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -131,7 +131,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
secs += get_elapsed_seconds(AB8500_RTC_EPOCH);

rtc_time_to_tm(secs, tm);
- return rtc_valid_tm(tm);
+ return 0;
}

static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
--
2.16.1


2018-02-21 21:24:26

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 007/100] rtc: ab3100: stop validating rtc_time in .read_time

rtc_time64_to_tm never generates an invalid tm. It is not necessary to
validate it. Also, the RTC core is always calling rtc_valid_tm after the
read_time callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ab3100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
index 9b725c553058..821ff52a2222 100644
--- a/drivers/rtc/rtc-ab3100.c
+++ b/drivers/rtc/rtc-ab3100.c
@@ -106,7 +106,7 @@ static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm)

rtc_time64_to_tm(time, tm);

- return rtc_valid_tm(tm);
+ return 0;
}

static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
--
2.16.1


2018-02-21 21:24:31

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 009/100] rtc: ac100: stop validating rtc_time in .read_time

The RTC core is always calling rtc_valid_tm after the read_time callback.
It is not necessary to call it just before returning from the callback.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ac100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
index 8ff9dc3fe5bf..080e3c04be43 100644
--- a/drivers/rtc/rtc-ac100.c
+++ b/drivers/rtc/rtc-ac100.c
@@ -387,7 +387,7 @@ static int ac100_rtc_get_time(struct device *dev, struct rtc_time *rtc_tm)
rtc_tm->tm_year = bcd2bin(reg[6] & AC100_RTC_YEA_MASK) +
AC100_YEAR_OFF;

- return rtc_valid_tm(rtc_tm);
+ return 0;
}

static int ac100_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
--
2.16.1


2018-02-21 21:24:43

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 002/100] rtc: ds1553: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-ds1553.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 7334c824371a..2441b9a2b366 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -127,10 +127,6 @@ static int ds1553_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* year is 1900 + tm->tm_year */
tm->tm_year = bcd2bin(year) + bcd2bin(century) * 100 - 1900;

- if (rtc_valid_tm(tm) < 0) {
- dev_err(dev, "retrieved date/time is not valid.\n");
- rtc_time_to_tm(0, tm);
- }
return 0;
}

--
2.16.1


2018-02-21 21:25:03

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 003/100] rtc: cmos: let the core handle invalid time

Setting the rtc to a valid time when the time is invalid is a bad practice,
because then userspace doesn't know it shouldn't trust the RTC.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-cmos.c | 12 ------------
1 file changed, 12 deletions(-)

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index b8ec6009171a..d98ad4874d8b 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -1262,8 +1262,6 @@ MODULE_DEVICE_TABLE(of, of_cmos_match);
static __init void cmos_of_init(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
- struct rtc_time time;
- int ret;
const __be32 *val;

if (!node)
@@ -1276,16 +1274,6 @@ static __init void cmos_of_init(struct platform_device *pdev)
val = of_get_property(node, "freq-reg", NULL);
if (val)
CMOS_WRITE(be32_to_cpup(val), RTC_FREQ_SELECT);
-
- cmos_read_time(&pdev->dev, &time);
- ret = rtc_valid_tm(&time);
- if (ret) {
- struct rtc_time def_time = {
- .tm_year = 1,
- .tm_mday = 1,
- };
- cmos_set_time(&pdev->dev, &def_time);
- }
}
#else
static inline void cmos_of_init(struct platform_device *pdev) {}
--
2.16.1


2018-02-21 21:26:27

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 004/100] rtc: rs5c348: let the core handle invalid time

Returning a valid time when the time is invalid is a bad practice, because
then userspace is not able to react on the information. Also, it doesn't
make sense to return epoch because it is already the default time.

Signed-off-by: Alexandre Belloni <[email protected]>
---
drivers/rtc/rtc-rs5c348.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 9a306983aaba..f2de8b17e7e3 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -135,11 +135,6 @@ rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_year = bcd2bin(rxbuf[RS5C348_REG_YEAR]) +
((rxbuf[RS5C348_REG_MONTH] & RS5C348_BIT_Y2K) ? 100 : 0);

- if (rtc_valid_tm(tm) < 0) {
- dev_err(&spi->dev, "retrieved date/time is not valid.\n");
- rtc_time_to_tm(0, tm);
- }
-
return 0;
}

--
2.16.1


2018-02-22 01:54:50

by Baolin Wang

[permalink] [raw]
Subject: Re: [PATCH 066/100] rtc: sc27xx: stop validating rtc_time in .read_time

Hi Alexandre,

On 22 February 2018 at 04:56, Alexandre Belloni
<[email protected]> wrote:
> rtc_time64_to_tm never generates an invalid tm. It is not necessary to
> validate it. Also, the RTC core is always calling rtc_valid_tm after the
> read_time callback.
>
> Signed-off-by: Alexandre Belloni <[email protected]>

Thanks for fixing this, and please add my tag if it helps.
Reviewed-by: Baolin Wang <[email protected]>

> ---
> drivers/rtc/rtc-sc27xx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
> index d544d5268757..00d87d138984 100644
> --- a/drivers/rtc/rtc-sc27xx.c
> +++ b/drivers/rtc/rtc-sc27xx.c
> @@ -376,7 +376,7 @@ static int sprd_rtc_read_time(struct device *dev, struct rtc_time *tm)
> return ret;
>
> rtc_time64_to_tm(secs, tm);
> - return rtc_valid_tm(tm);
> + return 0;
> }
>
> static int sprd_rtc_set_time(struct device *dev, struct rtc_time *tm)
> --
> 2.16.1
>



--
Baolin.wang
Best Regards

2018-02-22 11:42:00

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH 013/100] rtc: cpcap: stop validating rtc_time in .read_time

Hi,

On Wed, Feb 21, 2018 at 09:55:08PM +0100, Alexandre Belloni wrote:
> The RTC core is always calling rtc_valid_tm after the read_time callback.
> It is not necessary to call it just before returning from the callback.
>
> Signed-off-by: Alexandre Belloni <[email protected]>
> ---
> drivers/rtc/rtc-cpcap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-cpcap.c b/drivers/rtc/rtc-cpcap.c
> index 3a0333e1f21a..a8856f2b9bc2 100644
> --- a/drivers/rtc/rtc-cpcap.c
> +++ b/drivers/rtc/rtc-cpcap.c
> @@ -119,7 +119,7 @@ static int cpcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
>
> cpcap2rtc_time(tm, &cpcap_tm);
>
> - return rtc_valid_tm(tm);
> + return 0;
> }
>
> static int cpcap_rtc_set_time(struct device *dev, struct rtc_time *tm)

Reviewed-by: Sebastian Reichel <[email protected]>

-- Sebastian


Attachments:
(No filename) (928.00 B)
signature.asc (849.00 B)
Download all attachments

2018-02-22 15:49:10

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 000/100] rtc: remove cargo culted code

On Wed, Feb 21, 2018 at 09:54:55PM +0100, Alexandre Belloni wrote:
> Hello,
>
> This series:
> - removes useless calls to rtc_valid_tm in .read_time, .set_time and
> .set_alarm
> - removes code setting default values for RTCs (and lets the core
> handle it)
> - removes useless "time is invalid" messages at probe time
> - removes useless indirect calls

Seems like this could be just one patch for each of the issues..

2018-02-22 16:06:20

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 000/100] rtc: remove cargo culted code

On 22/02/2018 at 07:48:03 -0800, Christoph Hellwig wrote:
> On Wed, Feb 21, 2018 at 09:54:55PM +0100, Alexandre Belloni wrote:
> > Hello,
> >
> > This series:
> > - removes useless calls to rtc_valid_tm in .read_time, .set_time and
> > .set_alarm
> > - removes code setting default values for RTCs (and lets the core
> > handle it)
> > - removes useless "time is invalid" messages at probe time
> > - removes useless indirect calls
>
> Seems like this could be just one patch for each of the issues..

I'll probably squash the simpler ones before sending to Linus.

--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

2018-03-02 09:08:21

by Steve Twiss

[permalink] [raw]
Subject: RE: [PATCH 000/100] rtc: remove cargo culted code

On 02 March 2018 08:57, Alexandre Belloni wrote:

> To: Steve Twiss
> Cc: [email protected]; [email protected]
> Subject: Re: [PATCH 000/100] rtc: remove cargo culted code
>
> On 02/03/2018 at 08:46:48 +0000, Steve Twiss wrote:
> > Hi Alexandre,
> >
> > Acked for:
> > rtc: da9063: stop validating rtc_time in .read_time
> > rtc: da9052: stop validating rtc_time in .read_time
> > rtc: da9055: stop validating rtc_time in .read_time
> >
> > Acked-by: Steve Twiss <[email protected]>
> >

[...]

> > But after some further looking, I have not got any explicit case of how the
> > time read directly from the DA9063
> > registers can be incorrectly represented. So there should be no need to
> > check this.
>
> My point is that it is checked later in the core anyway so you end up
> doing:
>
> da9063_rtc_read_time()
> return rtc_valid_tm(tm);
>
> __rtc_read_time()
> if (err < 0)
> return err;
> err = rtc_valid_tm(tm);
>
> return err;
>
> So the check in da9063_rtc_read_time is always pointless.

Ahh. I see. Thanks!
Regards,
Steve


2018-03-02 12:40:10

by Steve Twiss

[permalink] [raw]
Subject: RE: [PATCH 000/100] rtc: remove cargo culted code

On Wed, Feb 21, 2018 at 8:54 PM, Alexandre Belloni wrote:

> subject: [PATCH 000/100] rtc: remove cargo culted code
> mailing list: [email protected] Filter messages from this mailing list
>
> Hello,
>
> This series:
> - removes useless calls to rtc_valid_tm in .read_time, .set_time and
> .set_alarm
> - removes code setting default values for RTCs (and lets the core
> handle it)
> - removes useless "time is invalid" messages at probe time
> - removes useless indirect calls
>
> Those were mostly copy pasted from other drivers

Hi Alexandre,

Acked for:
rtc: da9063: stop validating rtc_time in .read_time
rtc: da9052: stop validating rtc_time in .read_time
rtc: da9055: stop validating rtc_time in .read_time

Acked-by: Steve Twiss <[email protected]>

Agreed -- rtc_valid_tm() call is cargo cult for the above.

(By definition) for DA9063 I was trying to be rigorous.
The .read_time function is slightly different here because I can make a copy the alarm time into the RTC time
structure to solve an RTC synchronisation problem internally to the DA9063.
https://elixir.bootlin.com/linux/v4.5.6/source/drivers/rtc/rtc-da9063.c#L253

But after some further looking, I have not got any explicit case of how the time read directly from the DA9063
registers can be incorrectly represented. So there should be no need to check this.

Regards,
Steve

2018-03-02 12:44:47

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH 000/100] rtc: remove cargo culted code

On 02/03/2018 at 08:46:48 +0000, Steve Twiss wrote:
> On Wed, Feb 21, 2018 at 8:54 PM, Alexandre Belloni wrote:
>
> > subject: [PATCH 000/100] rtc: remove cargo culted code
> > mailing list: [email protected] Filter messages from this mailing list
> >
> > Hello,
> >
> > This series:
> > - removes useless calls to rtc_valid_tm in .read_time, .set_time and
> > .set_alarm
> > - removes code setting default values for RTCs (and lets the core
> > handle it)
> > - removes useless "time is invalid" messages at probe time
> > - removes useless indirect calls
> >
> > Those were mostly copy pasted from other drivers
>
> Hi Alexandre,
>
> Acked for:
> rtc: da9063: stop validating rtc_time in .read_time
> rtc: da9052: stop validating rtc_time in .read_time
> rtc: da9055: stop validating rtc_time in .read_time
>
> Acked-by: Steve Twiss <[email protected]>
>
> Agreed -- rtc_valid_tm() call is cargo cult for the above.
>
> (By definition) for DA9063 I was trying to be rigorous.
> The .read_time function is slightly different here because I can make a copy the alarm time into the RTC time
> structure to solve an RTC synchronisation problem internally to the DA9063.
> https://elixir.bootlin.com/linux/v4.5.6/source/drivers/rtc/rtc-da9063.c#L253
>
> But after some further looking, I have not got any explicit case of how the time read directly from the DA9063
> registers can be incorrectly represented. So there should be no need to check this.
>

My point is that it is checked later in the core anyway so you end up
doing:

da9063_rtc_read_time()
return rtc_valid_tm(tm);

__rtc_read_time()
if (err < 0)
return err;
err = rtc_valid_tm(tm);

return err;

So the check in da9063_rtc_read_time is always pointless.


--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com