Re: [PATCH 1/3] charger-manager: Fix bug related to checking fully charged state of battery

2013-01-05 Thread Anton Vorontsov
On Thu, Nov 22, 2012 at 04:44:15PM +0900, Chanwoo Choi wrote:
> This patch fix bug related to checking fully charged state of battery
> when charger-manager call is_full_charged() function. After reading
> property of charger/fuel-gauge through power_supply API, val.intval is
> more than 1. So, is_full_charged() function always return true. If true,
> battery means fully charged state.
> 
> Signed-off-by: Chanwoo Choi 
> Signed-off-by: Myungjoo Ham 
> Signed-off-by: Kyungmin Park 
> ---

Applied, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] charger-manager: Fix bug related to checking fully charged state of battery

2013-01-05 Thread Anton Vorontsov
On Thu, Nov 22, 2012 at 04:44:15PM +0900, Chanwoo Choi wrote:
 This patch fix bug related to checking fully charged state of battery
 when charger-manager call is_full_charged() function. After reading
 property of charger/fuel-gauge through power_supply API, val.intval is
 more than 1. So, is_full_charged() function always return true. If true,
 battery means fully charged state.
 
 Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
 Signed-off-by: Myungjoo Ham myungjoo@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---

Applied, thanks!
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] charger-manager: Fix bug related to checking fully charged state of battery

2012-11-22 Thread Chanwoo Choi
This patch fix bug related to checking fully charged state of battery
when charger-manager call is_full_charged() function. After reading
property of charger/fuel-gauge through power_supply API, val.intval is
more than 1. So, is_full_charged() function always return true. If true,
battery means fully charged state.

Signed-off-by: Chanwoo Choi 
Signed-off-by: Myungjoo Ham 
Signed-off-by: Kyungmin Park 
---
 drivers/power/charger-manager.c |   33 +
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 8a0aca6..ee039b9 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -239,44 +239,37 @@ static bool is_full_charged(struct charger_manager *cm)
int uV;
 
/* If there is no battery, it cannot be charged */
-   if (!is_batt_present(cm)) {
-   val.intval = 0;
-   goto out;
-   }
+   if (!is_batt_present(cm))
+   return false;
 
if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) {
+   val.intval = 0;
+
/* Not full if capacity of fuel gauge isn't full */
ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, );
-   if (!ret && val.intval > desc->fullbatt_full_capacity) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret && val.intval > desc->fullbatt_full_capacity)
+   return true;
}
 
/* Full, if it's over the fullbatt voltage */
if (desc->fullbatt_uV > 0) {
ret = get_batt_uV(cm, );
-   if (!ret && uV >= desc->fullbatt_uV) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret && uV >= desc->fullbatt_uV)
+   return true;
}
 
/* Full, if the capacity is more than fullbatt_soc */
if (cm->fuel_gauge && desc->fullbatt_soc > 0) {
+   val.intval = 0;
+
ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, );
-   if (!ret && val.intval >= desc->fullbatt_soc) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret && val.intval >= desc->fullbatt_soc)
+   return true;
}
 
-   val.intval = 0;
-
-out:
-   return val.intval ? true : false;
+   return false;
 }
 
 /**
-- 
1.7.0.4

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


[PATCH 1/3] charger-manager: Fix bug related to checking fully charged state of battery

2012-11-22 Thread Chanwoo Choi
This patch fix bug related to checking fully charged state of battery
when charger-manager call is_full_charged() function. After reading
property of charger/fuel-gauge through power_supply API, val.intval is
more than 1. So, is_full_charged() function always return true. If true,
battery means fully charged state.

Signed-off-by: Chanwoo Choi cw00.c...@samsung.com
Signed-off-by: Myungjoo Ham myungjoo@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/power/charger-manager.c |   33 +
 1 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 8a0aca6..ee039b9 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -239,44 +239,37 @@ static bool is_full_charged(struct charger_manager *cm)
int uV;
 
/* If there is no battery, it cannot be charged */
-   if (!is_batt_present(cm)) {
-   val.intval = 0;
-   goto out;
-   }
+   if (!is_batt_present(cm))
+   return false;
 
if (cm-fuel_gauge  desc-fullbatt_full_capacity  0) {
+   val.intval = 0;
+
/* Not full if capacity of fuel gauge isn't full */
ret = cm-fuel_gauge-get_property(cm-fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, val);
-   if (!ret  val.intval  desc-fullbatt_full_capacity) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret  val.intval  desc-fullbatt_full_capacity)
+   return true;
}
 
/* 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) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret  uV = desc-fullbatt_uV)
+   return true;
}
 
/* Full, if the capacity is more than fullbatt_soc */
if (cm-fuel_gauge  desc-fullbatt_soc  0) {
+   val.intval = 0;
+
ret = cm-fuel_gauge-get_property(cm-fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
-   if (!ret  val.intval = desc-fullbatt_soc) {
-   val.intval = 1;
-   goto out;
-   }
+   if (!ret  val.intval = desc-fullbatt_soc)
+   return true;
}
 
-   val.intval = 0;
-
-out:
-   return val.intval ? true : false;
+   return false;
 }
 
 /**
-- 
1.7.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/