lkml.org 
[lkml]   [2018]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rtc: jz4740: Add support for the JZ4725B, JZ4760, JZ4770
On 14/07/2018 15:50:08+0200, Paul Cercueil wrote:
> > > > This would avoid that change (and the test would preferably be
> > > > (rtc->type == ID_JZ4780))
> > >
> > > That branch should be taken if the SoC is JZ4760, JZ4770 or JZ4780.
> > > It should not be taken if the SoC is JZ4740 or JZ4725B.
> >
> > Sure but you can achieve that with only 2 ids...
> >
> > >
> > > > > ret = jz4780_rtc_enable_write(rtc);
> > > > > if (ret == 0)
> > > > > ret = jz4740_rtc_wait_write_ready(rtc);
> > > > > @@ -300,6 +303,9 @@ static void jz4740_rtc_power_off(void)
> > > > >
> > > > > static const struct of_device_id jz4740_rtc_of_match[] = {
> > > > > { .compatible = "ingenic,jz4740-rtc", .data = (void
> > > *)ID_JZ4740 },
> > > > > + { .compatible = "ingenic,jz4725b-rtc", .data = (void
> > > *)ID_JZ4725B
> > > > > },
> > > > > + { .compatible = "ingenic,jz4760-rtc", .data = (void
> > > *)ID_JZ4760 },
> > > > > + { .compatible = "ingenic,jz4770-rtc", .data = (void
> > > *)ID_JZ4770 },
> >
> > By doing the correct mapping here e.g:
> >
> > { .compatible = "ingenic,jz4725b-rtc", .data = (void *)ID_JZ4740 },
>
> Not very pretty and future-proof if you ask me...
> But you're the boss...
>

I think it makes the code simpler to follow . Regarding future
proofness, you will have to add code and probably use a switch case at
the time you need to handle an RTC differently. At that time, the >=
test trick will not work anymore anyway.


--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
\
 
 \ /
  Last update: 2018-07-15 22:07    [W:0.051 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site