Quoting Tony Lindgren <tony@xxxxxxxxxxx>:
* Andrew de Quincey <adq_dvb@xxxxxxxxxxxxx> [090608 12:56]:
Recent changes in the drivers/base/platform.c exposed an inconsistency
in the cbus drivers; they weren't matching platform_divers with
platform_devices, which causes all sorts of structure casting issues
within the base platform code since it assumes this.
Signed-off-by: Andrew de Quincey <adq@xxxxxxxxxxxxx>
The patch seems to be missing from the mail?
gah, FAIL.
Attached :)
commit 20c2956fc541bb327f4a2df41dbe5ff50261749f
Author: Andrew de Quincey <adq@xxxxxxxxxxxxx>
Date: Mon May 25 22:56:01 2009 +0100
Fix cbus to use platform APIs
diff --git a/drivers/cbus/retu-rtc.c b/drivers/cbus/retu-rtc.c
index 1ebc33b..76343f9 100644
--- a/drivers/cbus/retu-rtc.c
+++ b/drivers/cbus/retu-rtc.c
@@ -361,7 +361,7 @@ static int retu_rtc_init_irq(void)
}
-static int __devinit retu_rtc_probe(struct device *dev)
+static int __devinit retu_rtc_probe(struct platform_device *pdev)
{
int r;
@@ -380,48 +380,49 @@ static int __devinit retu_rtc_probe(struct device *dev)
else
retu_rtc_do_reset();
- if ((r = device_create_file(dev, &dev_attr_time)) != 0)
+ if ((r = device_create_file(&(pdev->dev), &dev_attr_time)) != 0)
return r;
- else if ((r = device_create_file(dev, &dev_attr_reset)) != 0)
+ else if ((r = device_create_file(&(pdev->dev), &dev_attr_reset)) != 0)
goto err_unregister_time;
- else if ((r = device_create_file(dev, &dev_attr_alarm)) != 0)
+ else if ((r = device_create_file(&(pdev->dev), &dev_attr_alarm)) != 0)
goto err_unregister_reset;
- else if ((r = device_create_file(dev, &dev_attr_alarm_expired)) != 0)
+ else if ((r = device_create_file(&(pdev->dev), &dev_attr_alarm_expired)) != 0)
goto err_unregister_alarm;
- else if ((r = device_create_file(dev, &dev_attr_cal)) != 0)
+ else if ((r = device_create_file(&(pdev->dev), &dev_attr_cal)) != 0)
goto err_unregister_alarm_expired;
else
return r;
err_unregister_alarm_expired:
- device_remove_file(dev, &dev_attr_alarm_expired);
+ device_remove_file(&(pdev->dev), &dev_attr_alarm_expired);
err_unregister_alarm:
- device_remove_file(dev, &dev_attr_alarm);
+ device_remove_file(&(pdev->dev), &dev_attr_alarm);
err_unregister_reset:
- device_remove_file(dev, &dev_attr_reset);
+ device_remove_file(&(pdev->dev), &dev_attr_reset);
err_unregister_time:
- device_remove_file(dev, &dev_attr_time);
+ device_remove_file(&(pdev->dev), &dev_attr_time);
return r;
}
-static int __devexit retu_rtc_remove(struct device *dev)
+static int __devexit retu_rtc_remove(struct platform_device *pdev)
{
retu_disable_irq(RETU_INT_RTCS);
retu_free_irq(RETU_INT_RTCS);
retu_free_irq(RETU_INT_RTCA);
- device_remove_file(dev, &dev_attr_cal);
- device_remove_file(dev, &dev_attr_alarm_expired);
- device_remove_file(dev, &dev_attr_alarm);
- device_remove_file(dev, &dev_attr_reset);
- device_remove_file(dev, &dev_attr_time);
+ device_remove_file(&(pdev->dev), &dev_attr_cal);
+ device_remove_file(&(pdev->dev), &dev_attr_alarm_expired);
+ device_remove_file(&(pdev->dev), &dev_attr_alarm);
+ device_remove_file(&(pdev->dev), &dev_attr_reset);
+ device_remove_file(&(pdev->dev), &dev_attr_time);
return 0;
}
-static struct device_driver retu_rtc_driver = {
- .name = "retu-rtc",
- .bus = &platform_bus_type,
+static struct platform_driver retu_rtc_driver = {
.probe = retu_rtc_probe,
.remove = __devexit_p(retu_rtc_remove),
+ .driver = {
+ .name = "retu-rtc",
+ }
};
static struct platform_device retu_rtc_device = {
@@ -448,7 +449,7 @@ static int __init retu_rtc_init(void)
init_completion(&retu_rtc_exited);
- if ((ret = driver_register(&retu_rtc_driver)) != 0)
+ if ((ret = platform_driver_register(&retu_rtc_driver)) != 0)
return ret;
if ((ret = platform_device_register(&retu_rtc_device)) != 0)
@@ -457,14 +458,14 @@ static int __init retu_rtc_init(void)
return 0;
err_unregister_driver:
- driver_unregister(&retu_rtc_driver);
+ platform_driver_unregister(&retu_rtc_driver);
return ret;
}
static void __exit retu_rtc_exit(void)
{
platform_device_unregister(&retu_rtc_device);
- driver_unregister(&retu_rtc_driver);
+ platform_driver_unregister(&retu_rtc_driver);
wait_for_completion(&retu_rtc_exited);
}
diff --git a/drivers/cbus/retu-wdt.c b/drivers/cbus/retu-wdt.c
index b7b20b7..1fa181e 100644
--- a/drivers/cbus/retu-wdt.c
+++ b/drivers/cbus/retu-wdt.c
@@ -104,20 +104,20 @@ static DEVICE_ATTR(period, S_IRUGO | S_IWUSR, retu_wdt_period_show, \
retu_wdt_period_store);
static DEVICE_ATTR(counter, S_IRUGO, retu_wdt_counter_show, NULL);
-static int __devinit retu_wdt_probe(struct device *dev)
+static int __devinit retu_wdt_probe(struct platform_device *pdev)
{
int ret;
- ret = device_create_file(dev, &dev_attr_period);
+ ret = device_create_file(&(pdev->dev), &dev_attr_period);
if (ret) {
printk(KERN_ERR "retu_wdt_probe: Error creating "
"sys device file: period\n");
return ret;
}
- ret = device_create_file(dev, &dev_attr_counter);
+ ret = device_create_file(&(pdev->dev), &dev_attr_counter);
if (ret) {
- device_remove_file(dev, &dev_attr_period);
+ device_remove_file(&(pdev->dev), &dev_attr_period);
printk(KERN_ERR "retu_wdt_probe: Error creating "
"sys device file: counter\n");
}
@@ -125,10 +125,10 @@ static int __devinit retu_wdt_probe(struct device *dev)
return ret;
}
-static int __devexit retu_wdt_remove(struct device *dev)
+static int __devexit retu_wdt_remove(struct platform_device *pdev)
{
- device_remove_file(dev, &dev_attr_period);
- device_remove_file(dev, &dev_attr_counter);
+ device_remove_file(&(pdev->dev), &dev_attr_period);
+ device_remove_file(&(pdev->dev), &dev_attr_counter);
return 0;
}
@@ -145,11 +145,12 @@ static struct platform_device retu_wdt_device = {
},
};
-static struct device_driver retu_wdt_driver = {
- .name = "retu-watchdog",
- .bus = &platform_bus_type,
+static struct platform_driver retu_wdt_driver = {
.probe = retu_wdt_probe,
.remove = __devexit_p(retu_wdt_remove),
+ .driver = {
+ .name = "retu-watchdog",
+ }
};
static int __init retu_wdt_init(void)
@@ -158,7 +159,7 @@ static int __init retu_wdt_init(void)
init_completion(&retu_wdt_completion);
- ret = driver_register(&retu_wdt_driver);
+ ret = platform_driver_register(&retu_wdt_driver);
if (ret)
return ret;
@@ -178,7 +179,7 @@ static int __init retu_wdt_init(void)
return ret;
exit1:
- driver_unregister(&retu_wdt_driver);
+ platform_driver_unregister(&retu_wdt_driver);
wait_for_completion(&retu_wdt_completion);
return ret;
@@ -187,7 +188,7 @@ exit1:
static void __exit retu_wdt_exit(void)
{
platform_device_unregister(&retu_wdt_device);
- driver_unregister(&retu_wdt_driver);
+ platform_driver_unregister(&retu_wdt_driver);
wait_for_completion(&retu_wdt_completion);
}
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 84d7840..d9f28d5 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -5,7 +5,7 @@
*
* Copyright (C) 2004, 2005 Nokia Corporation
*
- * Written by Juha Yrj�<juha.yrjola@xxxxxxxxx>,
+ * Written by Juha Yrjölä <juha.yrjola@xxxxxxxxx>,
* David Weinehall <david.weinehall@xxxxxxxxx>, and
* Mikko Ylinen <mikko.k.ylinen@xxxxxxxxx>
*
@@ -319,7 +319,7 @@ static void retu_power_off(void)
* Probe for the Retu ASIC and allocate memory
* for its device-struct if found
*/
-static int __devinit retu_probe(struct device *dev)
+static int __devinit retu_probe(struct platform_device *pdev)
{
const struct omap_em_asic_bb5_config * em_asic_config;
int rev, ret;
@@ -384,7 +384,7 @@ static int __devinit retu_probe(struct device *dev)
return 0;
}
-static int retu_remove(struct device *dev)
+static int retu_remove(struct platform_device *pdev)
{
#ifdef CONFIG_CBUS_RETU_USER
retu_user_cleanup();
@@ -403,11 +403,12 @@ static void retu_device_release(struct device *dev)
complete(&device_release);
}
-static struct device_driver retu_driver = {
- .name = "retu",
- .bus = &platform_bus_type,
+static struct platform_driver retu_driver = {
.probe = retu_probe,
.remove = retu_remove,
+ .driver = {
+ .name = "retu",
+ }
};
static struct platform_device retu_device = {
@@ -431,11 +432,11 @@ static int __init retu_init(void)
init_completion(&device_release);
- if ((ret = driver_register(&retu_driver)) < 0)
+ if ((ret = platform_driver_register(&retu_driver)) < 0)
return ret;
if ((ret = platform_device_register(&retu_device)) < 0) {
- driver_unregister(&retu_driver);
+ platform_driver_unregister(&retu_driver);
return ret;
}
return 0;
@@ -447,7 +448,7 @@ static int __init retu_init(void)
static void __exit retu_exit(void)
{
platform_device_unregister(&retu_device);
- driver_unregister(&retu_driver);
+ platform_driver_unregister(&retu_driver);
wait_for_completion(&device_release);
}
@@ -464,4 +465,4 @@ module_exit(retu_exit);
MODULE_DESCRIPTION("Retu ASIC control");
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Juha Yrj� David Weinehall, and Mikko Ylinen");
+MODULE_AUTHOR("Juha Yrj�l�, David Weinehall, and Mikko Ylinen");
diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index d8ad836..df74d28 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -9,9 +9,9 @@
* Copyright (C) 2004 Texas Instruments
* Copyright (C) 2004 David Brownell
*
- * Written by Juha Yrj�<juha.yrjola@xxxxxxxxx>,
+ * Written by Juha Yrjölä <juha.yrjola@xxxxxxxxx>,
* Tony Lindgren <tony@xxxxxxxxxxx>, and
- * Timo Ter�<timo.teras@xxxxxxxxx>
+ * Timo Ter�s <timo.teras@xxxxxxxxx>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file "COPYING" in the main directory of this
@@ -186,11 +186,11 @@ static int omap_otg_init(void)
return 0;
}
-static int omap_otg_probe(struct device *dev)
+static int omap_otg_probe(struct platform_device *pdev)
{
int ret;
- tahvo_otg_dev = to_platform_device(dev);
+ tahvo_otg_dev = pdev;
ret = omap_otg_init();
if (ret != 0) {
printk(KERN_ERR "tahvo-usb: omap_otg_init failed\n");
@@ -202,19 +202,21 @@ static int omap_otg_probe(struct device *dev)
&tahvo_usb_device);
}
-static int omap_otg_remove(struct device *dev)
+static int omap_otg_remove(struct platform_device *pdev)
{
- free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
+ if (tahvo_otg_dev != NULL)
+ free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
tahvo_otg_dev = NULL;
return 0;
}
-struct device_driver omap_otg_driver = {
- .name = "omap_otg",
- .bus = &platform_bus_type,
+struct platform_driver omap_otg_driver = {
.probe = omap_otg_probe,
.remove = omap_otg_remove,
+ .driver = {
+ .name = "omap_otg",
+ }
};
/*
@@ -641,19 +643,19 @@ 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 tahvo_usb_probe(struct platform_device *pdev)
{
struct tahvo_usb *tu;
int ret;
- dev_dbg(dev, "probe\n");
+ dev_dbg(&(pdev->dev), "probe\n");
/* Create driver data */
tu = kmalloc(sizeof(*tu), GFP_KERNEL);
if (!tu)
return -ENOMEM;
memset(tu, 0, sizeof(*tu));
- tu->pt_dev = container_of(dev, struct platform_device, dev);
+ tu->pt_dev = pdev;
#ifdef CONFIG_USB_OTG
/* Default mode */
#ifdef CONFIG_CBUS_TAHVO_USB_HOST_BY_DEFAULT
@@ -680,9 +682,9 @@ static int tahvo_usb_probe(struct device *dev)
}
/* Attributes */
- ret = device_create_file(dev, &dev_attr_vbus_state);
+ ret = device_create_file(&(pdev->dev), &dev_attr_vbus_state);
#ifdef CONFIG_USB_OTG
- ret |= device_create_file(dev, &dev_attr_otg_mode);
+ ret |= device_create_file(&(pdev->dev), &dev_attr_otg_mode);
#endif
if (ret)
printk(KERN_ERR "attribute creation failed: %d\n", ret);
@@ -706,7 +708,7 @@ static int tahvo_usb_probe(struct device *dev)
return ret;
}
- dev->driver_data = tu;
+ pdev->dev.driver_data = tu;
/* Act upon current vbus state once at startup. A vbus state irq may or
* may not be generated in addition to this. */
@@ -714,25 +716,26 @@ static int tahvo_usb_probe(struct device *dev)
return 0;
}
-static int tahvo_usb_remove(struct device *dev)
+static int 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,
+static struct platform_driver tahvo_usb_driver = {
.probe = tahvo_usb_probe,
.remove = tahvo_usb_remove,
+ .driver = {
+ .name = "tahvo-usb",
+ }
};
static struct platform_device tahvo_usb_device = {
@@ -745,18 +748,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_register(&tahvo_usb_driver);
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_register(&omap_otg_driver);
if (ret) {
platform_device_unregister(&tahvo_usb_device);
- driver_unregister(&tahvo_usb_driver);
+ platform_driver_unregister(&tahvo_usb_driver);
return ret;
}
return 0;
@@ -766,12 +769,12 @@ 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);
MODULE_DESCRIPTION("Tahvo USB OTG Transceiver Driver");
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Juha Yrj� Tony Lindgren, and Timo Ter�);
+MODULE_AUTHOR("Juha Yrj�l�, Tony Lindgren, and Timo Ter�s");
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index e734c4c..29fd4b8 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -5,7 +5,7 @@
*
* Copyright (C) 2004, 2005 Nokia Corporation
*
- * Written by Juha Yrj�<juha.yrjola@xxxxxxxxx>,
+ * Written by Juha Yrj�l� <juha.yrjola@xxxxxxxxx>,
* David Weinehall <david.weinehall@xxxxxxxxx>, and
* Mikko Ylinen <mikko.k.ylinen@xxxxxxxxx>
*
@@ -287,7 +287,7 @@ void tahvo_free_irq(int id)
* Probe for the Tahvo ASIC and allocate memory
* for its device-struct if found
*/
-static int __devinit tahvo_probe(struct device *dev)
+static int __devinit tahvo_probe(struct platform_device *pdev)
{
const struct omap_em_asic_bb5_config * em_asic_config;
int rev, id, ret;
@@ -356,7 +356,7 @@ static int __devinit tahvo_probe(struct device *dev)
return 0;
}
-static int tahvo_remove(struct device *dev)
+static int tahvo_remove(struct platform_device *pdev)
{
#ifdef CONFIG_CBUS_TAHVO_USER
tahvo_user_cleanup();
@@ -375,11 +375,12 @@ static void tahvo_device_release(struct device *dev)
complete(&device_release);
}
-static struct device_driver tahvo_driver = {
- .name = "tahvo",
- .bus = &platform_bus_type,
+static struct platform_driver tahvo_driver = {
.probe = tahvo_probe,
.remove = tahvo_remove,
+ .driver = {
+ .name = "tahvo",
+ }
};
static struct platform_device tahvo_device = {
@@ -403,11 +404,11 @@ static int __init tahvo_init(void)
init_completion(&device_release);
- if ((ret = driver_register(&tahvo_driver)) < 0)
+ if ((ret = platform_driver_register(&tahvo_driver)) < 0)
return ret;
if ((ret = platform_device_register(&tahvo_device)) < 0) {
- driver_unregister(&tahvo_driver);
+ platform_driver_unregister(&tahvo_driver);
return ret;
}
return 0;
@@ -419,7 +420,7 @@ static int __init tahvo_init(void)
static void __exit tahvo_exit(void)
{
platform_device_unregister(&tahvo_device);
- driver_unregister(&tahvo_driver);
+ platform_driver_unregister(&tahvo_driver);
wait_for_completion(&device_release);
}
@@ -439,4 +440,4 @@ module_exit(tahvo_exit);
MODULE_DESCRIPTION("Tahvo ASIC control");
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Juha Yrj� David Weinehall, and Mikko Ylinen");
+MODULE_AUTHOR("Juha Yrj�l�, David Weinehall, and Mikko Ylinen");