lkml.org 
[lkml]   [2012]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH RFT] regulator: tps65217: Convert to regulator_[is_enabled|get_voltage_sel]_regmap
Date
On Mon, Jun 18, 2012 at 18:15:14, Mark Brown wrote:
> On Mon, Jun 18, 2012 at 12:39:38PM +0000, AnilKumar, Chimata wrote:
>
> > + if (config->regmap)
> > + rdev->regmap = config->regmap;
> > + else
> > + rdev->regmap = dev_get_regmap(dev->parent, NULL);
>
> No, this would be broken. We're specifically using the device we got
> passed in. In this case the fact that the regmap is on the MFD means
> that the driver does need to explicitly set the regmap. Or we should
> have this be a multi-stage series of checks:
>
> if (config->regmap)
> rdev->regmap = config->regmap;
> else if (dev_get_regmap(dev, NULL))
> rdev->regmap = dev_get_regmap(dev, NULL);
> else if (dev->parent)
> rdev->regmap = dev_get_regmap(dev->parent, NULL);
>
> which should cover the MFD case if there's no regmap on the child
> without having to go through all the drivers doing it by hand.
>

I missed out !regmap case.

I think it is better to set in regulator it-self instead of these checks + calls,
this adds extra burden. So, regmap pointer set should be added if we are adding
regulator_[is_enabled|get_voltage_sel]_regmap API support to the driver.

Regards
AnilKumar


\
 
 \ /
  Last update: 2012-06-18 15:41    [W:0.184 / U:2.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site