From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>, linux-kernel@vger.kernel.org
Subject: Re: regulator_register() API
Date: Tue, 9 Jun 2009 16:18:34 +0100 [thread overview]
Message-ID: <20090609151834.GA30774@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <20090609135947.GB18591@gundam.enneenne.com>
On Tue, Jun 09, 2009 at 03:59:47PM +0200, Rodolfo Giometti wrote:
> Current regulator_register() implementation forces the caller to
> allocate a proper device for each regulators and also the line:
> struct regulator_init_data *init_data = dev->platform_data;
> forces the user to define the pointer platform_data as a "struct
> regulator_init_data" only.
That's not the case in current mainline - the init data is passed in as
an argument to regulator_register(). There should be no requirement
that the struct device be unique, you should be able to use the same
struct device for all the regulators on the device. It's mostly just
used for printk.
> However if the regulator_register() worked in a similar way to
> led_classdev_register(), I simply can do something like this:
> for (i = 0; i < regulators_num; i++) {
> /* init regulators structs */
> ...
>
> ret = regulator_register(&client->dev, ®[i].dev);
> if (ret < 0)
> dev_warn(&client->dev, "unable to register\n");
> }
You can do exactly this in current mainline. You do need to supply init
data for each regulator to make them useful. The change came in commit
0527100fd11d9710c7e153d791da78824b7b46fa which was merged during the
2.6.30 merge window.
> This will keep backward compatibility with old drivers and may offer a
> more versatile way to define a regulator expecially for
> multifunctional devices.
Most of the regulators currently supported are part of multi-function
devices so they're not an unusual case here.
next prev parent reply other threads:[~2009-06-09 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 13:59 regulator_register() API Rodolfo Giometti
2009-06-09 15:18 ` Mark Brown [this message]
2009-06-09 15:52 ` Rodolfo Giometti
2009-06-09 22:06 ` Mark Brown
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=20090609151834.GA30774@rakim.wolfsonmicro.main \
--to=broonie@opensource.wolfsonmicro.com \
--cc=giometti@enneenne.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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.