aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/capi/capifs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index 91aafadd413f..6ae0edf29c85 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -32,7 +32,6 @@ static char *revision = "$Revision: 1.1.2.3 $";
32#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N') 32#define CAPIFS_SUPER_MAGIC (('C'<<8)|'N')
33 33
34static struct vfsmount *capifs_mnt; 34static struct vfsmount *capifs_mnt;
35static struct dentry *capifs_root;
36 35
37static struct { 36static struct {
38 int setuid; 37 int setuid;
@@ -118,7 +117,7 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
118 inode->i_fop = &simple_dir_operations; 117 inode->i_fop = &simple_dir_operations;
119 inode->i_nlink = 2; 118 inode->i_nlink = 2;
120 119
121 capifs_root = s->s_root = d_alloc_root(inode); 120 s->s_root = d_alloc_root(inode);
122 if (s->s_root) 121 if (s->s_root)
123 return 0; 122 return 0;
124 123
@@ -143,15 +142,17 @@ static struct file_system_type capifs_fs_type = {
143 142
144struct dentry *capifs_new_ncci(unsigned int number, dev_t device) 143struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
145{ 144{
145 struct super_block *s = capifs_mnt->mnt_sb;
146 struct dentry *root = s->s_root;
146 struct dentry *dentry; 147 struct dentry *dentry;
147 struct inode *inode; 148 struct inode *inode;
148 char name[10]; 149 char name[10];
149 int namelen; 150 int namelen;
150 151
151 mutex_lock(&capifs_root->d_inode->i_mutex); 152 mutex_lock(&root->d_inode->i_mutex);
152 153
153 namelen = sprintf(name, "%d", number); 154 namelen = sprintf(name, "%d", number);
154 dentry = lookup_one_len(name, capifs_root, namelen); 155 dentry = lookup_one_len(name, root, namelen);
155 if (IS_ERR(dentry)) { 156 if (IS_ERR(dentry)) {
156 dentry = NULL; 157 dentry = NULL;
157 goto unlock_out; 158 goto unlock_out;
@@ -163,7 +164,7 @@ struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
163 goto unlock_out; 164 goto unlock_out;
164 } 165 }
165 166
166 inode = new_inode(capifs_mnt->mnt_sb); 167 inode = new_inode(s);
167 if (!inode) { 168 if (!inode) {
168 dput(dentry); 169 dput(dentry);
169 dentry = NULL; 170 dentry = NULL;
@@ -181,19 +182,20 @@ struct dentry *capifs_new_ncci(unsigned int number, dev_t device)
181 dget(dentry); 182 dget(dentry);
182 183
183unlock_out: 184unlock_out:
184 mutex_unlock(&capifs_root->d_inode->i_mutex); 185 mutex_unlock(&root->d_inode->i_mutex);
185 186
186 return dentry; 187 return dentry;
187} 188}
188 189
189void capifs_free_ncci(struct dentry *dentry) 190void capifs_free_ncci(struct dentry *dentry)
190{ 191{
192 struct dentry *root = capifs_mnt->mnt_sb->s_root;
191 struct inode *inode; 193 struct inode *inode;
192 194
193 if (!dentry) 195 if (!dentry)
194 return; 196 return;
195 197
196 mutex_lock(&capifs_root->d_inode->i_mutex); 198 mutex_lock(&root->d_inode->i_mutex);
197 199
198 inode = dentry->d_inode; 200 inode = dentry->d_inode;
199 if (inode) { 201 if (inode) {
@@ -203,7 +205,7 @@ void capifs_free_ncci(struct dentry *dentry)
203 } 205 }
204 dput(dentry); 206 dput(dentry);
205 207
206 mutex_unlock(&capifs_root->d_inode->i_mutex); 208 mutex_unlock(&root->d_inode->i_mutex);
207} 209}
208 210
209static int __init capifs_init(void) 211static int __init capifs_init(void)