Commit 99db4061 authored by Patrick Mochel's avatar Patrick Mochel

driverfs: don't dynamically allocate and duplicate struct driver_file_entry's any more

Now that all unique information about struct driver_file_entry's are gone (the dentry and parent pointers), 
the data in them is shared among all users of the entry. So, we don't have any reason to dynamically allocate
and duplicate the data anymore.
parent 916c2ff4
...@@ -26,23 +26,13 @@ extern struct driver_file_entry * device_default_files[]; ...@@ -26,23 +26,13 @@ extern struct driver_file_entry * device_default_files[];
*/ */
int device_create_file(struct device * dev, struct driver_file_entry * entry) int device_create_file(struct device * dev, struct driver_file_entry * entry)
{ {
struct driver_file_entry * new_entry; int error = -EINVAL;
int error = -ENOMEM;
if (!dev) if (dev) {
return -EINVAL;
get_device(dev); get_device(dev);
error = driverfs_create_file(entry,&dev->dir);
new_entry = kmalloc(sizeof(*new_entry),GFP_KERNEL);
if (!new_entry)
goto done;
memcpy(new_entry,entry,sizeof(*entry));
error = driverfs_create_file(new_entry,&dev->dir);
if (error)
kfree(new_entry);
done:
put_device(dev); put_device(dev);
}
return error; return error;
} }
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
static struct super_operations driverfs_ops; static struct super_operations driverfs_ops;
static struct file_operations driverfs_file_operations; static struct file_operations driverfs_file_operations;
static struct inode_operations driverfs_dir_inode_operations; static struct inode_operations driverfs_dir_inode_operations;
static struct dentry_operations driverfs_dentry_file_ops;
static struct address_space_operations driverfs_aops; static struct address_space_operations driverfs_aops;
static struct vfsmount *driverfs_mount; static struct vfsmount *driverfs_mount;
...@@ -161,7 +160,6 @@ static int driverfs_create(struct inode *dir, struct dentry *dentry, int mode) ...@@ -161,7 +160,6 @@ static int driverfs_create(struct inode *dir, struct dentry *dentry, int mode)
{ {
int res; int res;
mode = (mode & S_IALLUGO) | S_IFREG; mode = (mode & S_IALLUGO) | S_IFREG;
dentry->d_op = &driverfs_dentry_file_ops;
res = driverfs_mknod(dir, dentry, mode, 0); res = driverfs_mknod(dir, dentry, mode, 0);
return res; return res;
} }
...@@ -441,16 +439,6 @@ static int driverfs_release(struct inode * inode, struct file * filp) ...@@ -441,16 +439,6 @@ static int driverfs_release(struct inode * inode, struct file * filp)
return 0; return 0;
} }
static int driverfs_d_delete_file (struct dentry * dentry)
{
struct driver_file_entry * entry;
entry = (struct driver_file_entry *)dentry->d_fsdata;
if (entry)
kfree(entry);
return 0;
}
static struct file_operations driverfs_file_operations = { static struct file_operations driverfs_file_operations = {
.read = driverfs_read_file, .read = driverfs_read_file,
.write = driverfs_write_file, .write = driverfs_write_file,
...@@ -470,10 +458,6 @@ static struct address_space_operations driverfs_aops = { ...@@ -470,10 +458,6 @@ static struct address_space_operations driverfs_aops = {
.commit_write = driverfs_commit_write .commit_write = driverfs_commit_write
}; };
static struct dentry_operations driverfs_dentry_file_ops = {
.d_delete = driverfs_d_delete_file,
};
static struct super_operations driverfs_ops = { static struct super_operations driverfs_ops = {
.statfs = simple_statfs, .statfs = simple_statfs,
.drop_inode = generic_delete_inode, .drop_inode = generic_delete_inode,
......
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