public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
@ 2010-10-01  7:47 ` Felipe Balbi
  0 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01  7:47 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

No functional changes, just moving platform_device
registration to the proper location.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-n8x0.c |   45 ++++++++++++++++++++++++++
 drivers/cbus/tahvo.c             |   65 +-------------------------------------
 2 files changed, 46 insertions(+), 64 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 82c9880..f5ac666 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -222,6 +222,20 @@ static struct platform_device n8x0_cbus_device = {
 	},
 };
 
+static struct resource tahvo_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device tahvo_device = {
+	.name		= "tahvo",
+	.id		= -1,
+	.resource	= tahvo_resource,
+	.num_resources	= ARRAY_SIZE(tahvo_resource),
+};
+
 static struct resource retu_resource[] = {
 	{
 		.start	= -EINVAL, /* set later */
@@ -238,30 +252,61 @@ static struct platform_device retu_device = {
 
 static void __init n8x0_cbus_init(void)
 {
+	int		tahvo_irq_pin;
 	int		retu_irq_pin;
 	int		ret;
 
 	platform_device_register(&n8x0_cbus_device);
 
 	if (machine_is_nokia770()) {
+		tahvo_irq_pin = 40;
+	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
+			machine_is_nokia_n810_wimax()) {
+		tahvo_irq_pin = 111;
+	} else {
+		pr_err("tahvo: Unsupported board for tahvo\n");
+		ret = -ENODEV;
+		return;
+	}
+
+	ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(tahvo_irq_pin);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(tahvo_irq_pin);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
+	platform_device_register(&tahvo_device);
+
+	if (machine_is_nokia770()) {
 		retu_irq_pin = 62;
 	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
 			machine_is_nokia_n810_wimax()) {
 		retu_irq_pin = 108;
 	} else {
 		pr_err("retu: Unsupported board for retu\n");
+		gpio_free(tahvo_irq_pin);
 		return;
 	}
 
 	ret = gpio_request(retu_irq_pin, "RETU irq");
 	if (ret < 0) {
 		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		gpio_free(tahvo_irq_pin);
 		return;
 	}
 
 	ret = gpio_direction_input(retu_irq_pin);
 	if (ret < 0) {
 		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(tahvo_irq_pin);
 		gpio_free(retu_irq_pin);
 		return;
 	}
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 2ae1ac4..9699056 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -50,7 +50,6 @@
 #define PFX			"tahvo: "
 
 static int tahvo_initialized;
-static int tahvo_irq_pin;
 static int tahvo_is_betty;
 
 static struct tasklet_struct tahvo_tasklet;
@@ -374,20 +373,6 @@ static struct platform_driver tahvo_driver = {
 	},
 };
 
-static struct resource tahvo_resource[] = {
-	{
-		.start	= -EINVAL, /* set later */
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device tahvo_device = {
-	.name		= "tahvo",
-	.id		= -1,
-	.resource	= tahvo_resource,
-	.num_resources	= ARRAY_SIZE(tahvo_resource),
-};
-
 /**
  * tahvo_init - initialise Tahvo driver
  *
@@ -395,53 +380,7 @@ static struct platform_device tahvo_device = {
  */
 static int __init tahvo_init(void)
 {
-	int ret = 0;
-
-	/* REVISIT: Pass these from board-*.c files in platform_data */
-	if (machine_is_nokia770()) {
-		tahvo_irq_pin = 40;
-	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
-			machine_is_nokia_n810_wimax()) {
-		tahvo_irq_pin = 111;
-	} else {
-		pr_err("tahvo: Unsupported board for tahvo\n");
-		ret = -ENODEV;
-		goto err0;
-	}
-
-	ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
-	if (ret) {
-		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
-		goto err0;
-	}
-
-	/* Set the pin as input */
-	ret = gpio_direction_input(tahvo_irq_pin);
-	if (ret) {
-		pr_err("tahvo: Unable to change direction\n");
-		goto err1;
-	}
-
-	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
-
-	ret = platform_driver_probe(&tahvo_driver, tahvo_probe);
-	if (ret)
-		goto err1;
-
-	ret = platform_device_register(&tahvo_device);
-	if (ret)
-		goto err2;
-
-	return 0;
-
-err2:
-	platform_driver_unregister(&tahvo_driver);
-
-err1:
-	gpio_free(tahvo_irq_pin);
-
-err0:
-	return ret;
+	return platform_driver_probe(&tahvo_driver, tahvo_probe);
 }
 
 /*
@@ -449,9 +388,7 @@ err0:
  */
 static void __exit tahvo_exit(void)
 {
-	platform_device_unregister(&tahvo_device);
 	platform_driver_unregister(&tahvo_driver);
-	gpio_free(tahvo_irq_pin);
 }
 
 subsys_initcall(tahvo_init);
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 0/4] CBUS patches (v2)
@ 2010-10-01 12:33 Felipe Balbi
  2010-10-01 12:33 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:33 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

Tony,

Now CBUS patches changing also n770. Sorry about the previous
version. I was too quick when thinking a non-functional change
couldn't possibly be wrong hehe :-p

At least know, the patches look better. Below is pull request
too if you prefer to pull into your cbus branch:

***** Note: compilation of nokia770 doesn't work, so I couldn't even compile
***** test these patches against that board :-(

The following changes since commit 2365f1f7e5544b531ccd3e07fd06bb12bf7a62a7:

  Linux-omap rebuilt: Updated to v2.6.36-rc6, merged in few more patches (2010-09-29 11:19:10 -0700)

are available in the git repository at:

  git://gitorious.org/usb/usb.git cbus

Felipe Balbi (4):
      cbus: remove unneded includes
      cbus: retu: move platform_device to board file
      cbus: tahvo: move platform_device to board file
      cbus: tahvo-usb: move platform_device to board file

 arch/arm/mach-omap1/board-nokia770.c |   72 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   68 ++++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c                  |    5 --
 drivers/cbus/retu.c                  |   69 +--------------------------------
 drivers/cbus/tahvo-usb.c             |   15 +------
 drivers/cbus/tahvo.c                 |   63 +-----------------------------
 6 files changed, 144 insertions(+), 148 deletions(-)

-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] cbus: remove unneded includes
  2010-10-01 12:33 [PATCH 0/4] CBUS patches (v2) Felipe Balbi
@ 2010-10-01 12:33 ` Felipe Balbi
  2010-10-01 12:33 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:33 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

