Skip to content

Commit

Permalink
[WATCHDOG] move platform probe and remove function to devinit and dev…
Browse files Browse the repository at this point in the history
…exit

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>
  • Loading branch information
Wim Van Sebroeck committed Jun 18, 2009
1 parent a77dba7 commit b6bf291
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions drivers/watchdog/davinci_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static struct miscdevice davinci_wdt_miscdev = {
.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;
struct resource *res;
Expand Down Expand Up @@ -237,7 +237,7 @@ static int davinci_wdt_probe(struct platform_device *pdev)
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);
if (wdt_mem) {
Expand All @@ -254,7 +254,7 @@ static struct platform_driver platform_wdt_driver = {
.owner = THIS_MODULE,
},
.probe = davinci_wdt_probe,
.remove = davinci_wdt_remove,
.remove = __devexit_p(davinci_wdt_remove),
};

static int __init davinci_wdt_init(void)
Expand Down
6 changes: 3 additions & 3 deletions drivers/watchdog/mtx-1_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -229,7 +229,7 @@ static int mtx1_wdt_probe(struct platform_device *pdev)
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 ? */
if (mtx1_wdt_device.queue) {
Expand All @@ -242,7 +242,7 @@ static int mtx1_wdt_remove(struct platform_device *pdev)

static struct platform_driver mtx1_wdt = {
.probe = mtx1_wdt_probe,
.remove = mtx1_wdt_remove,
.remove = __devexit_p(mtx1_wdt_remove),
.driver.name = "mtx1-wdt",
.driver.owner = THIS_MODULE,
};
Expand Down
6 changes: 3 additions & 3 deletions drivers/watchdog/pnx4008_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static struct miscdevice pnx4008_wdt_miscdev = {
.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;
struct resource *res;
Expand Down Expand Up @@ -299,7 +299,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
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);
if (wdt_clk) {
Expand All @@ -321,7 +321,7 @@ static struct platform_driver platform_wdt_driver = {
.owner = THIS_MODULE,
},
.probe = pnx4008_wdt_probe,
.remove = pnx4008_wdt_remove,
.remove = __devexit_p(pnx4008_wdt_remove),
};

static int __init pnx4008_wdt_init(void)
Expand Down
4 changes: 2 additions & 2 deletions drivers/watchdog/rdc321x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
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) {
rdc321x_wdt_device.queue = 0;
Expand All @@ -259,7 +259,7 @@ static int rdc321x_wdt_remove(struct platform_device *pdev)

static struct platform_driver rdc321x_wdt_driver = {
.probe = rdc321x_wdt_probe,
.remove = rdc321x_wdt_remove,
.remove = __devexit_p(rdc321x_wdt_remove),
.driver = {
.owner = THIS_MODULE,
.name = "rdc321x-wdt",
Expand Down
6 changes: 3 additions & 3 deletions drivers/watchdog/rm9k_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
return platform_get_resource_byname(pdv, type, buf);
}

/* No hotplugging on the platform bus - use __init */
static int __init wdt_gpi_probe(struct platform_device *pdv)
/* No hotplugging on the platform bus - use __devinit */
static int __devinit wdt_gpi_probe(struct platform_device *pdv)
{
int res;
const struct resource
Expand All @@ -373,7 +373,7 @@ static int __init wdt_gpi_probe(struct platform_device *pdv)
return res;
}

static int __exit wdt_gpi_remove(struct platform_device *dev)
static int __devexit wdt_gpi_remove(struct platform_device *dev)
{
int res;

Expand Down

0 comments on commit b6bf291

Please sign in to comment.