Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4057 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
   2. r4058 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
   3. r4059 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
   4. r4060 - in trunk/src/target/gsm: include/gsmd src/gsmd
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: werner
Date: 2008-02-13 02:29:25 +0100 (Wed, 13 Feb 2008)
New Revision: 4057

Modified:
   branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch
   branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
   branches/src/target/kernel/2.6.24.x/patches/series
Log:

fix-pcf50606-atomic-i2c-int-read.patch
fix-pcf50633-atomic-i2c-int-read.patch

    Datasheet says reading the interrupt source regs (and thereby
    clearing them) must be done in a single i2c read transaction

Signed-off-by: Andy Green <[EMAIL PROTECTED]>

series: temporarily backed out fix-pcf50633-LOWBAT-kill-init.patch, since it
  conflicts with these patches, and since there's a new version of it in the
  queue already, there's no point in fixing it now

---

 drivers/i2c/chips/pcf50606.c |   60 ++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 26 deletions(-)
 drivers/i2c/chips/pcf50633.c |   58 ++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 28 deletions(-)



Modified: branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch    
2008-02-13 01:18:47 UTC (rev 4056)
+++ branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch    
2008-02-13 01:29:25 UTC (rev 4057)
@@ -8,7 +8,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.24/drivers/i2c/chips/pcf50606.c
-@@ -0,0 +1,1933 @@
+@@ -0,0 +1,1941 @@
 +/* Philips/NXP PCF50606 Power Management Unit (PMU) driver
 + *
 + * (C) 2006-2007 by OpenMoko, Inc.
@@ -566,25 +566,33 @@
 +{
 +      struct pcf50606_data *pcf =
 +                      container_of(work, struct pcf50606_data, work);
-+      u_int8_t int1, int2, int3;
++      u_int8_t pcfirq[3];
++      int ret;
 +
 +      mutex_lock(&pcf->working_lock);
 +      pcf->working = 1;
++      /*
++       * p35 pcf50606 datasheet rev 2.2:
++       * ''The system controller shall read all interrupt registers in
++       *   one I2C read action''
++       * because if you don't INT# gets stuck asserted forever after a
++       * while
++       */
++      ret = i2c_smbus_read_i2c_block_data(&pcf->client, PCF50606_REG_INT1, 3,
++                                          pcfirq);
++      if (ret != 3)
++              DEBUGPC("Oh crap PMU IRQ register read failed %d\n", ret);
 +
-+      int1 = __reg_read(pcf, PCF50606_REG_INT1);
-+      int2 = __reg_read(pcf, PCF50606_REG_INT2);
-+      int3 = __reg_read(pcf, PCF50606_REG_INT3);
-+
 +      dev_dbg(&pcf->client.dev, "INT1=0x%02x INT2=0x%02x INT3=0x%02x:",
-+              int1, int2, int3);
++              pcfirq[0], pcfirq[1], pcfirq[2]);
 +
