# \[PATCH\] rtc: pcf85063: remove useless century handling

- Subsystems: REAL TIME CLOCK (RTC) SUBSYSTEM, THE REST
- Maintainers: Alexandre Belloni, Linus Torvalds
- List: linux-rtc
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linux-rtc/2016/02/4692321/t

## \[PATCH\] rtc: pcf85063: remove useless century handling

- From: Alexandre Belloni \<hidden\>
- Date: 2016-02-23 23:05:33 
- Message: https://ratatoskr.run/linux-rtc/2016/02/4692321.md

```text
pcf85063_get_datetime() tries to handle a century bit but that bit is not
documented and the final value is never used anywhere else in the kernel.

Signed-off-by: Alexandre Belloni <redacted>
---
 drivers/rtc/rtc-pcf85063.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index c5db231f14de..2b3b99b094b5 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -31,13 +31,10 @@
 #define PCF85063_REG_MO			0x09
 #define PCF85063_REG_YR			0x0A
 
-#define PCF85063_MO_C			0x80 /* century */
-
 static struct i2c_driver pcf85063_driver;
 
 struct pcf85063 {
 	struct rtc_device *rtc;
-	int c_polarity;	/* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */
 	int voltage_low; /* indicates if a low_voltage was detected */
 };
 
@@ -103,9 +100,6 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 	tm->tm_year = bcd2bin(regs[6]);
 	if (tm->tm_year < 70)
 		tm->tm_year += 100;	/* assume we are in 1970...2069 */
-	/* detect the polarity heuristically. see note above. */
-	pcf85063->c_polarity = (regs[5] & PCF85063_MO_C) ?
-		(tm->tm_year >= 100) : (tm->tm_year < 100);
 
 	return rtc_valid_tm(tm);
 }
-- 
2.7.0

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
```

## Re: \[PATCH\] rtc: pcf85063: remove useless century handling

- From: Juergen Borleis \<hidden\>
- Date: 2016-02-26 11:05:37 
- Message: https://ratatoskr.run/linux-rtc/2016/02/4695292.md

```text
Hi Alexandre,

On Wednesday 24 February 2016 00:05:28 Alexandre Belloni wrote:
> pcf85063_get_datetime() tries to handle a century bit but that bit is not
> documented and the final value is never used anywhere else in the kernel.
> [...]
> However, I found two interesting things in that driver. I'll send a
> patch shortly, removing the useless century handling.
> Also, I'm quite unsure about the year range handling. I have a patch but
> I'm not sure about the RTC behaviour when the year goes from 99 to 00.
> Can you check that works properly?

Just returned from the embedded world exhibition... Will test it.

Regards,
Juergen

=2D-=20
Pengutronix e.K. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0| Juergen Borleis =A0 =A0 =A0 =A0 =A0 =A0 |
Industrial Linux Solutions =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| http://=
www.pengutronix.de/ =A0|
```

## Re: \[PATCH\] rtc: pcf85063: remove useless century handling

- From: Juergen Borleis \<hidden\>
- Date: 2016-03-01 08:27:20 
- Message: https://ratatoskr.run/linux-rtc/2016/03/4697639.md

```text
On Wednesday 24 February 2016 00:05:28 Alexandre Belloni wrote:
> pcf85063_get_datetime() tries to handle a century bit but that bit is not
> documented and the final value is never used anywhere else in the kernel.
>
> Signed-off-by: Alexandre Belloni <redacted>
> ---
>  drivers/rtc/rtc-pcf85063.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
> index c5db231f14de..2b3b99b094b5 100644
> --- a/drivers/rtc/rtc-pcf85063.c
> +++ b/drivers/rtc/rtc-pcf85063.c
> @@ -31,13 +31,10 @@
>  #define PCF85063_REG_MO			0x09
>  #define PCF85063_REG_YR			0x0A
>
> -#define PCF85063_MO_C			0x80 /* century */
> -
>  static struct i2c_driver pcf85063_driver;
>
>  struct pcf85063 {
>  	struct rtc_device *rtc;
> -	int c_polarity;	/* 0: MO_C=3D1 means 19xx, otherwise MO_C=3D1 means 20x=
x */
>  	int voltage_low; /* indicates if a low_voltage was detected */
>  };
>
> @@ -103,9 +100,6 @@ static int pcf85063_get_datetime(struct i2c_client
> *client, struct rtc_time *tm) tm->tm_year =3D bcd2bin(regs[6]);
>  	if (tm->tm_year < 70)
>  		tm->tm_year +=3D 100;	/* assume we are in 1970...2069 */
> -	/* detect the polarity heuristically. see note above. */
> -	pcf85063->c_polarity =3D (regs[5] & PCF85063_MO_C) ?
> -		(tm->tm_year >=3D 100) : (tm->tm_year < 100);
>
>  	return rtc_valid_tm(tm);
>  }

Reviewed-by: Juergen Borleis <redacted>
Tested-by: Ulrich =D6lmann <redacted>

Regards,
Juergen
```
