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

Hi Tony,

removed a few unneeded includes and moved platform_device
registration to board file.

ps: as usual, compile tested only :-p No working n810 available

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-omap2/board-n8x0.c |   96 ++++++++++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c              |    5 --
 drivers/cbus/retu.c              |   69 +---------------------------
 drivers/cbus/tahvo-usb.c         |   13 -----
 drivers/cbus/tahvo.c             |   65 +-------------------------
 5 files changed, 98 insertions(+), 150 deletions(-)

-- 
1.7.3.rc0.35.g8ac8c


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

* [PATCH 1/4] cbus: remove unneded includes
  2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
@ 2010-10-01  7:47 ` Felipe Balbi
  2010-10-01  7:47 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2010-10-01  7:47 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] 7+ messages in thread

* [PATCH 2/4] cbus: retu: move platform_device to board file
  2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
  2010-10-01  7:47 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
@ 2010-10-01  7:47 ` Felipe Balbi
  2010-10-01  7:47 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ 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/retu.c              |   69 +-------------------------------------
 2 files changed, 46 insertions(+), 68 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index c14d398..82c9880 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,53 @@ 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		retu_irq_pin;
+	int		ret;
+
 	platform_device_register(&n8x0_cbus_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");
+		return;
+	}
+
+	ret = gpio_request(retu_irq_pin, "RETU irq");
+	if (ret < 0) {
+		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(retu_irq_pin);
+	if (ret < 0) {
+		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(retu_irq_pin);
+		return;
+	}
+
+	set_irq_type(gpio_to_irq(retu_irq_pin), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(retu_irq_pin);
+	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] 7+ messages in thread

* [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 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
  2010-10-01  7:47 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
@ 2010-10-01  7:47 ` Felipe Balbi
  2010-10-01  7:47 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
  2010-10-01  7:48 ` [PATCH 0/4] CBUS patches Felipe Balbi
  4 siblings, 0 replies; 7+ 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] 7+ messages in thread

* [PATCH 4/4] cbus: tahvo-usb: move platform_device to board file
  2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
                   ` (2 preceding siblings ...)
  2010-10-01  7:47 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
@ 2010-10-01  7:47 ` Felipe Balbi
  2010-10-01  7:48 ` [PATCH 0/4] CBUS patches Felipe Balbi
  4 siblings, 0 replies; 7+ 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 |    6 ++++++
 drivers/cbus/tahvo-usb.c         |   13 -------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index f5ac666..a3b7b63 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -236,6 +236,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 struct resource retu_resource[] = {
 	{
 		.start	= -EINVAL, /* set later */
@@ -284,6 +289,7 @@ static void __init n8x0_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 
 	if (machine_is_nokia770()) {
 		retu_irq_pin = 62;
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index 1cb81fd..3e3b85f 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -742,27 +742,15 @@ 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;
 	}
@@ -774,7 +762,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] 7+ messages in thread

* Re: [PATCH 0/4] CBUS patches
  2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
                   ` (3 preceding siblings ...)
  2010-10-01  7:47 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
@ 2010-10-01  7:48 ` Felipe Balbi
  2010-10-01  8:03   ` Felipe Balbi
  4 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2010-10-01  7:48 UTC (permalink / raw)
  To: Balbi, Felipe; +Cc: Tony Lindgren, Linux OMAP Mailing List

On Fri, Oct 01, 2010 at 02:47:14AM -0500, Balbi, Felipe wrote:
>Hi Tony,
>
>removed a few unneeded includes and moved platform_device
>registration to board file.
>
>ps: as usual, compile tested only :-p No working n810 available

forgot to say, patches also available at:

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

-- 
balbi

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

* Re: [PATCH 0/4] CBUS patches
  2010-10-01  7:48 ` [PATCH 0/4] CBUS patches Felipe Balbi
@ 2010-10-01  8:03   ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2010-10-01  8:03 UTC (permalink / raw)
  To: Balbi, Felipe; +Cc: Tony Lindgren, Linux OMAP Mailing List

On Fri, Oct 01, 2010 at 02:48:08AM -0500, Balbi, Felipe wrote:
>On Fri, Oct 01, 2010 at 02:47:14AM -0500, Balbi, Felipe wrote:
>>Hi Tony,
>>
>>removed a few unneeded includes and moved platform_device
>>registration to board file.
>>
>>ps: as usual, compile tested only :-p No working n810 available
>
>forgot to say, patches also available at:
>
>git://gitorious.org/usb/usb.git cbus

Jarkko Nikula reminded me about 770. It also has cbus so it's now
missing the platform_devices hehe. Sorry about that. Forget about these
patches.

-- 
balbi

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

end of thread, other threads:[~2010-10-01  8:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01  7:47 [PATCH 0/4] CBUS patches Felipe Balbi
2010-10-01  7:47 ` [PATCH 1/4] cbus: remove unneded includes Felipe Balbi
2010-10-01  7:47 ` [PATCH 2/4] cbus: retu: move platform_device to board file Felipe Balbi
2010-10-01  7:47 ` [PATCH 3/4] cbus: tahvo: " Felipe Balbi
2010-10-01  7:47 ` [PATCH 4/4] cbus: tahvo-usb: " Felipe Balbi
2010-10-01  7:48 ` [PATCH 0/4] CBUS patches Felipe Balbi
2010-10-01  8:03   ` Felipe Balbi

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