* [PATCH v2 0/7] power_supply: Decrement the device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Hi,
Changes since v1:
=================
1. Remove check for non-NULL in power_supply_put (suggested by
Pavel Machek).
2. Add Pavel Machek's ack.
Description:
============
The reference counter of device allocated for power supply was
incremented with each call to power_supply_get_by_name() and
power_supply_get_by_phandle().
Add a symmetric 'put' operation so the device could be released after
final put_device() call during supply unregistering.
Rebased on next-20141007 + mine [1] patchset.
Tested on Trats2 board (max77693 + charger manager).
Kindly asking for reviewing and testing other drivers.
Best regards,
Krzysztof
[1] power_supply: Add API for safe access of get_property-like function attrs
http://www.spinics.net/lists/arm-kernel/msg369870.html
Krzysztof Kozlowski (7):
power_supply: Add power_supply_put for decrementing device reference
counter
power: charger-manager: Decrement the power supply's device reference
counter
x86/olpc/xo1/sci: Use newly added power_supply_put API
x86/olpc/xo15/sci: Use newly added power_supply_put API
power: 88pm860x_charger: Decrement the power supply's device reference
counter
power: bq2415x_charger: Decrement the power supply's device reference
counter
mfd: ab8500: Decrement the power supply's device reference counter
arch/x86/platform/olpc/olpc-xo1-sci.c | 4 +-
arch/x86/platform/olpc/olpc-xo15-sci.c | 4 +-
drivers/mfd/ab8500-sysctrl.c | 2 +
drivers/power/88pm860x_charger.c | 11 +++++-
drivers/power/bq2415x_charger.c | 6 ++-
drivers/power/charger-manager.c | 70 +++++++++++++++++++++++-----------
drivers/power/power_supply_core.c | 38 ++++++++++++++++++
include/linux/power_supply.h | 1 +
8 files changed, 106 insertions(+), 30 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 0/7] power_supply: Decrement the device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Changes since v1:
=================
1. Remove check for non-NULL in power_supply_put (suggested by
Pavel Machek).
2. Add Pavel Machek's ack.
Description:
============
The reference counter of device allocated for power supply was
incremented with each call to power_supply_get_by_name() and
power_supply_get_by_phandle().
Add a symmetric 'put' operation so the device could be released after
final put_device() call during supply unregistering.
Rebased on next-20141007 + mine [1] patchset.
Tested on Trats2 board (max77693 + charger manager).
Kindly asking for reviewing and testing other drivers.
Best regards,
Krzysztof
[1] power_supply: Add API for safe access of get_property-like function attrs
http://www.spinics.net/lists/arm-kernel/msg369870.html
Krzysztof Kozlowski (7):
power_supply: Add power_supply_put for decrementing device reference
counter
power: charger-manager: Decrement the power supply's device reference
counter
x86/olpc/xo1/sci: Use newly added power_supply_put API
x86/olpc/xo15/sci: Use newly added power_supply_put API
power: 88pm860x_charger: Decrement the power supply's device reference
counter
power: bq2415x_charger: Decrement the power supply's device reference
counter
mfd: ab8500: Decrement the power supply's device reference counter
arch/x86/platform/olpc/olpc-xo1-sci.c | 4 +-
arch/x86/platform/olpc/olpc-xo15-sci.c | 4 +-
drivers/mfd/ab8500-sysctrl.c | 2 +
drivers/power/88pm860x_charger.c | 11 +++++-
drivers/power/bq2415x_charger.c | 6 ++-
drivers/power/charger-manager.c | 70 +++++++++++++++++++++++-----------
drivers/power/power_supply_core.c | 38 ++++++++++++++++++
include/linux/power_supply.h | 1 +
8 files changed, 106 insertions(+), 30 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 1/7] power_supply: Add power_supply_put for decrementing device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
The power_supply_get_by_phandle() and power_supply_get_by_name() use
function class_find_device() for obtaining the reference to power
supply. Each use of class_find_device() increases the power supply's
device reference counter.
However the reference counter was not decreased by users of this API.
Thus final device_unregister() call from power_supply_unregister() could
not release the device and clean up its resources. This lead to memory
leak if at least once power_supply_get_by_*() was called between
registering and unregistering the power supply.
Add and document new API power_supply_put() for decrementing the
reference counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/power_supply_core.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/power_supply.h | 1 +
2 files changed, 39 insertions(+)
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 94f278cf2cbb..db368527c65b 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -331,6 +331,17 @@ static int power_supply_match_device_by_name(struct device *dev, const void *dat
return strcmp(psy->name, name) == 0;
}
+/**
+ * power_supply_get_by_name() - Search for a power supply and returns its ref
+ * @name: Power supply name to fetch
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to @name, a NULL otherwise.
+ */
struct power_supply *power_supply_get_by_name(const char *name)
{
struct device *dev = class_find_device(power_supply_class, NULL, name,
@@ -340,12 +351,39 @@ struct power_supply *power_supply_get_by_name(const char *name)
}
EXPORT_SYMBOL_GPL(power_supply_get_by_name);
+/**
+ * power_supply_put() - Drop reference obtained with power_supply_get_by_name
+ * @psy: Reference to put
+ *
+ * The reference to power supply should be put before unregistering
+ * the power supply.
+ */
+void power_supply_put(struct power_supply *psy)
+{
+ might_sleep();
+
+ put_device(psy->dev);
+}
+EXPORT_SYMBOL_GPL(power_supply_put);
+
#ifdef CONFIG_OF
static int power_supply_match_device_node(struct device *dev, const void *data)
{
return dev->parent && dev->parent->of_node == data;
}
+/**
+ * power_supply_get_by_phandle() - Search for a power supply and returns its ref
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a power supply name
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to value under @property, NULL or ERR_PTR otherwise.
+ */
struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property)
{
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 44e749c65505..1b6db883e090 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -256,6 +256,7 @@ extern struct atomic_notifier_head power_supply_notifier;
extern int power_supply_reg_notifier(struct notifier_block *nb);
extern void power_supply_unreg_notifier(struct notifier_block *nb);
extern struct power_supply *power_supply_get_by_name(const char *name);
+extern void power_supply_put(struct power_supply *psy);
#ifdef CONFIG_OF
extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 1/7] power_supply: Add power_supply_put for decrementing device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
The power_supply_get_by_phandle() and power_supply_get_by_name() use
function class_find_device() for obtaining the reference to power
supply. Each use of class_find_device() increases the power supply's
device reference counter.
However the reference counter was not decreased by users of this API.
Thus final device_unregister() call from power_supply_unregister() could
not release the device and clean up its resources. This lead to memory
leak if at least once power_supply_get_by_*() was called between
registering and unregistering the power supply.
Add and document new API power_supply_put() for decrementing the
reference counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/power_supply_core.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/power_supply.h | 1 +
2 files changed, 39 insertions(+)
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 94f278cf2cbb..db368527c65b 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -331,6 +331,17 @@ static int power_supply_match_device_by_name(struct device *dev, const void *dat
return strcmp(psy->name, name) == 0;
}
+/**
+ * power_supply_get_by_name() - Search for a power supply and returns its ref
+ * @name: Power supply name to fetch
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to @name, a NULL otherwise.
+ */
struct power_supply *power_supply_get_by_name(const char *name)
{
struct device *dev = class_find_device(power_supply_class, NULL, name,
@@ -340,12 +351,39 @@ struct power_supply *power_supply_get_by_name(const char *name)
}
EXPORT_SYMBOL_GPL(power_supply_get_by_name);
+/**
+ * power_supply_put() - Drop reference obtained with power_supply_get_by_name
+ * @psy: Reference to put
+ *
+ * The reference to power supply should be put before unregistering
+ * the power supply.
+ */
+void power_supply_put(struct power_supply *psy)
+{
+ might_sleep();
+
+ put_device(psy->dev);
+}
+EXPORT_SYMBOL_GPL(power_supply_put);
+
#ifdef CONFIG_OF
static int power_supply_match_device_node(struct device *dev, const void *data)
{
return dev->parent && dev->parent->of_node == data;
}
+/**
+ * power_supply_get_by_phandle() - Search for a power supply and returns its ref
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a power supply name
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to value under @property, NULL or ERR_PTR otherwise.
+ */
struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property)
{
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 44e749c65505..1b6db883e090 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -256,6 +256,7 @@ extern struct atomic_notifier_head power_supply_notifier;
extern int power_supply_reg_notifier(struct notifier_block *nb);
extern void power_supply_unreg_notifier(struct notifier_block *nb);
extern struct power_supply *power_supply_get_by_name(const char *name);
+extern void power_supply_put(struct power_supply *psy);
#ifdef CONFIG_OF
extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 2/7] power: charger-manager: Decrement the power supply's device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/charger-manager.c | 70 +++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 23 deletions(-)
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 9e01074d3169..60688c20594d 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -116,6 +116,7 @@ static bool is_batt_present(struct charger_manager *cm)
&val);
if (ret == 0 && val.intval)
present = true;
+ power_supply_put(psy);
break;
case CM_CHARGER_STAT:
for (i = 0; cm->desc->psy_charger_stat[i]; i++) {
@@ -129,6 +130,7 @@ static bool is_batt_present(struct charger_manager *cm)
ret = power_supply_get_property(psy,
POWER_SUPPLY_PROP_PRESENT, &val);
+ power_supply_put(psy);
if (ret == 0 && val.intval) {
present = true;
break;
@@ -166,6 +168,7 @@ static bool is_ext_pwr_online(struct charger_manager *cm)
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
&val);
+ power_supply_put(psy);
if (ret == 0 && val.intval) {
online = true;
break;
@@ -195,6 +198,7 @@ static int get_batt_uV(struct charger_manager *cm, int *uV)
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_VOLTAGE_NOW, &val);
+ power_supply_put(fuel_gauge);
if (ret)
return ret;
@@ -238,10 +242,13 @@ static bool is_charging(struct charger_manager *cm)
if (ret) {
dev_warn(cm->dev, "Cannot read ONLINE value from %s\n",
cm->desc->psy_charger_stat[i]);
+ power_supply_put(psy);
continue;
}
- if (val.intval == 0)
+ if (val.intval == 0) {
+ power_supply_put(psy);
continue;
+ }
/*
* 3. The charger should not be FULL, DISCHARGING,
@@ -249,6 +256,7 @@ static bool is_charging(struct charger_manager *cm)
*/
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_STATUS,
&val);
+ power_supply_put(psy);
if (ret) {
dev_warn(cm->dev, "Cannot read STATUS value from %s\n",
cm->desc->psy_charger_stat[i]);
@@ -276,6 +284,7 @@ static bool is_full_charged(struct charger_manager *cm)
struct charger_desc *desc = cm->desc;
union power_supply_propval val;
struct power_supply *fuel_gauge;
+ bool is_full = false;
int ret = 0;
int uV;
@@ -293,15 +302,19 @@ static bool is_full_charged(struct charger_manager *cm)
/* Not full if capacity of fuel gauge isn't full */
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, &val);
- if (!ret && val.intval > desc->fullbatt_full_capacity)
- return true;
+ if (!ret && val.intval > desc->fullbatt_full_capacity) {
+ is_full = true;
+ goto out;
+ }
}
/* Full, if it's over the fullbatt voltage */
if (desc->fullbatt_uV > 0) {
ret = get_batt_uV(cm, &uV);
- if (!ret && uV >= desc->fullbatt_uV)
- return true;
+ if (!ret && uV >= desc->fullbatt_uV) {
+ is_full = true;
+ goto out;
+ }
}
/* Full, if the capacity is more than fullbatt_soc */
@@ -310,11 +323,15 @@ static bool is_full_charged(struct charger_manager *cm)
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, &val);
- if (!ret && val.intval >= desc->fullbatt_soc)
- return true;
+ if (!ret && val.intval >= desc->fullbatt_soc) {
+ is_full = true;
+ goto out;
+ }
}
- return false;
+out:
+ power_supply_put(fuel_gauge);
+ return is_full;
}
/**
@@ -587,14 +604,18 @@ static int cm_get_battery_temperature_by_psy(struct charger_manager *cm,
int *temp)
{
struct power_supply *fuel_gauge;
+ int ret;
fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
if (!fuel_gauge)
return -ENODEV;
- return power_supply_get_property(fuel_gauge,
+ ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_TEMP,
(union power_supply_propval *)temp);
+ power_supply_put(fuel_gauge);
+
+ return ret;
}
static int cm_get_battery_temperature(struct charger_manager *cm,
@@ -876,7 +897,7 @@ static int charger_get_property(struct power_supply *psy,
struct charger_manager *cm = container_of(psy,
struct charger_manager, charger_psy);
struct charger_desc *desc = cm->desc;
- struct power_supply *fuel_gauge;
+ struct power_supply *fuel_gauge = NULL;
int ret = 0;
int uV;
@@ -919,18 +940,18 @@ static int charger_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_TEMP_AMBIENT:
return cm_get_battery_temperature(cm, &val->intval);
case POWER_SUPPLY_PROP_CAPACITY:
- fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
- if (!fuel_gauge) {
- ret = -ENODEV;
- break;
- }
-
if (!is_batt_present(cm)) {
/* There is no battery. Assume 100% */
val->intval = 100;
break;
}
+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
+ if (!fuel_gauge) {
+ ret = -ENODEV;
+ break;
+ }
+
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
if (ret)
@@ -1005,6 +1026,8 @@ static int charger_get_property(struct power_supply *psy,
default:
return -EINVAL;
}
+ if (fuel_gauge)
+ power_supply_put(fuel_gauge);
return ret;
}
@@ -1802,13 +1825,7 @@ static int charger_manager_probe(struct platform_device *pdev)
desc->psy_charger_stat[i]);
return -ENODEV;
}
- }
-
- fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);
- if (!fuel_gauge) {
- dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n",
- desc->psy_fuel_gauge);
- return -ENODEV;
+ power_supply_put(psy);
}
if (desc->polling_interval_ms == 0 ||
@@ -1848,6 +1865,12 @@ static int charger_manager_probe(struct platform_device *pdev)
cm->charger_psy.num_properties = psy_default.num_properties;
/* Find which optional psy-properties are available */
+ fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);
+ if (!fuel_gauge) {
+ dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n",
+ desc->psy_fuel_gauge);
+ return -ENODEV;
+ }
if (!power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_NOW, &val)) {
cm->charger_psy.properties[cm->charger_psy.num_properties] =
@@ -1867,6 +1890,7 @@ static int charger_manager_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to initialize thermal data\n");
cm->desc->measure_battery_temp = false;
}
+ power_supply_put(fuel_gauge);
INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 2/7] power: charger-manager: Decrement the power supply's device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/charger-manager.c | 70 +++++++++++++++++++++++++++--------------
1 file changed, 47 insertions(+), 23 deletions(-)
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 9e01074d3169..60688c20594d 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -116,6 +116,7 @@ static bool is_batt_present(struct charger_manager *cm)
&val);
if (ret == 0 && val.intval)
present = true;
+ power_supply_put(psy);
break;
case CM_CHARGER_STAT:
for (i = 0; cm->desc->psy_charger_stat[i]; i++) {
@@ -129,6 +130,7 @@ static bool is_batt_present(struct charger_manager *cm)
ret = power_supply_get_property(psy,
POWER_SUPPLY_PROP_PRESENT, &val);
+ power_supply_put(psy);
if (ret == 0 && val.intval) {
present = true;
break;
@@ -166,6 +168,7 @@ static bool is_ext_pwr_online(struct charger_manager *cm)
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
&val);
+ power_supply_put(psy);
if (ret == 0 && val.intval) {
online = true;
break;
@@ -195,6 +198,7 @@ static int get_batt_uV(struct charger_manager *cm, int *uV)
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_VOLTAGE_NOW, &val);
+ power_supply_put(fuel_gauge);
if (ret)
return ret;
@@ -238,10 +242,13 @@ static bool is_charging(struct charger_manager *cm)
if (ret) {
dev_warn(cm->dev, "Cannot read ONLINE value from %s\n",
cm->desc->psy_charger_stat[i]);
+ power_supply_put(psy);
continue;
}
- if (val.intval == 0)
+ if (val.intval == 0) {
+ power_supply_put(psy);
continue;
+ }
/*
* 3. The charger should not be FULL, DISCHARGING,
@@ -249,6 +256,7 @@ static bool is_charging(struct charger_manager *cm)
*/
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_STATUS,
&val);
+ power_supply_put(psy);
if (ret) {
dev_warn(cm->dev, "Cannot read STATUS value from %s\n",
cm->desc->psy_charger_stat[i]);
@@ -276,6 +284,7 @@ static bool is_full_charged(struct charger_manager *cm)
struct charger_desc *desc = cm->desc;
union power_supply_propval val;
struct power_supply *fuel_gauge;
+ bool is_full = false;
int ret = 0;
int uV;
@@ -293,15 +302,19 @@ static bool is_full_charged(struct charger_manager *cm)
/* Not full if capacity of fuel gauge isn't full */
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, &val);
- if (!ret && val.intval > desc->fullbatt_full_capacity)
- return true;
+ if (!ret && val.intval > desc->fullbatt_full_capacity) {
+ is_full = true;
+ goto out;
+ }
}
/* Full, if it's over the fullbatt voltage */
if (desc->fullbatt_uV > 0) {
ret = get_batt_uV(cm, &uV);
- if (!ret && uV >= desc->fullbatt_uV)
- return true;
+ if (!ret && uV >= desc->fullbatt_uV) {
+ is_full = true;
+ goto out;
+ }
}
/* Full, if the capacity is more than fullbatt_soc */
@@ -310,11 +323,15 @@ static bool is_full_charged(struct charger_manager *cm)
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, &val);
- if (!ret && val.intval >= desc->fullbatt_soc)
- return true;
+ if (!ret && val.intval >= desc->fullbatt_soc) {
+ is_full = true;
+ goto out;
+ }
}
- return false;
+out:
+ power_supply_put(fuel_gauge);
+ return is_full;
}
/**
@@ -587,14 +604,18 @@ static int cm_get_battery_temperature_by_psy(struct charger_manager *cm,
int *temp)
{
struct power_supply *fuel_gauge;
+ int ret;
fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
if (!fuel_gauge)
return -ENODEV;
- return power_supply_get_property(fuel_gauge,
+ ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_TEMP,
(union power_supply_propval *)temp);
+ power_supply_put(fuel_gauge);
+
+ return ret;
}
static int cm_get_battery_temperature(struct charger_manager *cm,
@@ -876,7 +897,7 @@ static int charger_get_property(struct power_supply *psy,
struct charger_manager *cm = container_of(psy,
struct charger_manager, charger_psy);
struct charger_desc *desc = cm->desc;
- struct power_supply *fuel_gauge;
+ struct power_supply *fuel_gauge = NULL;
int ret = 0;
int uV;
@@ -919,18 +940,18 @@ static int charger_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_TEMP_AMBIENT:
return cm_get_battery_temperature(cm, &val->intval);
case POWER_SUPPLY_PROP_CAPACITY:
- fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
- if (!fuel_gauge) {
- ret = -ENODEV;
- break;
- }
-
if (!is_batt_present(cm)) {
/* There is no battery. Assume 100% */
val->intval = 100;
break;
}
+ fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge);
+ if (!fuel_gauge) {
+ ret = -ENODEV;
+ break;
+ }
+
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
if (ret)
@@ -1005,6 +1026,8 @@ static int charger_get_property(struct power_supply *psy,
default:
return -EINVAL;
}
+ if (fuel_gauge)
+ power_supply_put(fuel_gauge);
return ret;
}
@@ -1802,13 +1825,7 @@ static int charger_manager_probe(struct platform_device *pdev)
desc->psy_charger_stat[i]);
return -ENODEV;
}
- }
-
- fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);
- if (!fuel_gauge) {
- dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n",
- desc->psy_fuel_gauge);
- return -ENODEV;
+ power_supply_put(psy);
}
if (desc->polling_interval_ms == 0 ||
@@ -1848,6 +1865,12 @@ static int charger_manager_probe(struct platform_device *pdev)
cm->charger_psy.num_properties = psy_default.num_properties;
/* Find which optional psy-properties are available */
+ fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);
+ if (!fuel_gauge) {
+ dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n",
+ desc->psy_fuel_gauge);
+ return -ENODEV;
+ }
if (!power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_NOW, &val)) {
cm->charger_psy.properties[cm->charger_psy.num_properties] =
@@ -1867,6 +1890,7 @@ static int charger_manager_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to initialize thermal data\n");
cm->desc->measure_battery_temp = false;
}
+ power_supply_put(fuel_gauge);
INIT_DELAYED_WORK(&cm->fullbatt_vchk_work, fullbatt_vchk);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 3/7] x86/olpc/xo1/sci: Use newly added power_supply_put API
2014-10-16 7:42 ` Krzysztof Kozlowski
(?)
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Replace direct usage of put_device() with new API: power_supply_put().
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
arch/x86/platform/olpc/olpc-xo1-sci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 9a2e590dd202..7fa8b3b53bc0 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -61,7 +61,7 @@ static void battery_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
@@ -71,7 +71,7 @@ static void ac_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 3/7] x86/olpc/xo1/sci: Use newly added power_supply_put API
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Bartlomiej Zolnierkiewicz, Kyungmin Park, Anton Vorontsov,
Pavel Machek, Marek Szyprowski
Replace direct usage of put_device() with new API: power_supply_put().
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
arch/x86/platform/olpc/olpc-xo1-sci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 9a2e590dd202..7fa8b3b53bc0 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -61,7 +61,7 @@ static void battery_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
@@ -71,7 +71,7 @@ static void ac_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 3/7] x86/olpc/xo1/sci: Use newly added power_supply_put API
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Replace direct usage of put_device() with new API: power_supply_put().
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
arch/x86/platform/olpc/olpc-xo1-sci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 9a2e590dd202..7fa8b3b53bc0 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -61,7 +61,7 @@ static void battery_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
@@ -71,7 +71,7 @@ static void ac_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 4/7] x86/olpc/xo15/sci: Use newly added power_supply_put API
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Replace direct usage of put_device() with new API: power_supply_put().
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 08e350e757dc..55130846ac87 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -83,7 +83,7 @@ static void battery_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
@@ -93,7 +93,7 @@ static void ac_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 4/7] x86/olpc/xo15/sci: Use newly added power_supply_put API
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Replace direct usage of put_device() with new API: power_supply_put().
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 08e350e757dc..55130846ac87 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -83,7 +83,7 @@ static void battery_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
@@ -93,7 +93,7 @@ static void ac_status_changed(void)
if (psy) {
power_supply_changed(psy);
- put_device(psy->dev);
+ power_supply_put(psy);
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 5/7] power: 88pm860x_charger: Decrement the power supply's device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/88pm860x_charger.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index 534b3e2e3487..48aa0d829cb0 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -298,13 +298,18 @@ static int set_charging_fsm(struct pm860x_charger_info *info)
return -EINVAL;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
&data);
- if (ret)
+ if (ret) {
+ power_supply_put(psy);
return ret;
+ }
vbatt = data.intval / 1000;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, &data);
- if (ret)
+ if (ret) {
+ power_supply_put(psy);
return ret;
+ }
+ power_supply_put(psy);
mutex_lock(&info->lock);
info->present = data.intval;
@@ -447,6 +452,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
set_charging_fsm(info);
out:
+ power_supply_put(psy);
return IRQ_HANDLED;
}
@@ -507,6 +513,7 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
out:
mutex_unlock(&info->lock);
+ power_supply_put(psy);
dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed);
set_charging_fsm(info);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 5/7] power: 88pm860x_charger: Decrement the power supply's device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/88pm860x_charger.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index 534b3e2e3487..48aa0d829cb0 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -298,13 +298,18 @@ static int set_charging_fsm(struct pm860x_charger_info *info)
return -EINVAL;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
&data);
- if (ret)
+ if (ret) {
+ power_supply_put(psy);
return ret;
+ }
vbatt = data.intval / 1000;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, &data);
- if (ret)
+ if (ret) {
+ power_supply_put(psy);
return ret;
+ }
+ power_supply_put(psy);
mutex_lock(&info->lock);
info->present = data.intval;
@@ -447,6 +452,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
set_charging_fsm(info);
out:
+ power_supply_put(psy);
return IRQ_HANDLED;
}
@@ -507,6 +513,7 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
out:
mutex_unlock(&info->lock);
+ power_supply_put(psy);
dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed);
set_charging_fsm(info);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 6/7] power: bq2415x_charger: Decrement the power supply's device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Use power_supply_put() to decrement the power supply's device reference
counter (increased by power_supply_get_by_name() or
power_supply_get_by_phandle()).
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/bq2415x_charger.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 81a3a78b92d8..8bc9ca9e0275 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -1684,6 +1684,8 @@ error_4:
error_3:
bq2415x_power_supply_exit(bq);
error_2:
+ if (!IS_ERR(bq->notify_psy))
+ power_supply_put(bq->notify_psy);
kfree(name);
error_1:
mutex_lock(&bq2415x_id_mutex);
@@ -1699,8 +1701,10 @@ static int bq2415x_remove(struct i2c_client *client)
{
struct bq2415x_device *bq = i2c_get_clientdata(client);
- if (bq->notify_psy)
+ if (bq->notify_psy) {
power_supply_unreg_notifier(&bq->nb);
+ power_supply_put(bq->notify_psy);
+ }
bq2415x_sysfs_exit(bq);
bq2415x_power_supply_exit(bq);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 6/7] power: bq2415x_charger: Decrement the power supply's device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Use power_supply_put() to decrement the power supply's device reference
counter (increased by power_supply_get_by_name() or
power_supply_get_by_phandle()).
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/power/bq2415x_charger.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 81a3a78b92d8..8bc9ca9e0275 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -1684,6 +1684,8 @@ error_4:
error_3:
bq2415x_power_supply_exit(bq);
error_2:
+ if (!IS_ERR(bq->notify_psy))
+ power_supply_put(bq->notify_psy);
kfree(name);
error_1:
mutex_lock(&bq2415x_id_mutex);
@@ -1699,8 +1701,10 @@ static int bq2415x_remove(struct i2c_client *client)
{
struct bq2415x_device *bq = i2c_get_clientdata(client);
- if (bq->notify_psy)
+ if (bq->notify_psy) {
power_supply_unreg_notifier(&bq->nb);
+ power_supply_put(bq->notify_psy);
+ }
bq2415x_sysfs_exit(bq);
bq2415x_power_supply_exit(bq);
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Lee Jones, Sebastian Reichel,
Dmitry Eremin-Solenikov, David Woodhouse, Krzysztof Kozlowski,
Konrad Rzeszutek Wilk, Rafael J. Wysocki, Lv Zheng,
Bjorn Helgaas, linux-kernel, linux-arm-kernel, linux-pm
Cc: Anton Vorontsov, Pavel Machek, Kyungmin Park, Marek Szyprowski,
Bartlomiej Zolnierkiewicz
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/mfd/ab8500-sysctrl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index 93b2d2c32ca3..d05a5719cfc4 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -51,6 +51,7 @@ static void ab8500_power_off(void)
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
&val);
+ power_supply_put(psy);
if (!ret && val.intval) {
charger_present = true;
@@ -73,6 +74,7 @@ static void ab8500_power_off(void)
pss[i]);
machine_restart("charging");
}
+ power_supply_put(psy);
}
shutdown:
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
@ 2014-10-16 7:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 7:42 UTC (permalink / raw)
To: linux-arm-kernel
Use power_supply_put() to decrement the power supply's device reference
counter.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
---
drivers/mfd/ab8500-sysctrl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index 93b2d2c32ca3..d05a5719cfc4 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -51,6 +51,7 @@ static void ab8500_power_off(void)
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
&val);
+ power_supply_put(psy);
if (!ret && val.intval) {
charger_present = true;
@@ -73,6 +74,7 @@ static void ab8500_power_off(void)
pss[i]);
machine_restart("charging");
}
+ power_supply_put(psy);
}
shutdown:
--
1.9.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
2014-10-16 7:42 ` Krzysztof Kozlowski
@ 2014-10-16 12:29 ` Lee Jones
-1 siblings, 0 replies; 23+ messages in thread
From: Lee Jones @ 2014-10-16 12:29 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Sebastian Reichel, Dmitry Eremin-Solenikov,
David Woodhouse, Konrad Rzeszutek Wilk, Rafael J. Wysocki,
Lv Zheng, Bjorn Helgaas, linux-kernel, linux-arm-kernel,
linux-pm, Anton Vorontsov, Pavel Machek, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> Use power_supply_put() to decrement the power supply's device reference
> counter.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Acked-by: Pavel Machek <pavel@ucw.cz>
I already Acked this.
> ---
> drivers/mfd/ab8500-sysctrl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> index 93b2d2c32ca3..d05a5719cfc4 100644
> --- a/drivers/mfd/ab8500-sysctrl.c
> +++ b/drivers/mfd/ab8500-sysctrl.c
> @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
>
> ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> &val);
> + power_supply_put(psy);
>
> if (!ret && val.intval) {
> charger_present = true;
> @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> pss[i]);
> machine_restart("charging");
> }
> + power_supply_put(psy);
> }
>
> shutdown:
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
@ 2014-10-16 12:29 ` Lee Jones
0 siblings, 0 replies; 23+ messages in thread
From: Lee Jones @ 2014-10-16 12:29 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> Use power_supply_put() to decrement the power supply's device reference
> counter.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Acked-by: Pavel Machek <pavel@ucw.cz>
I already Acked this.
> ---
> drivers/mfd/ab8500-sysctrl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> index 93b2d2c32ca3..d05a5719cfc4 100644
> --- a/drivers/mfd/ab8500-sysctrl.c
> +++ b/drivers/mfd/ab8500-sysctrl.c
> @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
>
> ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> &val);
> + power_supply_put(psy);
>
> if (!ret && val.intval) {
> charger_present = true;
> @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> pss[i]);
> machine_restart("charging");
> }
> + power_supply_put(psy);
> }
>
> shutdown:
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
2014-10-16 12:29 ` Lee Jones
@ 2014-10-16 12:41 ` Krzysztof Kozlowski
-1 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 12:41 UTC (permalink / raw)
To: Lee Jones
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Sebastian Reichel, Dmitry Eremin-Solenikov,
David Woodhouse, Konrad Rzeszutek Wilk, Rafael J. Wysocki,
Lv Zheng, Bjorn Helgaas, linux-kernel, linux-arm-kernel,
linux-pm, Anton Vorontsov, Pavel Machek, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
On czw, 2014-10-16 at 14:29 +0200, Lee Jones wrote:
> On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
>
> > Use power_supply_put() to decrement the power supply's device reference
> > counter.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Acked-by: Pavel Machek <pavel@ucw.cz>
>
> I already Acked this.
I think you acked mfd change in my first patchset
(power_supply_get_property()):
[PATCH 5/8] mfd: ab8500: Use power_supply_*() API for accessing
function attrs
... and this is my second patchset with other API (power_supply_put).
Best regards,
Krzysztof
>
> > ---
> > drivers/mfd/ab8500-sysctrl.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> > index 93b2d2c32ca3..d05a5719cfc4 100644
> > --- a/drivers/mfd/ab8500-sysctrl.c
> > +++ b/drivers/mfd/ab8500-sysctrl.c
> > @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
> >
> > ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> > &val);
> > + power_supply_put(psy);
> >
> > if (!ret && val.intval) {
> > charger_present = true;
> > @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> > pss[i]);
> > machine_restart("charging");
> > }
> > + power_supply_put(psy);
> > }
> >
> > shutdown:
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
@ 2014-10-16 12:41 ` Krzysztof Kozlowski
0 siblings, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2014-10-16 12:41 UTC (permalink / raw)
To: linux-arm-kernel
On czw, 2014-10-16 at 14:29 +0200, Lee Jones wrote:
> On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
>
> > Use power_supply_put() to decrement the power supply's device reference
> > counter.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Acked-by: Pavel Machek <pavel@ucw.cz>
>
> I already Acked this.
I think you acked mfd change in my first patchset
(power_supply_get_property()):
[PATCH 5/8] mfd: ab8500: Use power_supply_*() API for accessing
function attrs
... and this is my second patchset with other API (power_supply_put).
Best regards,
Krzysztof
>
> > ---
> > drivers/mfd/ab8500-sysctrl.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> > index 93b2d2c32ca3..d05a5719cfc4 100644
> > --- a/drivers/mfd/ab8500-sysctrl.c
> > +++ b/drivers/mfd/ab8500-sysctrl.c
> > @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
> >
> > ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> > &val);
> > + power_supply_put(psy);
> >
> > if (!ret && val.intval) {
> > charger_present = true;
> > @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> > pss[i]);
> > machine_restart("charging");
> > }
> > + power_supply_put(psy);
> > }
> >
> > shutdown:
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
2014-10-16 12:41 ` Krzysztof Kozlowski
@ 2014-10-17 7:50 ` Lee Jones
-1 siblings, 0 replies; 23+ messages in thread
From: Lee Jones @ 2014-10-17 7:50 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Linus Walleij,
Samuel Ortiz, Sebastian Reichel, Dmitry Eremin-Solenikov,
David Woodhouse, Konrad Rzeszutek Wilk, Rafael J. Wysocki,
Lv Zheng, Bjorn Helgaas, linux-kernel, linux-arm-kernel,
linux-pm, Anton Vorontsov, Pavel Machek, Kyungmin Park,
Marek Szyprowski, Bartlomiej Zolnierkiewicz
On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> On czw, 2014-10-16 at 14:29 +0200, Lee Jones wrote:
> > On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> >
> > > Use power_supply_put() to decrement the power supply's device reference
> > > counter.
> > >
> > > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > I already Acked this.
>
> I think you acked mfd change in my first patchset
> (power_supply_get_property()):
> [PATCH 5/8] mfd: ab8500: Use power_supply_*() API for accessing
> function attrs
>
> ... and this is my second patchset with other API (power_supply_put).
Maybe my reply wasn't sent properly (the WiFi at this conference has
been pretty shakey at points).
Anyway ... Acked-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > > drivers/mfd/ab8500-sysctrl.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> > > index 93b2d2c32ca3..d05a5719cfc4 100644
> > > --- a/drivers/mfd/ab8500-sysctrl.c
> > > +++ b/drivers/mfd/ab8500-sysctrl.c
> > > @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
> > >
> > > ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> > > &val);
> > > + power_supply_put(psy);
> > >
> > > if (!ret && val.intval) {
> > > charger_present = true;
> > > @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> > > pss[i]);
> > > machine_restart("charging");
> > > }
> > > + power_supply_put(psy);
> > > }
> > >
> > > shutdown:
> >
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 7/7] mfd: ab8500: Decrement the power supply's device reference counter
@ 2014-10-17 7:50 ` Lee Jones
0 siblings, 0 replies; 23+ messages in thread
From: Lee Jones @ 2014-10-17 7:50 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> On czw, 2014-10-16 at 14:29 +0200, Lee Jones wrote:
> > On Thu, 16 Oct 2014, Krzysztof Kozlowski wrote:
> >
> > > Use power_supply_put() to decrement the power supply's device reference
> > > counter.
> > >
> > > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > I already Acked this.
>
> I think you acked mfd change in my first patchset
> (power_supply_get_property()):
> [PATCH 5/8] mfd: ab8500: Use power_supply_*() API for accessing
> function attrs
>
> ... and this is my second patchset with other API (power_supply_put).
Maybe my reply wasn't sent properly (the WiFi at this conference has
been pretty shakey at points).
Anyway ... Acked-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > > drivers/mfd/ab8500-sysctrl.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
> > > index 93b2d2c32ca3..d05a5719cfc4 100644
> > > --- a/drivers/mfd/ab8500-sysctrl.c
> > > +++ b/drivers/mfd/ab8500-sysctrl.c
> > > @@ -51,6 +51,7 @@ static void ab8500_power_off(void)
> > >
> > > ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
> > > &val);
> > > + power_supply_put(psy);
> > >
> > > if (!ret && val.intval) {
> > > charger_present = true;
> > > @@ -73,6 +74,7 @@ static void ab8500_power_off(void)
> > > pss[i]);
> > > machine_restart("charging");
> > > }
> > > + power_supply_put(psy);
> > > }
> > >
> > > shutdown:
> >
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2014-10-17 7:50 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16 7:42 [PATCH v2 0/7] power_supply: Decrement the device reference counter Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 1/7] power_supply: Add power_supply_put for decrementing " Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 2/7] power: charger-manager: Decrement the power supply's " Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 3/7] x86/olpc/xo1/sci: Use newly added power_supply_put API Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 4/7] x86/olpc/xo15/sci: " Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 5/7] power: 88pm860x_charger: Decrement the power supply's device reference counter Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 6/7] power: bq2415x_charger: " Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 7:42 ` [PATCH v2 7/7] mfd: ab8500: " Krzysztof Kozlowski
2014-10-16 7:42 ` Krzysztof Kozlowski
2014-10-16 12:29 ` Lee Jones
2014-10-16 12:29 ` Lee Jones
2014-10-16 12:41 ` Krzysztof Kozlowski
2014-10-16 12:41 ` Krzysztof Kozlowski
2014-10-17 7:50 ` Lee Jones
2014-10-17 7:50 ` Lee Jones
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.