Skip to contentSkip to conversation

i2c: i2c-uclass-compat: avoid any BSS usage

RFC PATCH In review Vignesh R 4 participants 6 messages Jul 25, 2016 – Aug 10, 2016 I2C

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

RFC PATCH 1/1 i2c: i2c-uclass-compat: avoid any BSS usage

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

---
 drivers/i2c/i2c-uclass-compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-uclass-compat.c +1 -1
index 5606d1f807f6..de78db6a887f 100644
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
 static int i2c_compat_get_device(uint chip_addr, int alen,
 				 struct udevice **devp)
Signature · 1 line
2.9.2
#1 lore raw

RFC PATCH 1/1 i2c: i2c-uclass-compat: avoid any BSS usage

Hello Vignesh,

Am 25.07.2016 um 12:56 schrieb Vignesh R:

Quoted 9 lines

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

---
  drivers/i2c/i2c-uclass-compat.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

bye,
Heiko

Quoted 15 lines
drivers/i2c/i2c-uclass-compat.c +1 -1
index 5606d1f807f6..de78db6a887f 100644
@@ -9,7 +9,7 @@
  #include <errno.h>
  #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
  static int i2c_compat_get_device(uint chip_addr, int alen,
  				 struct udevice **devp)
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
author
#2 lore raw

RFC PATCH 1/1 i2c: i2c-uclass-compat: avoid any BSS usage

Quoted 8 lines · Heiko Schocher

Hello Vignesh,

Am 25.07.2016 um 12:56 schrieb Vignesh R:

Quoted 5 lines

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

Quoted 7 lines
Quoted 4 lines
---
  drivers/i2c/i2c-uclass-compat.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks! Would you be picking up this patch?

Quoted 17 lines
Quoted 16 lines
drivers/i2c/i2c-uclass-compat.c +1 -1
index 5606d1f807f6..de78db6a887f 100644
@@ -9,7 +9,7 @@
  #include <errno.h>
  #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
  static int i2c_compat_get_device(uint chip_addr, int alen,
                   struct udevice **devp)
Signature · 2 lines
Regards
Vignesh
#3 lore raw

RFC PATCH 1/1 i2c: i2c-uclass-compat: avoid any BSS usage

Hello Vignesh,

added Simon to cc...

Am 28.07.2016 um 07:54 schrieb Vignesh R:

Quoted 16 lines · Heiko Schocher
Quoted 13 lines

Hello Vignesh,

Am 25.07.2016 um 12:56 schrieb Vignesh R:

Quoted 9 lines

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

---
   drivers/i2c/i2c-uclass-compat.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 4 lines
Quoted 2 lines

Thanks! Would you be picking up this patch?

The patch is delegated to Simon, if Simon as no objections I can pick it up.

bye,
Heiko

Quoted 19 lines
Quoted 18 lines
Quoted 17 lines
drivers/i2c/i2c-uclass-compat.c +1 -1
index 5606d1f807f6..de78db6a887f 100644
@@ -9,7 +9,7 @@
   #include <errno.h>
   #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
   static int i2c_compat_get_device(uint chip_addr, int alen,
                    struct udevice **devp)
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

RFC PATCH 1/1 i2c: i2c-uclass-compat: avoid any BSS usage

Quoted 25 lines · Heiko Schocher

Hello Vignesh,

added Simon to cc...

Am 28.07.2016 um 07:54 schrieb Vignesh R:

Quoted 20 lines · Heiko Schocher
Quoted 16 lines

Hello Vignesh,

Am 25.07.2016 um 12:56 schrieb Vignesh R:

Quoted 10 lines

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

---
   drivers/i2c/i2c-uclass-compat.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

Thanks! Would you be picking up this patch?

The patch is delegated to Simon, if Simon as no objections I can pick it up.

Yes please.

#5 lore raw
In reply to Vignesh R
Quoted 8 lines · Vignesh R

As I2C can be used before DRAM initialization for reading EEPROM, avoid using static variables stored in BSS, since BSS is in DRAM, which may not have been initialised yet. Explicitly mark "static global" variables as belonging to the .data section.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160809/99dc7a69/attachment.sig>