Skip to content

Commit ef77507

Browse files
Longlong Xiaquic-jhugo
authored andcommitted
accel/qaic: Change to use DEFINE_SHOW_ATTRIBUTE macro
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. No functional change. Signed-off-by: Longlong Xia <xialonglong@kylinos.cn> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240819095816.447096-1-xialonglong@kylinos.cn
1 parent c1779a2 commit ef77507

1 file changed

Lines changed: 5 additions & 38 deletions

File tree

drivers/accel/qaic/qaic_debugfs.c

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -64,41 +64,19 @@ static int bootlog_show(struct seq_file *s, void *unused)
6464
return 0;
6565
}
6666

67-
static int bootlog_fops_open(struct inode *inode, struct file *file)
68-
{
69-
return single_open(file, bootlog_show, inode->i_private);
70-
}
71-
72-
static const struct file_operations bootlog_fops = {
73-
.owner = THIS_MODULE,
74-
.open = bootlog_fops_open,
75-
.read = seq_read,
76-
.llseek = seq_lseek,
77-
.release = single_release,
78-
};
67+
DEFINE_SHOW_ATTRIBUTE(bootlog);
7968

80-
static int read_dbc_fifo_size(struct seq_file *s, void *unused)
69+
static int fifo_size_show(struct seq_file *s, void *unused)
8170
{
8271
struct dma_bridge_chan *dbc = s->private;
8372

8473
seq_printf(s, "%u\n", dbc->nelem);
8574
return 0;
8675
}
8776

88-
static int fifo_size_open(struct inode *inode, struct file *file)
89-
{
90-
return single_open(file, read_dbc_fifo_size, inode->i_private);
91-
}
92-
93-
static const struct file_operations fifo_size_fops = {
94-
.owner = THIS_MODULE,
95-
.open = fifo_size_open,
96-
.read = seq_read,
97-
.llseek = seq_lseek,
98-
.release = single_release,
99-
};
77+
DEFINE_SHOW_ATTRIBUTE(fifo_size);
10078

101-
static int read_dbc_queued(struct seq_file *s, void *unused)
79+
static int queued_show(struct seq_file *s, void *unused)
10280
{
10381
struct dma_bridge_chan *dbc = s->private;
10482
u32 tail = 0, head = 0;
@@ -115,18 +93,7 @@ static int read_dbc_queued(struct seq_file *s, void *unused)
11593
return 0;
11694
}
11795

118-
static int queued_open(struct inode *inode, struct file *file)
119-
{
120-
return single_open(file, read_dbc_queued, inode->i_private);
121-
}
122-
123-
static const struct file_operations queued_fops = {
124-
.owner = THIS_MODULE,
125-
.open = queued_open,
126-
.read = seq_read,
127-
.llseek = seq_lseek,
128-
.release = single_release,
129-
};
96+
DEFINE_SHOW_ATTRIBUTE(queued);
13097

13198
void qaic_debugfs_init(struct qaic_drm_device *qddev)
13299
{

0 commit comments

Comments
 (0)