public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Arun Murthy <arun.murthy@stericsson.com>
Cc: dwmw2@infradead.org, linux-kernel@vger.kernel.org,
	karl.komierowski@stericsson.com, johan.palsson@stericsson.com,
	linus.walleij@linaro.org
Subject: [PATCH 2/6] ab8500_btemp: Get rid of 'enum adc_therm'
Date: Wed, 14 Mar 2012 05:05:04 +0400	[thread overview]
Message-ID: <20120314010504.GB10798@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20120314005901.GB1778@oksana.dev.rtsoft.ru>

This is the same as abx500_adc_therm, but when the former is used,
the following warning flood pops up:

drivers/power/ab8500_btemp.c: In function 'ab8500_btemp_batctrl_volt_to_res':
ab8500_btemp.c:150:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]
ab8500_btemp.c: In function 'ab8500_btemp_curr_source_enable':
ab8500_btemp.c:212:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]
ab8500_btemp.c:244:32: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]
ab8500_btemp.c: In function 'ab8500_btemp_measure_temp':
ab8500_btemp.c:462:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]
ab8500_btemp.c: In function 'ab8500_btemp_id':
ab8500_btemp.c:528:121: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]
ab8500_btemp.c:551:25: warning: comparison between 'enum abx500_adc_therm' and 'enum adc_therm' [-Wenum-compare]

This patch fixes the issue by switching the driver to use more
namespace-friendly enum.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
 drivers/power/ab8500_btemp.c         |   13 +++++++------
 include/linux/mfd/abx500/ab8500-bm.h |   15 ++-------------
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index 443bc7d..d8bb993 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -147,7 +147,7 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
 		return (450000 * (v_batctrl)) / (1800 - v_batctrl);
 	}
 
-	if (di->bat->adc_therm == ADC_THERM_BATCTRL) {
+	if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL) {
 		/*
 		 * If the battery has internal NTC, we use the current
 		 * source to calculate the resistance, 7uA or 20uA
@@ -209,7 +209,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
 		return 0;
 
 	/* Only do this for batteries with internal NTC */
-	if (di->bat->adc_therm == ADC_THERM_BATCTRL && enable) {
+	if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
 		if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
 			curr = BAT_CTRL_7U_ENA;
 		else
@@ -241,7 +241,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
 				__func__);
 			goto disable_curr_source;
 		}
-	} else if (di->bat->adc_therm == ADC_THERM_BATCTRL && !enable) {
+	} else if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
 		dev_dbg(di->dev, "Disable BATCTRL curr source\n");
 
 		/* Write 0 to the curr bits */
@@ -459,7 +459,7 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
 
 	id = di->bat->batt_id;
 
-	if (di->bat->adc_therm == ADC_THERM_BATCTRL &&
+	if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
 			id != BATTERY_UNKNOWN) {
 
 		rbat = ab8500_btemp_get_batctrl_res(di);
@@ -528,7 +528,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
 			dev_dbg(di->dev, "Battery detected on %s"
 				" low %d < res %d < high: %d"
 				" index: %d\n",
-				di->bat->adc_therm == ADC_THERM_BATCTRL ?
+				di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL ?
 				"BATCTRL" : "BATTEMP",
 				di->bat->bat_type[i].resis_low, res,
 				di->bat->bat_type[i].resis_high, i);
@@ -548,7 +548,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
 	 * We only have to change current source if the
 	 * detected type is Type 1, else we use the 7uA source
 	 */
-	if (di->bat->adc_therm == ADC_THERM_BATCTRL && di->bat->batt_id == 1) {
+	if (di->bat->adc_therm == ABx500_ADC_THERM_BATCTRL &&
+			di->bat->batt_id == 1) {
 		dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
 		di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
 	}
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 4b7342c..f61b7b9 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -9,6 +9,7 @@
 #define _AB8500_BM_H
 
 #include <linux/kernel.h>
+#include <linux/mfd/abx500.h>
 
 /*
  * System control 2 register offsets.
@@ -231,18 +232,6 @@
 /* Battery type */
 #define BATTERY_UNKNOWN			00
 
-/*
- * ADC for the battery thermistor.
- * When using the ADC_THERM_BATCTRL the battery ID resistor is combined with
- * a NTC resistor to both identify the battery and to measure its temperature.
- * Different phone manufactures uses different techniques to both identify the
- * battery and to read its temperature.
- */
-enum adc_therm {
-	ADC_THERM_BATCTRL,
-	ADC_THERM_BATTEMP,
-};
-
 /**
  * struct res_to_temp - defines one point in a temp to res curve. To
  * be used in battery packs that combines the identification resistor with a
@@ -464,7 +453,7 @@ struct ab8500_bm_data {
 	bool no_maintenance;
 	bool chg_unknown_bat;
 	bool enable_overshoot;
-	enum adc_therm adc_therm;
+	enum abx500_adc_therm adc_therm;
 	int fg_res;
 	int n_btypes;
 	int batt_id;
-- 
1.7.9


  parent reply	other threads:[~2012-03-14  1:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 16:24 [PATCH 0/4] AB8500 Battery Management Driver Arun Murthy
2012-02-29 16:24 ` [PATCH 1/4] power: abx500-chargalg: Add abx500 charging algorithm Arun Murthy
2012-02-29 16:24 ` [PATCH 2/4] power: ab8500-charger: AB8500 charger driver Arun Murthy
2012-02-29 17:50   ` Andi
2012-02-29 18:21     ` Arun Murthy
2012-02-29 16:24 ` [PATCH 3/4] power: ab8500-fg: A8500 fuel gauge driver Arun Murthy
2012-02-29 16:24 ` [PATCH 4/4] power: ab8500-btemp: AB8500 battery temperature driver Arun Murthy
2012-03-14  0:59 ` [PATCH 0/4] AB8500 Battery Management Driver Anton Vorontsov
2012-03-14  1:04   ` [PATCH 1/6] ab8500_charger: Convert to the new USB OTG calls Anton Vorontsov
2012-03-14  4:03     ` Arun MURTHY
2012-03-14  1:05   ` Anton Vorontsov [this message]
2012-03-14  4:25     ` [PATCH 2/6] ab8500_btemp: Get rid of 'enum adc_therm' Arun MURTHY
2012-03-14  1:05   ` [PATCH 3/6] ab8500_fg: Get rid of 'struct v_to_cap' Anton Vorontsov
2012-03-14  4:36     ` Arun MURTHY
2012-03-14  1:05   ` [PATCH 4/6] ab8500_fg: Get rid of 'struct battery_type' Anton Vorontsov
2012-03-14  4:36     ` Arun MURTHY
2012-03-14  1:05   ` [PATCH 5/6] ab8500_fg: Fix copy-paste error Anton Vorontsov
2012-03-14  4:36     ` Arun MURTHY
2012-03-14  5:45     ` Arun MURTHY
2012-03-14  1:05   ` [PATCH 6/6] ab8500: Turn unneeded global symbols into local ones Anton Vorontsov
2012-03-14  4:37     ` Arun MURTHY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120314010504.GB10798@oksana.dev.rtsoft.ru \
    --to=anton.vorontsov@linaro.org \
    --cc=arun.murthy@stericsson.com \
    --cc=dwmw2@infradead.org \
    --cc=johan.palsson@stericsson.com \
    --cc=karl.komierowski@stericsson.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox