Commit 67d93a0a authored by Patrick Mochel's avatar Patrick Mochel

Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
parents 9beb225e 473c7105
......@@ -259,34 +259,22 @@ struct device * get_device(struct device * dev)
*/
void put_device(struct device * dev)
{
struct device * parent;
if (!atomic_dec_and_lock(&dev->refcount,&device_lock))
return;
parent = dev->parent;
dev->parent = NULL;
list_del_init(&dev->node);
list_del_init(&dev->g_list);
list_del_init(&dev->bus_list);
list_del_init(&dev->driver_list);
spin_unlock(&device_lock);
BUG_ON(dev->present);
if (dev->release)
dev->release(dev);
if (parent)
put_device(parent);
device_del(dev);
}
void device_del(struct device * dev)
{
spin_lock(&device_lock);
dev->present = 0;
list_del_init(&dev->node);
list_del_init(&dev->g_list);
list_del_init(&dev->bus_list);
list_del_init(&dev->driver_list);
spin_unlock(&device_lock);
pr_debug("DEV: Unregistering device. ID = '%s', name = '%s'\n",
dev->bus_id,dev->name);
struct device * parent = dev->parent;
/* Notify the platform of the removal, in case they
* need to do anything...
......@@ -302,6 +290,12 @@ void device_del(struct device * dev)
/* remove the driverfs directory */
device_remove_dir(dev);
if (dev->release)
dev->release(dev);
if (parent)
put_device(parent);
}
/**
......@@ -315,22 +309,15 @@ void device_del(struct device * dev)
*/
void device_unregister(struct device * dev)
{
device_del(dev);
put_device(dev);
}
static int __init device_init(void)
{
int error;
spin_lock(&device_lock);
dev->present = 0;
spin_unlock(&device_lock);
error = init_driverfs_fs();
if (error)
panic("DEV: could not initialize driverfs");
return 0;
pr_debug("DEV: Unregistering device. ID = '%s', name = '%s'\n",
dev->bus_id,dev->name);
put_device(dev);
}
core_initcall(device_init);
EXPORT_SYMBOL(device_register);
EXPORT_SYMBOL(device_unregister);
EXPORT_SYMBOL(get_device);
......
......@@ -509,11 +509,13 @@ static void put_mount(void)
DBG("driverfs: mount_count = %d\n",mount_count);
}
int __init init_driverfs_fs(void)
static int __init driverfs_init(void)
{
return register_filesystem(&driverfs_fs_type);
}
core_initcall(driverfs_init);
static struct dentry * get_dentry(struct dentry * parent, const char * name)
{
struct qstr qstr;
......
......@@ -65,6 +65,4 @@ driverfs_create_symlink(struct driver_dir_entry * parent,
extern void
driverfs_remove_file(struct driver_dir_entry *, const char * name);
extern int init_driverfs_fs(void);
#endif /* _DDFS_H_ */
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