Changeset 4042


Ignore:
Timestamp:
02/10/08 23:33:47 (5 years ago)
Author:
werner
Message:

fix-pcf50633-enum-confusion.patch

From: Andy Green <andy@…>

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@…>

---

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch

    r3997 r4042  
    3535--- /dev/null 
    3636+++ linux-2.6.24/drivers/i2c/chips/pcf50633.c 
    37 @@ -0,0 +1,1736 @@ 
     37@@ -0,0 +1,1746 @@ 
    3838+/* Philips PCF50633 Power Management Unit (PMU) driver 
    3939+ * 
     
    106106+I2C_CLIENT_INSMOD_1(pcf50633); 
    107107+ 
    108 +#define PCF50633_F_CHG_ENABLED 0x00000001      /* Charger enabled */ 
    109 +#define PCF50633_F_CHG_PRESENT 0x00000002      /* Charger present */ 
    110 +#define PCF50633_F_CHG_ERR     0x00000008      /* Charger Error */ 
    111 +#define PCF50633_F_CHG_PROT    0x00000010      /* Charger Protection */ 
    112 +#define PCF50633_F_CHG_READY   0x00000020      /* Charging completed */ 
     108+#define PCF50633_FIDX_CHG_ENABLED      0       /* Charger enabled */ 
     109+#define PCF50633_FIDX_CHG_PRESENT      1       /* Charger present */ 
     110+#define PCF50633_FIDX_CHG_ERR          3       /* Charger Error */ 
     111+#define PCF50633_FIDX_CHG_PROT         4       /* Charger Protection */ 
     112+#define PCF50633_FIDX_CHG_READY                5       /* Charging completed */ 
     113+#define PCF50633_FIDX_PWR_PRESSED      8 
     114+#define PCF50633_FIDX_RTC_SECOND       9 
     115+#define PCF50633_FIDX_USB_PRESENT      10 
     116+ 
     117+#define PCF50633_F_CHG_ENABLED (1 << PCF50633_FIDX_CHG_ENABLED) 
     118+#define PCF50633_F_CHG_PRESENT (1 << PCF50633_FIDX_CHG_PRESENT) 
     119+#define PCF50633_F_CHG_ERR     (1 << PCF50633_FIDX_CHG_ERR) 
     120+#define PCF50633_F_CHG_PROT    (1 << PCF50633_FIDX_CHG_PROT) 
     121+#define PCF50633_F_CHG_READY   (1 << PCF50633_FIDX_CHG_READY) 
     122+ 
    113123+#define PCF50633_F_CHG_MASK    0x000000fc 
    114124+ 
    115 +#define PCF50633_F_PWR_PRESSED 0x00000100 
    116 +#define PCF50633_F_RTC_SECOND  0x00000200 
    117 +#define PCF50633_F_USB_PRESENT 0x00000400 
     125+#define PCF50633_F_PWR_PRESSED (1 << PCF50633_FIDX_PWR_PRESSED) 
     126+#define PCF50633_F_RTC_SECOND  (1 << PCF50633_FIDX_RTC_SECOND) 
     127+#define PCF50633_F_USB_PRESENT (1 << PCF50633_FIDX_USB_PRESENT) 
    118128+ 
    119129+enum close_state { 
     
    10301040+ 
    10311041+static const char *chgstate_names[] = { 
    1032 +       [PCF50633_F_CHG_ENABLED]                = "enabled", 
    1033 +       [PCF50633_F_CHG_PRESENT]                = "charger_present", 
    1034 +       [PCF50633_F_USB_PRESENT]                = "usb_present", 
    1035 +       [PCF50633_F_CHG_ERR]                    = "error", 
    1036 +       [PCF50633_F_CHG_PROT]                   = "protection", 
    1037 +       [PCF50633_F_CHG_READY]                  = "ready", 
     1042+       [PCF50633_FIDX_CHG_ENABLED]             = "enabled", 
     1043+       [PCF50633_FIDX_CHG_PRESENT]             = "charger_present", 
     1044+       [PCF50633_FIDX_USB_PRESENT]             = "usb_present", 
     1045+       [PCF50633_FIDX_CHG_ERR]                 = "error", 
     1046+       [PCF50633_FIDX_CHG_PROT]                = "protection", 
     1047+       [PCF50633_FIDX_CHG_READY]               = "ready", 
    10381048+}; 
    10391049+ 
Note: See TracChangeset for help on using the changeset viewer.