we don't use anything from those headers,
thus removing them.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/cbus/cbus.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 9e745bb..a8bbf42 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -30,15 +30,10 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 
-#include <asm/io.h>
-#include <asm/mach-types.h>
-
-#include <plat/board.h>
 #include <plat/cbus.h>
 
 #include "cbus.h"
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] cbus: retu: move platform_device to board file
  2010-10-01 12:33 [PATCH 0/4] CBUS patches (v2) Felipe Balbi
  2010-10-01 12:33 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
@ 2010-10-01 12:33 ` Felipe Balbi
  2010-10-01 12:33 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
  2010-10-01 12:33 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
  3 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:33 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

No functional changes, just moving platform_device
registration to the proper location.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap1/board-nokia770.c |   34 +++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   34 +++++++++++++++++
 drivers/cbus/retu.c                  |   69 +---------------------------------
 3 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index d739dd1..ac708ba 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/irq.h>
 #include <linux/input.h>
 #include <linux/clk.h>
 #include <linux/omapfb.h>
@@ -112,9 +113,42 @@ static struct platform_device nokia770_cbus_device = {
 	},
 };
 
+static struct resource retu_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device retu_device = {
+	.name		= "retu",
+	.id		= -1,
+	.resource	= retu_resource,
+	.num_resources	= ARRAY_SIZE(retu_resource),
+};
+
 static void __init nokia770_cbus_init(void)
 {
+	int		ret;
+
 	platform_device_register(&nokia770_cbus_device);
+
+	ret = gpio_request(62, "RETU irq");
+	if (ret < 0) {
+		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(62);
+	if (ret < 0) {
+		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(62);
+		return;
+	}
+
+	set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(62);
+	platform_device_register(&retu_device);
 }
 
 #else
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index c14d398..26f938e 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/stddef.h>
 #include <linux/platform_device.h>
@@ -221,9 +222,42 @@ static struct platform_device n8x0_cbus_device = {
 	},
 };
 
+static struct resource retu_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device retu_device = {
+	.name		= "retu",
+	.id		= -1,
+	.resource	= retu_resource,
+	.num_resources	= ARRAY_SIZE(retu_resource),
+};
+
 static void __init n8x0_cbus_init(void)
 {
+	int		ret;
+
 	platform_device_register(&n8x0_cbus_device);
+
+	ret = gpio_request(108, "RETU irq");
+	if (ret < 0) {
+		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(108);
+	if (ret < 0) {
+		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(108);
+		return;
+	}
+
+	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(108);
+	platform_device_register(&retu_device);
 }
 
 #else
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 4a072da..a2977c9 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -50,7 +50,6 @@
 #define PFX			"retu: "
 
 static int retu_initialized;
-static int retu_irq_pin;
 static int retu_is_vilma;
 
 static struct tasklet_struct retu_tasklet;
@@ -477,20 +476,6 @@ static struct platform_driver retu_driver = {
 	},
 };
 
-static struct resource retu_resource[] = {
-	{
-		.start	= -EINVAL, /* set later */
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device retu_device = {
-	.name		= "retu",
-	.id		= -1,
-	.resource	= retu_resource,
-	.num_resources	= ARRAY_SIZE(retu_resource),
-};
-
 /**
  * retu_init - initialise Retu driver
  *
@@ -498,57 +483,7 @@ static struct platform_device retu_device = {
  */
 static int __init retu_init(void)
 {
-	int ret = 0;
-
-	/* REVISIT: Pass these from board-*.c files in platform_data */
-	if (machine_is_nokia770()) {
-		retu_irq_pin = 62;
-	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
-			machine_is_nokia_n810_wimax()) {
-		retu_irq_pin = 108;
-	} else {
-		pr_err("retu: Unsupported board for retu\n");
-		ret = -ENODEV;
-		goto err0;
-	}
-
-	ret = gpio_request(retu_irq_pin, "RETU irq");
-	if (ret < 0) {
-		pr_err("retu: Unable to reserve IRQ GPIO\n");
-		goto err0;
-	}
-
-	/* Set the pin as input */
-	ret = gpio_direction_input(retu_irq_pin);
-	if (ret < 0) {
-		pr_err("retu: Unable to change gpio direction\n");
-		goto err1;
-	}
-
-	/* Rising edge triggers the IRQ */
-	set_irq_type(gpio_to_irq(retu_irq_pin), IRQ_TYPE_EDGE_RISING);
-
-	/* Set up correct gpio number on struct resource */
-	retu_resource[0].start = gpio_to_irq(retu_irq_pin);
-
-	ret = platform_device_register(&retu_device);
-	if (ret < 0)
-		goto err1;
-
-	ret = platform_driver_probe(&retu_driver, retu_probe);
-	if (ret < 0)
-		goto err2;
-
-	return 0;
-
-err2:
-	platform_driver_unregister(&retu_driver);
-
-err1:
-	gpio_free(retu_irq_pin);
-
-err0:
-	return ret;
+	return platform_driver_probe(&retu_driver, retu_probe);
 }
 
 /*
@@ -556,9 +491,7 @@ err0:
  */
 static void __exit retu_exit(void)
 {
-	platform_device_unregister(&retu_device);
 	platform_driver_unregister(&retu_driver);
-	gpio_free(retu_irq_pin);
 }
 
 subsys_initcall(retu_init);
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-10-01 12:33 [PATCH 0/4] CBUS patches (v2) Felipe Balbi
  2010-10-01 12:33 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
  2010-10-01 12:33 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
@ 2010-10-01 12:33 ` Felipe Balbi
  2010-10-01 12:37   ` Felipe Balbi
  2010-10-01 12:33 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
  3 siblings, 1 reply; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:33 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

No functional changes, just moving platform_device
registration to the proper location.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap1/board-nokia770.c |   32 +++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   35 +++++++++++++++++--
 drivers/cbus/tahvo.c                 |   63 +---------------------------------
 3 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index ac708ba..962363b 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -127,6 +127,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+static struct resource tahvo_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device tahvo_device = {
+	.name		= "tahvo",
+	.id		= -1,
+	.resource	= tahvo_resource,
+	.num_resources	= ARRAY_SIZE(tahvo_resource),
+};
+
 static void __init nokia770_cbus_init(void)
 {
 	int		ret;
@@ -149,6 +163,24 @@ static void __init nokia770_cbus_init(void)
 	set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_RISING);
 	retu_resource[0].start = gpio_to_irq(62);
 	platform_device_register(&retu_device);
+
+	ret = gpio_request(40, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		gpio_free(62);
+		return;
+	}
+
+	ret = gpio_direction_input(40);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(62);
+		gpio_free(40);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(40);
+	platform_device_register(&tahvo_device);
 }
 
 #else
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 26f938e..c840710 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -236,6 +236,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+static struct resource tahvo_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device tahvo_device = {
+	.name		= "tahvo",
+	.id		= -1,
+	.resource	= tahvo_resource,
+	.num_resources	= ARRAY_SIZE(tahvo_resource),
+};
+
 static void __init n8x0_cbus_init(void)
 {
 	int		ret;
@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
-	retu_resource[0].start = gpio_to_irq(108);
-	platform_device_register(&retu_device);
+	ret = gpio_request(111, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		gpio_free(108);
+		return;
+	}
+
+	/* Set the pin as input */
+	ret = gpio_direction_input(111);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(108);
+		gpio_free(111);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(111);
+	platform_device_register(&tahvo_device);
 }
 
 #else
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 2ae1ac4..1abe300 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -50,7 +50,6 @@
 #define PFX			"tahvo: "
 
 static int tahvo_initialized;
-static int tahvo_irq_pin;
 static int tahvo_is_betty;
 
 static struct tasklet_struct tahvo_tasklet;
@@ -374,20 +373,6 @@ static struct platform_driver tahvo_driver = {
 	},
 };
 
-static struct resource tahvo_resource[] = {
-	{
-		.start	= -EINVAL, /* set later */
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device tahvo_device = {
-	.name		= "tahvo",
-	.id		= -1,
-	.resource	= tahvo_resource,
-	.num_resources	= ARRAY_SIZE(tahvo_resource),
-};
-
 /**
  * tahvo_init - initialise Tahvo driver
  *
@@ -395,53 +380,7 @@ static struct platform_device tahvo_device = {
  */
 static int __init tahvo_init(void)
 {
-	int ret = 0;
-
-	/* REVISIT: Pass these from board-*.c files in platform_data */
-	if (machine_is_nokia770()) {
-		tahvo_irq_pin = 40;
-	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
-			machine_is_nokia_n810_wimax()) {
-		tahvo_irq_pin = 111;
-	} else {
-		pr_err("tahvo: Unsupported board for tahvo\n");
-		ret = -ENODEV;
-		goto err0;
-	}
-
-	ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
-	if (ret) {
-		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
-		goto err0;
-	}
-
-	/* Set the pin as input */
-	ret = gpio_direction_input(tahvo_irq_pin);
-	if (ret) {
-		pr_err("tahvo: Unable to change direction\n");
-		goto err1;
-	}
-
-	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
-
-	ret = platform_driver_probe(&tahvo_driver, tahvo_probe);
-	if (ret)
-		goto err1;
-
-	ret = platform_device_register(&tahvo_device);
-	if (ret)
-		goto err2;
-
-	return 0;
-
-err2:
-	platform_driver_unregister(&tahvo_driver);
-
-err1:
-	gpio_free(tahvo_irq_pin);
-
-err0:
-	return ret;
+	return platform_driver_probe(&tahvo_driver, tahvo_probe);
 }
 
 /*
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] cbus: tahvo-usb: move platform_device to board file
  2010-10-01 12:33 [PATCH 0/4] CBUS patches (v2) Felipe Balbi
                   ` (2 preceding siblings ...)
  2010-10-01 12:33 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
