mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Eric Miao" <eric.y.miao@gmail.com>
To: "Jonathan Cameron" <Jonathan.Cameron@gmail.com>
Cc: "Jonathan Cameron" <jic23@cam.ac.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	"Liam Girdwood" <lrg@kernel.org>
Subject: Re: [PATCH] da903x regulator bug fix
Date: Tue, 28 Oct 2008 09:02:52 +0800	[thread overview]
Message-ID: <f17812d70810271802v75b08712l4ab243802f59ecce@mail.gmail.com> (raw)
In-Reply-To: <f17812d70810271801t47830712h431df82baee11654@mail.gmail.com>

(Resend with corrected e-mail address of Liam)

I'd suggest making this a static inline function then,
e.g. to_da903x_dev(rdev), which will help both
readability and future modifications.

> On Mon, Oct 27, 2008 at 11:29 PM, Jonathan Cameron
> <Jonathan.Cameron@gmail.com> wrote:
>> Changes the device registration part of the probe function to supply the
>> regulator device rather than its parent (the mfd device) as this caused
>> problems when the regulator core attempted to find constraints associated
>> with the regulators.
>>
>> Signed-of-by: Jonathan Cameron <jic23@cam.ac.uk>
>>
>> --
>> This is quickest and simplest way to fix this bug. There may be better
>> ways of doing it, but they all require considerably more substantial
>> changes to the driver.
>>
>> diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
>> index 3688e33..f928aa1 100644
>> --- a/drivers/regulator/da903x.c
>> +++ b/drivers/regulator/da903x.c
>> @@ -93,7 +93,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev
>> *rdev,
>>                   int min_uV, int max_uV)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t val, mask;
>>
>>     if (check_range(info, min_uV, max_uV)) {
>> @@ -111,7 +111,7 @@ static int da903x_set_ldo_voltage(struct
>> regulator_dev *rdev,
>>  static int da903x_get_voltage(struct regulator_dev *rdev)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t val, mask;
>>     int ret;
>>
>> @@ -128,7 +128,7 @@ static int da903x_get_voltage(struct regulator_dev
>> *rdev)
>>  static int da903x_enable(struct regulator_dev *rdev)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>
>>     return da903x_set_bits(da9034_dev, info->enable_reg,
>>                     1 << info->enable_bit);
>> @@ -137,7 +137,7 @@ static int da903x_enable(struct regulator_dev *rdev)
>>  static int da903x_disable(struct regulator_dev *rdev)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>
>>     return da903x_clr_bits(da9034_dev, info->enable_reg,
>>                     1 << info->enable_bit);
>> @@ -146,7 +146,7 @@ static int da903x_disable(struct regulator_dev *rdev)
>>  static int da903x_is_enabled(struct regulator_dev *rdev)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t reg_val;
>>     int ret;
>>
>> @@ -238,7 +238,7 @@ static int da9034_set_dvc_voltage(struct
>> regulator_dev *rdev,
>>                   int min_uV, int max_uV)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t val, mask;
>>     int ret;
>>
>> @@ -264,7 +264,7 @@ static int da9034_set_ldo12_voltage(struct
>> regulator_dev *rdev,
>>                     int min_uV, int max_uV)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t val, mask;
>>
>>     if (check_range(info, min_uV, max_uV)) {
>> @@ -283,7 +283,7 @@ static int da9034_set_ldo12_voltage(struct
>> regulator_dev *rdev,
>>  static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
>>  {
>>     struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
>> -    struct device *da9034_dev = rdev_get_dev(rdev)->parent;
>> +    struct device *da9034_dev = rdev_get_dev(rdev)->parent->parent;
>>     uint8_t val, mask;
>>     int ret;
>>
>> @@ -466,7 +466,7 @@ static int __devinit da903x_regulator_probe(struct
>> platform_device *pdev)
>>     if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15)
>>         ri->desc.ops = &da9030_regulator_ldo1_15_ops;
>>
>> -    rdev = regulator_register(&ri->desc, pdev->dev.parent, ri);
>> +    rdev = regulator_register(&ri->desc, &pdev->dev, ri);
>>     if (IS_ERR(rdev)) {
>>         dev_err(&pdev->dev, "failed to register regulator %s\n",
>>                 ri->desc.name);
>>
>>
>>
>>
>>
>
>
>
> --
> Cheers
> - eric
>



-- 
Cheers
- eric

  reply	other threads:[~2008-10-28  1:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-24 15:47 Da903x regulator driver. Bug? Jonathan Cameron
2008-10-24 17:23 ` Jonathan Cameron
2008-10-24 18:24   ` Liam Girdwood
2008-10-24 18:53     ` Jonathan Cameron
2008-10-24 19:44       ` Mark Brown
2008-10-27 15:29 ` [PATCH] da903x regulator bug fix Jonathan Cameron
2008-10-28  1:01   ` Eric Miao
2008-10-28  1:02     ` Eric Miao [this message]
2008-10-28 10:40       ` Jonathan Cameron
2008-10-28 11:03       ` Jonathan Cameron
2008-10-28 11:19         ` Liam Girdwood
2008-10-28 12:21           ` Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f17812d70810271802v75b08712l4ab243802f59ecce@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=Jonathan.Cameron@gmail.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®