Skip to contentSkip to conversation

I2C device board info

DISCUSSION Russell King - ARM Linux 4 participants 9 messages Jul 18, 2009 – Jul 20, 2009 6 messages not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Sascha,

I've noticed the following in i2c_board_info initializers:

arch/arm/mach-mx2/pcm038.c: I2C_BOARD_INFO("rtc-pcf8563", 0x51),
arch/arm/mach-mx2/pcm038.c- .type = "pcf8563"

However, I2C_BOARD_INFO is defined as:

#define I2C_BOARD_INFO(dev_type, dev_addr) \
.type = dev_type, .addr = (dev_addr)

so you're initializing .type twice. Only one of these will be used, so you may want to correct these entries. (Looking at Realview, the one which is used is the second - so in the above case, .type will be initialized with current gcc to "pcf8563" not "rtc-pcf8563".)

A message that is not in the archive (sent off-list or not yet received): 20090718105600.GA29887-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org

#2 lore raw

Hi Russell,

Quoted 9 lines · Russell King - ARM Linux

Sascha,

I've noticed the following in i2c_board_info initializers:

arch/arm/mach-mx2/pcm038.c: I2C_BOARD_INFO("rtc-pcf8563", 0x51),
arch/arm/mach-mx2/pcm038.c- .type = "pcf8563"

However, I2C_BOARD_INFO is defined as:

Quoted 7 lines

#define I2C_BOARD_INFO(dev_type, dev_addr) \
.type = dev_type, .addr = (dev_addr)

so you're initializing .type twice. Only one of these will be used, so you may want to correct these entries. (Looking at Realview, the one which is used is the second - so in the above case, .type will be initialized with current gcc to "pcf8563" not "rtc-pcf8563".)

Most probably for historical reasons - the initial implementation of I2C_BOARD_INFO did define the driver name, and setting the device type was optional. Apparently the above piece of code was forgotten when I2C_BOARD_INFO() was modified.

The correct type name for this chip is "pcf8563" so the two lines above should be turned into:

		I2C_BOARD_INFO("pcf8563", 0x51),

Note that this is not an isolated case, although this one is worse because I2C_BOARD_INFO() and .type do not agree on the chip name. But there are several redundant .type definitions in arch/arm/mach-* and one in arch/blackfin/mach-bf527. Time to fix them?

Signature · 1 line
Jean Delvare

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 4 lines · Jean Delvare

Note that this is not an isolated case, although this one is worse because I2C_BOARD_INFO() and .type do not agree on the chip name. But there are several redundant .type definitions in arch/arm/mach-* and one in arch/blackfin/mach-bf527. Time to fix them?

That is my intention - I'm preparing patches for Realview and Versatile. This will only leave the MX* series of platforms in arch/arm doing this, which fall into Sascha's domain.

A message that is not in the archive (sent off-list or not yet received): 20090718131237.GB4120-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org

#6 lore raw
Quoted 9 lines · Russell King - ARM Linux
Quoted 4 lines · Jean Delvare

Note that this is not an isolated case, although this one is worse because I2C_BOARD_INFO() and .type do not agree on the chip name. But there are several redundant .type definitions in arch/arm/mach-* and one in arch/blackfin/mach-bf527. Time to fix them?

That is my intention - I'm preparing patches for Realview and Versatile. This will only leave the MX* series of platforms in arch/arm doing this, which fall into Sascha's domain.

OK, thank you. I'll send a patch for the blackfin ones then.

Signature · 1 line
Jean Delvare

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 7 lines · Jean Delvare
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Jean Delvare

Note that this is not an isolated case, although this one is worse because I2C_BOARD_INFO() and .type do not agree on the chip name. But there are several redundant .type definitions in arch/arm/mach-* and one in arch/blackfin/mach-bf527. Time to fix them?

Quoted 5 lines
Quoted 3 lines

That is my intention - I'm preparing patches for Realview and Versatile. This will only leave the MX* series of platforms in arch/arm doing this, which fall into Sascha's domain.

OK, thank you. I'll send a patch for the blackfin ones then.

