Skip to contentSkip to conversation

i2c: tegra: Add __devinit/exit to probe/remove

PATCH New Stephen Warren 4 participants 18 messages Dec 18, 2011 – Feb 6, 2012

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

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

This fixes some section mismatch build warnings.

---
v2: New patch.

 drivers/i2c/busses/i2c-tegra.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-tegra.c +2 -2
index 46b6500..e8560ed 100644
@@ -558,7 +558,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
 	.functionality	= tegra_i2c_func,
 };
 
-static int tegra_i2c_probe(struct platform_device *pdev)
+static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 {
 	struct tegra_i2c_dev *i2c_dev;
 	struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -690,7 +690,7 @@ err_iounmap:
 	return ret;
 }
 
-static int tegra_i2c_remove(struct platform_device *pdev)
+static int __devexit tegra_i2c_remove(struct platform_device *pdev)
 {
 	struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
 	i2c_del_adapter(&i2c_dev->adapter);
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 2/4 i2c: tegra: Support DVC controller in device tree

One of the Tegra I2C blocks is inside the DVC (Digital Voltage Controller) block. This block is identical to the rest of the I2C blocks, except that it only supports master mode, it has registers moved around, and it needs some extra init to get it into I2C mode. The register moves are handled by i2c_readl and i2c_writel

This patch adds a new compatible value for controllers of this "DVC" type; I figured that this approach was reasonable, as opposed to adding an is-dvc property under the existing compatible value, since the HW truly is different.

v2: Call of_device_is_compatible() to determine is_dvc, instead of storing the flag in tegra_i2c_of_match[]'s .data field.

---
 drivers/i2c/busses/i2c-tegra.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-tegra.c +5 -1
index e8560ed..6381604 100644
@@ -636,7 +636,10 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 			i2c_dev->bus_clk_rate = be32_to_cpup(prop);
 	}
 
-	if (pdev->id == 3)
+	if (pdev->dev.of_node)
+		i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
+						"nvidia,tegra20-i2c-dvc");
+	else if (pdev->id == 3)
 		i2c_dev->is_dvc = 1;
 	init_completion(&i2c_dev->msg_complete);
 
@@ -742,6 +745,7 @@ static int tegra_i2c_resume(struct platform_device *pdev)
 /* Match table for of_platform binding */
 static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
 	{ .compatible = "nvidia,tegra20-i2c", },
+	{ .compatible = "nvidia,tegra20-i2c-dvc", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v2 2/4 i2c: tegra: Support DVC controller in device tree

Quoted 11 lines · Stephen Warren

One of the Tegra I2C blocks is inside the DVC (Digital Voltage Controller) block. This block is identical to the rest of the I2C blocks, except that it only supports master mode, it has registers moved around, and it needs some extra init to get it into I2C mode. The register moves are handled by i2c_readl and i2c_writel

This patch adds a new compatible value for controllers of this "DVC" type; I figured that this approach was reasonable, as opposed to adding an is-dvc property under the existing compatible value, since the HW truly is different.

Quoted 5 lines

v2: Call of_device_is_compatible() to determine is_dvc, instead of storing the flag in tegra_i2c_of_match[]'s .data field.

---

I've applied this one as well to the tegra for-3.3/drivers. Ben, let me know if you want it through your tree but since it mostly fixes device tree usage I figured it's OK for us to take.

-Olof

#3 lore raw

PATCH v2 3/4 arm/dt: tegra: Use new compatible value for DVC I2C controller

In reply to Stephen Warren

Update the device tree to indicate which I2C controller is the DVC controller. AUXDATA needs to be updated too, since the compatible value changed.

---
v2: No change

 arch/arm/boot/dts/tegra20.dtsi |    2 +-
 arch/arm/mach-tegra/board-dt.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
index 660c8ad..3da7afd 100644
@@ -39,7 +39,7 @@
 	i2c at 7000d000 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "nvidia,tegra20-i2c";
+		compatible = "nvidia,tegra20-i2c-dvc";
 		reg = <0x7000D000 0x200>;
 		interrupts = < 0 53 0x04 >;
 	};
arch/arm/mach-tegra/board-dt.c +1 -1
index b44633b..9abc89d 100644
@@ -74,7 +74,7 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", NULL),
-	OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_DVC_BASE, "tegra-i2c.3", NULL),
+	OF_DEV_AUXDATA("nvidia,tegra20-i2c-dvc", TEGRA_DVC_BASE, "tegra-i2c.3", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra-i2s.1", NULL),
 	OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL),
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v2 3/4 arm/dt: tegra: Use new compatible value for DVC I2C controller

Quoted 5 lines · Stephen Warren

Update the device tree to indicate which I2C controller is the DVC controller. AUXDATA needs to be updated too, since the compatible value changed.

Thanks, applied to for-3.3/dt.

