lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090609220629.GA13204@opensource.wolfsonmicro.com>
Date:	Tue, 9 Jun 2009 23:06:30 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Liam Girdwood <lrg@...mlogic.co.uk>, linux-kernel@...r.kernel.org
Subject: Re: regulator_register() API

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