[rtc-linux] Re: [PATCH v4 06/10] rtc: max77686: Add max77802 support
From: Javier Martinez Canillas <javier@dowhile0.org>
Date: 2016-01-27 04:37:06
Also in:
linux-samsung-soc, lkml
Hello Krzysztof, On Wed, Jan 27, 2016 at 1:23 AM, Krzysztof Kozlowski [off-list ref] wrote:
On 27.01.2016 12:36, Javier Martinez Canillas wrote:
[snip]
quoted
+ if (!info->drv_data->separate_i2c_addr) + info->max77686->rtc_regmap = info->max77686->regmap; +At this stage I don't like the idea of messing with parent's state structure. The driver should not modify any of parents data (the best way would be to take a pointer to const). In this patch this looks like breaking the encapsulation. If the parent is responsible for regmaps, then the parent should set rtc_regmap for children (parent also knows what type device it is working on). ...but I am assuming that a new patch will be following this one - the patch moving ownership of i2c dummy and regmap to the RTC driver. In that case this code makes a lot more sense. Am I thinking correctly?
You assumption is correct. Modifying the parent's state is indeed a layering violation but I did this to keep the changes self contained in the RTC subsystem and avoid touching the MFD driver. But this will be cleaned by Laxman once he moves the regmap initialization from the MFD driver to the RTC.
Best regards, Krzysztof
Best regards, Javier -- -- 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.