-Olof

#5 lore raw

PATCH v2 4/4 arm/dt: Add ADT7461 to Seaboard

In reply to Stephen Warren

The ADT7461 is a temperature monitoring IC. One is present on the DVC I2C bus on Seaboard.

---
v2: No change

 arch/arm/boot/dts/tegra-seaboard.dts |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-seaboard.dts +5 -0
index 3cfbd04..b55a02e 100644
@@ -25,6 +25,11 @@
 
 	i2c at 7000d000 {
 		clock-frequency = <400000>;
+
+		adt7461 at 4c {
+			compatible = "adt7461";
+			reg = <0x4c>;
+		};
 	};
 
 	serial at 70006000 {
Signature · 1 line
1.7.5.4
#6 lore raw

PATCH v2 4/4 arm/dt: Add ADT7461 to Seaboard

Quoted 4 lines · Stephen Warren

The ADT7461 is a temperature monitoring IC. One is present on the DVC I2C bus on Seaboard.

Thanks, applied to for-3.3/dt.

-Olof

#7 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

In reply to Stephen Warren
Quoted 1 line · Stephen Warren

This fixes some section mismatch build warnings.

What was the error was a devinit function called from these?

Quoted 37 lines

---
v2: New patch.

?drivers/i2c/busses/i2c-tegra.c | ? ?4 ++--
?1 files changed, 2 insertions(+), 2 deletions(-)

drivers/i2c/busses/i2c-tegra.c +2 -3
index 46b6500..e8560ed 100644
@@ -558,7 +558,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
 ? ? ? ?.functionality ?= tegra_i2c_func,
 ?};
 
-static int tegra_i2c_probe(struct platform_device *pdev)
+static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 ?{
 ? ? ? ?struct tegra_i2c_dev *i2c_dev;
 ? ? ? ?struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -690,7 +690,7 @@ err_iounmap:
 ? ? ? ?return ret;
 ?}
 
-static int tegra_i2c_remove(struct platform_device *pdev)
+static int __devexit tegra_i2c_remove(struct platform_device *pdev)
 ?{
 ? ? ? ?struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
 ? ? ? ?i2c_del_adapter(&i2c_dev->adapter);
--

1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Shubhrajyoti Datta wrote at Sunday, December 18, 2011 11:54 PM:

Quoted 4 lines · Stephen Warren
Quoted 1 line

This fixes some section mismatch build warnings.

What was the error was a devinit function called from these?

As I Understand It, probe/remove are devinit/exit functions, and hence should be marked as such.

The errors were from building with CONFIG_DEBUG_SECTION_MISMATCH=y.

I guess the section mismatch errors won't actually show up in the code that's in the kernel right now; they only showed up because I had a local patch that modified probe() to reference tegra_i2c_of_match[] which is __devinitconst. I since reworked that patch so that it doesn't introduce that reference, for other reasons. Still, I think this is a good cleanup change even if nothing is actually causing these mismatch errors to fire right now.

Signature · 1 line
nvpublic
#10 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Quoted 9 lines · Olof Johansson
Quoted 3 lines · Stephen Warren

This fixes some section mismatch build warnings.

Ben, since the patch is trivial, I've picked it up in tegra for-3.3/drivers and will merge that way. Let me know if you disagree.

Hi Stephen ,
could you check this one also
thanks.

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

---
Untested

 drivers/i2c/busses/i2c-tegra.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
index 46b6500..b25f78b 100644
@@ -751,7 +751,7 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
 
 static struct platform_driver tegra_i2c_driver = {
        .probe   = tegra_i2c_probe,
-       .remove  = tegra_i2c_remove,
+       .remove  =__devexit_p(tegra_i2c_remove),
 #ifdef CONFIG_PM
        .suspend = tegra_i2c_suspend,
        .resume  = tegra_i2c_resume,
Signature · 1 line
1.7.1
Quoted 7 lines

Thanks,

-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#11 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Ben or Olof,

drivers/i2c/busses/i2c-tegra.c MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); · line 754

Quoted 2 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
-       .remove  = tegra_i2c_remove,
+       .remove  =__devexit_p(tegra_i2c_remove),

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Signature · 1 line
nvpublic
#12 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Quoted 17 lines · Stephen Warren

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Quoted 7 lines

Ben or Olof,

drivers/i2c/busses/i2c-tegra.c MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); · line 754

Quoted 2 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
-       .remove  = tegra_i2c_remove,
+       .remove  =__devexit_p(tegra_i2c_remove),

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Let me know if you want anything applying or a pull-request processed.

I think once fixed the patches would be fine and I ack them:

Quoted 7 lines
Signature · 6 lines
nvpublic

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.
#13 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Ben Dooks wrote at Friday, January 06, 2012 9:26 AM:

Quoted 23 lines · Stephen Warren
Quoted 22 lines

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Ben or Olof,

