Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1490606
| From | Jean-Francois Moine <moinejf@free.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] regulator: axp20x: simplify device access |
| Date | 2016-09-24 11:20 +0200 |
| Message-ID | <skRhM-7Cx-9@gated-at.bofh.it> (permalink) |
| References | <sktp7-Nf-9@gated-at.bofh.it> <sktp7-Nf-11@gated-at.bofh.it> <skQF3-7as-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, 24 Sep 2016 16:29:11 +0800
Chen-Yu Tsai <wens@csie.org> wrote:
[snip]
> > static int axp20x_regulator_probe(struct platform_device *pdev)
> > {
> > + struct device *dev = pdev->dev.parent;
>
> There are 2 struct device's in play in this function, 1 from the parent,
> and 1 for the platform device for this regulator sub-device.
>
> > struct regulator_dev *rdev;
> > - struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> > + struct axp20x_dev *axp20x = dev_get_drvdata(dev);
> > const struct regulator_desc *regulators;
> > struct regulator_config config = {
> > - .dev = pdev->dev.parent,
> > + .dev = dev,
> > .regmap = axp20x->regmap,
> > .driver_data = axp20x,
> > };
> > @@ -532,7 +533,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
> > dcdc5_ix = AXP22X_DCDC5;
> > dc1sw_ix = AXP22X_DC1SW;
> > dc5ldo_ix = AXP22X_DC5LDO;
> > - drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
> > + drivevbus = of_property_read_bool(dev->of_node,
> > "x-powers,drive-vbus-en");
> > break;
> > case AXP806_ID:
> > @@ -555,13 +556,13 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
> > dc5ldo_ix = AXP809_DC5LDO;
> > break;
> > default:
> > - dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
> > + dev_err(dev, "Unsupported AXP variant: %ld\n",
>
> So this one is incorrect. You should use this device's struct,
> not the parent. It's possible the mfd driver supports a PMIC,
> but the regulator driver is still missing.
Why do you need a regulator driver? The 'regulator' node in the DT is
not a real device. It is just a container and it could be removed
without any problem.
--
Ken ar c'hentaƱ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 3/3] regulator: axp20x: simplify device access Chen-Yu Tsai <wens@csie.org> - 2016-09-24 10:40 +0200 Re: [PATCH 3/3] regulator: axp20x: simplify device access Jean-Francois Moine <moinejf@free.fr> - 2016-09-24 11:20 +0200
csiph-web