From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>, linux-kernel@vger.kernel.org
Subject: Re: regulator_register() API
Date: Tue, 9 Jun 2009 23:06:30 +0100 [thread overview]
Message-ID: <20090609220629.GA13204@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20090609155235.GK18591@gundam.enneenne.com>
On Tue, Jun 09, 2009 at 05:52:35PM +0200, Rodolfo Giometti wrote:
> Great! However this resolve one issue, the caller still needs to
> allocate a device struct by itsown. On the other hand, doing like
> led_classdev_register() does will resolve it also!
The regulator driver does not need to allocate a struct device. The
struct device that is passed in is for the chip as a whole and would
normally be something like the struct device for the I2C client. As
I say it's there mostly for the benefit of printk().
The regulator API returns a pointer to the class device that is
allocated and ensures that that class device is parented by the device
that was passed in.
> As you can see in this case I simply can do:
>
> /* Register the led devices */
> for (i = 0; i < 6; i++)
> if (pdata->led[i].name) {
> data->led[i].dev.name = pdata->led[i].name;
The code in, for example, the lp3971 driver looks pretty much the same
as this except instead of copying data into the struct it passes data
into the registration API.
prev parent reply other threads:[~2009-06-09 22:06 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
2009-06-09 15:52 ` Rodolfo Giometti
2009-06-09 22:06 ` Mark Brown [this message]
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=20090609220629.GA13204@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.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.