aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/bin.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/bin.c')
-rw-r--r--fs/sysfs/bin.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 606267a36275..67a0d5030c96 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -23,7 +23,8 @@
23static int 23static int
24fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) 24fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count)
25{ 25{
26 struct bin_attribute * attr = to_bin_attr(dentry); 26 struct sysfs_dirent *attr_sd = dentry->d_fsdata;
27 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
27 struct kobject * kobj = to_kobj(dentry->d_parent); 28 struct kobject * kobj = to_kobj(dentry->d_parent);
28 29
29 if (!attr->read) 30 if (!attr->read)
@@ -65,7 +66,8 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
65static int 66static int
66flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) 67flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count)
67{ 68{
68 struct bin_attribute *attr = to_bin_attr(dentry); 69 struct sysfs_dirent *attr_sd = dentry->d_fsdata;
70 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
69 struct kobject *kobj = to_kobj(dentry->d_parent); 71 struct kobject *kobj = to_kobj(dentry->d_parent);
70 72
71 if (!attr->write) 73 if (!attr->write)
@@ -101,9 +103,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
101 103
102static int mmap(struct file *file, struct vm_area_struct *vma) 104static int mmap(struct file *file, struct vm_area_struct *vma)
103{ 105{
104 struct dentry *dentry = file->f_path.dentry; 106 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
105 struct bin_attribute *attr = to_bin_attr(dentry); 107 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
106 struct kobject *kobj = to_kobj(dentry->d_parent); 108 struct kobject *kobj = to_kobj(file->f_path.dentry->d_parent);
107 109
108 if (!attr->mmap) 110 if (!attr->mmap)
109 return -EINVAL; 111 return -EINVAL;
@@ -114,7 +116,8 @@ static int mmap(struct file *file, struct vm_area_struct *vma)
114static int open(struct inode * inode, struct file * file) 116static int open(struct inode * inode, struct file * file)
115{ 117{
116 struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent); 118 struct kobject *kobj = sysfs_get_kobject(file->f_path.dentry->d_parent);
117 struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); 119 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
120 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
118 int error = -EINVAL; 121 int error = -EINVAL;
119 122
120 if (!kobj || !attr) 123 if (!kobj || !attr)
@@ -150,7 +153,8 @@ static int open(struct inode * inode, struct file * file)
150static int release(struct inode * inode, struct file * file) 153static int release(struct inode * inode, struct file * file)
151{ 154{
152 struct kobject * kobj = to_kobj(file->f_path.dentry->d_parent); 155 struct kobject * kobj = to_kobj(file->f_path.dentry->d_parent);
153 struct bin_attribute * attr = to_bin_attr(file->f_path.dentry); 156 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
157 struct bin_attribute *attr = attr_sd->s_elem.bin_attr.bin_attr;
154 u8 * buffer = file->private_data; 158 u8 * buffer = file->private_data;
155 159
156 kobject_put(kobj); 160 kobject_put(kobj);