Quoted 2 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
-       .remove  = tegra_i2c_remove,
+       .remove  =__devexit_p(tegra_i2c_remove),
Quoted 8 lines
Quoted 2 lines

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Let me know if you want anything applying or a pull-request processed.

I think once fixed the patches would be fine and I ack them:

Olof, since you took the original through the Tegra tree, I think it makes sense for us to take this fix through there too, and for 3.3? The patch above is http://patchwork.ozlabs.org/patch/132349/

Signature · 1 line
nvpublic
#14 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Quoted 29 lines · Stephen Warren

Ben Dooks wrote at Friday, January 06, 2012 9:26 AM:

Quoted 28 lines · Stephen Warren
Quoted 17 lines

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Quoted 7 lines

Ben or Olof,

Quoted 2 lines

- ? ? ? .remove ?= tegra_i2c_remove,
+ ? ? ? .remove ?=__devexit_p(tegra_i2c_remove),

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Let me know if you want anything applying or a pull-request processed.

Quoted 7 lines
Quoted 3 lines

I think once fixed the patches would be fine and I ack them:

Olof, since you took the original through the Tegra tree, I think it makes sense for us to take this fix through there too, and for 3.3? The patch above is http://patchwork.ozlabs.org/patch/132349/

Yep, will do.

-Olof

#15 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

Olof Johansson wrote at Friday, January 06, 2012 10:45 AM:

Quoted 32 lines · Stephen Warren
Quoted 31 lines

Ben Dooks wrote at Friday, January 06, 2012 9:26 AM:

Quoted 30 lines · Stephen Warren
Quoted 17 lines

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Quoted 7 lines

Ben or Olof,

Quoted 2 lines

- ? ? ? .remove ?= tegra_i2c_remove,
+ ? ? ? .remove ?=__devexit_p(tegra_i2c_remove),

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Let me know if you want anything applying or a pull-request processed.

I think once fixed the patches would be fine and I ack them:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Olof, since you took the original through the Tegra tree, I think it makes sense for us to take this fix through there too, and for 3.3? The patch above is http://patchwork.ozlabs.org/patch/132349/

Yep, will do.

I haven't seen this show up anywhere yet.

Signature · 1 line
nvpublic
#16 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/removeG

In reply to Stephen Warren
Quoted 29 lines · Stephen Warren

Ben Dooks wrote at Friday, January 06, 2012 9:26 AM:

Quoted 28 lines · Stephen Warren
Quoted 17 lines

Shubhrajyoti Datta wrote at Monday, December 19, 2011 11:15 PM:
...

Quoted 4 lines

Hi Stephen ,
could you check this one also
thanks.

Quoted 8 lines

From: Shubhrajyoti D <[email protected]>
Date: Tue, 20 Dec 2011 11:40:51 +0530
Subject: [PATCH] I2C : tegra : devexit in remove

Adding I2C __devexxit in remove

Quoted 7 lines

Ben or Olof,

drivers/i2c/busses/i2c-tegra.c MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); · line 754

Quoted 2 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
-       .remove  = tegra_i2c_remove,
+       .remove  =__devexit_p(tegra_i2c_remove),

When you apply this, can you fix it up to add a space after the = in the modified line? If you want, I can post an updated version to do that.

Let me know if you want anything applying or a pull-request processed.

Quoted 7 lines
Quoted 3 lines

I think once fixed the patches would be fine and I ack them:

Olof, since you took the original through the Tegra tree, I think it makes sense for us to take this fix through there too, and for 3.3? The patch above is http://patchwork.ozlabs.org/patch/132349/

Done, applied, sorry for the delay.

The patch has whitespace damage but I fixed it up manually.

-Olof

#17 lore raw

PATCH v2 1/4 i2c: tegra: Add __devinit/exit to probe/remove

In reply to Stephen Warren
Quoted 23 lines · Stephen Warren

This fixes some section mismatch build warnings.

---
v2: New patch.

 drivers/i2c/busses/i2c-tegra.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
index 46b6500..e8560ed 100644
@@ -558,7 +558,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
 	.functionality	= tegra_i2c_func,
 };
 
-static int tegra_i2c_probe(struct platform_device *pdev)
+static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 {
 	struct tegra_i2c_dev *i2c_dev;
 	struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;

drivers/i2c/busses/i2c-tegra.c err_iounmap: · line 696

Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -690,7 +690,7 @@ err_iounmap:
 	return ret;
 }
 
-static int tegra_i2c_remove(struct platform_device *pdev)
+static int __devexit tegra_i2c_remove(struct platform_device *pdev)
 {
 	struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
 	i2c_del_adapter(&i2c_dev->adapter);

You need t oupdate the platform driver's .remove method with __devexit_p to ensure that it nulls it out.

Signature · 3 lines
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.