.. | .. |
---|
183 | 183 | return 0; |
---|
184 | 184 | } |
---|
185 | 185 | |
---|
186 | | -static int fpuemustats_clear_open(struct inode *inode, struct file *file) |
---|
187 | | -{ |
---|
188 | | - return single_open(file, fpuemustats_clear_show, inode->i_private); |
---|
189 | | -} |
---|
190 | | - |
---|
191 | | -static const struct file_operations fpuemustats_clear_fops = { |
---|
192 | | - .open = fpuemustats_clear_open, |
---|
193 | | - .read = seq_read, |
---|
194 | | - .llseek = seq_lseek, |
---|
195 | | - .release = single_release, |
---|
196 | | -}; |
---|
| 186 | +DEFINE_SHOW_ATTRIBUTE(fpuemustats_clear); |
---|
197 | 187 | |
---|
198 | 188 | static int __init debugfs_fpuemu(void) |
---|
199 | 189 | { |
---|
200 | 190 | struct dentry *fpuemu_debugfs_base_dir; |
---|
201 | 191 | struct dentry *fpuemu_debugfs_inst_dir; |
---|
202 | | - struct dentry *d, *reset_file; |
---|
203 | | - |
---|
204 | | - if (!mips_debugfs_dir) |
---|
205 | | - return -ENODEV; |
---|
| 192 | + char name[32]; |
---|
206 | 193 | |
---|
207 | 194 | fpuemu_debugfs_base_dir = debugfs_create_dir("fpuemustats", |
---|
208 | 195 | mips_debugfs_dir); |
---|
209 | | - if (!fpuemu_debugfs_base_dir) |
---|
210 | | - return -ENOMEM; |
---|
211 | 196 | |
---|
212 | | - reset_file = debugfs_create_file("fpuemustats_clear", 0444, |
---|
213 | | - mips_debugfs_dir, NULL, |
---|
214 | | - &fpuemustats_clear_fops); |
---|
215 | | - if (!reset_file) |
---|
216 | | - return -ENOMEM; |
---|
| 197 | + debugfs_create_file("fpuemustats_clear", 0444, mips_debugfs_dir, NULL, |
---|
| 198 | + &fpuemustats_clear_fops); |
---|
217 | 199 | |
---|
218 | 200 | #define FPU_EMU_STAT_OFFSET(m) \ |
---|
219 | 201 | offsetof(struct mips_fpu_emulator_stats, m) |
---|
220 | 202 | |
---|
221 | 203 | #define FPU_STAT_CREATE(m) \ |
---|
222 | 204 | do { \ |
---|
223 | | - d = debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \ |
---|
| 205 | + debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \ |
---|
224 | 206 | (void *)FPU_EMU_STAT_OFFSET(m), \ |
---|
225 | 207 | &fops_fpuemu_stat); \ |
---|
226 | | - if (!d) \ |
---|
227 | | - return -ENOMEM; \ |
---|
228 | 208 | } while (0) |
---|
229 | 209 | |
---|
230 | 210 | FPU_STAT_CREATE(emulated); |
---|
.. | .. |
---|
243 | 223 | |
---|
244 | 224 | fpuemu_debugfs_inst_dir = debugfs_create_dir("instructions", |
---|
245 | 225 | fpuemu_debugfs_base_dir); |
---|
246 | | - if (!fpuemu_debugfs_inst_dir) |
---|
247 | | - return -ENOMEM; |
---|
248 | 226 | |
---|
249 | 227 | #define FPU_STAT_CREATE_EX(m) \ |
---|
250 | 228 | do { \ |
---|
251 | | - char name[32]; \ |
---|
252 | | - \ |
---|
253 | 229 | adjust_instruction_counter_name(name, #m); \ |
---|
254 | 230 | \ |
---|
255 | | - d = debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ |
---|
| 231 | + debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \ |
---|
256 | 232 | (void *)FPU_EMU_STAT_OFFSET(m), \ |
---|
257 | 233 | &fops_fpuemu_stat); \ |
---|
258 | | - if (!d) \ |
---|
259 | | - return -ENOMEM; \ |
---|
260 | 234 | } while (0) |
---|
261 | 235 | |
---|
262 | 236 | FPU_STAT_CREATE_EX(abs_s); |
---|