[U-Boot] [PATCH v2 1/2] rtc: pl031: convert the driver to driver model

Tuomas Tynkkynen tuomas.tynkkynen at iki.fi
Wed Jul 4 11:29:19 UTC 2018


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 <takahiro.akashi at linaro.org>
>> ---
...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.


More information about the U-Boot mailing list