@ 2010-10-01 12:33 ` Felipe Balbi
  3 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:33 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

No functional changes, just moving platform_device
registration to the proper location.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap1/board-nokia770.c |    6 ++++++
 arch/arm/mach-omap2/board-n8x0.c     |    7 ++++++-
 drivers/cbus/tahvo-usb.c             |   15 ++-------------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 962363b..5dd21dc 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -141,6 +141,11 @@ static struct platform_device tahvo_device = {
 	.num_resources	= ARRAY_SIZE(tahvo_resource),
 };
 
+static struct platform_device tahvo_usb_device = {
+	.name		= "tahvo-usb",
+	.id		= -1,
+};
+
 static void __init nokia770_cbus_init(void)
 {
 	int		ret;
@@ -181,6 +186,7 @@ static void __init nokia770_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(40);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 }
 
 #else
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index c840710..aaa40ae 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -250,6 +250,11 @@ static struct platform_device tahvo_device = {
 	.num_resources	= ARRAY_SIZE(tahvo_resource),
 };
 
+static struct platform_device tahvo_usb_device = {
+	.name		= "tahvo-usb",
+	.id		= -1,
+};
+
 static void __init n8x0_cbus_init(void)
 {
 	int		ret;
@@ -276,7 +281,6 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	/* Set the pin as input */
 	ret = gpio_direction_input(111);
 	if (ret) {
 		pr_err("tahvo: Unable to change direction\n");
@@ -287,6 +291,7 @@ static void __init n8x0_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(111);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 }
 
 #else
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index 1cb81fd..3b83bab 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -742,30 +742,20 @@ static struct platform_driver tahvo_usb_driver = {
 	.remove		= __exit_p(tahvo_usb_remove),
 };
 
-static struct platform_device tahvo_usb_device = {
-	.name		= "tahvo-usb",
-	.id		= -1,
-};
-
 static int __init tahvo_usb_init(void)
 {
 	int ret = 0;
 
-	printk(KERN_INFO "Tahvo USB transceiver driver initializing\n");
 	ret = platform_driver_probe(&tahvo_usb_driver, tahvo_usb_probe);
 	if (ret)
 		return ret;
-	ret = platform_device_register(&tahvo_usb_device);
-	if (ret < 0) {
-		platform_driver_unregister(&tahvo_usb_driver);
-		return ret;
-	}
+
 	ret = platform_driver_probe(&omap_otg_driver, omap_otg_probe);
 	if (ret) {
-		platform_device_unregister(&tahvo_usb_device);
 		platform_driver_unregister(&tahvo_usb_driver);
 		return ret;
 	}
+
 	return 0;
 }
 
@@ -774,7 +764,6 @@ subsys_initcall(tahvo_usb_init);
 static void __exit tahvo_usb_exit(void)
 {
 	platform_driver_unregister(&omap_otg_driver);
-	platform_device_unregister(&tahvo_usb_device);
 	platform_driver_unregister(&tahvo_usb_driver);
 }
 module_exit(tahvo_usb_exit);
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-10-01 12:33 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
@ 2010-10-01 12:37   ` Felipe Balbi
  2010-11-05 16:36     ` Tony Lindgren
  0 siblings, 1 reply; 10+ messages in thread
From: Felipe Balbi @ 2010-10-01 12:37 UTC (permalink / raw)
  To: Balbi, Felipe; +Cc: Tony Lindgren, Linux OMAP Mailing List

On Fri, Oct 01, 2010 at 07:33:38AM -0500, Balbi, Felipe wrote:
>@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
> 		return;
> 	}
>
>-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
>-	retu_resource[0].start = gpio_to_irq(108);
>-	platform_device_register(&retu_device);

hmmm, these three deleted lines look suspicious :-(

Let these cook for a while, I'll get back to them in a day or two. CBUS
is making me crazy :-p

-- 
balbi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-10-19  7:29 [PATCH 0/4] Horray, more CBUS patches Felipe Balbi
@ 2010-10-19  7:29 ` Felipe Balbi
  0 siblings, 0 replies; 10+ messages in thread
