| .. | .. |
|---|
| 222 | 222 | while (bit < bitsize) { |
|---|
| 223 | 223 | zero = find_next_zero_bit(fault->opcodes, bitsize, bit); |
|---|
| 224 | 224 | if (zero - 1 != bit) |
|---|
| 225 | | - size += snprintf(data + size, |
|---|
| 225 | + size += scnprintf(data + size, |
|---|
| 226 | 226 | datalen - size - 1, |
|---|
| 227 | 227 | "0x%lx-0x%lx,", bit, zero - 1); |
|---|
| 228 | 228 | else |
|---|
| 229 | | - size += snprintf(data + size, |
|---|
| 229 | + size += scnprintf(data + size, |
|---|
| 230 | 230 | datalen - size - 1, "0x%lx,", |
|---|
| 231 | 231 | bit); |
|---|
| 232 | 232 | bit = find_next_bit(fault->opcodes, bitsize, zero); |
|---|
| .. | .. |
|---|
| 259 | 259 | int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd) |
|---|
| 260 | 260 | { |
|---|
| 261 | 261 | struct dentry *parent = ibd->hfi1_ibdev_dbg; |
|---|
| 262 | + struct dentry *fault_dir; |
|---|
| 262 | 263 | |
|---|
| 263 | 264 | ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL); |
|---|
| 264 | 265 | if (!ibd->fault) |
|---|
| .. | .. |
|---|
| 278 | 279 | bitmap_zero(ibd->fault->opcodes, |
|---|
| 279 | 280 | sizeof(ibd->fault->opcodes) * BITS_PER_BYTE); |
|---|
| 280 | 281 | |
|---|
| 281 | | - ibd->fault->dir = |
|---|
| 282 | | - fault_create_debugfs_attr("fault", parent, |
|---|
| 283 | | - &ibd->fault->attr); |
|---|
| 284 | | - if (IS_ERR(ibd->fault->dir)) { |
|---|
| 282 | + fault_dir = |
|---|
| 283 | + fault_create_debugfs_attr("fault", parent, &ibd->fault->attr); |
|---|
| 284 | + if (IS_ERR(fault_dir)) { |
|---|
| 285 | 285 | kfree(ibd->fault); |
|---|
| 286 | 286 | ibd->fault = NULL; |
|---|
| 287 | 287 | return -ENOENT; |
|---|
| 288 | 288 | } |
|---|
| 289 | + ibd->fault->dir = fault_dir; |
|---|
| 289 | 290 | |
|---|
| 290 | | - DEBUGFS_SEQ_FILE_CREATE(fault_stats, ibd->fault->dir, ibd); |
|---|
| 291 | | - if (!debugfs_create_bool("enable", 0600, ibd->fault->dir, |
|---|
| 292 | | - &ibd->fault->enable)) |
|---|
| 293 | | - goto fail; |
|---|
| 294 | | - if (!debugfs_create_bool("suppress_err", 0600, |
|---|
| 295 | | - ibd->fault->dir, |
|---|
| 296 | | - &ibd->fault->suppress_err)) |
|---|
| 297 | | - goto fail; |
|---|
| 298 | | - if (!debugfs_create_bool("opcode_mode", 0600, ibd->fault->dir, |
|---|
| 299 | | - &ibd->fault->opcode)) |
|---|
| 300 | | - goto fail; |
|---|
| 301 | | - if (!debugfs_create_file("opcodes", 0600, ibd->fault->dir, |
|---|
| 302 | | - ibd->fault, &__fault_opcodes_fops)) |
|---|
| 303 | | - goto fail; |
|---|
| 304 | | - if (!debugfs_create_u64("skip_pkts", 0600, |
|---|
| 305 | | - ibd->fault->dir, |
|---|
| 306 | | - &ibd->fault->fault_skip)) |
|---|
| 307 | | - goto fail; |
|---|
| 308 | | - if (!debugfs_create_u64("skip_usec", 0600, |
|---|
| 309 | | - ibd->fault->dir, |
|---|
| 310 | | - &ibd->fault->fault_skip_usec)) |
|---|
| 311 | | - goto fail; |
|---|
| 312 | | - if (!debugfs_create_u8("direction", 0600, ibd->fault->dir, |
|---|
| 313 | | - &ibd->fault->direction)) |
|---|
| 314 | | - goto fail; |
|---|
| 291 | + debugfs_create_file("fault_stats", 0444, fault_dir, ibd, |
|---|
| 292 | + &_fault_stats_file_ops); |
|---|
| 293 | + debugfs_create_bool("enable", 0600, fault_dir, &ibd->fault->enable); |
|---|
| 294 | + debugfs_create_bool("suppress_err", 0600, fault_dir, |
|---|
| 295 | + &ibd->fault->suppress_err); |
|---|
| 296 | + debugfs_create_bool("opcode_mode", 0600, fault_dir, |
|---|
| 297 | + &ibd->fault->opcode); |
|---|
| 298 | + debugfs_create_file("opcodes", 0600, fault_dir, ibd->fault, |
|---|
| 299 | + &__fault_opcodes_fops); |
|---|
| 300 | + debugfs_create_u64("skip_pkts", 0600, fault_dir, |
|---|
| 301 | + &ibd->fault->fault_skip); |
|---|
| 302 | + debugfs_create_u64("skip_usec", 0600, fault_dir, |
|---|
| 303 | + &ibd->fault->fault_skip_usec); |
|---|
| 304 | + debugfs_create_u8("direction", 0600, fault_dir, &ibd->fault->direction); |
|---|
| 315 | 305 | |
|---|
| 316 | 306 | return 0; |
|---|
| 317 | | -fail: |
|---|
| 318 | | - hfi1_fault_exit_debugfs(ibd); |
|---|
| 319 | | - return -ENOMEM; |
|---|
| 320 | 307 | } |
|---|
| 321 | 308 | |
|---|
| 322 | 309 | bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd) |
|---|