-+      if (int1 & PCF50606_INT1_ONKEYF) {
++      if (pcfirq[0] & PCF50606_INT1_ONKEYF) {
 +              /* ONKEY falling edge (start of button press) */
 +              DEBUGPC("ONKEYF ");
 +              pcf->flags |= PCF50606_F_PWR_PRESSED;
 +              input_report_key(pcf->input_dev, KEY_POWER, 1);
 +      }
-+      if (int1 & PCF50606_INT1_ONKEY1S) {
++      if (pcfirq[0] & PCF50606_INT1_ONKEY1S) {
 +              /* ONKEY pressed for more than 1 second */
 +              pcf->onkey_seconds = 0;
 +              DEBUGPC("ONKEY1S ");
@@ -595,7 +603,7 @@
 +              /* enable SECOND interrupt (hz tick) */
 +              reg_clear_bits(pcf, PCF50606_REG_INT1M, PCF50606_INT1_SECOND);
 +      }
-+      if (int1 & PCF50606_INT1_ONKEYR) {
++      if (pcfirq[0] & PCF50606_INT1_ONKEYR) {
 +              /* ONKEY rising edge (end of button press) */
 +              DEBUGPC("ONKEYR ");
 +              pcf->flags &= ~PCF50606_F_PWR_PRESSED;
@@ -608,15 +616,15 @@
 +                                       PCF50606_INT1_SECOND,
 +                                       PCF50606_INT1_SECOND);
 +      }
-+      if (int1 & PCF50606_INT1_EXTONR) {
++      if (pcfirq[0] & PCF50606_INT1_EXTONR) {
 +              DEBUGPC("EXTONR ");
 +              input_report_key(pcf->input_dev, KEY_POWER2, 1);
 +      }
-+      if (int1 & PCF50606_INT1_EXTONF) {
++      if (pcfirq[0] & PCF50606_INT1_EXTONF) {
 +              DEBUGPC("EXTONF ");
 +              input_report_key(pcf->input_dev, KEY_POWER2, 0);
 +      }
-+      if (int1 & PCF50606_INT1_SECOND) {
++      if (pcfirq[0] & PCF50606_INT1_SECOND) {
 +              DEBUGPC("SECOND ");
 +              if (pcf->flags & PCF50606_F_RTC_SECOND)
 +                      rtc_update_irq(pcf->rtc, 1,
@@ -638,14 +646,14 @@
 +                      }
 +              }
 +      }
-+      if (int1 & PCF50606_INT1_ALARM) {
++      if (pcfirq[0] & PCF50606_INT1_ALARM) {
 +              DEBUGPC("ALARM ");
 +              if (pcf->pdata->used_features & PCF50606_FEAT_RTC)
 +                      rtc_update_irq(pcf->rtc, 1,
 +                                     RTC_AF | RTC_IRQF);
 +      }
 +
-+      if (int2 & PCF50606_INT2_CHGINS) {
++      if (pcfirq[1] & PCF50606_INT2_CHGINS) {
 +              /* Charger inserted */
 +              DEBUGPC("CHGINS ");
 +              input_report_key(pcf->input_dev, KEY_BATTERY, 1);
@@ -656,7 +664,7 @@
 +                                     PCF50606_FEAT_MBC, PMU_EVT_INSERT);
 +              /* FIXME: how to signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGRM) {
++      if (pcfirq[1] & PCF50606_INT2_CHGRM) {
 +              /* Charger removed */
 +              DEBUGPC("CHGRM ");
 +              input_report_key(pcf->input_dev, KEY_BATTERY, 0);
@@ -667,57 +675,57 @@
 +                                     PCF50606_FEAT_MBC, PMU_EVT_INSERT);
 +              /* FIXME: how signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGFOK) {
++      if (pcfirq[1] & PCF50606_INT2_CHGFOK) {
 +              /* Battery ready for fast charging */
 +              DEBUGPC("CHGFOK ");
 +              pcf->flags |= PCF50606_F_CHG_FOK;
 +              /* FIXME: how to signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGERR) {
++      if (pcfirq[1] & PCF50606_INT2_CHGERR) {
 +              /* Error in charge mode */
 +              DEBUGPC("CHGERR ");
 +              pcf->flags |= PCF50606_F_CHG_ERR;
 +              pcf->flags &= ~(PCF50606_F_CHG_FOK|PCF50606_F_CHG_READY);
 +              /* FIXME: how to signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGFRDY) {
++      if (pcfirq[1] & PCF50606_INT2_CHGFRDY) {
 +              /* Fast charge completed */
 +              DEBUGPC("CHGFRDY ");
 +              pcf->flags |= PCF50606_F_CHG_READY;
 +              pcf->flags &= ~PCF50606_F_CHG_FOK;
 +              /* FIXME: how to signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGPROT) {
++      if (pcfirq[1] & PCF50606_INT2_CHGPROT) {
 +              /* Charging protection interrupt */
 +              DEBUGPC("CHGPROT ");
 +              pcf->flags &= ~(PCF50606_F_CHG_FOK|PCF50606_F_CHG_READY);
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int2 & PCF50606_INT2_CHGWD10S) {
++      if (pcfirq[1] & PCF50606_INT2_CHGWD10S) {
 +              /* Charger watchdog will expire in 10 seconds */
 +              DEBUGPC("CHGWD10S ");
 +              reg_set_bit_mask(pcf, PCF50606_REG_OOCC1,
 +                               PCF50606_OOCC1_WDTRST,
 +                               PCF50606_OOCC1_WDTRST);
 +      }
-+      if (int2 & PCF50606_INT2_CHGWDEXP) {
++      if (pcfirq[1] & PCF50606_INT2_CHGWDEXP) {
 +              /* Charger watchdog expires */
 +              DEBUGPC("CHGWDEXP ");
 +              /* FIXME: how to signal this to userspace */
 +      }
 +
-+      if (int3 & PCF50606_INT3_ADCRDY) {
++      if (pcfirq[2] & PCF50606_INT3_ADCRDY) {
 +              /* ADC result ready */
 +              DEBUGPC("ADCRDY ");
 +      }
-+      if (int3 & PCF50606_INT3_ACDINS) {
++      if (pcfirq[2] & PCF50606_INT3_ACDINS) {
 +              /* Accessory insertion detected */
 +              DEBUGPC("ACDINS ");
 +              if (pcf->pdata->cb)
 +                      pcf->pdata->cb(&pcf->client.dev,
 +                                     PCF50606_FEAT_ACD, PMU_EVT_INSERT);
 +      }
-+      if (int3 & PCF50606_INT3_ACDREM) {
++      if (pcfirq[2] & PCF50606_INT3_ACDREM) {
 +              /* Accessory removal detected */
 +              DEBUGPC("ACDREM ");
 +              if (pcf->pdata->cb)
@@ -725,7 +733,7 @@
 +                                     PCF50606_FEAT_ACD, PMU_EVT_REMOVE);
 +      }
 +      /* FIXME: TSCPRES */
-+      if (int3 & PCF50606_INT3_LOWBAT) {
++      if (pcfirq[2] & PCF50606_INT3_LOWBAT) {
 +              /* Really low battery voltage, we have 8 seconds left */
 +              DEBUGPC("LOWBAT ");
 +              apm_queue_event(APM_LOW_BATTERY);
@@ -736,7 +744,7 @@
 +                               PCF50606_OOCC1_TOTRST,
 +                               PCF50606_OOCC1_TOTRST);
 +      }
-+      if (int3 & PCF50606_INT3_HIGHTMP) {
++      if (pcfirq[2] & PCF50606_INT3_HIGHTMP) {
 +              /* High temperature */
 +              DEBUGPC("HIGHTMP ");
 +              apm_queue_event(APM_CRITICAL_SUSPEND);

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-13 
01:18:47 UTC (rev 4056)
+++ branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch  2008-02-13 
01:29:25 UTC (rev 4057)
@@ -34,7 +34,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.24/drivers/i2c/chips/pcf50633.c
-@@ -0,0 +1,1789 @@
+@@ -0,0 +1,1791 @@
 +/* Philips PCF50633 Power Management Unit (PMU) driver
 + *
 + * (C) 2006-2007 by OpenMoko, Inc.
@@ -526,22 +526,24 @@
 +{
 +      struct pcf50633_data *pcf =
 +                      container_of(work, struct pcf50633_data, work);
-+      u_int8_t int1, int2, int3, int4, int5;
++      u_int8_t pcfirq[5];
++      int ret;
 +
 +      mutex_lock(&pcf->working_lock);
 +      pcf->working = 1;
++      /*
++       * datasheet says we have to read the five IRQ
++       * status regs in one transaction
++       */
++      ret = i2c_smbus_read_i2c_block_data(&pcf->client, PCF50633_REG_INT1, 5,
++                                          pcfirq);
++      if (ret != 5)
++              DEBUGP("Oh crap PMU IRQ register read failed %d\n", ret);
 +
-+      /* FIXME: read in one i2c transaction */
-+      int1 = __reg_read(pcf, PCF50633_REG_INT1);
-+      int2 = __reg_read(pcf, PCF50633_REG_INT2);
-+      int3 = __reg_read(pcf, PCF50633_REG_INT3);
-+      int4 = __reg_read(pcf, PCF50633_REG_INT4);
-+      int5 = __reg_read(pcf, PCF50633_REG_INT5);
-+
 +      DEBUGP("INT1=0x%02x INT2=0x%02x INT3=0x%02x INT4=0x%02x INT5=0x%02x\n",
-+              int1, int2, int3, int4, int5);
++              pcfirq[0], pcfirq[1], pcfirq[2], pcfirq[3], pcfirq[4]);
 +
-+      if (int1 & PCF50633_INT1_ADPINS) {
++      if (pcfirq[0] & PCF50633_INT1_ADPINS) {
 +              /* Charger inserted */
 +              DEBUGPC("ADPINS ");
 +              input_report_key(pcf->input_dev, KEY_BATTERY, 1);
@@ -553,7 +555,7 @@
 +              /* FIXME: signal this to userspace */
 +              //kobject_uevent( ,KOBJ_ADD);
 +      }
-+      if (int1 & PCF50633_INT1_ADPREM) {
++      if (pcfirq[0] & PCF50633_INT1_ADPREM) {
 +              /* Charger removed */
 +              DEBUGPC("ADPREM ");
 +              input_report_key(pcf->input_dev, KEY_BATTERY, 0);
@@ -565,7 +567,7 @@
 +              /* FIXME: signal this to userspace */
 +              //kobject_uevent( ,KOBJ_ADD);
 +      }
-+      if (int1 & PCF50633_INT1_USBINS) {
++      if (pcfirq[0] & PCF50633_INT1_USBINS) {
 +              DEBUGPC("USBINS ");
 +              input_report_key(pcf->input_dev, KEY_POWER2, 1);
 +              apm_queue_event(APM_POWER_STATUS_CHANGE);
@@ -575,7 +577,7 @@
 +                                     PCF50633_FEAT_MBC, PMU_EVT_USB_INSERT);
 +
 +      }
-+      if (int1 & PCF50633_INT1_USBREM) {
++      if (pcfirq[0] & PCF50633_INT1_USBREM) {
 +              DEBUGPC("USBREM ");
 +              input_report_key(pcf->input_dev, KEY_POWER2, 0);
 +              apm_queue_event(APM_POWER_STATUS_CHANGE);
@@ -584,13 +586,13 @@
 +                      pcf->pdata->cb(&pcf->client.dev,
 +                                     PCF50633_FEAT_MBC, PMU_EVT_USB_REMOVE);
 +      }
-+      if (int1 & PCF50633_INT1_ALARM) {
++      if (pcfirq[0] & PCF50633_INT1_ALARM) {
 +              DEBUGPC("ALARM ");
 +              if (pcf->pdata->used_features & PCF50633_FEAT_RTC)
 +                      rtc_update_irq(pcf->rtc, 1,
 +                                     RTC_AF | RTC_IRQF);
 +      }
-+      if (int1 & PCF50633_INT1_SECOND) {
++      if (pcfirq[0] & PCF50633_INT1_SECOND) {
 +              DEBUGPC("SECOND ");
 +              if (pcf->flags & PCF50633_F_RTC_SECOND)
 +                      rtc_update_irq(pcf->rtc, 1,
@@ -612,13 +614,13 @@
 +              }
 +      }
 +
-+      if (int2 & PCF50633_INT2_ONKEYF) {
++      if (pcfirq[1] & PCF50633_INT2_ONKEYF) {
 +              /* ONKEY falling edge (start of button press) */
 +              DEBUGPC("ONKEYF ");
 +              pcf->flags |= PCF50633_F_PWR_PRESSED;
 +              input_report_key(pcf->input_dev, KEY_POWER, 1);
 +      }
-+      if (int2 & PCF50633_INT2_ONKEYR) {
++      if (pcfirq[1] & PCF50633_INT2_ONKEYR) {
 +              /* ONKEY rising edge (end of button press) */
 +              DEBUGPC("ONKEYR ");
 +              pcf->flags &= ~PCF50633_F_PWR_PRESSED;
@@ -633,37 +635,37 @@
 +      }
 +      /* FIXME: we don't use EXTON1/2/3. thats why we skip it */
 +
-+      if (int3 & PCF50633_INT3_BATFULL) {
++      if (pcfirq[2] & PCF50633_INT3_BATFULL) {
 +              DEBUGPC("BATFULL ");
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_CHGHALT) {
++      if (pcfirq[2] & PCF50633_INT3_CHGHALT) {
 +              DEBUGPC("CHGHALT ");
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_THLIMON) {
++      if (pcfirq[2] & PCF50633_INT3_THLIMON) {
 +              DEBUGPC("THLIMON ");
 +              pcf->flags |= PCF50633_F_CHG_PROT;
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_THLIMOFF) {
++      if (pcfirq[2] & PCF50633_INT3_THLIMOFF) {
 +              DEBUGPC("THLIMOFF ");
 +              pcf->flags &= ~PCF50633_F_CHG_PROT;
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_USBLIMON) {
++      if (pcfirq[2] & PCF50633_INT3_USBLIMON) {
 +              DEBUGPC("USBLIMON ");
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_USBLIMOFF) {
++      if (pcfirq[2] & PCF50633_INT3_USBLIMOFF) {
 +              DEBUGPC("USBLIMOFF ");
 +              /* FIXME: signal this to userspace */
 +      }
-+      if (int3 & PCF50633_INT3_ADCRDY) {
++      if (pcfirq[2] & PCF50633_INT3_ADCRDY) {
 +              /* ADC result ready */
 +              DEBUGPC("ADCRDY ");
 +      }
-+      if (int3 & PCF50633_INT3_ONKEY1S) {
++      if (pcfirq[2] & PCF50633_INT3_ONKEY1S) {
 +              /* ONKEY pressed for more than 1 second */
 +              pcf->onkey_seconds = 0;
 +              DEBUGPC("ONKEY1S ");
@@ -675,7 +677,7 @@
 +              reg_clear_bits(pcf, PCF50633_REG_INT1M, PCF50633_INT1_SECOND);
 +      }
 +
-+      if (int4 & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {
++      if (pcfirq[3] & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {
 +              /* Really low battery voltage, we have 8 seconds left */
 +              DEBUGPC("LOWBAT ");
 +              apm_queue_event(APM_LOW_BATTERY);
@@ -686,12 +688,12 @@
 +                               PCF50633_OOCSHDWN_TOTRST,
 +                               PCF50633_OOCSHDWN_TOTRST);
 +      }
-+      if (int4 & PCF50633_INT4_HIGHTMP) {
++      if (pcfirq[3] & PCF50633_INT4_HIGHTMP) {
 +              /* High temperature */
 +              DEBUGPC("HIGHTMP ");
 +              apm_queue_event(APM_CRITICAL_SUSPEND);
 +      }
-+      if (int4 & (PCF50633_INT4_AUTOPWRFAIL|PCF50633_INT4_DWN1PWRFAIL|
++      if (pcfirq[3] & (PCF50633_INT4_AUTOPWRFAIL|PCF50633_INT4_DWN1PWRFAIL|
 +                 PCF50633_INT4_DWN2PWRFAIL|PCF50633_INT4_LEDPWRFAIL|
 +                 PCF50633_INT4_LEDOVP)) {
 +              /* Some regulator failed */

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series  2008-02-13 01:18:47 UTC 
(rev 4056)
+++ branches/src/target/kernel/2.6.24.x/patches/series  2008-02-13 01:29:25 UTC 
(rev 4057)
@@ -95,7 +95,9 @@
 fix-hwecc-2410.patch
 
 # this may not be the last word on this issue, but the patch certainly helps
-fix-pcf50633-LOWBAT-kill-init.patch
+# backed out temporarily since the patch fails and there's a new version of
+# this just around the corner anyway
+##fix-pcf50633-LOWBAT-kill-init.patch
 
 # temporary work-around. awaiting decision on correct fix from upstream.
 gta01-dehang-printk.patch




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-02-13 02:43:45 +0100 (Wed, 13 Feb 2008)
New Revision: 4058

Added:
   
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch
Modified:
   
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch
   branches/src/target/kernel/2.6.24.x/patches/series
Log:
fix-pcf50633-LOWBAT-kill-init.patch
fix-pcf50606-LOWBAT-kill-init.patch

    [ GTA01 part untested but highly likely to be fine. ]

    Until now the driver treats LOWBAT as a fatal crisis and responds
    by going postal on init.  But the driver didn't think that we can
    have adapter or USB power and no battery, which is fine. 

    This patch reserves the crisis behaviour for when we have no
    adapter / USB power and just acknowledges the PMU exception when
    we do.

    In addition if init doesn't exist yet because we heard about LOWBAT
    early in boot -- and we run on battery power only -- then we react
    by doing an APM CRITICAL_SUSPEND right away

Signed-off-by: Andy Green <[EMAIL PROTECTED]>

---

 drivers/i2c/chips/pcf50606.c |   53 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 46 insertions(+), 7 deletions(-)
 drivers/i2c/chips/pcf50633.c |   56 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 49 insertions(+), 7 deletions(-)

series: added fix-pcf50606-LOWBAT-kill-init.patch, brought back
  fix-pcf50633-LOWBAT-kill-init.patch



Added: 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch
===================================================================
--- 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch 
    2008-02-13 01:29:25 UTC (rev 4057)
+++ 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch 
    2008-02-13 01:43:45 UTC (rev 4058)
@@ -0,0 +1,71 @@
+Index: linux-2.6.24/drivers/i2c/chips/pcf50606.c
+===================================================================
+--- linux-2.6.24.orig/drivers/i2c/chips/pcf50606.c
++++ linux-2.6.24/drivers/i2c/chips/pcf50606.c
+@@ -628,8 +628,20 @@
+                       if (pcf->onkey_seconds >=
+                           pcf->pdata->onkey_seconds_required) {
+                               /* Ask init to do 'ctrlaltdel' */
+-                              DEBUGPC("SIGINT(init) ");
+-                              kill_proc(1, SIGINT, 1);
++                              /*
++                               * currently Linux reacts badly to issuing a
++                               * signal to PID #1 before init is started.
++                               * What happens is that the next kernel thread
++                               * to start, which is the JFFS2 Garbage
++                               * collector in our case, gets the signal
++                               * instead and proceeds to fail to fork --
++                               * which is very bad.  Therefore we confirm
++                               * PID #1 exists before issuing the signal
++                               */
++                              if (find_task_by_pid(1)) {
++                                      kill_proc(1, SIGINT, 1);
++                                      DEBUGPC("SIGINT(init) ");
++                              }
+                               /* FIXME: what to do if userspace doesn't
+                                * shut down? Do we want to force it? */
+                       }
+@@ -723,11 +735,38 @@
+       }
+       /* FIXME: TSCPRES */
+       if (pcfirq[2] & PCF50606_INT3_LOWBAT) {
+-              /* Really low battery voltage, we have 8 seconds left */
+-              DEBUGPC("LOWBAT ");
+-              apm_queue_event(APM_LOW_BATTERY);
+-              DEBUGPC("SIGPWR(init) ");
+-              kill_proc(1, SIGPWR, 1);
++              if (__reg_read(pcf, PCF50606_REG_OOCS) & PCF50606_OOCS_EXTON) {
++                      /*
++                       * hey no need to freak out, we have some kind of
++                       * valid charger power
++                       */
++                      DEBUGPC("(NO)BAT ");
++              } else {
++                      /* Really low battery voltage, we have 8 seconds left */
++                      DEBUGPC("LOWBAT ");
++                      /*
++                       * currently Linux reacts badly to issuing a signal to
++                       * PID #1 before init is started.  What happens is that
++                       * the next kernel thread to start, which is the JFFS2
++                       * Garbage collector in our case, gets the signal
++                       * instead and proceeds to fail to fork -- which is
++                       * very bad.  Therefore we confirm PID #1 exists
++                       * before issuing SPIGPWR
++                       */
++                      if (find_task_by_pid(1)) {
++                              apm_queue_event(APM_LOW_BATTERY);
++                              DEBUGPC("SIGPWR(init) ");
++                              kill_proc(1, SIGPWR, 1);
++                      } else
++                              /*
++                               * well, our situation is like this:  we do not
++                               * have any external power, we have a low
++                               * battery and since PID #1 doesn't exist yet,
++                               * we are early in the boot, likely before
++                               * rootfs mount.  We should just call it a day
++                               */
++                              apm_queue_event(APM_CRITICAL_SUSPEND);
++              }
+               /* Tell PMU we are taking care of this */
+               reg_set_bit_mask(pcf, PCF50606_REG_OOCC1,
+                                PCF50606_OOCC1_TOTRST,

Modified: 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch
===================================================================
--- 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch 
    2008-02-13 01:29:25 UTC (rev 4057)
+++ 
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch 
    2008-02-13 01:43:45 UTC (rev 4058)
@@ -2,10 +2,33 @@
 ===================================================================
 --- linux-2.6.24.orig/drivers/i2c/chips/pcf50633.c
 +++ linux-2.6.24/drivers/i2c/chips/pcf50633.c
-@@ -637,15 +637,25 @@
+@@ -570,8 +570,20 @@
+                       if (pcf->onkey_seconds >=
+                           pcf->pdata->onkey_seconds_required) {
+                               /* Ask init to do 'ctrlaltdel' */
+-                              DEBUGPC("SIGINT(init) ");
+-                              kill_proc(1, SIGINT, 1);
++                              /*
++                               * currently Linux reacts badly to issuing a
++                               * signal to PID #1 before init is started.
++                               * What happens is that the next kernel thread
++                               * to start, which is the JFFS2 Garbage
++                               * collector in our case, gets the signal
++                               * instead and proceeds to fail to fork --
++                               * which is very bad.  Therefore we confirm
++                               * PID #1 exists before issuing the signal
++                               */
++                              if (find_task_by_pid(1)) {
++                                      DEBUGPC("SIGINT(init) ");
++                                      kill_proc(1, SIGINT, 1);
++                              }
+                               /* FIXME: what if userspace doesn't shut down? 
*/
+                       }
+               }
+@@ -641,11 +653,41 @@
        }
  
-       if (int4 & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {
+       if (pcfirq[3] & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {
 -              /* Really low battery voltage, we have 8 seconds left */
 -              DEBUGPC("LOWBAT ");
 -              apm_queue_event(APM_LOW_BATTERY);
@@ -22,16 +45,30 @@
 +              } else {
 +                      /* Really low battery voltage, we have 8 seconds left */
 +                      DEBUGPC("LOWBAT ");
-+                      apm_queue_event(APM_LOW_BATTERY);
-+                      DEBUGPC("SIGPWR(init) ");
-+                      kill_proc(1, SIGPWR, 1);
++                      /*
++                       * currently Linux reacts badly to issuing a signal to
++                       * PID #1 before init is started.  What happens is that
++                       * the next kernel thread to start, which is the JFFS2
++                       * Garbage collector in our case, gets the signal
++                       * instead and proceeds to fail to fork -- which is
++                       * very bad.  Therefore we confirm PID #1 exists
++                       * before issuing SPIGPWR
++                       */
++                      if (find_task_by_pid(1)) {
++                              apm_queue_event(APM_LOW_BATTERY);
++                              DEBUGPC("SIGPWR(init) ");
++                              kill_proc(1, SIGPWR, 1);
++                      } else
++                              /*
++                               * well, our situation is like this:  we do not
++                               * have any external power, we have a low
++                               * battery and since PID #1 doesn't exist yet,
++                               * we are early in the boot, likely before
++                               * rootfs mount.  We should just call it a day
++                               */
++                              apm_queue_event(APM_CRITICAL_SUSPEND);
 +              }
++
                /* Tell PMU we are taking care of this */
                reg_set_bit_mask(pcf, PCF50633_REG_OOCSHDWN,
--                               PCF50633_OOCSHDWN_TOTRST,
--                               PCF50633_OOCSHDWN_TOTRST);
-+                              PCF50633_OOCSHDWN_TOTRST,
-+                              PCF50633_OOCSHDWN_TOTRST);
-       }
-       if (int4 & PCF50633_INT4_HIGHTMP) {
-               /* High temperature */
+                                PCF50633_OOCSHDWN_TOTRST,

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series  2008-02-13 01:29:25 UTC 
(rev 4057)
+++ branches/src/target/kernel/2.6.24.x/patches/series  2008-02-13 01:43:45 UTC 
(rev 4058)
@@ -94,10 +94,9 @@
 # bad bug
 fix-hwecc-2410.patch
 
-# this may not be the last word on this issue, but the patch certainly helps
-# backed out temporarily since the patch fails and there's a new version of
-# this just around the corner anyway
-##fix-pcf50633-LOWBAT-kill-init.patch
+# pending further review
+fix-pcf50606-LOWBAT-kill-init.patch
+fix-pcf50633-LOWBAT-kill-init.patch
 
 # temporary work-around. awaiting decision on correct fix from upstream.
 gta01-dehang-printk.patch




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-02-13 02:54:46 +0100 (Wed, 13 Feb 2008)
New Revision: 4059

Modified:
   branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
Log:
pcf50633.patch:
- drivers/i2c/chips/pcf50633.c (pcf50633_detect): don't use "marketing name" to
  identify the driver



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-13 
01:43:45 UTC (rev 4058)
+++ branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch  2008-02-13 
01:54:46 UTC (rev 4059)
@@ -1505,7 +1505,7 @@
 +      if (!data->input_dev)
 +              goto exit_sysfs;
 +
-+      data->input_dev->name = "FIC Neo1973 PMU events";
++      data->input_dev->name = "GTA02 PMU events";
 +      data->input_dev->phys = "FIXME";
 +      data->input_dev->id.bustype = BUS_I2C;
 +      data->input_dev->cdev.dev = &new_client->dev;




--- End Message ---
--- Begin Message ---
Author: erin_yueh
Date: 2008-02-13 04:48:28 +0100 (Wed, 13 Feb 2008)
New Revision: 4060

Added:
   trunk/src/target/gsm/include/gsmd/strl.h
   trunk/src/target/gsm/src/gsmd/strl.c
Modified:
   trunk/src/target/gsm/include/gsmd/extrsp.h
   trunk/src/target/gsm/include/gsmd/gsmd.h
   trunk/src/target/gsm/src/gsmd/Makefile.am
   trunk/src/target/gsm/src/gsmd/atcmd.c
   trunk/src/target/gsm/src/gsmd/ext_response.c
   trunk/src/target/gsm/src/gsmd/gsmd.c
   trunk/src/target/gsm/src/gsmd/operator_cache.c
   trunk/src/target/gsm/src/gsmd/usock.c
   trunk/src/target/gsm/src/gsmd/vendor_ti.c
   trunk/src/target/gsm/src/gsmd/vendor_tihtc.c
Log:
gsmd: add strlcpy, strlcat functions (Paulius Zaleckas)


Modified: trunk/src/target/gsm/include/gsmd/extrsp.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/extrsp.h  2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/include/gsmd/extrsp.h  2008-02-13 03:48:28 UTC (rev 
4060)
@@ -7,6 +7,8 @@
 /* how many individual sub-ranges can one range contain */
 #define GSM_EXTRSP_MAX_RANGES  16
 
+/* how many character we are going to store in string buffer */
+#define GSM_EXTRSP_MAX_STRBUF  64
 
 struct gsm_extrsp_range_item {
        int min;
@@ -28,7 +30,7 @@
                        struct gsm_extrsp_range_item 
item[GSM_EXTRSP_MAX_RANGES];
                        int num_items;
                } range;
-               char string[64];
+               char string[GSM_EXTRSP_MAX_STRBUF];
                int numeric;
        } u;
 };

Modified: trunk/src/target/gsm/include/gsmd/gsmd.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/gsmd.h    2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/include/gsmd/gsmd.h    2008-02-13 03:48:28 UTC (rev 
4060)
@@ -12,6 +12,7 @@
 #include <gsmd/vendorplugin.h>
 #include <gsmd/select.h>
 #include <gsmd/state.h>
+#include <gsmd/strl.h>
 
 void *gsmd_tallocs;
 

Added: trunk/src/target/gsm/include/gsmd/strl.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/strl.h    2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/include/gsmd/strl.h    2008-02-13 03:48:28 UTC (rev 
4060)
@@ -0,0 +1,12 @@
+#ifndef __GSMD_STRL_H
+#define __GSMD_STRL_H
+
+#ifdef __GSMD__
+
+/* safe strcpy and strcat versions */
+extern size_t strlcpy(char *dest, const char *src, size_t size);
+extern size_t strlcat(char *dest, const char *src, size_t count);
+
+#endif /* __GSMD__ */
+
+#endif

Modified: trunk/src/target/gsm/src/gsmd/Makefile.am
===================================================================
--- trunk/src/target/gsm/src/gsmd/Makefile.am   2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/Makefile.am   2008-02-13 03:48:28 UTC (rev 
4060)
@@ -18,7 +18,7 @@
 gsmd_CFLAGS = -D PLUGINDIR=\"$(plugindir)\"
 gsmd_SOURCES = gsmd.c atcmd.c select.c machine.c vendor.c unsolicited.c log.c \
               usock.c talloc.c timer.c operator_cache.c ext_response.c \
-              sms_cb.c sms_pdu.c
+              sms_cb.c sms_pdu.c strl.c
 gsmd_LDADD = -ldl
 gsmd_LDFLAGS = -Wl,--export-dynamic
 

Modified: trunk/src/target/gsm/src/gsmd/atcmd.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/atcmd.c       2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/atcmd.c       2008-02-13 03:48:28 UTC (rev 
4060)
@@ -619,7 +619,7 @@
        atcmd->cb = cb;
        atcmd->resp = NULL;
        atcmd->timeout = NULL;
-       strncpy(atcmd->buf, cmd, buflen-1);
+       strlcpy(atcmd->buf, cmd, buflen);
 
        if (!ct)
                atcmd->create_timer_func = discard_timer; 

Modified: trunk/src/target/gsm/src/gsmd/ext_response.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/ext_response.c        2008-02-13 01:54:46 UTC 
(rev 4059)
+++ trunk/src/target/gsm/src/gsmd/ext_response.c        2008-02-13 03:48:28 UTC 
(rev 4060)
@@ -122,12 +122,8 @@
                        break;
                case TOKEN_STRING:
                        if (*cur == '"') {
-                               int len = strlen(buf);
-                               if (len > sizeof(cur_token->u.string)-1)
-                                       len = sizeof(cur_token->u.string)-1;
-
                                /* end of string token */
-                               strncpy(cur_token->u.string, buf, len);
+                               strlcpy(cur_token->u.string, buf, 
GSM_EXTRSP_MAX_STRBUF);
                                er->num_tokens++;
                                state = TOKEN_STRING_LASTQUOTE;
                        } else {

Modified: trunk/src/target/gsm/src/gsmd/gsmd.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/gsmd.c        2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/gsmd.c        2008-02-13 03:48:28 UTC (rev 
4060)
@@ -152,7 +152,7 @@
        struct gsmd *g = ctx;
 
        DEBUGP("imsi : %s\n", resp);
-       strcpy(g->imsi, resp);
+       strlcpy(g->imsi, resp, sizeof(g->imsi));
 
        return 0;
 }

Modified: trunk/src/target/gsm/src/gsmd/operator_cache.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/operator_cache.c      2008-02-13 01:54:46 UTC 
(rev 4059)
+++ trunk/src/target/gsm/src/gsmd/operator_cache.c      2008-02-13 03:48:28 UTC 
(rev 4060)
@@ -82,7 +82,7 @@
        strncpy(mcc, numeric_bcd_string, 3);
        strncpy(mnc, numeric_bcd_string+3, 2);
 
-       strncpy(op->alnum_long, alnum_long, sizeof(op->alnum_long-1));
+       strlcpy(op->alnum_long, alnum_long, sizeof(op->alnum_long));
        op->numeric.mcc = atoi(mcc);
        op->numeric.mnc = atoi(mnc);
 

Added: trunk/src/target/gsm/src/gsmd/strl.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/strl.c        2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/strl.c        2008-02-13 03:48:28 UTC (rev 
4060)
@@ -0,0 +1,86 @@
+/* safe strcpy and strcat versions
+ *
+ * Copyright (C) 1991, 1992  Linus Torvalds
+ * Copyright (C) 2008 by Paulius Zaleckas, JSC Teltonika
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <string.h>
+
+#include "gsmd.h"
+#include <gsmd/gsmd.h>
+
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+       size_t ret = strlen(src);
+
+       if (size) {
+               size_t len;
+               if (ret >= size) {
+                       len = size - 1;
+                       DEBUGP("\"%s\" was truncated by %i characters\n", src,
+                              ret - len);
+               }
+               else
+                       len = ret;
+               memcpy(dest, src, len);
+               dest[len] = '\0';
+       }
+       return ret;
+}
+
+/**
+ * strlcat - Append a length-limited, %NUL-terminated string to another
+ * @dest: The string to be appended to
+ * @src: The string to append to it
+ * @count: The size of the destination buffer.
+ */
+size_t strlcat(char *dest, const char *src, size_t count)
+{
+       size_t dsize = strlen(dest);
+       size_t len = strlen(src);
+       size_t res = dsize + len;
+
+       /* This would be a bug */
+       if (dsize >= count) {
+               DEBUGP("Length of destination string > provided buffer 
size!\n");
+               return 0;
+       }
+
+       dest += dsize;
+       count -= dsize;
+       if (len >= count) {
+               len = count - 1;
+               DEBUGP("\"%s\" was truncated by %i characters\n", src,
+                      res - len);
+       }
+       memcpy(dest, src, len);
+       dest[len] = 0;
+       return res;
+}
+

Modified: trunk/src/target/gsm/src/gsmd/usock.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/usock.c       2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/usock.c       2008-02-13 03:48:28 UTC (rev 
4060)
@@ -160,7 +160,7 @@
                gcs.stat = er->tokens[2].u.numeric;
                gcs.mode = er->tokens[3].u.numeric;
                gcs.mpty = er->tokens[4].u.numeric;
-               strcpy(gcs.number, er->tokens[5].u.string);
+               strlcpy(gcs.number, er->tokens[5].u.string, GSMD_ADDR_MAXLEN+1);
                gcs.type = er->tokens[6].u.numeric;
        }
        else if ( er->num_tokens == 8 &&
@@ -186,9 +186,9 @@
                gcs.stat = er->tokens[2].u.numeric;
                gcs.mode = er->tokens[3].u.numeric;
                gcs.mpty = er->tokens[4].u.numeric;
-               strcpy(gcs.number, er->tokens[5].u.string);
+               strlcpy(gcs.number, er->tokens[5].u.string, GSMD_ADDR_MAXLEN+1);
                gcs.type = er->tokens[6].u.numeric;
-               strncpy(gcs.alpha, er->tokens[7].u.string, 8+1);
+               strlcpy(gcs.alpha, er->tokens[7].u.string, GSMD_ALPHA_MAXLEN+1);
        }
        else {
                DEBUGP("Invalid Input : Parse error\n");
@@ -257,7 +257,7 @@
                
                gcfs.status = er->tokens[0].u.numeric;
                gcfs.classx = er->tokens[1].u.numeric;
-               strcpy(gcfs.addr.number, er->tokens[2].u.string);
+               strlcpy(gcfs.addr.number, er->tokens[2].u.string, 
GSMD_ADDR_MAXLEN+1);
                gcfs.addr.type = er->tokens[3].u.numeric;
        }
        else if ( er->num_tokens == 7 &&
@@ -271,7 +271,7 @@
                
                gcfs.status = er->tokens[0].u.numeric;
                gcfs.classx = er->tokens[1].u.numeric;
-               strcpy(gcfs.addr.number, er->tokens[2].u.string);
+               strlcpy(gcfs.addr.number, er->tokens[2].u.string, 
GSMD_ADDR_MAXLEN+1);
                gcfs.addr.type = er->tokens[3].u.numeric;
                gcfs.time = er->tokens[6].u.numeric;
        }
@@ -560,18 +560,18 @@
                if (!cmd)
                        return -ENOMEM;
 
-               strncat(cmd->buf, gp->pin, sizeof(gp->pin));
+               strlcat(cmd->buf, gp->pin, cmd->buflen);
 
                switch (gp->type) {
                        case GSMD_PIN_SIM_PUK:
                        case GSMD_PIN_SIM_PUK2:
-                               strcat(cmd->buf, "\",\"");
-                               strncat(cmd->buf, gp->newpin, 
sizeof(gp->newpin));
+                               strlcat(cmd->buf, "\",\"", cmd->buflen);
+                               strlcat(cmd->buf, gp->newpin, cmd->buflen);
                        break;
                default:
                        break;
                }
-               strcat(cmd->buf, "\"");
+               strlcat(cmd->buf, "\"", cmd->buflen);
                break;
        case GSMD_PIN_GET_STATUS:
                cmd = atcmd_fill("AT+CPIN?", 8 + 1, &get_cpin_cb, gu, 0, NULL);
@@ -718,7 +718,7 @@
                        er->tokens[1].type == GSMD_ECMD_RTT_STRING &&
                        er->tokens[2].type == GSMD_ECMD_RTT_NUMERIC) {
                                vmail.enable = er->tokens[0].u.numeric;
-                               strcpy(vmail.addr.number, 
er->tokens[1].u.string);
+                               strlcpy(vmail.addr.number, 
er->tokens[1].u.string, GSMD_ADDR_MAXLEN+1);
                                vmail.addr.type = er->tokens[2].u.numeric;
                }
                rc = gsmd_ucmd_submit(gu, GSMD_MSG_NETWORK, 
GSMD_NETWORK_VMAIL_GET,
@@ -824,7 +824,7 @@
                        er->tokens[2].type == GSMD_ECMD_RTT_STRING ) {
 
                
-               strcpy(buf, er->tokens[2].u.string);
+               strlcpy(buf, er->tokens[2].u.string, sizeof(buf));
        }
        else {
                DEBUGP("Invalid Input : Parse error\n");
@@ -896,9 +896,12 @@
                                 */
                                
                                out2->stat = er->tokens[0].u.numeric;
-                               strcpy(out2->opname_longalpha, 
er->tokens[1].u.string);
-                               strcpy(out2->opname_shortalpha, 
er->tokens[2].u.string);
-                               strcpy(out2->opname_num, 
er->tokens[3].u.string);
+                               strlcpy(out2->opname_longalpha, 
er->tokens[1].u.string,
+                                       sizeof(out2->opname_longalpha));
+                               strlcpy(out2->opname_shortalpha, 
er->tokens[2].u.string,
+                                       sizeof(out2->opname_shortalpha));
+                               strlcpy(out2->opname_num, 
er->tokens[3].u.string,
+                                       sizeof(out2->opname_num));
                        }
                        else {
                                DEBUGP("Invalid Input : Parse error\n");
@@ -1131,9 +1134,9 @@
                 */
 
                gps.pb.index = er->tokens[0].u.numeric;
-               strcpy(gps.pb.numb, er->tokens[1].u.string);
+               strlcpy(gps.pb.numb, er->tokens[1].u.string, 
GSMD_PB_NUMB_MAXLEN+1);
                gps.pb.type = er->tokens[2].u.numeric;
-               strcpy(gps.pb.text, er->tokens[3].u.string);
+               strlcpy(gps.pb.text, er->tokens[3].u.string, 
GSMD_PB_TEXT_MAXLEN+1);
        }
        else {
                DEBUGP("Invalid Input : Parse error\n");
@@ -1180,9 +1183,9 @@
                 */
 
                gp.index = er->tokens[0].u.numeric;
-               strcpy(gp.numb, er->tokens[1].u.string);
+               strlcpy(gp.numb, er->tokens[1].u.string, GSMD_PB_NUMB_MAXLEN+1);
                gp.type = er->tokens[2].u.numeric;
-               strcpy(gp.text, er->tokens[3].u.string);
+               strlcpy(gp.text, er->tokens[3].u.string, GSMD_PB_TEXT_MAXLEN+1);
        }
        else {
                DEBUGP("Invalid Input : Parse error\n");
@@ -1231,9 +1234,9 @@
                 */
 
                gps.pb.index = er->tokens[0].u.numeric;
-               strcpy(gps.pb.numb, er->tokens[1].u.string);
+               strlcpy(gps.pb.numb, er->tokens[1].u.string, 
GSMD_PB_NUMB_MAXLEN+1);
                gps.pb.type = er->tokens[2].u.numeric;
-               strcpy(gps.pb.text, er->tokens[3].u.string);
+               strlcpy(gps.pb.text, er->tokens[3].u.string, 
GSMD_PB_TEXT_MAXLEN+1);
        }
        else {
                DEBUGP("Invalid Input : Parse error\n");

Modified: trunk/src/target/gsm/src/gsmd/vendor_ti.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/vendor_ti.c   2008-02-13 01:54:46 UTC (rev 
4059)
+++ trunk/src/target/gsm/src/gsmd/vendor_ti.c   2008-02-13 03:48:28 UTC (rev 
4060)
@@ -68,7 +68,7 @@
        char *tok1, *tok2;
        char tx_buf[20];
        
-       strcpy(tx_buf, buf);
+       strlcpy(tx_buf, buf, sizeof(tx_buf));
        tok1 = strtok(tx_buf, ",");
        if (!tok1)
                return -EIO;
@@ -122,7 +122,7 @@
                                                   sizeof(*aux));
        char tx_buf[64];
 
-       strcpy(tx_buf, buf);
+       strlcpy(tx_buf, buf, sizeof(tx_buf));
        DEBUGP("entering cpi_parse param=`%s'\n", param);
        if (!ucmd)
                return -EINVAL;

Modified: trunk/src/target/gsm/src/gsmd/vendor_tihtc.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/vendor_tihtc.c        2008-02-13 01:54:46 UTC 
(rev 4059)
+++ trunk/src/target/gsm/src/gsmd/vendor_tihtc.c        2008-02-13 03:48:28 UTC 
(rev 4060)
@@ -85,7 +85,7 @@
        char *tok1, *tok2;
        char tx_buf[20];
        
-       strcpy(tx_buf, buf);
+       strlcpy(tx_buf, buf, sizeof(tx_buf));
        tok1 = strtok(tx_buf, ",");
        if (!tok1)
                return -EIO;
@@ -132,7 +132,7 @@
                                                   sizeof(*aux));
        char tx_buf[64];
 
-       strcpy(tx_buf, buf);
+       strlcpy(tx_buf, buf, sizeof(tx_buf));
        DEBUGP("entering cpi_parse param=`%s'\n", param);
        if (!ucmd)
                return -EINVAL;




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to