Commit f21c8fc3 authored by Patrick Mochel's avatar Patrick Mochel

driver model: make sure we call device_unregister() and not put_device()

when removing system and platform devices.
parent 007aa553
...@@ -39,7 +39,7 @@ int platform_device_register(struct platform_device * pdev) ...@@ -39,7 +39,7 @@ int platform_device_register(struct platform_device * pdev)
void platform_device_unregister(struct platform_device * pdev) void platform_device_unregister(struct platform_device * pdev)
{ {
if (pdev) if (pdev)
put_device(&pdev->dev); device_unregister(&pdev->dev);
} }
static int platform_match(struct device * dev, struct device_driver * drv) static int platform_match(struct device * dev, struct device_driver * drv)
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* add themselves as children of the system bus. * add themselves as children of the system bus.
*/ */
#define DEBUG 1
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -76,8 +78,8 @@ int sys_register_root(struct sys_root * root) ...@@ -76,8 +78,8 @@ int sys_register_root(struct sys_root * root)
*/ */
void sys_unegister_root(struct sys_root * root) void sys_unegister_root(struct sys_root * root)
{ {
put_device(&root->sysdev); device_unregister(&root->sysdev);
put_device(&root->dev); device_unregister(&root->dev);
} }
/** /**
...@@ -125,7 +127,7 @@ int sys_device_register(struct sys_device * sysdev) ...@@ -125,7 +127,7 @@ int sys_device_register(struct sys_device * sysdev)
void sys_device_unregister(struct sys_device * sysdev) void sys_device_unregister(struct sys_device * sysdev)
{ {
if (sysdev) if (sysdev)
put_device(&sysdev->dev); device_unregister(&sysdev->dev);
} }
struct bus_type system_bus_type = { struct bus_type system_bus_type = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment