.. | .. |
---|
271 | 271 | * device debug info |
---|
272 | 272 | */ |
---|
273 | 273 | |
---|
274 | | -static int hva_dbg_device(struct seq_file *s, void *data) |
---|
| 274 | +static int device_show(struct seq_file *s, void *data) |
---|
275 | 275 | { |
---|
276 | 276 | struct hva_dev *hva = s->private; |
---|
277 | 277 | |
---|
.. | .. |
---|
281 | 281 | return 0; |
---|
282 | 282 | } |
---|
283 | 283 | |
---|
284 | | -static int hva_dbg_encoders(struct seq_file *s, void *data) |
---|
| 284 | +static int encoders_show(struct seq_file *s, void *data) |
---|
285 | 285 | { |
---|
286 | 286 | struct hva_dev *hva = s->private; |
---|
287 | 287 | unsigned int i = 0; |
---|
.. | .. |
---|
299 | 299 | return 0; |
---|
300 | 300 | } |
---|
301 | 301 | |
---|
302 | | -static int hva_dbg_last(struct seq_file *s, void *data) |
---|
| 302 | +static int last_show(struct seq_file *s, void *data) |
---|
303 | 303 | { |
---|
304 | 304 | struct hva_dev *hva = s->private; |
---|
305 | 305 | struct hva_ctx *last_ctx = &hva->dbg.last_ctx; |
---|
.. | .. |
---|
316 | 316 | return 0; |
---|
317 | 317 | } |
---|
318 | 318 | |
---|
319 | | -static int hva_dbg_regs(struct seq_file *s, void *data) |
---|
| 319 | +static int regs_show(struct seq_file *s, void *data) |
---|
320 | 320 | { |
---|
321 | 321 | struct hva_dev *hva = s->private; |
---|
322 | 322 | |
---|
.. | .. |
---|
325 | 325 | return 0; |
---|
326 | 326 | } |
---|
327 | 327 | |
---|
328 | | -#define hva_dbg_declare(name) \ |
---|
329 | | - static int hva_dbg_##name##_open(struct inode *i, struct file *f) \ |
---|
330 | | - { \ |
---|
331 | | - return single_open(f, hva_dbg_##name, i->i_private); \ |
---|
332 | | - } \ |
---|
333 | | - static const struct file_operations hva_dbg_##name##_fops = { \ |
---|
334 | | - .open = hva_dbg_##name##_open, \ |
---|
335 | | - .read = seq_read, \ |
---|
336 | | - .llseek = seq_lseek, \ |
---|
337 | | - .release = single_release, \ |
---|
338 | | - } |
---|
339 | | - |
---|
340 | 328 | #define hva_dbg_create_entry(name) \ |
---|
341 | 329 | debugfs_create_file(#name, 0444, hva->dbg.debugfs_entry, hva, \ |
---|
342 | | - &hva_dbg_##name##_fops) |
---|
| 330 | + &name##_fops) |
---|
343 | 331 | |
---|
344 | | -hva_dbg_declare(device); |
---|
345 | | -hva_dbg_declare(encoders); |
---|
346 | | -hva_dbg_declare(last); |
---|
347 | | -hva_dbg_declare(regs); |
---|
| 332 | +DEFINE_SHOW_ATTRIBUTE(device); |
---|
| 333 | +DEFINE_SHOW_ATTRIBUTE(encoders); |
---|
| 334 | +DEFINE_SHOW_ATTRIBUTE(last); |
---|
| 335 | +DEFINE_SHOW_ATTRIBUTE(regs); |
---|
348 | 336 | |
---|
349 | 337 | void hva_debugfs_create(struct hva_dev *hva) |
---|
350 | 338 | { |
---|
351 | 339 | hva->dbg.debugfs_entry = debugfs_create_dir(HVA_NAME, NULL); |
---|
352 | | - if (!hva->dbg.debugfs_entry) |
---|
353 | | - goto err; |
---|
354 | 340 | |
---|
355 | | - if (!hva_dbg_create_entry(device)) |
---|
356 | | - goto err; |
---|
357 | | - |
---|
358 | | - if (!hva_dbg_create_entry(encoders)) |
---|
359 | | - goto err; |
---|
360 | | - |
---|
361 | | - if (!hva_dbg_create_entry(last)) |
---|
362 | | - goto err; |
---|
363 | | - |
---|
364 | | - if (!hva_dbg_create_entry(regs)) |
---|
365 | | - goto err; |
---|
366 | | - |
---|
367 | | - return; |
---|
368 | | - |
---|
369 | | -err: |
---|
370 | | - hva_debugfs_remove(hva); |
---|
| 341 | + hva_dbg_create_entry(device); |
---|
| 342 | + hva_dbg_create_entry(encoders); |
---|
| 343 | + hva_dbg_create_entry(last); |
---|
| 344 | + hva_dbg_create_entry(regs); |
---|
371 | 345 | } |
---|
372 | 346 | |
---|
373 | 347 | void hva_debugfs_remove(struct hva_dev *hva) |
---|
.. | .. |
---|
380 | 354 | * context (instance) debug info |
---|
381 | 355 | */ |
---|
382 | 356 | |
---|
383 | | -static int hva_dbg_ctx(struct seq_file *s, void *data) |
---|
| 357 | +static int ctx_show(struct seq_file *s, void *data) |
---|
384 | 358 | { |
---|
385 | 359 | struct hva_ctx *ctx = s->private; |
---|
386 | 360 | |
---|
.. | .. |
---|
392 | 366 | return 0; |
---|
393 | 367 | } |
---|
394 | 368 | |
---|
395 | | -hva_dbg_declare(ctx); |
---|
| 369 | +DEFINE_SHOW_ATTRIBUTE(ctx); |
---|
396 | 370 | |
---|
397 | 371 | void hva_dbg_ctx_create(struct hva_ctx *ctx) |
---|
398 | 372 | { |
---|
.. | .. |
---|
407 | 381 | |
---|
408 | 382 | ctx->dbg.debugfs_entry = debugfs_create_file(name, 0444, |
---|
409 | 383 | hva->dbg.debugfs_entry, |
---|
410 | | - ctx, &hva_dbg_ctx_fops); |
---|
| 384 | + ctx, &ctx_fops); |
---|
411 | 385 | } |
---|
412 | 386 | |
---|
413 | 387 | void hva_dbg_ctx_remove(struct hva_ctx *ctx) |
---|