linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] arm: omap: debug-leds: few changes
@ 2012-07-24  8:53 Felipe Balbi
  2012-07-24  8:53 ` [PATCH 1/5] arm: omap: debug-leds: drop machine_is_* checks Felipe Balbi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony,

here are a few changes for the debug-leds driver. This series tries to get the
driver closer to be moved away from arch/arm/plat-omap/ and under drivers/leds.
There's only the dependency with <plat/fpga.h> now.

I tried moving the needed definitions into the C file, but there's another file
which uses the same structure (arch/arm/mach-omap1/leds-h2p2-debug.c) so I left
it for another series. Ideally, omap1 would be using the same debug-leds driver
for that purpose and we could drop the dependency on <plat/fpga.h>.

BTW, patches were compile tested only due to the lack of an H4 board.

Felipe Balbi (5):
  arm: omap: debug-leds: drop machine_is_* checks
  arm: omap: debug-leds: move initialization to debug-leds
  arm: omap: debug-leds: add section annotation to probe
  arm: omap: debug-leds: add a remove method
  arm: omap: debug-leds: switch to resource_size()

 arch/arm/plat-omap/debug-leds.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

-- 
1.7.11

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

* [PATCH 1/5] arm: omap: debug-leds: drop machine_is_* checks
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
@ 2012-07-24  8:53 ` Felipe Balbi
  2012-07-24  8:53 ` [PATCH 2/5] arm: omap: debug-leds: move initialization to debug-leds Felipe Balbi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:53 UTC (permalink / raw)
  To: linux-arm-kernel

that platform_device is only registered by
board-h4.c, so there's no need to check which
machine is running as the driver won't bind
to anything.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/plat-omap/debug-leds.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 39407cb..17cbef6 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -304,12 +304,6 @@ static struct platform_driver led_driver = {
 
 static int __init fpga_init(void)
 {
-	if (machine_is_omap_h4()
-			|| machine_is_omap_h3()
-			|| machine_is_omap_h2()
-			|| machine_is_omap_perseus2()
-			)
-		return platform_driver_register(&led_driver);
-	return 0;
+	return platform_driver_register(&led_driver);
 }
 fs_initcall(fpga_init);
-- 
1.7.11

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

* [PATCH 2/5] arm: omap: debug-leds: move initialization to debug-leds
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
  2012-07-24  8:53 ` [PATCH 1/5] arm: omap: debug-leds: drop machine_is_* checks Felipe Balbi
@ 2012-07-24  8:53 ` Felipe Balbi
  2012-07-24  8:54 ` [PATCH 3/5] arm: omap: debug-leds: add section annotation to probe Felipe Balbi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:53 UTC (permalink / raw)
  To: linux-arm-kernel

there's no problem in registering debug-leds on
module_init() as that's not critical to board
boot up.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/plat-omap/debug-leds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 17cbef6..615d085 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -306,4 +306,4 @@ static int __init fpga_init(void)
 {
 	return platform_driver_register(&led_driver);
 }
-fs_initcall(fpga_init);
+module_init(fpga_init);
-- 
1.7.11

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

* [PATCH 3/5] arm: omap: debug-leds: add section annotation to probe
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
  2012-07-24  8:53 ` [PATCH 1/5] arm: omap: debug-leds: drop machine_is_* checks Felipe Balbi
  2012-07-24  8:53 ` [PATCH 2/5] arm: omap: debug-leds: move initialization to debug-leds Felipe Balbi
@ 2012-07-24  8:54 ` Felipe Balbi
  2012-07-24  8:54 ` [PATCH 4/5] arm: omap: debug-leds: add a remove method Felipe Balbi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:54 UTC (permalink / raw)
  To: linux-arm-kernel

put our probe function on __devinit section, so
it can be freed on some cases.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/plat-omap/debug-leds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 615d085..392daa8 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -236,7 +236,7 @@ fpga_led_set(struct led_classdev *cdev, enum led_brightness value)
 	spin_unlock_irqrestore(&lock, flags);
 }
 
