[WATCHDOG] move platform probe and remove function to devinit and devexit
A pointer to probe and remove functions is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
a77dba7e44
commit
b6bf291f1c
5 changed files with 14 additions and 14 deletions
|
@ -193,7 +193,7 @@ static struct miscdevice davinci_wdt_miscdev = {
|
||||||
.fops = &davinci_wdt_fops,
|
.fops = &davinci_wdt_fops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int davinci_wdt_probe(struct platform_device *pdev)
|
static int __devinit davinci_wdt_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int ret = 0, size;
|
int ret = 0, size;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
@ -237,7 +237,7 @@ static int davinci_wdt_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int davinci_wdt_remove(struct platform_device *pdev)
|
static int __devexit davinci_wdt_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
misc_deregister(&davinci_wdt_miscdev);
|
misc_deregister(&davinci_wdt_miscdev);
|
||||||
if (wdt_mem) {
|
if (wdt_mem) {
|
||||||
|
@ -254,7 +254,7 @@ static struct platform_driver platform_wdt_driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
},
|
},
|
||||||
.probe = davinci_wdt_probe,
|
.probe = davinci_wdt_probe,
|
||||||
.remove = davinci_wdt_remove,
|
.remove = __devexit_p(davinci_wdt_remove),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init davinci_wdt_init(void)
|
static int __init davinci_wdt_init(void)
|
||||||
|
|
|
@ -206,7 +206,7 @@ static struct miscdevice mtx1_wdt_misc = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int mtx1_wdt_probe(struct platform_device *pdev)
|
static int __devinit mtx1_wdt_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ static int mtx1_wdt_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mtx1_wdt_remove(struct platform_device *pdev)
|
static int __devexit mtx1_wdt_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
/* FIXME: do we need to lock this test ? */
|
/* FIXME: do we need to lock this test ? */
|
||||||
if (mtx1_wdt_device.queue) {
|
if (mtx1_wdt_device.queue) {
|
||||||
|
@ -242,7 +242,7 @@ static int mtx1_wdt_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
static struct platform_driver mtx1_wdt = {
|
static struct platform_driver mtx1_wdt = {
|
||||||
.probe = mtx1_wdt_probe,
|
.probe = mtx1_wdt_probe,
|
||||||
.remove = mtx1_wdt_remove,
|
.remove = __devexit_p(mtx1_wdt_remove),
|
||||||
.driver.name = "mtx1-wdt",
|
.driver.name = "mtx1-wdt",
|
||||||
.driver.owner = THIS_MODULE,
|
.driver.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
|
@ -246,7 +246,7 @@ static struct miscdevice pnx4008_wdt_miscdev = {
|
||||||
.fops = &pnx4008_wdt_fops,
|
.fops = &pnx4008_wdt_fops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pnx4008_wdt_probe(struct platform_device *pdev)
|
static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int ret = 0, size;
|
int ret = 0, size;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
@ -299,7 +299,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pnx4008_wdt_remove(struct platform_device *pdev)
|
static int __devexit pnx4008_wdt_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
misc_deregister(&pnx4008_wdt_miscdev);
|
misc_deregister(&pnx4008_wdt_miscdev);
|
||||||
if (wdt_clk) {
|
if (wdt_clk) {
|
||||||
|
@ -321,7 +321,7 @@ static struct platform_driver platform_wdt_driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
},
|
},
|
||||||
.probe = pnx4008_wdt_probe,
|
.probe = pnx4008_wdt_probe,
|
||||||
.remove = pnx4008_wdt_remove,
|
.remove = __devexit_p(pnx4008_wdt_remove),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init pnx4008_wdt_init(void)
|
static int __init pnx4008_wdt_init(void)
|
||||||
|
|
|
@ -245,7 +245,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rdc321x_wdt_remove(struct platform_device *pdev)
|
static int __devexit rdc321x_wdt_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
if (rdc321x_wdt_device.queue) {
|
if (rdc321x_wdt_device.queue) {
|
||||||
rdc321x_wdt_device.queue = 0;
|
rdc321x_wdt_device.queue = 0;
|
||||||
|
@ -259,7 +259,7 @@ static int rdc321x_wdt_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
static struct platform_driver rdc321x_wdt_driver = {
|
static struct platform_driver rdc321x_wdt_driver = {
|
||||||
.probe = rdc321x_wdt_probe,
|
.probe = rdc321x_wdt_probe,
|
||||||
.remove = rdc321x_wdt_remove,
|
.remove = __devexit_p(rdc321x_wdt_remove),
|
||||||
.driver = {
|
.driver = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.name = "rdc321x-wdt",
|
.name = "rdc321x-wdt",
|
||||||
|
|
|
@ -345,8 +345,8 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
|
||||||
return platform_get_resource_byname(pdv, type, buf);
|
return platform_get_resource_byname(pdv, type, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No hotplugging on the platform bus - use __init */
|
/* No hotplugging on the platform bus - use __devinit */
|
||||||
static int __init wdt_gpi_probe(struct platform_device *pdv)
|
static int __devinit wdt_gpi_probe(struct platform_device *pdv)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
const struct resource
|
const struct resource
|
||||||
|
@ -373,7 +373,7 @@ static int __init wdt_gpi_probe(struct platform_device *pdv)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __exit wdt_gpi_remove(struct platform_device *dev)
|
static int __devexit wdt_gpi_remove(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue