lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 24 Sep 2016 10:59:27 +0200
From:   Jean-Francois Moine <moinejf@...e.fr>
To:     Chen-Yu Tsai <wens@...e.org>
Cc:     Mark Rutland <mark.rutland@....com>,
        Rob Herring <robh+dt@...nel.org>,
        devicetree <devicetree@...r.kernel.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-sunxi <linux-sunxi@...glegroups.com>
Subject: Re: [PATCH 3/3] regulator: axp20x: simplify device access

On Sat, 24 Sep 2016 16:29:11 +0800
Chen-Yu Tsai <wens@...e.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/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