From: Felipe Balbi @ 2010-10-19  7:29 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi

No functional changes, just moving platform_device
registration to the proper location.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap1/board-nokia770.c |   32 ++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   33 +++++++++++++++++
 drivers/cbus/tahvo.c                 |   65 +---------------------------------
 3 files changed, 66 insertions(+), 64 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 3969f2d..fabc154 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -127,6 +127,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+static struct resource tahvo_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device tahvo_device = {
+	.name		= "tahvo",
+	.id		= -1,
+	.resource	= tahvo_resource,
+	.num_resources	= ARRAY_SIZE(tahvo_resource),
+};
+
 static void __init nokia770_cbus_init(void)
 {
 	int		ret;
@@ -149,6 +163,24 @@ static void __init nokia770_cbus_init(void)
 	set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_RISING);
 	retu_resource[0].start = gpio_to_irq(62);
 	platform_device_register(&retu_device);
+
+	ret = gpio_request(40, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		gpio_free(62);
+		return;
+	}
+
+	ret = gpio_direction_input(40);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(62);
+		gpio_free(40);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(40);
+	platform_device_register(&tahvo_device);
 }
 
 #else
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 938742d..1823f01 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -236,6 +236,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+static struct resource tahvo_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device tahvo_device = {
+	.name		= "tahvo",
+	.id		= -1,
+	.resource	= tahvo_resource,
+	.num_resources	= ARRAY_SIZE(tahvo_resource),
+};
+
 static void __init n8x0_cbus_init(void)
 {
 	int		ret;
@@ -258,6 +272,25 @@ static void __init n8x0_cbus_init(void)
 	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
 	retu_resource[0].start = gpio_to_irq(108);
 	platform_device_register(&retu_device);
+
+	ret = gpio_request(111, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		gpio_free(108);
+		return;
+	}
+
+	/* Set the pin as input */
+	ret = gpio_direction_input(111);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(108);
+		gpio_free(111);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(111);
+	platform_device_register(&tahvo_device);
 }
 
 #else
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 2ae1ac4..9699056 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -50,7 +50,6 @@
 #define PFX			"tahvo: "
 
 static int tahvo_initialized;
