* [RFT/PATCH 0/8] cbus patches
@ 2010-09-14 8:30 Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 1/8] cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls Felipe Balbi
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
Hi all,
if you have n8x0/n770 board getting dust, please
spend some minutes to boot test the following
patches on that. After you do so, please reply
with your Tested-by tag.
I'm also adding to this series Jarkko Nikula's
ioctl fix since l-o doesn't compile without that.
Felipe Balbi (7):
cbus: remove device_release completion
cbus: retu: pass irq number via struct resource
cbus: retu: avoid section mismatch
cbus: tahvo: usb: convert to platform_driver
cbus: tahvo: remove device_release
cbus: tahvo: pass irq via struct resource
cbus: tahvo: avoid section mismatch
Jarkko Nikula (1):
cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls
drivers/cbus/retu-headset.c | 3 +-
drivers/cbus/retu-pwrbutton.c | 9 +--
drivers/cbus/retu-rtc.c | 7 +-
drivers/cbus/retu-user.c | 5 +-
drivers/cbus/retu-wdt.c | 13 ++--
drivers/cbus/retu.c | 123 ++++++++++++++++++++++-------------------
drivers/cbus/tahvo-usb.c | 49 ++++++++--------
drivers/cbus/tahvo-user.c | 5 +-
drivers/cbus/tahvo.c | 116 +++++++++++++++++++++------------------
9 files changed, 172 insertions(+), 158 deletions(-)
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFT/PATCH 1/8] cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 2/8] cbus: remove device_release completion Felipe Balbi
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
From: Jarkko Nikula <jhnikula@gmail.com>
Locked .ioctl is gone from struct file_operations by commit b19dd42
so these cbus drivers don't compile. Also it seems there is no need for BKL
anyway in these drivers.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu-user.c | 5 ++---
drivers/cbus/retu-wdt.c | 6 +++---
drivers/cbus/tahvo-user.c | 5 ++---
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/cbus/retu-user.c b/drivers/cbus/retu-user.c
index 953d92a..c36f356 100644
--- a/drivers/cbus/retu-user.c
+++ b/drivers/cbus/retu-user.c
@@ -270,8 +270,7 @@ static int retu_close(struct inode *inode, struct file *filp)
/*
* Device control (ioctl)
*/
-static int retu_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+static long retu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct retu_tahvo_write_parms par;
int ret;
@@ -360,7 +359,7 @@ static unsigned retu_poll(struct file *filp, struct poll_table_struct *pt)
static struct file_operations retu_user_fileops = {
.owner = THIS_MODULE,
- .ioctl = retu_ioctl,
+ .unlocked_ioctl = retu_ioctl,
.read = retu_read,
.release = retu_close,
.poll = retu_poll
diff --git a/drivers/cbus/retu-wdt.c b/drivers/cbus/retu-wdt.c
index 6070a05..3d83cdc 100644
--- a/drivers/cbus/retu-wdt.c
+++ b/drivers/cbus/retu-wdt.c
@@ -184,8 +184,8 @@ static ssize_t retu_wdt_write(struct file *file, const char __user *data,
return len;
}
-static int retu_wdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static long retu_wdt_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int new_margin;
@@ -246,7 +246,7 @@ static int __devinit retu_wdt_ping(void)
static const struct file_operations retu_wdt_fops = {
.owner = THIS_MODULE,
.write = retu_wdt_write,
- .ioctl = retu_wdt_ioctl,
+ .unlocked_ioctl = retu_wdt_ioctl,
.open = retu_wdt_open,
.release = retu_wdt_release,
};
diff --git a/drivers/cbus/tahvo-user.c b/drivers/cbus/tahvo-user.c
index bd30f06..9cfc71c 100644
--- a/drivers/cbus/tahvo-user.c
+++ b/drivers/cbus/tahvo-user.c
@@ -254,8 +254,7 @@ static int tahvo_close(struct inode *inode, struct file *filp)
/*
* Device control (ioctl)
*/
-static int tahvo_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+static long tahvo_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct retu_tahvo_write_parms par;
int ret;
@@ -342,7 +341,7 @@ static unsigned tahvo_poll(struct file *filp, struct poll_table_struct *pt)
static struct file_operations tahvo_user_fileops = {
.owner = THIS_MODULE,
- .ioctl = tahvo_ioctl,
+ .unlocked_ioctl = tahvo_ioctl,
.read = tahvo_read,
.release = tahvo_close,
.poll = tahvo_poll
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFT/PATCH 2/8] cbus: remove device_release completion
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 1/8] cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 3/8] cbus: retu: pass irq number via struct resource Felipe Balbi
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
We don't do anything before releasing the device
so we might as well return as soon as possible.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index bc81a9b..15368dc 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -56,8 +56,6 @@ static int retu_is_vilma;
static struct tasklet_struct retu_tasklet;
spinlock_t retu_lock = SPIN_LOCK_UNLOCKED;
-static struct completion device_release;
-
struct retu_irq_handler_desc {
int (*func)(unsigned long);
unsigned long arg;
@@ -491,11 +489,6 @@ static int __devexit retu_remove(struct platform_device *pdev)
return 0;
}
-static void retu_device_release(struct device *dev)
-{
- complete(&device_release);
-}
-
static struct platform_driver retu_driver = {
.probe = retu_probe,
.remove = __devexit_p(retu_remove),
@@ -507,9 +500,6 @@ static struct platform_driver retu_driver = {
static struct platform_device retu_device = {
.name = "retu",
.id = -1,
- .dev = {
- .release = retu_device_release,
- }
};
/**
@@ -525,8 +515,6 @@ static int __init retu_init(void)
machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
return -ENODEV;
- init_completion(&device_release);
-
ret = platform_driver_register(&retu_driver);
if (ret < 0)
return ret;
@@ -547,7 +535,6 @@ static void __exit retu_exit(void)
{
platform_device_unregister(&retu_device);
platform_driver_unregister(&retu_driver);
- wait_for_completion(&device_release);
}
subsys_initcall(retu_init);
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFT/PATCH 3/8] cbus: retu: pass irq number via struct resource
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 1/8] cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 2/8] cbus: remove device_release completion Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 4/8] cbus: retu: avoid section mismatch Felipe Balbi
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
this patch prepares retu to be able to create and
register the platform_device on board files. IRQ
number is now being passed via struct resource as
it should be.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu.c | 103 +++++++++++++++++++++++++++++++-------------------
1 files changed, 64 insertions(+), 39 deletions(-)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 15368dc..67b663e 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -398,32 +398,12 @@ static int retu_allocate_children(struct device *parent)
static int __devinit retu_probe(struct platform_device *pdev)
{
int rev, ret;
+ int irq;
/* Prepare tasklet */
tasklet_init(&retu_tasklet, retu_tasklet_handler, 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 {
- dev_err(&pdev->dev, "cbus: Unsupported board for tahvo\n");
- return -ENODEV;
- }
-
- ret = gpio_request(retu_irq_pin, "RETU irq");
- if (ret < 0) {
- dev_err(&pdev->dev, "Unable to reserve IRQ GPIO\n");
- return ret;
- }
-
- /* Set the pin as input */
- gpio_direction_input(retu_irq_pin);
-
- /* Rising edge triggers the IRQ */
- set_irq_type(gpio_to_irq(retu_irq_pin), IRQ_TYPE_EDGE_RISING);
+ irq = platform_get_irq(pdev, 0);
retu_initialized = 1;
@@ -437,14 +417,14 @@ static int __devinit retu_probe(struct platform_device *pdev)
/* Mask all RETU interrupts */
retu_write_reg(RETU_REG_IMR, 0xffff);
- ret = request_irq(gpio_to_irq(retu_irq_pin), retu_irq_handler, 0,
+ ret = request_irq(irq, retu_irq_handler, 0,
"retu", 0);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to register IRQ handler\n");
- gpio_free(retu_irq_pin);
return ret;
}
- set_irq_wake(gpio_to_irq(retu_irq_pin), 1);
+
+ set_irq_wake(irq, 1);
/* Register power off function */
pm_power_off = retu_power_off;
@@ -453,8 +433,7 @@ static int __devinit retu_probe(struct platform_device *pdev)
/* Initialize user-space interface */
if (retu_user_init() < 0) {
dev_err(&pdev->dev, "Unable to initialize driver\n");
- free_irq(gpio_to_irq(retu_irq_pin), 0);
- gpio_free(retu_irq_pin);
+ free_irq(irq, 0);
return ret;
}
#endif
@@ -466,8 +445,7 @@ static int __devinit retu_probe(struct platform_device *pdev)
retu_user_cleanup();
#endif
retu_write_reg(RETU_REG_IMR, 0xffff);
- free_irq(gpio_to_irq(retu_irq_pin), 0);
- gpio_free(retu_irq_pin);
+ free_irq(irq, 0);
tasklet_kill(&retu_tasklet);
return ret;
}
@@ -477,13 +455,16 @@ static int __devinit retu_probe(struct platform_device *pdev)
static int __devexit retu_remove(struct platform_device *pdev)
{
+ int irq;
+
+ irq = platform_get_irq(pdev, 0);
+
#ifdef CONFIG_CBUS_RETU_USER
retu_user_cleanup();
#endif
/* Mask all RETU interrupts */
retu_write_reg(RETU_REG_IMR, 0xffff);
- free_irq(gpio_to_irq(retu_irq_pin), 0);
- gpio_free(retu_irq_pin);
+ free_irq(irq, 0);
tasklet_kill(&retu_tasklet);
return 0;
@@ -497,9 +478,18 @@ 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),
};
/**
@@ -511,21 +501,55 @@ static int __init retu_init(void)
{
int ret = 0;
- if (!(machine_is_nokia770() || machine_is_nokia_n800() ||
- machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
- return -ENODEV;
+ /* 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_driver_register(&retu_driver);
if (ret < 0)
- return ret;
+ goto err1;
ret = platform_device_register(&retu_device);
- if (ret < 0) {
- platform_driver_unregister(&retu_driver);
- return ret;
- }
+ if (ret < 0)
+ goto err2;
return 0;
+
+err2:
+ platform_driver_unregister(&retu_driver);
+
+err1:
+ gpio_free(retu_irq_pin);
+
+err0:
+ return ret;
}
/*
@@ -535,6 +559,7 @@ 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] 11+ messages in thread
* [RFT/PATCH 4/8] cbus: retu: avoid section mismatch
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (2 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 3/8] cbus: retu: pass irq number via struct resource Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 5/8] cbus: tahvo: usb: convert to platform_driver Felipe Balbi
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
... by removing __init reference from platform_driver
structure.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/retu-headset.c | 3 +--
drivers/cbus/retu-pwrbutton.c | 9 ++++-----
drivers/cbus/retu-rtc.c | 7 +++----
drivers/cbus/retu-wdt.c | 7 +++----
drivers/cbus/retu.c | 9 ++++-----
5 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/drivers/cbus/retu-headset.c b/drivers/cbus/retu-headset.c
index c86c665..f5fb50c 100644
--- a/drivers/cbus/retu-headset.c
+++ b/drivers/cbus/retu-headset.c
@@ -321,7 +321,6 @@ static int retu_headset_resume(struct platform_device *pdev)
}
static struct platform_driver retu_headset_driver = {
- .probe = retu_headset_probe,
.remove = retu_headset_remove,
.suspend = retu_headset_suspend,
.resume = retu_headset_resume,
@@ -332,7 +331,7 @@ static struct platform_driver retu_headset_driver = {
static int __init retu_headset_init(void)
{
- return platform_driver_register(&retu_headset_driver);
+ return platform_driver_probe(&retu_headset_driver, retu_headset_probe);
}
static void __exit retu_headset_exit(void)
diff --git a/drivers/cbus/retu-pwrbutton.c b/drivers/cbus/retu-pwrbutton.c
index f0cd056..6b8dfa9 100644
--- a/drivers/cbus/retu-pwrbutton.c
+++ b/drivers/cbus/retu-pwrbutton.c
@@ -85,7 +85,7 @@ static void retubutton_irq(unsigned long arg)
* Init function.
* Allocates interrupt for power button and registers itself to input layer.
*/
-static int __devinit retubutton_probe(struct platform_device *pdev)
+static int __init retubutton_probe(struct platform_device *pdev)
{
struct retu_pwrbutton *pwr;
int ret = 0;
@@ -143,7 +143,7 @@ err0:
/**
* Cleanup function which is called when driver is unloaded
*/
-static int __devexit retubutton_remove(struct platform_device *pdev)
+static int __exit retubutton_remove(struct platform_device *pdev)
{
struct retu_pwrbutton *pwr = platform_get_drvdata(pdev);
@@ -157,8 +157,7 @@ static int __devexit retubutton_remove(struct platform_device *pdev)
}
static struct platform_driver retu_pwrbutton_driver = {
- .probe = retubutton_probe,
- .remove = __devexit_p(retubutton_remove),
+ .remove = __exit_p(retubutton_remove),
.driver = {
.name = "retu-pwrbutton",
},
@@ -166,7 +165,7 @@ static struct platform_driver retu_pwrbutton_driver = {
static int __init retubutton_init(void)
{
- return platform_driver_register(&retu_pwrbutton_driver);
+ return platform_driver_probe(&retu_pwrbutton_driver, retubutton_probe);
}
module_init(retubutton_init);
diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c
index b3974e2..c0fe481 100644
--- a/drivers/cbus/retu-rtc.c
+++ b/drivers/cbus/retu-rtc.c
@@ -273,7 +273,7 @@ static struct rtc_class_ops retu_rtc_ops = {
.set_alarm = retu_rtc_set_alarm,
};
-static int __devinit retu_rtc_probe(struct platform_device *pdev)
+static int __init retu_rtc_probe(struct platform_device *pdev)
{
struct retu_rtc *rtc;
int r;
@@ -350,8 +350,7 @@ static int __devexit retu_rtc_remove(struct platform_device *pdev)
}
static struct platform_driver retu_rtc_driver = {
- .probe = retu_rtc_probe,
- .remove = __devexit_p(retu_rtc_remove),
+ .remove = __exit_p(retu_rtc_remove),
.driver = {
.name = "retu-rtc",
},
@@ -359,7 +358,7 @@ static struct platform_driver retu_rtc_driver = {
static int __init retu_rtc_init(void)
{
- return platform_driver_register(&retu_rtc_driver);
+ return platform_driver_probe(&retu_rtc_driver, retu_rtc_probe);
}
static void __exit retu_rtc_exit(void)
diff --git a/drivers/cbus/retu-wdt.c b/drivers/cbus/retu-wdt.c
index 3d83cdc..8b87ae9 100644
--- a/drivers/cbus/retu-wdt.c
+++ b/drivers/cbus/retu-wdt.c
@@ -253,7 +253,7 @@ static const struct file_operations retu_wdt_fops = {
/*----------------------------------------------------------------------------*/
-static int __devinit retu_wdt_probe(struct platform_device *pdev)
+static int __init retu_wdt_probe(struct platform_device *pdev)
{
struct retu_wdt_dev *wdev;
int ret;
@@ -340,8 +340,7 @@ static int __devexit retu_wdt_remove(struct platform_device *pdev)
}
static struct platform_driver retu_wdt_driver = {
- .probe = retu_wdt_probe,
- .remove = __devexit_p(retu_wdt_remove),
+ .remove = __exit_p(retu_wdt_remove),
.driver = {
.name = "retu-wdt",
},
@@ -349,7 +348,7 @@ static struct platform_driver retu_wdt_driver = {
static int __init retu_wdt_init(void)
{
- return platform_driver_register(&retu_wdt_driver);
+ return platform_driver_probe(&retu_wdt_driver, retu_wdt_probe);
}
static void __exit retu_wdt_exit(void)
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 67b663e..1397366 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -395,7 +395,7 @@ static int retu_allocate_children(struct device *parent)
* Probe for the Retu ASIC and allocate memory
* for its device-struct if found
*/
-static int __devinit retu_probe(struct platform_device *pdev)
+static int __init retu_probe(struct platform_device *pdev)
{
int rev, ret;
int irq;
@@ -453,7 +453,7 @@ static int __devinit retu_probe(struct platform_device *pdev)
return 0;
}
-static int __devexit retu_remove(struct platform_device *pdev)
+static int __exit retu_remove(struct platform_device *pdev)
{
int irq;
@@ -471,8 +471,7 @@ static int __devexit retu_remove(struct platform_device *pdev)
}
static struct platform_driver retu_driver = {
- .probe = retu_probe,
- .remove = __devexit_p(retu_remove),
+ .remove = __exit_p(retu_remove),
.driver = {
.name = "retu",
},
@@ -532,7 +531,7 @@ static int __init retu_init(void)
/* Set up correct gpio number on struct resource */
retu_resource[0].start = gpio_to_irq(retu_irq_pin);
- ret = platform_driver_register(&retu_driver);
+ ret = platform_driver_probe(&retu_driver, retu_probe);
if (ret < 0)
goto err1;
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFT/PATCH 5/8] cbus: tahvo: usb: convert to platform_driver
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (3 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 4/8] cbus: retu: avoid section mismatch Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 6/8] cbus: tahvo: remove device_release Felipe Balbi
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
tahvo-usb was already using a platform_device,
now also convert device_driver into platform_driver.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo-usb.c | 49 +++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index 9dc04ad..1cb81fd 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -188,11 +188,11 @@ static int tahvo_otg_init(void)
return 0;
}
-static int omap_otg_probe(struct device *dev)
+static int __init omap_otg_probe(struct platform_device *pdev)
{
int ret;
- tahvo_otg_dev = to_platform_device(dev);
+ tahvo_otg_dev = pdev;
ret = tahvo_otg_init();
if (ret != 0) {
printk(KERN_ERR "tahvo-usb: tahvo_otg_init failed\n");
@@ -204,7 +204,7 @@ static int omap_otg_probe(struct device *dev)
&tahvo_usb_device);
}
-static int omap_otg_remove(struct device *dev)
+static int __exit omap_otg_remove(struct platform_device *pdev)
{
free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
tahvo_otg_dev = NULL;
@@ -212,11 +212,11 @@ static int omap_otg_remove(struct device *dev)
return 0;
}
-struct device_driver omap_otg_driver = {
- .name = "omap_otg",
- .bus = &platform_bus_type,
- .probe = omap_otg_probe,
- .remove = omap_otg_remove,
+struct platform_driver omap_otg_driver = {
+ .driver = {
+ .name = "omap_otg",
+ },
+ .remove = __exit_p(omap_otg_remove),
};
/*
@@ -643,9 +643,10 @@ static ssize_t otg_mode_store(struct device *device,
static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
#endif
-static int tahvo_usb_probe(struct device *dev)
+static int __init tahvo_usb_probe(struct platform_device *pdev)
{
struct tahvo_usb *tu;
+ struct device *dev = &pdev->dev;
int ret;
ret = tahvo_get_status();
@@ -720,25 +721,25 @@ static int tahvo_usb_probe(struct device *dev)
return 0;
}
-static int tahvo_usb_remove(struct device *dev)
+static int __exit tahvo_usb_remove(struct platform_device *pdev)
{
- dev_dbg(dev, "remove\n");
+ dev_dbg(&pdev->dev, "remove\n");
tahvo_free_irq(TAHVO_INT_VBUSON);
flush_scheduled_work();
otg_set_transceiver(0);
- device_remove_file(dev, &dev_attr_vbus_state);
+ device_remove_file(&pdev->dev, &dev_attr_vbus_state);
#ifdef CONFIG_USB_OTG
- device_remove_file(dev, &dev_attr_otg_mode);
+ device_remove_file(&pdev->dev, &dev_attr_otg_mode);
#endif
return 0;
}
-static struct device_driver tahvo_usb_driver = {
- .name = "tahvo-usb",
- .bus = &platform_bus_type,
- .probe = tahvo_usb_probe,
- .remove = tahvo_usb_remove,
+static struct platform_driver tahvo_usb_driver = {
+ .driver = {
+ .name = "tahvo-usb",
+ },
+ .remove = __exit_p(tahvo_usb_remove),
};
static struct platform_device tahvo_usb_device = {
@@ -751,18 +752,18 @@ static int __init tahvo_usb_init(void)
int ret = 0;
printk(KERN_INFO "Tahvo USB transceiver driver initializing\n");
- ret = driver_register(&tahvo_usb_driver);
+ ret = platform_driver_probe(&tahvo_usb_driver, tahvo_usb_probe);
if (ret)
return ret;
ret = platform_device_register(&tahvo_usb_device);
if (ret < 0) {
- driver_unregister(&tahvo_usb_driver);
+ platform_driver_unregister(&tahvo_usb_driver);
return ret;
}
- ret = driver_register(&omap_otg_driver);
+ ret = platform_driver_probe(&omap_otg_driver, omap_otg_probe);
if (ret) {
platform_device_unregister(&tahvo_usb_device);
- driver_unregister(&tahvo_usb_driver);
+ platform_driver_unregister(&tahvo_usb_driver);
return ret;
}
return 0;
@@ -772,9 +773,9 @@ subsys_initcall(tahvo_usb_init);
static void __exit tahvo_usb_exit(void)
{
- driver_unregister(&omap_otg_driver);
+ platform_driver_unregister(&omap_otg_driver);
platform_device_unregister(&tahvo_usb_device);
- driver_unregister(&tahvo_usb_driver);
+ platform_driver_unregister(&tahvo_usb_driver);
}
module_exit(tahvo_usb_exit);
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFT/PATCH 6/8] cbus: tahvo: remove device_release
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (4 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 5/8] cbus: tahvo: usb: convert to platform_driver Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 7/8] cbus: tahvo: pass irq via struct resource Felipe Balbi
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
it's useless as we don't do anything besides
wait_for_completion(). Remove it.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo.c | 13 -------------
1 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 7d49252..7c57ca4 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -56,8 +56,6 @@ static int tahvo_is_betty;
static struct tasklet_struct tahvo_tasklet;
spinlock_t tahvo_lock = SPIN_LOCK_UNLOCKED;
-static struct completion device_release;
-
struct tahvo_irq_handler_desc {
int (*func)(unsigned long);
unsigned long arg;
@@ -388,11 +386,6 @@ static int __devexit tahvo_remove(struct platform_device *pdev)
return 0;
}
-static void tahvo_device_release(struct device *dev)
-{
- complete(&device_release);
-}
-
static struct platform_driver tahvo_driver = {
.probe = tahvo_probe,
.remove = __devexit_p(tahvo_remove),
@@ -404,9 +397,6 @@ static struct platform_driver tahvo_driver = {
static struct platform_device tahvo_device = {
.name = "tahvo",
.id = -1,
- .dev = {
- .release = tahvo_device_release,
- }
};
/**
@@ -422,8 +412,6 @@ static int __init tahvo_init(void)
machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
return -ENODEV;
- init_completion(&device_release);
-
ret = platform_driver_register(&tahvo_driver);
if (ret)
return ret;
@@ -443,7 +431,6 @@ static void __exit tahvo_exit(void)
{
platform_device_unregister(&tahvo_device);
platform_driver_unregister(&tahvo_driver);
- wait_for_completion(&device_release);
}
subsys_initcall(tahvo_init);
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFT/PATCH 7/8] cbus: tahvo: pass irq via struct resource
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (5 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 6/8] cbus: tahvo: remove device_release Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 8/8] cbus: tahvo: avoid section mismatch Felipe Balbi
2010-09-17 0:09 ` [RFT/PATCH 0/8] cbus patches Tony Lindgren
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
prepare tahvo for platform_device creation on
board files. Start passing irq number via
struct resource.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo.c | 96 ++++++++++++++++++++++++++++++-------------------
1 files changed, 59 insertions(+), 37 deletions(-)
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 7c57ca4..8e41758 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -304,6 +304,7 @@ EXPORT_SYMBOL(tahvo_free_irq);
static int __devinit tahvo_probe(struct platform_device *pdev)
{
int rev, id, ret;
+ int irq;
/* Prepare tasklet */
tasklet_init(&tahvo_tasklet, tahvo_tasklet_handler, 0);
@@ -327,45 +328,22 @@ static int __devinit tahvo_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s v%d.%d found\n", tahvo_is_betty ? "Betty" : "Tahvo",
(rev >> 4) & 0x0f, rev & 0x0f);
- /* 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 {
- dev_err(&pdev->dev, "cbus: Unsupported board for tahvo\n");
- return -ENODEV;
- }
-
- ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
- if (ret) {
- dev_err(&pdev->dev, "Unable to reserve IRQ GPIO\n");
- return ret;
- }
-
- /* Set the pin as input */
- gpio_direction_input(tahvo_irq_pin);
-
- /* Rising edge triggers the IRQ */
- set_irq_type(gpio_to_irq(tahvo_irq_pin), IRQ_TYPE_EDGE_RISING);
+ irq = platform_get_irq(pdev, 0);
/* Mask all TAHVO interrupts */
tahvo_write_reg(TAHVO_REG_IMR, 0xffff);
- ret = request_irq(gpio_to_irq(tahvo_irq_pin), tahvo_irq_handler, 0,
- "tahvo", 0);
+ ret = request_irq(irq, tahvo_irq_handler, IRQF_TRIGGER_RISING,
+ "tahvo", 0);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to register IRQ handler\n");
- gpio_free(tahvo_irq_pin);
return ret;
}
#ifdef CONFIG_CBUS_TAHVO_USER
/* Initialize user-space interface */
if (tahvo_user_init() < 0) {
dev_err(&pdev->dev, "Unable to initialize driver\n");
- free_irq(gpio_to_irq(tahvo_irq_pin), 0);
- gpio_free(tahvo_irq_pin);
+ free_irq(irq, 0);
return ret;
}
#endif
@@ -374,13 +352,16 @@ static int __devinit tahvo_probe(struct platform_device *pdev)
static int __devexit tahvo_remove(struct platform_device *pdev)
{
+ int irq;
+
+ irq = platform_get_irq(pdev, 0);
+
#ifdef CONFIG_CBUS_TAHVO_USER
tahvo_user_cleanup();
#endif
/* Mask all TAHVO interrupts */
tahvo_write_reg(TAHVO_REG_IMR, 0xffff);
- free_irq(gpio_to_irq(tahvo_irq_pin), 0);
- gpio_free(tahvo_irq_pin);
+ free_irq(irq, 0);
tasklet_kill(&tahvo_tasklet);
return 0;
@@ -394,9 +375,18 @@ 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),
};
/**
@@ -408,20 +398,51 @@ static int __init tahvo_init(void)
{
int ret = 0;
- if (!(machine_is_nokia770() || machine_is_nokia_n800() ||
- machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
- return -ENODEV;
+ /* 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_register(&tahvo_driver);
if (ret)
- return ret;
+ goto err1;
ret = platform_device_register(&tahvo_device);
- if (ret) {
- platform_driver_unregister(&tahvo_driver);
- return ret;
- }
+ if (ret)
+ goto err2;
+
return 0;
+
+err2:
+ platform_driver_unregister(&tahvo_driver);
+
+err1:
+ gpio_free(tahvo_irq_pin);
+
+err0:
+ return ret;
}
/*
@@ -431,6 +452,7 @@ 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] 11+ messages in thread
* [RFT/PATCH 8/8] cbus: tahvo: avoid section mismatch
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (6 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 7/8] cbus: tahvo: pass irq via struct resource Felipe Balbi
@ 2010-09-14 8:30 ` Felipe Balbi
2010-09-17 0:09 ` [RFT/PATCH 0/8] cbus patches Tony Lindgren
8 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-14 8:30 UTC (permalink / raw)
To: Linux OMAP Mailing List; +Cc: Jarkko Nikula, Tony Lindgren, Felipe Balbi
... by removing references to init section from
platform_driver structure
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/cbus/tahvo.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 8e41758..2ae1ac4 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(tahvo_free_irq);
* Probe for the Tahvo ASIC and allocate memory
* for its device-struct if found
*/
-static int __devinit tahvo_probe(struct platform_device *pdev)
+static int __init tahvo_probe(struct platform_device *pdev)
{
int rev, id, ret;
int irq;
@@ -350,7 +350,7 @@ static int __devinit tahvo_probe(struct platform_device *pdev)
return 0;
}
-static int __devexit tahvo_remove(struct platform_device *pdev)
+static int __exit tahvo_remove(struct platform_device *pdev)
{
int irq;
@@ -368,8 +368,7 @@ static int __devexit tahvo_remove(struct platform_device *pdev)
}
static struct platform_driver tahvo_driver = {
- .probe = tahvo_probe,
- .remove = __devexit_p(tahvo_remove),
+ .remove = __exit_p(tahvo_remove),
.driver = {
.name = "tahvo",
},
@@ -425,7 +424,7 @@ static int __init tahvo_init(void)
tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
- ret = platform_driver_register(&tahvo_driver);
+ ret = platform_driver_probe(&tahvo_driver, tahvo_probe);
if (ret)
goto err1;
--
1.7.3.rc0.35.g8ac8c
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFT/PATCH 0/8] cbus patches
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
` (7 preceding siblings ...)
2010-09-14 8:30 ` [RFT/PATCH 8/8] cbus: tahvo: avoid section mismatch Felipe Balbi
@ 2010-09-17 0:09 ` Tony Lindgren
2010-09-17 6:44 ` Felipe Balbi
8 siblings, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2010-09-17 0:09 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Linux OMAP Mailing List, Jarkko Nikula
* Felipe Balbi <balbi@ti.com> [100914 01:22]:
> Hi all,
>
> if you have n8x0/n770 board getting dust, please
> spend some minutes to boot test the following
> patches on that. After you do so, please reply
> with your Tested-by tag.
>
> I'm also adding to this series Jarkko Nikula's
> ioctl fix since l-o doesn't compile without that.
Seems to kick the watchdog on N800 at least after
the following fix. So I've pushed them all into the
cbus branch for more testing :)
Regards,
Tony
From: Tony Lindgren <tony@atomide.com>
Date: Thu, 16 Sep 2010 17:02:33 -0700
Subject: [PATCH] cbus: Fix retu init order
Device needs to be registered before the driver. Otherwise
the driver register will fail.
Eventually the device register will move to the board-*.c files.
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 1397366..4a072da 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -531,11 +531,11 @@ static int __init retu_init(void)
/* Set up correct gpio number on struct resource */
retu_resource[0].start = gpio_to_irq(retu_irq_pin);
- ret = platform_driver_probe(&retu_driver, retu_probe);
+ ret = platform_device_register(&retu_device);
if (ret < 0)
goto err1;
- ret = platform_device_register(&retu_device);
+ ret = platform_driver_probe(&retu_driver, retu_probe);
if (ret < 0)
goto err2;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFT/PATCH 0/8] cbus patches
2010-09-17 0:09 ` [RFT/PATCH 0/8] cbus patches Tony Lindgren
@ 2010-09-17 6:44 ` Felipe Balbi
0 siblings, 0 replies; 11+ messages in thread
From: Felipe Balbi @ 2010-09-17 6:44 UTC (permalink / raw)
To: Tony Lindgren; +Cc: Balbi, Felipe, Linux OMAP Mailing List, Jarkko Nikula
Hi,
On Thu, Sep 16, 2010 at 07:09:00PM -0500, Tony Lindgren wrote:
>diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
>index 1397366..4a072da 100644
>--- a/drivers/cbus/retu.c
>+++ b/drivers/cbus/retu.c
>@@ -531,11 +531,11 @@ static int __init retu_init(void)
> /* Set up correct gpio number on struct resource */
> retu_resource[0].start = gpio_to_irq(retu_irq_pin);
>
>- ret = platform_driver_probe(&retu_driver, retu_probe);
>+ ret = platform_device_register(&retu_device);
ok, good catch :-)
Thanks a lot.
--
balbi
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-09-17 6:45 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-14 8:30 [RFT/PATCH 0/8] cbus patches Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 1/8] cbus: Fix compile by converting ioctl calls to unlocked_ioctl calls Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 2/8] cbus: remove device_release completion Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 3/8] cbus: retu: pass irq number via struct resource Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 4/8] cbus: retu: avoid section mismatch Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 5/8] cbus: tahvo: usb: convert to platform_driver Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 6/8] cbus: tahvo: remove device_release Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 7/8] cbus: tahvo: pass irq via struct resource Felipe Balbi
2010-09-14 8:30 ` [RFT/PATCH 8/8] cbus: tahvo: avoid section mismatch Felipe Balbi
2010-09-17 0:09 ` [RFT/PATCH 0/8] cbus patches Tony Lindgren
2010-09-17 6:44 ` Felipe Balbi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.