devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
To: Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Kyungmin Park
	<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Marek Szyprowski
	<m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Bartlomiej Zolnierkiewicz
	<b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [RFT v3 06/14] regulator: max77802: Remove support for board files
Date: Thu, 30 Oct 2014 12:50:45 +0100	[thread overview]
Message-ID: <54522615.7040002@collabora.co.uk> (raw)
In-Reply-To: <1414668053-31370-7-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Hello Krzysztof,

On 10/30/2014 12:20 PM, Krzysztof Kozlowski wrote:
>  static int max77802_pmic_probe(struct platform_device *pdev)
>  {
>  	struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
> -	struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
>  	struct max77802_regulator_prv *max77802;
> -	int i, ret = 0, val;
> +	int i, val;
>  	struct regulator_config config = { };
>  
> -	/* This is allocated by the MFD driver */
> -	if (!pdata) {
> -		dev_err(&pdev->dev, "no platform data found for regulator\n");
> -		return -ENODEV;
> -	}
> -
>  	max77802 = devm_kzalloc(&pdev->dev,
>  				sizeof(struct max77802_regulator_prv),
>  				GFP_KERNEL);
>  	if (!max77802)
>  		return -ENOMEM;
>  
> -	if (iodev->dev->of_node) {
> -		ret = max77802_pmic_dt_parse_pdata(pdev, pdata);
> -		if (ret)
> -			return ret;
> +	if (!pdev->dev.of_node) {
> +		/*
> +		 * Backward DTS compatiblity where regulator driver had not
> +		 * a compatible property for itself.
> +		 */
> +		if (!iodev->dev->of_node) {
> +			dev_err(&pdev->dev, "No OF node for driver and its parent\n");
> +			return -EINVAL;
> +		}
> +		pdev->dev.of_node = of_get_child_by_name(iodev->dev->of_node,
> +								"regulators");
> +		max77802->missing_of_node = true;
>  	}

I may be missing something but I don't understand why a compatible string
for the regulators sub-node is needed. Isn't enough to just fill the
.regulators_node field in the struct regulator_desc? e.g:

    .regulators_node = of_match_ptr("regulators") for max77802
    .regulators_node = of_match_ptr("voltage-regulators") for max77686

AFAIU this should be enough for the core to extract the init_data and will
make your change much more simpler and you can drop patches 1-3 and 13-14.

Or maybe I misread the regulator_of_get_init_data() function?

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-10-30 11:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 11:20 [PATCH v3 00/14] regulator: max77686: Add GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 01/14] mfd: max77686/802: Map regulator driver to its own of_node Krzysztof Kozlowski
2014-10-31 12:23   ` Mark Brown
2014-10-31 13:07     ` Krzysztof Kozlowski
2014-10-31 18:06       ` Mark Brown
2014-10-30 11:20 ` [PATCH v3 02/14] mfd/regulator: dt-bindings: max77686: Document of_compatible for regulator Krzysztof Kozlowski
2014-11-03 17:00   ` Lee Jones
2014-11-04  7:53     ` Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 03/14] regulator: dt-bindings: max77802: " Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 04/14] regulator: max77686: Consistently index opmode array by rdev id Krzysztof Kozlowski
2014-10-30 11:20 ` [RFT v3 05/14] regulator: max77802: Don't ignore return value of current opmode Krzysztof Kozlowski
     [not found]   ` <1414668053-31370-6-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:42     ` Javier Martinez Canillas
2014-10-30 11:20 ` [RFT v3 06/14] regulator: max77802: Remove support for board files Krzysztof Kozlowski
     [not found]   ` <1414668053-31370-7-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:50     ` Javier Martinez Canillas [this message]
2014-10-30 12:10       ` Krzysztof Kozlowski
2014-10-30 12:21         ` Javier Martinez Canillas
2014-10-30 12:30           ` Krzysztof Kozlowski
2014-10-30 12:42             ` Javier Martinez Canillas
2014-10-30 12:53               ` Krzysztof Kozlowski
2014-10-30 14:02                 ` Javier Martinez Canillas
2014-10-30 11:20 ` [PATCH v3 07/14] regulator: max77686: " Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 08/14] mfd: max77686/802: " Krzysztof Kozlowski
2014-11-03 17:01   ` Lee Jones
2014-11-04  7:51     ` Krzysztof Kozlowski
2014-11-04  8:07       ` Lee Jones
2014-10-30 11:20 ` [PATCH v3 09/14] regulator: max77686: Initialize opmode explicitly to normal mode Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 10/14] regulator: max77686: Add GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 11/14] mfd/regulator: dt-bindings: max77686: Document gpio properties Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 12/14] ARM: dts: exynos4412-trats: Switch max77686 regulators to GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 13/14] ARM: dts: exynos5420-peach: Update to new max77802 regulator compatible Krzysztof Kozlowski
     [not found] ` <1414668053-31370-1-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:20   ` [PATCH v3 14/14] ARM: dts: exynos5800-peach: " Krzysztof Kozlowski

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=54522615.7040002@collabora.co.uk \
    --to=javier.martinez-zgy8ohtn/8ppycu2f3hruq@public.gmane.org \
    --cc=b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).