From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tuomas Tynkkynen Date: Wed, 4 Jul 2018 14:29:19 +0300 Subject: [U-Boot] [PATCH v2 1/2] rtc: pl031: convert the driver to driver model In-Reply-To: <98c08ea3-47bd-0872-04b8-4177d7a78c31@suse.de> References: <20180704073628.23596-1-takahiro.akashi@linaro.org> <20180704073628.23596-2-takahiro.akashi@linaro.org> <98c08ea3-47bd-0872-04b8-4177d7a78c31@suse.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 07/04/2018 11:53 AM, Alexander Graf wrote: > On 07/04/2018 09:36 AM, AKASHI Takahiro wrote: > > This patch is missing a patch description. I'm not the maintainer of the rtc code base so it's not my call, but I personally just reject all patches with empty patch descriptions ;). > > And thanks a lot for doing the conversion! I think it's a very good step forward. > >> Signed-off-by: AKASHI Takahiro >> --- ...snip... >>   /* >> - * Reset the RTC. We set the date back to 1970-01-01. >> + * Get the current time from the RTC >>    */ >> -void rtc_reset(void) >> +static int pl031_rtc_get(struct udevice *dev, struct rtc_time *tm) >>   { >> -    RTC_WRITE_REG(RTC_LR, 0x00); >> -    if(!pl031_initted) >> -        rtc_init(); >> +    struct pl031_rtc_platdata *pdata = dev_get_platdata(dev); >> +    ulong tim; >> + >> +    if (!tm) { >> +        puts("Error getting the date/time\n"); >> +        return -1; >> +    } >> + >> +    if (!pl031_initted) > > In theory with dm you can now have multiple instances of the device, right? So we can no longer have a global variable that indicates if a device is initialized. Instead, this needs to move into device private data. > I think the initialization code in rtc_init() should be move to the .probe callback instead, so there's no need to keep the bool aroun.