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]
Date:	Wed, 17 Oct 2012 05:39:37 +0000
From:	"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>
To:	Anton Vorontsov <cbouatmailru@...il.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2] power_supply: Added helper function to get the ps
 object from supplied_to list

Hi Anton,

Please ignore the following patch.
 
> This patch adds a helper function in the power supply core to get the power
> supply object from supplied_to list based on power supply attribute.
> 
> Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@...el.com>
> ---
>  drivers/power/power_supply_core.c |   19 +++++++++++++++++++
>  include/linux/power_supply.h      |    3 +++
>  2 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/power/power_supply_core.c
> b/drivers/power/power_supply_core.c
> index ff990d2..5845a76 100644
> --- a/drivers/power/power_supply_core.c
> +++ b/drivers/power/power_supply_core.c
> @@ -158,6 +158,25 @@ struct power_supply
> *power_supply_get_by_name(char *name)  }
> EXPORT_SYMBOL_GPL(power_supply_get_by_name);
> 
> +struct power_supply *power_supply_get_by_suppliedto(struct power_supply
> *psy,
> +				enum power_supply_property psp, int intval) {
> +	union power_supply_propval ret = {0,};
> +	struct power_supply *pst;
> +	int i;
> +
> +	for (i = 0; i < psy->num_supplicants; i++) {
> +		pst = power_supply_get_by_name(psy->supplied_to[i]);
> +		if (!pst || pst->get_property(pst, psp, &ret))
> +			continue;
> +		if (ret.intval == intval)
> +			return pst;
> +	}
> +
> +	return NULL;
> +}
> +EXPORT_SYMBOL_GPL(power_supply_get_by_suppliedto);
> +
>  int power_supply_powers(struct power_supply *psy, struct device *dev)  {
>  	return sysfs_create_link(&psy->dev->kobj, &dev->kobj, "powers"); diff --
> git a/include/linux/power_supply.h b/include/linux/power_supply.h index
> 0bafbb1..3cfee0c 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -219,6 +219,9 @@ struct power_supply_info {  };
> 
>  extern struct power_supply *power_supply_get_by_name(char *name);
> +extern struct power_supply *power_supply_get_by_suppliedto(
> +				struct power_supply *psy,
> +				enum power_supply_property psp, int intval);
>  extern void power_supply_changed(struct power_supply *psy);  extern int
> power_supply_am_i_supplied(struct power_supply *psy);  extern int
> power_supply_set_battery_charged(struct power_supply *psy);
> --
> 1.7.0.4

--
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