hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/sti/hva/hva-debugfs.c
....@@ -271,7 +271,7 @@
271271 * device debug info
272272 */
273273
274
-static int hva_dbg_device(struct seq_file *s, void *data)
274
+static int device_show(struct seq_file *s, void *data)
275275 {
276276 struct hva_dev *hva = s->private;
277277
....@@ -281,7 +281,7 @@
281281 return 0;
282282 }
283283
284
-static int hva_dbg_encoders(struct seq_file *s, void *data)
284
+static int encoders_show(struct seq_file *s, void *data)
285285 {
286286 struct hva_dev *hva = s->private;
287287 unsigned int i = 0;
....@@ -299,7 +299,7 @@
299299 return 0;
300300 }
301301
302
-static int hva_dbg_last(struct seq_file *s, void *data)
302
+static int last_show(struct seq_file *s, void *data)
303303 {
304304 struct hva_dev *hva = s->private;
305305 struct hva_ctx *last_ctx = &hva->dbg.last_ctx;
....@@ -316,7 +316,7 @@
316316 return 0;
317317 }
318318
319
-static int hva_dbg_regs(struct seq_file *s, void *data)
319
+static int regs_show(struct seq_file *s, void *data)
320320 {
321321 struct hva_dev *hva = s->private;
322322
....@@ -325,49 +325,23 @@
325325 return 0;
326326 }
327327
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
-
340328 #define hva_dbg_create_entry(name) \
341329 debugfs_create_file(#name, 0444, hva->dbg.debugfs_entry, hva, \
342
- &hva_dbg_##name##_fops)
330
+ &name##_fops)
343331
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);
348336
349337 void hva_debugfs_create(struct hva_dev *hva)
350338 {
351339 hva->dbg.debugfs_entry = debugfs_create_dir(HVA_NAME, NULL);
352
- if (!hva->dbg.debugfs_entry)
353
- goto err;
354340
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);
371345 }
372346
373347 void hva_debugfs_remove(struct hva_dev *hva)
....@@ -380,7 +354,7 @@
380354 * context (instance) debug info
381355 */
382356
383
-static int hva_dbg_ctx(struct seq_file *s, void *data)
357
+static int ctx_show(struct seq_file *s, void *data)
384358 {
385359 struct hva_ctx *ctx = s->private;
386360
....@@ -392,7 +366,7 @@
392366 return 0;
393367 }
394368
395
-hva_dbg_declare(ctx);
369
+DEFINE_SHOW_ATTRIBUTE(ctx);
396370
397371 void hva_dbg_ctx_create(struct hva_ctx *ctx)
398372 {
....@@ -407,7 +381,7 @@
407381
408382 ctx->dbg.debugfs_entry = debugfs_create_file(name, 0444,
409383 hva->dbg.debugfs_entry,
410
- ctx, &hva_dbg_ctx_fops);
384
+ ctx, &ctx_fops);
411385 }
412386
413387 void hva_dbg_ctx_remove(struct hva_ctx *ctx)