[PATCH 4/5] ds2760_battery, cosmetic: fix tabs/spaces mess, indentation, fit 80 columns

From: Anton Vorontsov <cbou_at_mail.ru>
Date: Thu, 22 Mar 2007 00:21:04 +0300

Signed-off-by: Anton Vorontsov <cbou_at_mail.ru>

---
 drivers/hwmon/battery/ds2760_battery.c |  119 ++++++++++++++++----------------
 include/linux/ds2760_battery.h         |   34 +++++----
 2 files changed, 77 insertions(+), 76 deletions(-)
diff --git a/drivers/hwmon/battery/ds2760_battery.c b/drivers/hwmon/battery/ds2760_battery.c
index 3a12d73..7420d9e 100644
--- a/drivers/hwmon/battery/ds2760_battery.c
+++ b/drivers/hwmon/battery/ds2760_battery.c
@@ -34,24 +34,23 @@
                                               batt_cdev);
 
 /* Some batteries have their rated capacity stored a N * 10 mAh, while
- *  * others use an index into this table. */
+ * others use an index into this table. */
 static int rated_capacities[] = {
-    0,
-    920,        /* Samsung */
-    920,        /* BYD */
-    920,        /* Lishen */
-    920,        /* NEC */
-    1440,       /* Samsung */
-    1440,       /* BYD */
-    1440,       /* Lishen */
-    1440,       /* NEC */
-    2880,       /* Samsung */
-    2880,       /* BYD */
-    2880,       /* Lishen */
-    2880        /* NEC */
+	0,
+	920,        /* Samsung */
+	920,        /* BYD */
+	920,        /* Lishen */
+	920,        /* NEC */
+	1440,       /* Samsung */
+	1440,       /* BYD */
+	1440,       /* Lishen */
+	1440,       /* NEC */
+	2880,       /* Samsung */
+	2880,       /* BYD */
+	2880,       /* Lishen */
+	2880        /* NEC */
 };
 
-
 static int ds2760_battery_read_status(struct ds2760_device_info *di);
 static void ds2760_battery_update_status(struct ds2760_device_info *di);
 
@@ -122,7 +121,7 @@ static int ds2760_battery_get_status(struct battery *bat)
 }
 
 /* array is level at temps 0C, 10C, 20C, 30C, 40C
- *  * temp is in Celsius */
+ * temp is in Celsius */
 static int
 battery_interpolate(int array[], int temp)
 {
@@ -153,78 +152,78 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)
 		return 1;
 	}
 
-        di->update_time = jiffies;
+	di->update_time = jiffies;
 
-        /* DS2760 reports voltage in units of 4.88mV, but the battery class
+	/* DS2760 reports voltage in units of 4.88mV, but the battery class
 	 * reports in units of mV, so convert by multiplying by 4.875.
 	 * We approximate because integer math is cheap, and close enough. */
-        di->voltage_raw = (di->raw[DS2760_VOLTAGE_MSB] << 3) |
-			  (di->raw[DS2760_VOLTAGE_LSB] >> 5);
-        di->voltage_mV = (di->voltage_raw * 5) - (di->voltage_raw / 8);
+	di->voltage_raw = (di->raw[DS2760_VOLTAGE_MSB] << 3) |
+	                  (di->raw[DS2760_VOLTAGE_LSB] >> 5);
+	di->voltage_mV = (di->voltage_raw * 5) - (di->voltage_raw / 8);
 
-        /* DS2760 reports current in signed units of 0.625mA, but the battery
+	/* DS2760 reports current in signed units of 0.625mA, but the battery
 	 * class reports in units of mA, so convert by multiplying by 0.625. */
-        di->current_raw =
-            (((signed char)di->raw[DS2760_CURRENT_MSB]) << 5) |
-                          (di->raw[DS2760_CURRENT_LSB] >> 3);
-        di->current_mA = (di->current_raw / 2) + (di->current_raw / 8);
+	di->current_raw =
+	    (((signed char)di->raw[DS2760_CURRENT_MSB]) << 5) |
+	                  (di->raw[DS2760_CURRENT_LSB] >> 3);
+	di->current_mA = (di->current_raw / 2) + (di->current_raw / 8);
 
