r4042 - branches/src/target/kernel/2.6.24.x/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Sun Feb 10 23:33:50 CET 2008


Author: werner
Date: 2008-02-10 23:33:47 +0100 (Sun, 10 Feb 2008)
New Revision: 4042

Modified:
   branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
Log:
fix-pcf50633-enum-confusion.patch

From: Andy Green <andy at openmoko.com>

Confusion in the code about bit indexes and bit values
in an enum.  Fix allows us to reclaim some 4K of text
space and stop /sys reporting <NULL> for some things

Signed-off-by: Andy Green <andy at openmoko.com>

---

 drivers/i2c/chips/pcf50633.c |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)



Modified: branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch	2008-02-10 21:29:37 UTC (rev 4041)
+++ branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch	2008-02-10 22:33:47 UTC (rev 4042)
@@ -34,7 +34,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.24/drivers/i2c/chips/pcf50633.c
-@@ -0,0 +1,1736 @@
+@@ -0,0 +1,1746 @@
 +/* Philips PCF50633 Power Management Unit (PMU) driver
 + *
 + * (C) 2006-2007 by OpenMoko, Inc.
@@ -105,16 +105,26 @@
 +
 +I2C_CLIENT_INSMOD_1(pcf50633);
 +
-+#define PCF50633_F_CHG_ENABLED	0x00000001	/* Charger enabled */
-+#define PCF50633_F_CHG_PRESENT	0x00000002	/* Charger present */
-+#define PCF50633_F_CHG_ERR	0x00000008	/* Charger Error */
-+#define PCF50633_F_CHG_PROT	0x00000010	/* Charger Protection */
-+#define PCF50633_F_CHG_READY	0x00000020	/* Charging completed */
++#define PCF50633_FIDX_CHG_ENABLED	0	/* Charger enabled */
++#define PCF50633_FIDX_CHG_PRESENT	1	/* Charger present */
++#define PCF50633_FIDX_CHG_ERR		3	/* Charger Error */
++#define PCF50633_FIDX_CHG_PROT		4	/* Charger Protection */
++#define PCF50633_FIDX_CHG_READY		5	/* Charging completed */
++#define PCF50633_FIDX_PWR_PRESSED	8
++#define PCF50633_FIDX_RTC_SECOND	9
++#define PCF50633_FIDX_USB_PRESENT	10
++
++#define PCF50633_F_CHG_ENABLED	(1 << PCF50633_FIDX_CHG_ENABLED)
++#define PCF50633_F_CHG_PRESENT	(1 << PCF50633_FIDX_CHG_PRESENT)
++#define PCF50633_F_CHG_ERR	(1 << PCF50633_FIDX_CHG_ERR)
++#define PCF50633_F_CHG_PROT	(1 << PCF50633_FIDX_CHG_PROT)
++#define PCF50633_F_CHG_READY	(1 << PCF50633_FIDX_CHG_READY)
++
 +#define PCF50633_F_CHG_MASK	0x000000fc
 +
-+#define PCF50633_F_PWR_PRESSED	0x00000100
-+#define PCF50633_F_RTC_SECOND	0x00000200
-+#define PCF50633_F_USB_PRESENT	0x00000400
++#define PCF50633_F_PWR_PRESSED	(1 << PCF50633_FIDX_PWR_PRESSED)
++#define PCF50633_F_RTC_SECOND	(1 << PCF50633_FIDX_RTC_SECOND)
++#define PCF50633_F_USB_PRESENT	(1 << PCF50633_FIDX_USB_PRESENT)
 +
 +enum close_state {
 +	CLOSE_STATE_NOT,
@@ -1029,12 +1039,12 @@
 +static DEVICE_ATTR(chgmode, S_IRUGO | S_IWUSR, show_chgmode, set_chgmode);
 +
 +static const char *chgstate_names[] = {
-+	[PCF50633_F_CHG_ENABLED]		= "enabled",
-+	[PCF50633_F_CHG_PRESENT] 		= "charger_present",
-+	[PCF50633_F_USB_PRESENT] 		= "usb_present",
-+	[PCF50633_F_CHG_ERR]			= "error",
-+	[PCF50633_F_CHG_PROT]			= "protection",
-+	[PCF50633_F_CHG_READY]			= "ready",
++	[PCF50633_FIDX_CHG_ENABLED]		= "enabled",
++	[PCF50633_FIDX_CHG_PRESENT] 		= "charger_present",
++	[PCF50633_FIDX_USB_PRESENT] 		= "usb_present",
++	[PCF50633_FIDX_CHG_ERR]			= "error",
++	[PCF50633_FIDX_CHG_PROT]		= "protection",
++	[PCF50633_FIDX_CHG_READY]		= "ready",
 +};
 +
 +static ssize_t show_chgstate(struct device *dev, struct device_attribute *attr,





More information about the commitlog mailing list