linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias.list@kaehlcke.net>
To: AnilKumar Ch <anilkumar@ti.com>
Cc: broonie@opensource.wolfsonmicro.com, sameo@linux.intel.com,
	dan.carpenter@oracle.com, rdunlap@xenotime.net,
	sfr@canb.auug.org.au, linux-next@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH] mfd/regulator: tps65217: Move regulator plat data handling to regulator
Date: Mon, 13 Aug 2012 10:27:32 +0200	[thread overview]
Message-ID: <20120813082732.GA31722@darwin> (raw)
In-Reply-To: <1342776601-8773-1-git-send-email-anilkumar@ti.com>

Hi,

El Fri, Jul 20, 2012 at 03:00:01PM +0530 AnilKumar Ch ha dit:

> Regulator platform data handling was mistakenly added to MFD
> driver. So we will see build errors if we compile MFD drivers
> without CONFIG_REGULATOR. This patch moves regulator platform
> data handling from TPS65217 MFD driver to regulator driver.
> 
>
> diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
> index 6caa222..9730f1d 100644
> --- a/drivers/regulator/tps65217-regulator.c
> +++ b/drivers/regulator/tps65217-regulator.c
>
> +static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev)
> +{
> +	struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
> +	struct device_node *node = tps->dev->of_node;
> +	struct tps65217_board *pdata;
> +	struct device_node *regs;
> +	int i, count;
> +
> +	regs = of_find_node_by_name(node, "regulators");
> +	if (!regs)
> +		return NULL;
> +
> +	count = of_regulator_match(pdev->dev.parent, regs,
> +				reg_matches, TPS65217_NUM_REGULATOR);
> +	of_node_put(regs);
> +	if ((count < 0) || (count > TPS65217_NUM_REGULATOR))
> +		return NULL;
> +
> +	pdata = devm_kzalloc(&pdev->dev, count * sizeof(*pdata),
> GFP_KERNEL);

this allocates a struct tps65217_board for each regulator specified in
the device tree. the structure itself provides arrays for the pointers
to the regulator init data and the regulator device tree node, so only
one instance of it is needed

also the tps65217_board structure should be renamed to something like
tps65217_regulators, now that it is specific to the regulator
driver. besides the regulators the tps65217 can have other subdevices,
so for the non device tree use case it makes sense to keep a chip wide
platform data structure around which contains the subdevice specific
ones

best regards

-- 
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam

                   If you pay peanuts, you get monkeys
                           (James Goldsmith)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

  parent reply	other threads:[~2012-08-13  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20  9:30 [PATCH] mfd/regulator: tps65217: Move regulator plat data handling to regulator AnilKumar Ch
2012-07-27 12:48 ` Samuel Ortiz
2012-07-31 14:30   ` AnilKumar, Chimata
2012-08-01  5:25     ` AnilKumar, Chimata
     [not found]     ` <331ABD5ECB02734CA317220B2BBEABC13EA07402@DBDE01.ent.ti.com>
2012-08-06  7:10       ` AnilKumar, Chimata
2012-08-13  8:27 ` Matthias Kaehlcke [this message]
2012-08-13 13:35   ` AnilKumar, Chimata
2012-08-13 20:02     ` Matthias Kaehlcke

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=20120813082732.GA31722@darwin \
    --to=matthias.list@kaehlcke.net \
    --cc=anilkumar@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=sameo@linux.intel.com \
    --cc=sfr@canb.auug.org.au \
    /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).