Can I get an ack for this please?

Thanks.

Subject: ARM: Realview & Versatile: Fix i2c_board_info definitions

Fix i2c_board_info definitions - we were defining the 'type' field of these structures twice since the first argument of I2C_BOARD_INFO sets this field. Move the second definition into I2C_BOARD_INFO().

---
 arch/arm/mach-realview/core.c  |    3 +--
 arch/arm/mach-versatile/core.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-realview/core.c +1 -2
index ab615e7..dc3519c 100644
@@ -208,8 +208,7 @@ struct platform_device realview_i2c_device = {
 
 static struct i2c_board_info realview_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 
arch/arm/mach-versatile/core.c +1 -2
index afc0f87..975eae4 100644
@@ -343,8 +343,7 @@ static struct platform_device versatile_i2c_device = {
 
 static struct i2c_board_info versatile_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 

A message that is not in the archive (sent off-list or not yet received): 20090718135713.GC4120-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org

Acked-by
#10 lore raw
Quoted 43 lines · Russell King - ARM Linux
Quoted 6 lines · Jean Delvare
Quoted 3 lines · Russell King - ARM Linux

That is my intention - I'm preparing patches for Realview and Versatile. This will only leave the MX* series of platforms in arch/arm doing this, which fall into Sascha's domain.

OK, thank you. I'll send a patch for the blackfin ones then.

Can I get an ack for this please?

Thanks.

Subject: ARM: Realview & Versatile: Fix i2c_board_info definitions

Fix i2c_board_info definitions - we were defining the 'type' field of these structures twice since the first argument of I2C_BOARD_INFO sets this field. Move the second definition into I2C_BOARD_INFO().

---
 arch/arm/mach-realview/core.c  |    3 +--
 arch/arm/mach-versatile/core.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-realview/core.c +1 -2
index ab615e7..dc3519c 100644
@@ -208,8 +208,7 @@ struct platform_device realview_i2c_device = {
 
 static struct i2c_board_info realview_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 
arch/arm/mach-versatile/core.c +0 -0
index afc0f87..975eae4 100644

arch/arm/mach-versatile/core.c static struct platform_device versatile_i2c_device = { · line 349

Quoted 9 lines
arch/arm/mach-versatile/core.c +1 -2
@@ -343,8 +343,7 @@ static struct platform_device versatile_i2c_device = {
 
 static struct i2c_board_info versatile_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 
Signature · 1 line
Jean Delvare
Acked-by
#11 lore raw
In reply to a message not in the archive
Quoted 18 lines · Russell King - ARM Linux
Quoted 7 lines · Jean Delvare
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Jean Delvare

Note that this is not an isolated case, although this one is worse because I2C_BOARD_INFO() and .type do not agree on the chip name. But there are several redundant .type definitions in arch/arm/mach-* and one in arch/blackfin/mach-bf527. Time to fix them?

Quoted 5 lines
Quoted 3 lines

That is my intention - I'm preparing patches for Realview and Versatile. This will only leave the MX* series of platforms in arch/arm doing this, which fall into Sascha's domain.

OK, thank you. I'll send a patch for the blackfin ones then.

Can I get an ack for this please?

Thanks.

Quoted 7 lines

Subject: ARM: Realview & Versatile: Fix i2c_board_info definitions

Fix i2c_board_info definitions - we were defining the 'type' field of these structures twice since the first argument of I2C_BOARD_INFO sets this field. Move the second definition into I2C_BOARD_INFO().

Quoted 33 lines
---
 arch/arm/mach-realview/core.c  |    3 +--
 arch/arm/mach-versatile/core.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-realview/core.c +1 -2
index ab615e7..dc3519c 100644
@@ -208,8 +208,7 @@ struct platform_device realview_i2c_device = {
 
 static struct i2c_board_info realview_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 
arch/arm/mach-versatile/core.c +1 -2
index afc0f87..975eae4 100644
@@ -343,8 +343,7 @@ static struct platform_device versatile_i2c_device = {
 
 static struct i2c_board_info versatile_i2c_board_info[] = {
 	{
-		I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-		.type = "ds1338",
+		I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
 	},
 };
 
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#12 lore raw
In reply to a message not in the archive
Quoted 9 lines · Russell King - ARM Linux

Sascha,

I've noticed the following in i2c_board_info initializers:

arch/arm/mach-mx2/pcm038.c: I2C_BOARD_INFO("rtc-pcf8563", 0x51),
arch/arm/mach-mx2/pcm038.c- .type = "pcf8563"

However, I2C_BOARD_INFO is defined as:

Quoted 8 lines

#define I2C_BOARD_INFO(dev_type, dev_addr) \
.type = dev_type, .addr = (dev_addr)

so you're initializing .type twice. Only one of these will be used, so you may want to correct these entries. (Looking at Realview, the one which is used is the second - so in the above case, .type will be initialized with current gcc to "pcf8563" not "rtc-pcf8563".)

Ok, here we go:

Quoted 1 line

From 89b5958a911ddcf1079e0dd6bbf2287f04c358d9 Mon Sep 17 00:00:00 2001

From: Sascha Hauer <[email protected]>
Date: Mon, 20 Jul 2009 08:18:47 +0200
Subject: [PATCH] ARM: mxc: Fix i2c_board_info definitions

Fix i2c_board_info definitions - we were defining the 'type' field of these structures twice since the first argument of I2C_BOARD_INFO sets this field. Move the second definition into I2C_BOARD_INFO().

---
 arch/arm/mach-mx1/mx1ads.c          |    6 ++----
 arch/arm/mach-mx2/eukrea_cpuimx27.c |    3 +--
 arch/arm/mach-mx2/pcm038.c          |   12 ++++--------
 arch/arm/mach-mx3/pcm037.c          |    3 +--
 arch/arm/mach-mx3/pcm043.c          |    3 +--
 5 files changed, 9 insertions(+), 18 deletions(-)
arch/arm/mach-mx1/mx1ads.c +2 -4
index 6af064d..30f04e5 100644
@@ -104,12 +104,10 @@ static struct imxi2c_platform_data mx1ads_i2c_data = {
 
 static struct i2c_board_info mx1ads_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("pcf857x", 0x22),
-		.type = "pcf8575",
+		I2C_BOARD_INFO("pcf8575", 0x22),
 		.platform_data = &pcf857x_data[0],
 	}, {
-		I2C_BOARD_INFO("pcf857x", 0x24),
-		.type = "pcf8575",
+		I2C_BOARD_INFO("pcf8575", 0x24),
 		.platform_data = &pcf857x_data[1],
 	},
 };
arch/arm/mach-mx2/eukrea_cpuimx27.c +1 -2
index a2c4181..7b18760 100644
@@ -135,8 +135,7 @@ static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = {
 
 static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563"
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	},
 };
 
arch/arm/mach-mx2/pcm038.c +4 -8
index 638d078..9a3483c 100644
@@ -186,17 +186,13 @@ static struct at24_platform_data board_eeprom = {
 };
 
 static struct i2c_board_info pcm038_i2c_devices[] = {
-	[0] = {
+	{
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
-	},
-	[1] = {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563"
-	},
-	[2] = {
+	}, {
+		I2C_BOARD_INFO("pcf8563", 0x51),
+	}, {
 		I2C_BOARD_INFO("lm75", 0x4a),
-		.type = "lm75"
 	}
 };
 
arch/arm/mach-mx3/pcm037.c +1 -2
index 6a3a1a9..d307887 100644
@@ -266,8 +266,7 @@ static struct i2c_board_info pcm037_i2c_devices[] = {
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
 	}, {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563",
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	}
 };
 #endif
arch/arm/mach-mx3/pcm043.c +1 -2
index 7c7d3cc..e43276e 100644
@@ -133,8 +133,7 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
 	}, {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563",
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	}
 };
 #endif
Signature · 7 lines
1.6.3.3

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#14 lore raw
Quoted 117 lines · Sascha Hauer
Quoted 9 lines · Russell King - ARM Linux

Sascha,

I've noticed the following in i2c_board_info initializers:

arch/arm/mach-mx2/pcm038.c: I2C_BOARD_INFO("rtc-pcf8563", 0x51),
arch/arm/mach-mx2/pcm038.c- .type = "pcf8563"

However, I2C_BOARD_INFO is defined as:

Quoted 8 lines

#define I2C_BOARD_INFO(dev_type, dev_addr) \
.type = dev_type, .addr = (dev_addr)

so you're initializing .type twice. Only one of these will be used, so you may want to correct these entries. (Looking at Realview, the one which is used is the second - so in the above case, .type will be initialized with current gcc to "pcf8563" not "rtc-pcf8563".)

Ok, here we go:

From 89b5958a911ddcf1079e0dd6bbf2287f04c358d9 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <[email protected]>
Date: Mon, 20 Jul 2009 08:18:47 +0200
Subject: [PATCH] ARM: mxc: Fix i2c_board_info definitions

Fix i2c_board_info definitions - we were defining the 'type' field of these structures twice since the first argument of I2C_BOARD_INFO sets this field. Move the second definition into I2C_BOARD_INFO().

---
 arch/arm/mach-mx1/mx1ads.c          |    6 ++----
 arch/arm/mach-mx2/eukrea_cpuimx27.c |    3 +--
 arch/arm/mach-mx2/pcm038.c          |   12 ++++--------
 arch/arm/mach-mx3/pcm037.c          |    3 +--
 arch/arm/mach-mx3/pcm043.c          |    3 +--
 5 files changed, 9 insertions(+), 18 deletions(-)
arch/arm/mach-mx1/mx1ads.c +2 -4
index 6af064d..30f04e5 100644
@@ -104,12 +104,10 @@ static struct imxi2c_platform_data mx1ads_i2c_data = {
 
 static struct i2c_board_info mx1ads_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("pcf857x", 0x22),
-		.type = "pcf8575",
+		I2C_BOARD_INFO("pcf8575", 0x22),
 		.platform_data = &pcf857x_data[0],
 	}, {
-		I2C_BOARD_INFO("pcf857x", 0x24),
-		.type = "pcf8575",
+		I2C_BOARD_INFO("pcf8575", 0x24),
 		.platform_data = &pcf857x_data[1],
 	},
 };
arch/arm/mach-mx2/eukrea_cpuimx27.c +1 -2
index a2c4181..7b18760 100644
@@ -135,8 +135,7 @@ static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = {
 
 static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563"
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	},
 };
 
arch/arm/mach-mx2/pcm038.c +4 -8
index 638d078..9a3483c 100644
@@ -186,17 +186,13 @@ static struct at24_platform_data board_eeprom = {
 };
 
 static struct i2c_board_info pcm038_i2c_devices[] = {
-	[0] = {
+	{
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
-	},
-	[1] = {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563"
-	},
-	[2] = {
+	}, {
+		I2C_BOARD_INFO("pcf8563", 0x51),
+	}, {
 		I2C_BOARD_INFO("lm75", 0x4a),
-		.type = "lm75"
 	}
 };
 
arch/arm/mach-mx3/pcm037.c +1 -2
index 6a3a1a9..d307887 100644
@@ -266,8 +266,7 @@ static struct i2c_board_info pcm037_i2c_devices[] = {
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
 	}, {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563",
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	}
 };
 #endif
arch/arm/mach-mx3/pcm043.c +0 -0
index 7c7d3cc..e43276e 100644

arch/arm/mach-mx3/pcm043.c static struct i2c_board_info pcm043_i2c_devices[] = { · line 139

Quoted 9 lines
arch/arm/mach-mx3/pcm043.c +1 -2
@@ -133,8 +133,7 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
 		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
 		.platform_data = &board_eeprom,
 	}, {
-		I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-		.type = "pcf8563",
+		I2C_BOARD_INFO("pcf8563", 0x51),
 	}
 };
 #endif
Signature · 1 line
Jean Delvare