-static void __init newled_init(struct device *dev)
+static void __devinit newled_init(struct device *dev)
 {
 	unsigned	i;
 	struct dbg_led	*led;
@@ -254,7 +254,7 @@ static void __init newled_init(struct device *dev)
 
 /*-------------------------------------------------------------------------*/
 
-static int /* __init */ fpga_probe(struct platform_device *pdev)
+static int __devinit fpga_probe(struct platform_device *pdev)
 {
 	struct resource	*iomem;
 
-- 
1.7.11

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

* [PATCH 4/5] arm: omap: debug-leds: add a remove method
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
                   ` (2 preceding siblings ...)
  2012-07-24  8:54 ` [PATCH 3/5] arm: omap: debug-leds: add section annotation to probe Felipe Balbi
@ 2012-07-24  8:54 ` Felipe Balbi
  2012-07-24  8:54 ` [PATCH 5/5] arm: omap: debug-leds: switch to resource_size() Felipe Balbi
  2012-09-07 22:32 ` [PATCH 0/5] arm: omap: debug-leds: few changes Tony Lindgren
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:54 UTC (permalink / raw)
  To: linux-arm-kernel

while at that, also convert to module_platform_driver

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/plat-omap/debug-leds.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 392daa8..08fbb85 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -251,6 +251,14 @@ static void __devinit newled_init(struct device *dev)
 	return;
 }
 
+static void __devexit newled_exit(void)
+{
+	unsigned	i;
+	struct dbg_led	*led;
+
+	for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++)
+		led_classdev_unregister(&led->cdev);
+}
 
 /*-------------------------------------------------------------------------*/
 
@@ -279,6 +287,16 @@ static int __devinit fpga_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static int __devexit fpga_remove(struct platform_device *pdev)
+{
+	if (new_led_api())
+		newled_exit();
+
+	iounmap(fpga);
+
+	return 0;
+}
+
 static int fpga_suspend_noirq(struct device *dev)
 {
 	__raw_writew(~0, &fpga->leds);
@@ -300,10 +318,7 @@ static struct platform_driver led_driver = {
 	.driver.name	= "omap_dbg_led",
 	.driver.pm	= &fpga_dev_pm_ops,
 	.probe		= fpga_probe,
+	.remove		= __devexit_p(fpga_remove),
 };
 
-static int __init fpga_init(void)
-{
-	return platform_driver_register(&led_driver);
-}
-module_init(fpga_init);
+module_platform_driver(led_driver);
-- 
1.7.11

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

* [PATCH 5/5] arm: omap: debug-leds: switch to resource_size()
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
                   ` (3 preceding siblings ...)
  2012-07-24  8:54 ` [PATCH 4/5] arm: omap: debug-leds: add a remove method Felipe Balbi
@ 2012-07-24  8:54 ` Felipe Balbi
  2012-09-07 22:32 ` [PATCH 0/5] arm: omap: debug-leds: few changes Tony Lindgren
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2012-07-24  8:54 UTC (permalink / raw)
  To: linux-arm-kernel

instead of hardcoding the address space size, we
can calculate it using resource_size() helper.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/plat-omap/debug-leds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 08fbb85..ebc0317 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -272,7 +272,7 @@ static int __devinit fpga_probe(struct platform_device *pdev)
 	if (!iomem)
 		return -ENODEV;
 
-	fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE);
+	fpga = ioremap(iomem->start, resource_size(iomem));
 	__raw_writew(~0, &fpga->leds);
 
 #ifdef	CONFIG_LEDS
-- 
1.7.11

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

* [PATCH 0/5] arm: omap: debug-leds: few changes
  2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
                   ` (4 preceding siblings ...)
  2012-07-24  8:54 ` [PATCH 5/5] arm: omap: debug-leds: switch to resource_size() Felipe Balbi
@ 2012-09-07 22:32 ` Tony Lindgren
  5 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2012-09-07 22:32 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [120724 02:02]:
> Hi Tony,
> 
> here are a few changes for the debug-leds driver. This series tries to get the
> driver closer to be moved away from arch/arm/plat-omap/ and under drivers/leds.
> There's only the dependency with <plat/fpga.h> now.
> 
> I tried moving the needed definitions into the C file, but there's another file
> which uses the same structure (arch/arm/mach-omap1/leds-h2p2-debug.c) so I left
> it for another series. Ideally, omap1 would be using the same debug-leds driver
> for that purpose and we could drop the dependency on <plat/fpga.h>.
> 
> BTW, patches were compile tested only due to the lack of an H4 board.
> 
> Felipe Balbi (5):
>   arm: omap: debug-leds: drop machine_is_* checks
>   arm: omap: debug-leds: move initialization to debug-leds
>   arm: omap: debug-leds: add section annotation to probe
>   arm: omap: debug-leds: add a remove method
>   arm: omap: debug-leds: switch to resource_size()
> 
>  arch/arm/plat-omap/debug-leds.c | 37 +++++++++++++++++++++++--------------
>  1 file changed, 23 insertions(+), 14 deletions(-)

Sorry for forgetting this series.. Found it after shrinking my inbox
to a more readable size :)

There are some good changes in linux-next that remove most of the
debug-leds code. Maybe take a quick look what can be rebased on
those to make it into a reald driver?

Regards,

Tony

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

end of thread, other threads:[~2012-09-07 22:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24  8:53 [PATCH 0/5] arm: omap: debug-leds: few changes Felipe Balbi
2012-07-24  8:53 ` [PATCH 1/5] arm: omap: debug-leds: drop machine_is_* checks Felipe Balbi
2012-07-24  8:53 ` [PATCH 2/5] arm: omap: debug-leds: move initialization to debug-leds Felipe Balbi
2012-07-24  8:54 ` [PATCH 3/5] arm: omap: debug-leds: add section annotation to probe Felipe Balbi
2012-07-24  8:54 ` [PATCH 4/5] arm: omap: debug-leds: add a remove method Felipe Balbi
2012-07-24  8:54 ` [PATCH 5/5] arm: omap: debug-leds: switch to resource_size() Felipe Balbi
2012-09-07 22:32 ` [PATCH 0/5] arm: omap: debug-leds: few changes Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).