-        /* DS2760 reports accumulated current in signed units of 0.25mAh, but
+	/* DS2760 reports accumulated current in signed units of 0.25mAh, but
 	 * the battery class reports charge in mJ, so we pretend that
 	 * 1 mAh = 1 mJ. */
-        di->accum_current_raw =
-            (((signed char)di->raw[DS2760_CURRENT_ACCUM_MSB]) << 8) |
-                           di->raw[DS2760_CURRENT_ACCUM_LSB];
-        di->accum_current_mAh = di->accum_current_raw / 4;
+	di->accum_current_raw =
+	    (((signed char)di->raw[DS2760_CURRENT_ACCUM_MSB]) << 8) |
+	                   di->raw[DS2760_CURRENT_ACCUM_LSB];
+	di->accum_current_mAh = di->accum_current_raw / 4;
 
-        /* DS2760 reports temperature in signed units of 0.125C, but the
+	/* DS2760 reports temperature in signed units of 0.125C, but the
 	 * battery class reports in units of 1/10 C, so we convert by
 	 * multiplying by .125 * 10 = 1.25. */
-        di->temp_raw = (((signed char)di->raw[DS2760_TEMP_MSB]) << 3) |
-				     (di->raw[DS2760_TEMP_LSB] >> 5);
-        di->temp_C = di->temp_raw + (di->temp_raw / 4);
+	di->temp_raw = (((signed char)di->raw[DS2760_TEMP_MSB]) << 3) |
+	                             (di->raw[DS2760_TEMP_LSB] >> 5);
+	di->temp_C = di->temp_raw + (di->temp_raw / 4);
 
-        /* At least some battery monitors (e.g. HP iPAQ) store the battery's
+	/* At least some battery monitors (e.g. HP iPAQ) store the battery's
 	 * maximum rated capacity. */
-        if (di->raw[DS2760_RATED_CAPACITY] < ARRAY_SIZE(rated_capacities))
-                di->rated_capacity =
-                        rated_capacities[(unsigned int)di->raw[DS2760_RATED_CAPACITY]];
-        else
-                di->rated_capacity = di->raw[DS2760_RATED_CAPACITY] * 10;
+	if (di->raw[DS2760_RATED_CAPACITY] < ARRAY_SIZE(rated_capacities))
+		di->rated_capacity = rated_capacities[
+		        (unsigned int)di->raw[DS2760_RATED_CAPACITY]];
+	else
+		di->rated_capacity = di->raw[DS2760_RATED_CAPACITY] * 10;
 
-        /* Calculate the full level at the present temperature. */
-        di->full_active_mAh = di->raw[DS2760_ACTIVE_FULL] << 8 |
-			      di->raw[DS2760_ACTIVE_FULL + 1];
+	/* Calculate the full level at the present temperature. */
+	di->full_active_mAh = di->raw[DS2760_ACTIVE_FULL] << 8 |
+	                      di->raw[DS2760_ACTIVE_FULL + 1];
 
-        scale[0] = di->raw[DS2760_ACTIVE_FULL] << 8 |
-                   di->raw[DS2760_ACTIVE_FULL + 1];
-        for (i = 1; i < 5; i++)
-                scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
+	scale[0] = di->raw[DS2760_ACTIVE_FULL] << 8 |
+	           di->raw[DS2760_ACTIVE_FULL + 1];
+	for (i = 1; i < 5; i++)
+		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
 
-        di->full_active_mAh = battery_interpolate(scale, di->temp_C / 10);
+	di->full_active_mAh = battery_interpolate(scale, di->temp_C / 10);
 
-        /* Calculate the empty level at the present temperature. */
-        scale[4] = di->raw[DS2760_ACTIVE_EMPTY + 4];
-        for (i = 3; i >= 0; i--)
-                scale[i] = scale[i + 1] + di->raw[DS2760_ACTIVE_EMPTY + i];
+	/* Calculate the empty level at the present temperature. */
+	scale[4] = di->raw[DS2760_ACTIVE_EMPTY + 4];
+	for (i = 3; i >= 0; i--)
+		scale[i] = scale[i + 1] + di->raw[DS2760_ACTIVE_EMPTY + i];
 
