* [PATCH 1/6] cbus: fix compile breakage
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 14:00 ` [PATCH 2/6] cbus: move the module_platform_driver where possible Felipe Balbi
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
we need to include <linux/export.h> and <linux/module.h>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/cbus.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 486254d..52eab4a 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -26,6 +26,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/export.h>
+#include <linux/module.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
--
1.7.8.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/6] cbus: move the module_platform_driver where possible
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
2011-11-23 14:00 ` [PATCH 1/6] cbus: fix compile breakage Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 14:00 ` [PATCH 3/6] cbus: fix very old compile warning Felipe Balbi
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 11925 bytes --]
this allows us to delete a bunch of boilerplate code
from the drivers. While at that, also add missing
MODULE_ALIAS().
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/cbus.c | 19 +++++--------------
drivers/cbus/retu-headset.c | 21 ++++++---------------
drivers/cbus/retu-pwrbutton.c | 20 ++++++--------------
drivers/cbus/retu-rtc.c | 18 +++++-------------
drivers/cbus/retu-wdt.c | 19 +++++--------------
drivers/cbus/retu.c | 13 ++-----------
drivers/cbus/tahvo-usb.c | 21 +++++++++++----------
drivers/cbus/tahvo.c | 13 ++-----------
8 files changed, 42 insertions(+), 102 deletions(-)
diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 52eab4a..c7ed881 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -247,7 +247,7 @@ int cbus_write_reg(struct device *child, unsigned dev, unsigned reg,
}
EXPORT_SYMBOL(cbus_write_reg);
-static int __init cbus_bus_probe(struct platform_device *pdev)
+static int __devinit cbus_bus_probe(struct platform_device *pdev)
{
struct cbus_host *chost;
struct cbus_host_platform_data *pdata = pdev->dev.platform_data;
@@ -296,7 +296,7 @@ exit1:
return ret;
}
-static void __exit cbus_bus_remove(struct platform_device *pdev)
+static void __devexit cbus_bus_remove(struct platform_device *pdev)
{
struct cbus_host *chost = platform_get_drvdata(pdev);
@@ -308,23 +308,14 @@ static void __exit cbus_bus_remove(struct platform_device *pdev)
}
static struct platform_driver cbus_driver = {
- .remove = __exit_p(cbus_bus_remove),
+ .probe = cbus_bus_probe,
+ .remove = __devexit_p(cbus_bus_remove),
.driver = {
.name = "cbus",
},
};
-static int __init cbus_bus_init(void)
-{
- return platform_driver_probe(&cbus_driver, cbus_bus_probe);
-}
-subsys_initcall(cbus_bus_init);
-
-static void __exit cbus_bus_exit(void)
-{
- platform_driver_unregister(&cbus_driver);
-}
-module_exit(cbus_bus_exit);
+module_platform_driver(cbus_driver);
MODULE_DESCRIPTION("CBUS serial protocol");
MODULE_LICENSE("GPL");
diff --git a/drivers/cbus/retu-headset.c b/drivers/cbus/retu-headset.c
index 3b8e138..576b0e6 100644
--- a/drivers/cbus/retu-headset.c
+++ b/drivers/cbus/retu-headset.c
@@ -222,7 +222,7 @@ static void retu_headset_detect_timer(unsigned long arg)
spin_unlock_irqrestore(&hs->lock, flags);
}
-static int __init retu_headset_probe(struct platform_device *pdev)
+static int __devinit retu_headset_probe(struct platform_device *pdev)
{
struct retu_headset *hs;
int irq;
@@ -291,7 +291,7 @@ err1:
return r;
}
-static int retu_headset_remove(struct platform_device *pdev)
+static int __devexit retu_headset_remove(struct platform_device *pdev)
{
struct retu_headset *hs = platform_get_drvdata(pdev);
@@ -333,7 +333,8 @@ static int retu_headset_resume(struct platform_device *pdev)
}
static struct platform_driver retu_headset_driver = {
- .remove = retu_headset_remove,
+ .probe = retu_headset_probe,
+ .remove = __devexit_p(retu_headset_remove),
.suspend = retu_headset_suspend,
.resume = retu_headset_resume,
.driver = {
@@ -341,19 +342,9 @@ static struct platform_driver retu_headset_driver = {
},
};
-static int __init retu_headset_init(void)
-{
- return platform_driver_probe(&retu_headset_driver, retu_headset_probe);
-}
-
-static void __exit retu_headset_exit(void)
-{
- platform_driver_unregister(&retu_headset_driver);
-}
-
-module_init(retu_headset_init);
-module_exit(retu_headset_exit);
+module_platform_driver(retu_headset_driver);
+MODULE_ALIAS("platform:retu-headset");
MODULE_DESCRIPTION("Retu/Vilma headset detection");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Juha Yrjölä");
diff --git a/drivers/cbus/retu-pwrbutton.c b/drivers/cbus/retu-pwrbutton.c
index a5a3069..98ad005 100644
--- a/drivers/cbus/retu-pwrbutton.c
+++ b/drivers/cbus/retu-pwrbutton.c
@@ -72,7 +72,7 @@ static irqreturn_t retubutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int __init retubutton_probe(struct platform_device *pdev)
+static int __devinit retubutton_probe(struct platform_device *pdev)
{
struct retu_pwrbutton *pwr;
int ret = 0;
@@ -127,7 +127,7 @@ err0:
return ret;
}
-static int __exit retubutton_remove(struct platform_device *pdev)
+static int __devexit retubutton_remove(struct platform_device *pdev)
{
struct retu_pwrbutton *pwr = platform_get_drvdata(pdev);
@@ -140,24 +140,16 @@ static int __exit retubutton_remove(struct platform_device *pdev)
}
static struct platform_driver retu_pwrbutton_driver = {
- .remove = __exit_p(retubutton_remove),
+ .probe = retubutton_probe,
+ .remove = __devexit_p(retubutton_remove),
.driver = {
.name = "retu-pwrbutton",
},
};
-static int __init retubutton_init(void)
-{
- return platform_driver_probe(&retu_pwrbutton_driver, retubutton_probe);
-}
-module_init(retubutton_init);
-
-static void __exit retubutton_exit(void)
-{
- platform_driver_unregister(&retu_pwrbutton_driver);
-}
-module_exit(retubutton_exit);
+module_platform_driver(retu_pwrbutton_driver);
+MODULE_ALIAS("platform:retu-pwrbutton");
MODULE_DESCRIPTION("Retu Power Button");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Ari Saastamoinen");
diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c
index 488849c..965ee55 100644
--- a/drivers/cbus/retu-rtc.c
+++ b/drivers/cbus/retu-rtc.c
@@ -199,7 +199,7 @@ static struct rtc_class_ops retu_rtc_ops = {
.set_alarm = retu_rtc_set_alarm,
};
-static int __init retu_rtc_probe(struct platform_device *pdev)
+static int __devinit retu_rtc_probe(struct platform_device *pdev)
{
struct retu_rtc *rtc;
int r;
@@ -261,24 +261,16 @@ static int __devexit retu_rtc_remove(struct platform_device *pdev)
}
static struct platform_driver retu_rtc_driver = {
- .remove = __exit_p(retu_rtc_remove),
+ .probe = retu_rtc_probe,
+ .remove = __devexit_p(retu_rtc_remove),
.driver = {
.name = "retu-rtc",
},
};
-static int __init retu_rtc_init(void)
-{
- return platform_driver_probe(&retu_rtc_driver, retu_rtc_probe);
-}
-module_init(retu_rtc_init);
-
-static void __exit retu_rtc_exit(void)
-{
- platform_driver_unregister(&retu_rtc_driver);
-}
-module_exit(retu_rtc_exit);
+module_platform_driver(retu_rtc_driver);
+MODULE_ALIAS("platform:retu-rtc");
MODULE_DESCRIPTION("Retu RTC");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Paul Mundt");
diff --git a/drivers/cbus/retu-wdt.c b/drivers/cbus/retu-wdt.c
index 3eb388f..7557bc1 100644
--- a/drivers/cbus/retu-wdt.c
+++ b/drivers/cbus/retu-wdt.c
@@ -193,7 +193,7 @@ static const struct file_operations retu_wdt_fops = {
.release = retu_wdt_release,
};
-static int __init retu_wdt_probe(struct platform_device *pdev)
+static int __devinit retu_wdt_probe(struct platform_device *pdev)
{
struct retu_wdt_dev *wdev;
int ret;
@@ -248,25 +248,16 @@ static int __devexit retu_wdt_remove(struct platform_device *pdev)
}
static struct platform_driver retu_wdt_driver = {
- .remove = __exit_p(retu_wdt_remove),
+ .probe = retu_wdt_probe,
+ .remove = __devexit_p(retu_wdt_remove),
.driver = {
.name = "retu-wdt",
},
};
-static int __init retu_wdt_init(void)
-{
- return platform_driver_probe(&retu_wdt_driver, retu_wdt_probe);
-}
-
-static void __exit retu_wdt_exit(void)
-{
- platform_driver_unregister(&retu_wdt_driver);
-}
-
-module_init(retu_wdt_init);
-module_exit(retu_wdt_exit);
+module_platform_driver(retu_wdt_driver);
+MODULE_ALIAS("platform:retu-wdt");
MODULE_DESCRIPTION("Retu WatchDog");
MODULE_AUTHOR("Amit Kucheria");
MODULE_LICENSE("GPL");
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 437a309..5bd88c6 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -518,18 +518,9 @@ static struct platform_driver retu_driver = {
},
};
-static int __init retu_init(void)
-{
- return platform_driver_register(&retu_driver);
-}
-subsys_initcall(retu_init);
-
-static void __exit retu_exit(void)
-{
- platform_driver_unregister(&retu_driver);
-}
-module_exit(retu_exit);
+module_platform_driver(retu_driver);
+MODULE_ALIAS("platform:retu");
MODULE_DESCRIPTION("Retu ASIC control");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Juha Yrjölä");
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index 41e39ca..15da853 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -189,7 +189,7 @@ static int tahvo_otg_init(void)
return 0;
}
-static int __init omap_otg_probe(struct platform_device *pdev)
+static int __devinit omap_otg_probe(struct platform_device *pdev)
{
int ret;
@@ -205,7 +205,7 @@ static int __init omap_otg_probe(struct platform_device *pdev)
tahvo_usb_device);
}
-static int __exit omap_otg_remove(struct platform_device *pdev)
+static int __devexit omap_otg_remove(struct platform_device *pdev)
{
free_irq(tahvo_otg_dev->resource[1].start, tahvo_usb_device);
tahvo_otg_dev = NULL;
@@ -214,10 +214,11 @@ static int __exit omap_otg_remove(struct platform_device *pdev)
}
struct platform_driver omap_otg_driver = {
+ .probe = omap_otg_probe,
+ .remove = __devexit_p(omap_otg_remove),
.driver = {
.name = "omap_otg",
},
- .remove = __exit_p(omap_otg_remove),
};
/*
@@ -588,7 +589,7 @@ static ssize_t otg_mode_store(struct device *device,
static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
#endif
-static int __init tahvo_usb_probe(struct platform_device *pdev)
+static int __devinit tahvo_usb_probe(struct platform_device *pdev)
{
struct tahvo_usb *tu;
struct device *dev = &pdev->dev;
@@ -680,7 +681,7 @@ err_free_tu:
return ret;
}
-static int __exit tahvo_usb_remove(struct platform_device *pdev)
+static int __devexit tahvo_usb_remove(struct platform_device *pdev)
{
struct tahvo_usb *tu = platform_get_drvdata(pdev);
@@ -703,21 +704,22 @@ static int __exit tahvo_usb_remove(struct platform_device *pdev)
}
static struct platform_driver tahvo_usb_driver = {
+ .probe = tahvo_usb_probe,
+ .remove = __devexit_p(tahvo_usb_remove),
.driver = {
.name = "tahvo-usb",
},
- .remove = __exit_p(tahvo_usb_remove),
};
static int __init tahvo_usb_init(void)
{
int ret = 0;
- ret = platform_driver_probe(&tahvo_usb_driver, tahvo_usb_probe);
+ ret = platform_driver_register(&tahvo_usb_driver);
if (ret)
return ret;
- ret = platform_driver_probe(&omap_otg_driver, omap_otg_probe);
+ ret = platform_driver_register(&omap_otg_driver);
if (ret) {
platform_driver_unregister(&tahvo_usb_driver);
return ret;
@@ -725,8 +727,7 @@ static int __init tahvo_usb_init(void)
return 0;
}
-
-subsys_initcall(tahvo_usb_init);
+module_init(tahvo_usb_init);
static void __exit tahvo_usb_exit(void)
{
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 5de3d8d..7f7c712 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -401,18 +401,9 @@ static struct platform_driver tahvo_driver = {
},
};
-static int __init tahvo_init(void)
-{
- return platform_driver_register(&tahvo_driver);
-}
-subsys_initcall(tahvo_init);
-
-static void __exit tahvo_exit(void)
-{
- platform_driver_unregister(&tahvo_driver);
-}
-module_exit(tahvo_exit);
+module_platform_driver(tahvo_driver);
+MODULE_ALIAS("platform:tahvo");
MODULE_DESCRIPTION("Tahvo ASIC control");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Juha Yrjölä");
--
1.7.8.rc3
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/6] cbus: fix very old compile warning
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
2011-11-23 14:00 ` [PATCH 1/6] cbus: fix compile breakage Felipe Balbi
2011-11-23 14:00 ` [PATCH 2/6] cbus: move the module_platform_driver where possible Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 14:00 ` [PATCH 4/6] cbus: retu: move irq_chip to our context structure Felipe Balbi
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
platform_driver.remove returns an 'int'.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/cbus.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index c7ed881..45b01fd 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -296,7 +296,7 @@ exit1:
return ret;
}
-static void __devexit cbus_bus_remove(struct platform_device *pdev)
+static int __devexit cbus_bus_remove(struct platform_device *pdev)
{
struct cbus_host *chost = platform_get_drvdata(pdev);
@@ -305,6 +305,8 @@ static void __devexit cbus_bus_remove(struct platform_device *pdev)
gpio_free(chost->clk_gpio);
kfree(chost);
+
+ return 0;
}
static struct platform_driver cbus_driver = {
--
1.7.8.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/6] cbus: retu: move irq_chip to our context structure
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
` (2 preceding siblings ...)
2011-11-23 14:00 ` [PATCH 3/6] cbus: fix very old compile warning Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 14:00 ` [PATCH 5/6] cbus: tahvo: " Felipe Balbi
2011-11-23 14:00 ` [RFC/PATCH 6/6] cbus: retu: implement irq_domain support Felipe Balbi
5 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
in theory, we could have many retu devices connected
to different CBUS buses. The only thing preventing
that is the poweroff() function pointer which we need
to set.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 5bd88c6..25fa405 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -46,6 +46,8 @@ struct retu {
struct mutex mutex;
struct device *dev;
+ struct irq_chip irq_chip;
+
int irq_base;
int irq_end;
@@ -247,14 +249,6 @@ static void retu_bus_sync_unlock(struct irq_data *data)
mutex_unlock(&retu->mutex);
}
-static struct irq_chip retu_irq_chip = {
- .name = "retu",
- .irq_bus_lock = retu_bus_lock,
- .irq_bus_sync_unlock = retu_bus_sync_unlock,
- .irq_mask = retu_irq_mask,
- .irq_unmask = retu_irq_unmask,
-};
-
static inline void retu_irq_setup(int irq)
{
#ifdef CONFIG_ARM
@@ -272,7 +266,7 @@ static void retu_irq_init(struct retu *retu)
for (irq = base; irq < end; irq++) {
irq_set_chip_data(irq, retu);
- irq_set_chip(irq, &retu_irq_chip);
+ irq_set_chip(irq, &retu->irq_chip);
irq_set_nested_thread(irq, 1);
retu_irq_setup(irq);
}
@@ -409,6 +403,7 @@ static int retu_allocate_children(struct device *parent, int irq_base)
*/
static int __devinit retu_probe(struct platform_device *pdev)
{
+ struct irq_chip *chip;
struct retu *retu;
int ret = -ENOMEM;
@@ -428,10 +423,19 @@ static int __devinit retu_probe(struct platform_device *pdev)
goto err1;
}
+ chip = &retu->irq_chip;
+
+ chip->name = "retu",
+ chip->irq_bus_lock = retu_bus_lock,
+ chip->irq_bus_sync_unlock = retu_bus_sync_unlock,
+ chip->irq_mask = retu_irq_mask,
+ chip->irq_unmask = retu_irq_unmask,
+
retu->irq = platform_get_irq(pdev, 0);
retu->irq_base = ret;
retu->irq_end = ret + MAX_RETU_IRQ_HANDLERS;
retu->dev = &pdev->dev;
+
the_retu = retu;
mutex_init(&retu->mutex);
--
1.7.8.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/6] cbus: tahvo: move irq_chip to our context structure
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
` (3 preceding siblings ...)
2011-11-23 14:00 ` [PATCH 4/6] cbus: retu: move irq_chip to our context structure Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 14:00 ` [RFC/PATCH 6/6] cbus: retu: implement irq_domain support Felipe Balbi
5 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
in theory, we could have many tahvo devices connected
to different CBUS buses. Let's allow that to happen.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 7f7c712..819111a 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -44,6 +44,8 @@ struct tahvo {
struct mutex mutex;
struct device *dev;
+ struct irq_chip irq_chip;
+
int irq_base;
int irq_end;
int irq;
@@ -199,14 +201,6 @@ static void tahvo_irq_unmask(struct irq_data *data)
tahvo->mask_pending = true;
}
-static struct irq_chip tahvo_irq_chip = {
- .name = "tahvo",
- .irq_bus_lock = tahvo_irq_bus_lock,
- .irq_bus_sync_unlock = tahvo_irq_bus_sync_unlock,
- .irq_mask = tahvo_irq_mask,
- .irq_unmask = tahvo_irq_unmask,
-};
-
static inline void tahvo_irq_setup(int irq)
{
#ifdef CONFIG_ARM
@@ -224,7 +218,7 @@ static void tahvo_irq_init(struct tahvo *tahvo)
for (irq = base; irq < end; irq++) {
irq_set_chip_data(irq, tahvo);
- irq_set_chip(irq, &tahvo_irq_chip);
+ irq_set_chip(irq, &tahvo->irq_chip);
irq_set_nested_thread(irq, 1);
tahvo_irq_setup(irq);
}
@@ -297,6 +291,7 @@ static int tahvo_allocate_children(struct device *parent, int irq_base)
static int __devinit tahvo_probe(struct platform_device *pdev)
{
+ struct irq_chip *chip;
struct tahvo *tahvo;
int rev;
int ret;
@@ -321,6 +316,14 @@ static int __devinit tahvo_probe(struct platform_device *pdev)
goto err1;
}
+ chip = &tahvo->irq_chip;
+
+ chip->name = "tahvo",
+ chip->irq_bus_lock = tahvo_irq_bus_lock,
+ chip->irq_bus_sync_unlock = tahvo_irq_bus_sync_unlock,
+ chip->irq_mask = tahvo_irq_mask,
+ chip->irq_unmask = tahvo_irq_unmask,
+
tahvo->irq_base = ret;
tahvo->irq_end = ret + MAX_TAHVO_IRQ_HANDLERS;
tahvo->dev = &pdev->dev;
--
1.7.8.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [RFC/PATCH 6/6] cbus: retu: implement irq_domain support
2011-11-23 14:00 [PATCH 0/6] CBUS patches Felipe Balbi
` (4 preceding siblings ...)
2011-11-23 14:00 ` [PATCH 5/6] cbus: tahvo: " Felipe Balbi
@ 2011-11-23 14:00 ` Felipe Balbi
2011-11-23 16:59 ` Felipe Balbi
5 siblings, 1 reply; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 14:00 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Linux OMAP Mailing List, Felipe Balbi
Then, when moving to devicetree, we can list
IRQs as 1, 2, 3. It's the only way to have a
sane devicetree actually.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu.c | 42 +++++++++++++++++++++++++++---------------
1 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 25fa405..f25e0a3 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -25,7 +25,7 @@
#include <linux/module.h>
#include <linux/init.h>
-
+#include <linux/irqdomain.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -46,6 +46,7 @@ struct retu {
struct mutex mutex;
struct device *dev;
+ struct irq_domain irq_domain;
struct irq_chip irq_chip;
int irq_base;
@@ -199,11 +200,9 @@ static irqreturn_t retu_irq_handler(int irq, void *_retu)
while (idr) {
unsigned long pending = __ffs(idr);
- unsigned int irq;
idr &= ~BIT(pending);
- irq = pending + retu->irq_base;
- handle_nested_irq(irq);
+ handle_nested_irq(pending);
}
return IRQ_HANDLED;
@@ -216,7 +215,7 @@ static void retu_irq_mask(struct irq_data *data)
struct retu *retu = irq_data_get_irq_chip_data(data);
int irq = data->irq;
- retu->mask |= (1 << (irq - retu->irq_base));
+ retu->mask |= (1 << irq);
retu->mask_pending = true;
}
@@ -225,7 +224,7 @@ static void retu_irq_unmask(struct irq_data *data)
struct retu *retu = irq_data_get_irq_chip_data(data);
int irq = data->irq;
- retu->mask &= ~(1 << (irq - retu->irq_base));
+ retu->mask &= ~(1 << irq);
retu->mask_pending = true;
}
@@ -260,6 +259,7 @@ static inline void retu_irq_setup(int irq)
static void retu_irq_init(struct retu *retu)
{
+ struct irq_domain *domain;
int base = retu->irq_base;
int end = retu->irq_end;
int irq;
@@ -270,10 +270,19 @@ static void retu_irq_init(struct retu *retu)
irq_set_nested_thread(irq, 1);
retu_irq_setup(irq);
}
+
+ /* IRQ domain setup */
+ domain = &retu->irq_domain;
+ domain->irq_base = base;
+ domain->nr_irq = MAX_RETU_IRQ_HANDLERS;
+ domain->hwirq_base = 1;
+
+ irq_domain_add(domain);
}
static void retu_irq_exit(struct retu *retu)
{
+ struct irq_domain *domain;
int base = retu->irq_base;
int end = retu->irq_end;
int irq;
@@ -285,6 +294,9 @@ static void retu_irq_exit(struct retu *retu)
irq_set_chip_and_handler(irq, NULL, NULL);
irq_set_chip_data(irq, NULL);
}
+
+ domain = &retu->irq_domain;
+ irq_domain_del(domain);
}
/* -------------------------------------------------------------------------- */
@@ -326,7 +338,7 @@ static struct resource generic_resources[] = {
* @parent: parent device for this child
*/
static struct device *retu_allocate_child(char *name, struct device *parent,
- int irq_base, int irq1, int irq2, int num)
+ int irq1, int irq2, int num)
{
struct platform_device *pdev;
int status;
@@ -340,8 +352,8 @@ static struct device *retu_allocate_child(char *name, struct device *parent,
pdev->dev.parent = parent;
if (num) {
- generic_resources[0].start = irq_base + irq1;
- generic_resources[1].start = irq_base + irq2;
+ generic_resources[0].start = irq1;
+ generic_resources[1].start = irq2;
status = platform_device_add_resources(pdev,
generic_resources, num);
@@ -368,26 +380,26 @@ err:
/**
* retu_allocate_children - Allocates Retu's children
*/
-static int retu_allocate_children(struct device *parent, int irq_base)
+static int retu_allocate_children(struct device *parent)
{
struct device *child;
- child = retu_allocate_child("retu-pwrbutton", parent, irq_base,
+ child = retu_allocate_child("retu-pwrbutton", parent,
RETU_INT_PWR, -1, 1);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-headset", parent, irq_base,
+ child = retu_allocate_child("retu-headset", parent,
RETU_INT_HOOK, -1, 1);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-rtc", parent, irq_base,
+ child = retu_allocate_child("retu-rtc", parent,
RETU_INT_RTCS, RETU_INT_RTCA, 2);
if (!child)
return -ENOMEM;
- child = retu_allocate_child("retu-wdt", parent, -1, -1, -1, 0);
+ child = retu_allocate_child("retu-wdt", parent, -1, -1, 0);
if (!child)
return -ENOMEM;
@@ -466,7 +478,7 @@ static int __devinit retu_probe(struct platform_device *pdev)
/* Register power off function */
pm_power_off = retu_power_off;
- ret = retu_allocate_children(&pdev->dev, retu->irq_base);
+ ret = retu_allocate_children(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to allocate Retu children\n");
goto err3;
--
1.7.8.rc3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [RFC/PATCH 6/6] cbus: retu: implement irq_domain support
2011-11-23 14:00 ` [RFC/PATCH 6/6] cbus: retu: implement irq_domain support Felipe Balbi
@ 2011-11-23 16:59 ` Felipe Balbi
2011-12-08 0:47 ` Tony Lindgren
0 siblings, 1 reply; 9+ messages in thread
From: Felipe Balbi @ 2011-11-23 16:59 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Tony Lindgren, Linux OMAP Mailing List
[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]
Hi,
On Wed, Nov 23, 2011 at 04:00:48PM +0200, Felipe Balbi wrote:
> Then, when moving to devicetree, we can list
> IRQs as 1, 2, 3. It's the only way to have a
> sane devicetree actually.
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
> drivers/cbus/retu.c | 42 +++++++++++++++++++++++++++---------------
> 1 files changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
> index 25fa405..f25e0a3 100644
> --- a/drivers/cbus/retu.c
> +++ b/drivers/cbus/retu.c
> @@ -25,7 +25,7 @@
>
> #include <linux/module.h>
> #include <linux/init.h>
> -
> +#include <linux/irqdomain.h>
> #include <linux/slab.h>
> #include <linux/kernel.h>
> #include <linux/errno.h>
> @@ -46,6 +46,7 @@ struct retu {
> struct mutex mutex;
> struct device *dev;
>
> + struct irq_domain irq_domain;
> struct irq_chip irq_chip;
>
> int irq_base;
> @@ -199,11 +200,9 @@ static irqreturn_t retu_irq_handler(int irq, void *_retu)
>
> while (idr) {
> unsigned long pending = __ffs(idr);
> - unsigned int irq;
>
> idr &= ~BIT(pending);
> - irq = pending + retu->irq_base;
> - handle_nested_irq(irq);
> + handle_nested_irq(pending);
This is particular, I'm not sure if it's correct. Not sure if we should
use hw IRQ number of linux IRQ number. A boot test should be enough to
verify though.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [RFC/PATCH 6/6] cbus: retu: implement irq_domain support
2011-11-23 16:59 ` Felipe Balbi
@ 2011-12-08 0:47 ` Tony Lindgren
0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2011-12-08 0:47 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Linux OMAP Mailing List
* Felipe Balbi <balbi@ti.com> [111123 08:23]:
> Hi,
>
> On Wed, Nov 23, 2011 at 04:00:48PM +0200, Felipe Balbi wrote:
> > Then, when moving to devicetree, we can list
> > IRQs as 1, 2, 3. It's the only way to have a
> > sane devicetree actually.
> >
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > ---
> > drivers/cbus/retu.c | 42 +++++++++++++++++++++++++++---------------
> > 1 files changed, 27 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
> > index 25fa405..f25e0a3 100644
> > --- a/drivers/cbus/retu.c
> > +++ b/drivers/cbus/retu.c
> > @@ -25,7 +25,7 @@
> >
> > #include <linux/module.h>
> > #include <linux/init.h>
> > -
> > +#include <linux/irqdomain.h>
> > #include <linux/slab.h>
> > #include <linux/kernel.h>
> > #include <linux/errno.h>
> > @@ -46,6 +46,7 @@ struct retu {
> > struct mutex mutex;
> > struct device *dev;
> >
> > + struct irq_domain irq_domain;
> > struct irq_chip irq_chip;
> >
> > int irq_base;
> > @@ -199,11 +200,9 @@ static irqreturn_t retu_irq_handler(int irq, void *_retu)
> >
> > while (idr) {
> > unsigned long pending = __ffs(idr);
> > - unsigned int irq;
> >
> > idr &= ~BIT(pending);
> > - irq = pending + retu->irq_base;
> > - handle_nested_irq(irq);
> > + handle_nested_irq(pending);
>
> This is particular, I'm not sure if it's correct. Not sure if we should
> use hw IRQ number of linux IRQ number. A boot test should be enough to
> verify though.
This one does not seem to work, so pushing only the first five. The watchdog
seems to be kicked, so looks like they work.
Tony
[ 2.810638] tahvo tahvo: Betty v2.1 found
[ 2.819549] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 2.828430] pgd = c0004000
[ 2.831420] [00000000] *pgd=00000000
[ 2.835205] Internal error: Oops: 5 [#1] SMP
[ 2.839691] Modules linked in:
[ 2.842926] CPU: 0 Not tainted (3.2.0-rc2-01686-gf3667721-dirty #231)
[ 2.850097] PC is at irq_domain_add+0x10/0x154
[ 2.854766] LR is at retu_probe+0x130/0x358
[ 2.859161] pc : [<c009dda4>] lr : [<c0426294>] psr: 60000013
[ 2.859191] sp : c7827eb8 ip : 00010000 fp : c0537458
[ 2.871215] r10: c066bf68 r9 : c0bf4418 r8 : 00000068
[ 2.876708] r7 : 00000001 r6 : c7a888ec r5 : c7a888a0 r4 : 00000001
[ 2.883575] r3 : 00000000 r2 : c7825400 r1 : c06caf80 r0 : c7a888ec
[ 2.890441] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
[ 2.898101] Control: 00c5387d Table: 80004000 DAC: 00000017
[ 2.904144] Process swapper (pid: 1, stack limit = 0xc78262f8)
[ 2.910278] Stack: (0xc7827eb8 to 0xc7828000)
[ 2.914855] 7ea0: 00000001 c7a888a0
[ 2.923461] 7ec0: c7a8890c 00000078 00000068 c0426294 00000000 00000000 c069d090 c066bf68
[ 2.932067] 7ee0: c066bf68 c069d090 c0291024 c068f8d0 c0bf25b0 c069d090 c06a7480 c02922ac
[ 2.940673] 7f00: c066bf68 c0290ef8 c066bf68 c066bf9c c069d090 c0291024 c068f8d0 00000000
[ 2.949279] 7f20: c7abb5e0 c02910b8 00000000 c7827f38 c069d090 c0290724 c781a658 c78641b0
[ 2.957885] 7f40: 00000000 c0537458 c061b0ac c069d090 c069d090 c0290034 c0537458 c0233bd0
[ 2.966491] 7f60: c061b50c c061b0ac c069d090 00000013 c7826000 c05f6958 00000000 c02916bc
[ 2.975097] 7f80: c061b50c c061b0ac c061b5f4 00000013 c7826000 c0008688 c0626880 c009e650
[ 2.983703] 7fa0: 0000005f 00000000 c061b5f4 35390013 00000000 00000000 00000000 0000019a
[ 2.992309] 7fc0: c067cf94 c061b50c c061b0ac c061b5f4 00000013 00000000 00000000 00000000
[ 3.000915] 7fe0: 00000000 c05d0298 00000000 c05d0200 c0014f88 c0014f88 ffffffff ffffff9f
[ 3.009521] [<c009dda4>] (irq_domain_add+0x10/0x154) from [<c0426294>] (retu_probe+0x130/0x358)
[ 3.018707] [<c0426294>] (retu_probe+0x130/0x358) from [<c02922ac>] (platform_drv_probe+0x18/0x1c)
[ 3.028167] [<c02922ac>] (platform_drv_probe+0x18/0x1c) from [<c0290ef8>] (driver_probe_device+0x98/0x1c4)
[ 3.038330] [<c0290ef8>] (driver_probe_device+0x98/0x1c4) from [<c02910b8>] (__driver_attach+0x94/0x98)
[ 3.048217] [<c02910b8>] (__driver_attach+0x94/0x98) from [<c0290724>] (bus_for_each_dev+0x60/0x8c)
[ 3.057739] [<c0290724>] (bus_for_each_dev+0x60/0x8c) from [<c0290034>] (bus_add_driver+0x198/0x260)
[ 3.067352] [<c0290034>] (bus_add_driver+0x198/0x260) from [<c02916bc>] (driver_register+0x6c/0x148)
[ 3.076965] [<c02916bc>] (driver_register+0x6c/0x148) from [<c0008688>] (do_one_initcall+0x34/0x180)
[ 3.086578] [<c0008688>] (do_one_initcall+0x34/0x180) from [<c05d0298>] (kernel_init+0x98/0x144)
[ 3.095855] [<c05d0298>] (kernel_init+0x98/0x144) from [<c0014f88>] (kernel_thread_exit+0x0/0x8)
[ 3.105102] Code: e92d41f0 e1a06000 e5903014 e5907010 (e5933000)
[ 3.111816] ---[ end trace 539355b8447db297 ]---
[ 3.116729] Kernel panic - not syncing: Attempted to kill init!
^ permalink raw reply [flat|nested] 9+ messages in thread