All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Francois Moine <moinejf@free.fr>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>
Subject: Re: [PATCH 3/3] regulator: axp20x: simplify device access
Date: Sat, 24 Sep 2016 10:59:27 +0200	[thread overview]
Message-ID: <20160924105927.794f768afbe30e53616cf95f@free.fr> (raw)
In-Reply-To: <CAGb2v64ZpQ=9KUH39cFoRxU6n03cgDoUbHegjFfDWaTLQAZ2wg@mail.gmail.com>

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/

WARNING: multiple messages have this Message-ID (diff)
From: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: [PATCH 3/3] regulator: axp20x: simplify device access
Date: Sat, 24 Sep 2016 10:59:27 +0200	[thread overview]
Message-ID: <20160924105927.794f768afbe30e53616cf95f@free.fr> (raw)
In-Reply-To: <CAGb2v64ZpQ=9KUH39cFoRxU6n03cgDoUbHegjFfDWaTLQAZ2wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: moinejf@free.fr (Jean-Francois Moine)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] regulator: axp20x: simplify device access
Date: Sat, 24 Sep 2016 10:59:27 +0200	[thread overview]
Message-ID: <20160924105927.794f768afbe30e53616cf95f@free.fr> (raw)
In-Reply-To: <CAGb2v64ZpQ=9KUH39cFoRxU6n03cgDoUbHegjFfDWaTLQAZ2wg@mail.gmail.com>

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/

  reply	other threads:[~2016-09-24  9:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  7:44 [PATCH 0/3] regulator: axp20x: Simplify various code Jean-Francois Moine
2016-09-23  7:44 ` Jean-Francois Moine
2016-09-23  7:44 ` Jean-Francois Moine
2016-09-20 16:09 ` [PATCH 1/3] regulator: axp20x: simplify poly-phase handling Jean-Francois Moine
2016-09-20 16:09   ` Jean-Francois Moine
2016-09-20 16:09   ` Jean-Francois Moine
2016-09-20 16:38 ` [PATCH 2/3] regulator: axp20x: simplify the treatment of linked regulators Jean-Francois Moine
2016-09-20 16:38   ` Jean-Francois Moine
2016-09-20 16:38   ` Jean-Francois Moine
2016-09-21 18:20 ` [PATCH 3/3] regulator: axp20x: simplify device access Jean-Francois Moine
2016-09-21 18:20   ` Jean-Francois Moine
2016-09-21 18:20   ` Jean-Francois Moine
2016-09-24  8:29   ` Chen-Yu Tsai
2016-09-24  8:29     ` Chen-Yu Tsai
2016-09-24  8:29     ` Chen-Yu Tsai
2016-09-24  8:59     ` Jean-Francois Moine [this message]
2016-09-24  8:59       ` Jean-Francois Moine
2016-09-24  8:59       ` Jean-Francois Moine

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=20160924105927.794f768afbe30e53616cf95f@free.fr \
    --to=moinejf@free.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.