-static int tahvo_irq_pin;
 static int tahvo_is_betty;
 
 static struct tasklet_struct tahvo_tasklet;
@@ -374,20 +373,6 @@ static struct platform_driver tahvo_driver = {
 	},
 };
 
-static struct resource tahvo_resource[] = {
-	{
-		.start	= -EINVAL, /* set later */
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device tahvo_device = {
-	.name		= "tahvo",
-	.id		= -1,
-	.resource	= tahvo_resource,
-	.num_resources	= ARRAY_SIZE(tahvo_resource),
-};
-
 /**
  * tahvo_init - initialise Tahvo driver
  *
@@ -395,53 +380,7 @@ static struct platform_device tahvo_device = {
  */
 static int __init tahvo_init(void)
 {
-	int ret = 0;
-
-	/* REVISIT: Pass these from board-*.c files in platform_data */
-	if (machine_is_nokia770()) {
-		tahvo_irq_pin = 40;
-	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
-			machine_is_nokia_n810_wimax()) {
-		tahvo_irq_pin = 111;
-	} else {
-		pr_err("tahvo: Unsupported board for tahvo\n");
-		ret = -ENODEV;
-		goto err0;
-	}
-
-	ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
-	if (ret) {
-		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
-		goto err0;
-	}
-
-	/* Set the pin as input */
-	ret = gpio_direction_input(tahvo_irq_pin);
-	if (ret) {
-		pr_err("tahvo: Unable to change direction\n");
-		goto err1;
-	}
-
-	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
-
-	ret = platform_driver_probe(&tahvo_driver, tahvo_probe);
-	if (ret)
-		goto err1;
-
-	ret = platform_device_register(&tahvo_device);
-	if (ret)
-		goto err2;
-
-	return 0;
-
-err2:
-	platform_driver_unregister(&tahvo_driver);
-
-err1:
-	gpio_free(tahvo_irq_pin);
-
-err0:
-	return ret;
+	return platform_driver_probe(&tahvo_driver, tahvo_probe);
 }
 
 /*
@@ -449,9 +388,7 @@ err0:
  */
 static void __exit tahvo_exit(void)
 {
-	platform_device_unregister(&tahvo_device);
 	platform_driver_unregister(&tahvo_driver);
-	gpio_free(tahvo_irq_pin);
 }
 
 subsys_initcall(tahvo_init);
-- 
1.7.3.rc0.35.g8ac8c


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-10-01 12:37   ` Felipe Balbi
@ 2010-11-05 16:36     ` Tony Lindgren
  2010-11-05 16:40       ` Tony Lindgren
  0 siblings, 1 reply; 10+ messages in thread
From: Tony Lindgren @ 2010-11-05 16:36 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux OMAP Mailing List

* Felipe Balbi <balbi@ti.com> [101001 05:29]:
> On Fri, Oct 01, 2010 at 07:33:38AM -0500, Balbi, Felipe wrote:
> >@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
> >		return;
> >	}
> >
> >-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
> >-	retu_resource[0].start = gpio_to_irq(108);
> >-	platform_device_register(&retu_device);
> 
> hmmm, these three deleted lines look suspicious :-(
> 
> Let these cook for a while, I'll get back to them in a day or two. CBUS
> is making me crazy :-p

Marking these as changes needed then in pw.k.o.

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file
  2010-11-05 16:36     ` Tony Lindgren
@ 2010-11-05 16:40       ` Tony Lindgren
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2010-11-05 16:40 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Linux OMAP Mailing List

* Tony Lindgren <tony@atomide.com> [101105 09:27]:
> * Felipe Balbi <balbi@ti.com> [101001 05:29]:
> > On Fri, Oct 01, 2010 at 07:33:38AM -0500, Balbi, Felipe wrote:
> > >@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
> > >		return;
> > >	}
> > >
> > >-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
> > >-	retu_resource[0].start = gpio_to_irq(108);
> > >-	platform_device_register(&retu_device);
> > 
> > hmmm, these three deleted lines look suspicious :-(
> > 
> > Let these cook for a while, I'll get back to them in a day or two. CBUS
> > is making me crazy :-p
> 
> Marking these as changes needed then in pw.k.o.

Ah already archived and looking at the later set now,
never mind..

Tony

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-05 16:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 12:33 [PATCH 0/4] CBUS patches (v2) Felipe Balbi
2010-10-01 12:33 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
2010-10-01 12:33 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
2010-10-01 12:33 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
2010-10-01 12:37   ` Felipe Balbi
2010-11-05 16:36     ` Tony Lindgren
2010-11-05 16:40       ` Tony Lindgren
2010-10-01 12:33 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2010-10-19  7:29 [PATCH 0/4] Horray, more CBUS patches Felipe Balbi
2010-10-19  7:29 ` [PATCH 3/4] cbus: tahvo: move platform_device to board file Felipe Balbi
2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
2010-10-01  7:47 ` [PATCH 3/4] cbus: tahvo: move platform_device to board file Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox