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: <20140318150119.GA25116@earth.universe>
Date:	Tue, 18 Mar 2014 16:01:19 +0100
From:	sre@...g0.de
To:	Chanwoo Choi <cw00.choi@...sung.com>
Cc:	dbaryshkov@...il.com, dwmw2@...radead.org,
	myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 0/4] power_supply: Add DT helper function to get
 power-supply dev from dt

Hi Chanwoo,

On Tue, Mar 18, 2014 at 03:06:00PM +0900, Chanwoo Choi wrote:
> I checked power_supply_get_by_phandle().
> But power_supply_get_by_phandle() is different from of_power_supply_get_dev()
> 
> So, I expalin the difference between "power_supply_get_by_phandle()" and "of_power_supply_get_dev()".
> 
> Existing "power_supply_get_by_phandle()"
> - Need correct the name of power_supply property.
> some device driver using power_supply_get_by_phandle() has the dependecy of 
> the name of power_supply property.
> 
> If the name of power_supply property is modified,
> have to modify some device driver using power_supply_get_by_phandle().

The property names are part of the DT ABI, which is not supposed to
be stable.

> But,
> Proposed "of_power_supply_get_dev()"
> - of_power_supply_get_dev() has not dependency of specific name.
> of_power_supply_get_dev() only need device type of power_supply device among following device type:
> 	"fuelgague"
> 	"charger"
> 	we can do addtional device type of power_supply device.
> 
> If some device driver use of_poewr_supply_get_dev(),
> don't need to consider the name of power_supply device.	
 
You don't need to consider the name of the power_supply device for
power_supply_get_by_phandle either. You only need to consider the
property name, which references the power_supply device. You can
have a look at drivers/power/bq2415x_charger.c, which makes use
of this function:

power_supply_get_by_phandle(np, "ti,usb-charger-detection");

A corresponding DT node can be found in arch/arm/boot/dts/omap3-n900.dts:

bq24150a: bq24150a@6b {
    /* ... */

    ti,usb-charger-detection = <&isp1704>;
}

As you can see the property name has nothing to do with any
names from the referenced node. Apart from that the node name
is also needed by your proposed of_power_supply_get_dev. The
difference is, that you hardcoded it to be either "fuelgauge"
or "charger". The following two calls should return the same
node:

of_power_supply_get_dev(dev, POWER_SUPPLY_DEV_FUELGAUGE, 0);
of_power_supply_get_dev(dev, "fuelgauge");

-- Sebastian

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