-        di->empty_mAh = battery_interpolate(scale, di->temp_C / 10);
+	di->empty_mAh = battery_interpolate(scale, di->temp_C / 10);
 
 	/* From Maxim Application Note 131: remaining capacity =
 	 * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */
 	di->rem_capacity = ((di->accum_current_mAh - di->empty_mAh) * 100) /
-			    (di->full_active_mAh - di->empty_mAh);
+	                    (di->full_active_mAh - di->empty_mAh);
 
 	if (di->rem_capacity < 0)
 		di->rem_capacity = 0;
 	if (di->rem_capacity > 100)
 		di->rem_capacity = 100;
 
-        if (di->current_mA)
-                di->life_min = -((di->accum_current_mAh - di->empty_mAh) * 60) /
-				di->current_mA;
-        else
-                di->life_min = 0;
+	if (di->current_mA)
+		di->life_min = -((di->accum_current_mAh - di->empty_mAh) *
+		                 60) / di->current_mA;
+	else
+		di->life_min = 0;
 
 	return 0;
 }
diff --git a/include/linux/ds2760_battery.h b/include/linux/ds2760_battery.h
index a654c63..4f37f8e 100644
--- a/include/linux/ds2760_battery.h
+++ b/include/linux/ds2760_battery.h
@@ -34,9 +34,11 @@ struct ds2760_device_info {
 	/* Return non-zero if charging power supplied. This is called by 
 	   ds2760_battery to check current state of the power. */
 	int  (*is_charge_power_supplied)(void);
+
 	/* Notify ds2760_battery that charge power supply changed 
 	   asynchronously. You call this (optionally). */
 	void (*charge_power_changed)(struct ds2760_device_info *di);
+
 	/* is_charge_power_supplied/charge_power_changed call diagram:
 	   ds2760_battery calls is_charge_power_supplied() from time to time 
 	   to get current state of the power. It is not guaranteed to be often,
@@ -51,22 +53,22 @@ struct ds2760_device_info {
 	void (*charge_callback)(const struct ds2760_device_info *di);
 
 	/* DS2760 data, valid after calling ds2760_battery_read_status() */
-        unsigned long update_time;          /* jiffies when data read */
-        char    raw[DS2760_DATA_SIZE];      /* raw DS2760 data */
-        int     voltage_raw;                /* units of 4.88 mV */
-        int     voltage_mV;                 /* units of mV */
-        int     current_raw;                /* units of 0.625 mA */
-        int     current_mA;                 /* units of mA */
-        int     accum_current_raw;          /* units of 0.25 mAh */
-        int     accum_current_mAh;          /* units of mAh */
-        int     temp_raw;                   /* units of 0.125 C */
-        int     temp_C;                     /* units of 0.1 C */
-        int     rated_capacity;             /* units of mAh */
-        int     rem_capacity;               /* percentage */
-        int     full_active_mAh;            /* units of mAh */
-        int     empty_mAh;                  /* units of mAh */
-        int     life_min;                   /* units of minutes */
-	int     charge_status;              /* BATTERY_STATUS_* */
+	unsigned long update_time;      /* jiffies when data read */
+	char raw[DS2760_DATA_SIZE];     /* raw DS2760 data */
+	int voltage_raw;                /* units of 4.88 mV */
+	int voltage_mV;                 /* units of mV */
+	int current_raw;                /* units of 0.625 mA */
+	int current_mA;                 /* units of mA */
+	int accum_current_raw;          /* units of 0.25 mAh */
+	int accum_current_mAh;          /* units of mAh */
+	int temp_raw;                   /* units of 0.125 C */
+	int temp_C;                     /* units of 0.1 C */
+	int rated_capacity;             /* units of mAh */
+	int rem_capacity;               /* percentage */
+	int full_active_mAh;            /* units of mAh */
+	int empty_mAh;                  /* units of mAh */
+	int life_min;                   /* units of minutes */
+	int charge_status;              /* BATTERY_STATUS_* */
 
 	/* private */
 	int full_counter;
-- 
1.5.0.5-dirty
Received on Wed Mar 21 2007 - 16:21:40 EST

This archive was generated by hypermail 2.2.0 : Wed Mar 21 2007 - 16:22:51 EST