public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/3] charger-manager: Fix bug when check dropped voltage after fullbatt event
@ 2012-11-22  7:53 Chanwoo Choi
  2012-12-17  6:53 ` Anton Vorontsov
  0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2012-11-22  7:53 UTC (permalink / raw)
  To: anton.vorontsov; +Cc: myungjoo.ham, kyungmin.park, linux-kernel, Chanwoo Choi

This patch check difference value between current voltage of battery
and desc->fullbatt_uV whether positve or negative number. If difference
value is negative number when current voltage of battery is larger than
desc->fullbatt_uV, charger-manager return immediately because battery
is fully charged.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/power/charger-manager.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index ee039b9..17130c7 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -468,7 +468,9 @@ static void fullbatt_vchk(struct work_struct *work)
 	struct charger_manager *cm = container_of(dwork,
 			struct charger_manager, fullbatt_vchk_work);
 	struct charger_desc *desc = cm->desc;
-	int batt_uV, err, diff;
+	int batt_uV;
+	int err;
+	int diff;
 
 	/* remove the appointment for fullbatt_vchk */
 	cm->fullbatt_vchk_jiffies_at = 0;
@@ -482,8 +484,9 @@ static void fullbatt_vchk(struct work_struct *work)
 		return;
 	}
 
-	diff = desc->fullbatt_uV;
-	diff -= batt_uV;
+	diff = desc->fullbatt_uV - batt_uV;
+	if (diff < 0)
+		return;
 
 	dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff);
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/3] charger-manager: Fix bug when check dropped voltage after fullbatt event
  2012-11-22  7:53 [PATCH v2 2/3] charger-manager: Fix bug when check dropped voltage after fullbatt event Chanwoo Choi
@ 2012-12-17  6:53 ` Anton Vorontsov
  2012-12-17  7:15   ` Chanwoo Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Vorontsov @ 2012-12-17  6:53 UTC (permalink / raw)
  To: Chanwoo Choi; +Cc: myungjoo.ham, kyungmin.park, linux-kernel

On Thu, Nov 22, 2012 at 04:53:51PM +0900, Chanwoo Choi wrote:
> This patch check difference value between current voltage of battery
> and desc->fullbatt_uV whether positve or negative number. If difference
> value is negative number when current voltage of battery is larger than
> desc->fullbatt_uV, charger-manager return immediately because battery
> is fully charged.
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/power/charger-manager.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
> index ee039b9..17130c7 100644
> --- a/drivers/power/charger-manager.c
> +++ b/drivers/power/charger-manager.c
> @@ -468,7 +468,9 @@ static void fullbatt_vchk(struct work_struct *work)
>  	struct charger_manager *cm = container_of(dwork,
>  			struct charger_manager, fullbatt_vchk_work);
>  	struct charger_desc *desc = cm->desc;
> -	int batt_uV, err, diff;
> +	int batt_uV;
> +	int err;
> +	int diff;

I applied the patch, but dropped this part. This is an unrelated style
fix, and, if anything, it desires a separate patch (possibly 'fixing' the
whole file/driver).

Thanks!

>  	/* remove the appointment for fullbatt_vchk */
>  	cm->fullbatt_vchk_jiffies_at = 0;
> @@ -482,8 +484,9 @@ static void fullbatt_vchk(struct work_struct *work)
>  		return;
>  	}
>  
> -	diff = desc->fullbatt_uV;
> -	diff -= batt_uV;
> +	diff = desc->fullbatt_uV - batt_uV;
> +	if (diff < 0)
> +		return;
>  
>  	dev_info(cm->dev, "VBATT dropped %duV after full-batt.\n", diff);
>  
> -- 
> 1.7.0.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/3] charger-manager: Fix bug when check dropped voltage after fullbatt event
  2012-12-17  6:53 ` Anton Vorontsov
@ 2012-12-17  7:15   ` Chanwoo Choi
  0 siblings, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2012-12-17  7:15 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: myungjoo.ham, kyungmin.park, linux-kernel

On 12/17/2012 03:53 PM, Anton Vorontsov wrote:
> On Thu, Nov 22, 2012 at 04:53:51PM +0900, Chanwoo Choi wrote:
>> This patch check difference value between current voltage of battery
>> and desc->fullbatt_uV whether positve or negative number. If difference
>> value is negative number when current voltage of battery is larger than
>> desc->fullbatt_uV, charger-manager return immediately because battery
>> is fully charged.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  drivers/power/charger-manager.c |    9 ++++++---
>>  1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
>> index ee039b9..17130c7 100644
>> --- a/drivers/power/charger-manager.c
>> +++ b/drivers/power/charger-manager.c
>> @@ -468,7 +468,9 @@ static void fullbatt_vchk(struct work_struct *work)
>>  	struct charger_manager *cm = container_of(dwork,
>>  			struct charger_manager, fullbatt_vchk_work);
>>  	struct charger_desc *desc = cm->desc;
>> -	int batt_uV, err, diff;
>> +	int batt_uV;
>> +	int err;
>> +	int diff;
> 
> I applied the patch, but dropped this part. This is an unrelated style
> fix, and, if anything, it desires a separate patch (possibly 'fixing' the
> whole file/driver).
> 
> Thanks!
> 

Thanks for your comment and applied it.
I will re-send other patch for fixing coding style.

Best Regards,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-17  7:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22  7:53 [PATCH v2 2/3] charger-manager: Fix bug when check dropped voltage after fullbatt event Chanwoo Choi
2012-12-17  6:53 ` Anton Vorontsov
2012-12-17  7:15   ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox