[PATCH v1 3/8] media: cec: core: Use DEFINE_SHOW_STORE_ATTRIBUTE() helper for debugfs

From: Andy Shevchenko

Date: Thu Jul 09 2026 - 04:24:25 EST


Use DEFINE_SHOW_STORE_ATTRIBUTE() helper for read-write file to reduce some
duplicated code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/media/cec/core/cec-core.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
index 0c89fac58349..674bcb6450dc 100644
--- a/drivers/media/cec/core/cec-core.c
+++ b/drivers/media/cec/core/cec-core.c
@@ -205,19 +205,7 @@ static int cec_error_inj_show(struct seq_file *sf, void *unused)

return call_op(adap, error_inj_show, sf);
}
-
-static int cec_error_inj_open(struct inode *inode, struct file *file)
-{
- return single_open(file, cec_error_inj_show, inode->i_private);
-}
-
-static const struct file_operations cec_error_inj_fops = {
- .open = cec_error_inj_open,
- .write = cec_error_inj_write,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_STORE_ATTRIBUTE(cec_error_inj);
#endif

struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
--
2.50.1