Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-28 Thread Alexandre Belloni
Hi, On 27/08/2017 at 13:30:59 +0200, Andreas Färber wrote: > Well, I found your rtc_year_days rather confusing and had to play with > the arguments until I got it working as expected, so I wanted an inline > function (or macro) as abstraction from my three callers. > > Sadly the naming is rather

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Alexandre Belloni
On 27/08/2017 at 15:37:51 +0200, Andrew Lunn wrote: > > >> +static inline int rtd119x_rtc_year_days(int year) > > >> +{ > > >> +return rtc_year_days(1, 12, year); > > > > > > I'm not sure it is worth wrapping rtc_year_days > > [snip] > > > > Well, I found your rtc_year_days rather confusi

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andrew Lunn
> >> +static inline int rtd119x_rtc_year_days(int year) > >> +{ > >> + return rtc_year_days(1, 12, year); > > > > I'm not sure it is worth wrapping rtc_year_days > [snip] > > Well, I found your rtc_year_days rather confusing and had to play with > the arguments until I got it working as expected

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Hi Alexandre, Am 27.08.2017 um 11:13 schrieb Alexandre Belloni: > Not much to add, apart from the spinlock issue already spotted by Andrew. > > On 27/08/2017 at 02:33:27 +0200, Andreas Färber wrote: >> +struct rtd119x_rtc { >> +void __iomem *base; >> +struct clk *clk; >> +struct rtc_d

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Am 27.08.2017 um 10:27 schrieb Alexandre Belloni: > On 27/08/2017 at 04:30:08 +0200, Andreas Färber wrote: >> Am 27.08.2017 um 04:05 schrieb Andrew Lunn: >> By that same argument we could ask why so many drivers (and mine, too) >> are calling rtc_valid_tm() when __rtc_read_time() calls it again...

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Hi Andrew, Am 27.08.2017 um 05:27 schrieb Andrew Lunn: > On Sun, Aug 27, 2017 at 04:30:08AM +0200, Andreas Färber wrote: >> Am 27.08.2017 um 04:05 schrieb Andrew Lunn: >>> n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote: +struct rtd119x_rtc { + void __iomem *base; +

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Alexandre Belloni
Hi, Not much to add, apart from the spinlock issue already spotted by Andrew. On 27/08/2017 at 02:33:27 +0200, Andreas Färber wrote: > +struct rtd119x_rtc { > + void __iomem *base; > + struct clk *clk; > + struct rtc_device *rtcdev; > + unsigned base_year; checkpatch complains th

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Alexandre Belloni
On 27/08/2017 at 04:30:08 +0200, Andreas Färber wrote: > Am 27.08.2017 um 04:05 schrieb Andrew Lunn: > > n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote: > >> +struct rtd119x_rtc { > >> + void __iomem *base; > >> + struct clk *clk; > >> + struct rtc_device *rtcdev; > >> + unsigned

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-26 Thread Andrew Lunn
On Sun, Aug 27, 2017 at 04:30:08AM +0200, Andreas Färber wrote: > Am 27.08.2017 um 04:05 schrieb Andrew Lunn: > > n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote: > >> +struct rtd119x_rtc { > >> + void __iomem *base; > >> + struct clk *clk; > >> + struct rtc_device *rtcdev; > >> +

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-26 Thread Andreas Färber
Am 27.08.2017 um 04:05 schrieb Andrew Lunn: > n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote: >> +struct rtd119x_rtc { >> +void __iomem *base; >> +struct clk *clk; >> +struct rtc_device *rtcdev; >> +unsigned base_year; >> +spinlock_t lock; > > Where is this lock

Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-26 Thread Andrew Lunn
n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote: > Based on QNAP's arch/arm/mach-rtk119x/driver/rtk_rtc_drv.c code and > mach-rtk119x/driver/dc2vo/fpga/include/mis_reg.h register definitions. > > The base year 2014 was observed on all of Zidoo X9S, ProBox2 Ava and > Beelink Lake I. >

[PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-26 Thread Andreas Färber
Based on QNAP's arch/arm/mach-rtk119x/driver/rtk_rtc_drv.c code and mach-rtk119x/driver/dc2vo/fpga/include/mis_reg.h register definitions. The base year 2014 was observed on all of Zidoo X9S, ProBox2 Ava and Beelink Lake I. Signed-off-by: Andreas Färber --- v1 -> v2: * Dropped open/release in