Messages in this thread |  | | Date | Wed, 13 Apr 2011 10:44:02 +0200 | From | Antonio Ospite <> | Subject | Re: [PATCH v2] rfkill: Regulator consumer driver for rfkill |
| |
On Tue, 12 Apr 2011 13:44:02 +0200 Johannes Berg <johannes@sipsolutions.net> wrote:
> On Tue, 2011-04-12 at 13:41 +0200, Johannes Berg wrote: > > > > + * static struct regulator_consumer_supply pcap_regulator_V6_consumers [] = { > > > + * { .dev_name = "rfkill-regulator.0", supply = "vrfkill" }, > > > + * }; > > > > It's a comment, but it should be .supply = (missing the .) > >
well spotted, I'll fix this.
> > > + if (pdata->name == NULL || pdata->type == 0) { > > > + dev_err(&pdev->dev, "invalid name or type in platform data\n"); > > > + return -EINVAL; > > > + } > > > + > > > + vcc = regulator_get_exclusive(&pdev->dev, "vrfkill"); > > > > Wasn't that supposed to use pdata->supply? Actually, there's no member > > "supply" in the struct? > > Oh wait, I think I just misunderstood how this works. But if the name is > "vrfkill" how does that really work with multiple instances? >
That's how the regulator framework works, I know Mark already replied to you but I try to elaborate more for the records and to organize my thoughts about that:
- In the consumers for the regulator we choose the virtual supply, "vrfkill" in this case, and which driver is going to use it.
- Wrt. to multiple instances, they are distinguished using device ids.
When we set consumers for a physical regulator we can tell: device "rfkill-regulator.1" will call this regulator "vrfkill" and we declare the relative rfkill-regulator platform device with .id=1, this way the regulator framework knows what physical regulator to return when asked for vrfkill _from_ a rfkill-regulator platform device instance with .id==1
I hope I am not introducing any inaccuracies :)
A v3 of the patch is on its way.
Thanks, Antonio
-- Antonio Ospite http://ao2.it
PGP public key ID: 0x4553B001
A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? [unhandled content-type:application/pgp-signature] |  |