Skip to content

Commit 560daf9

Browse files
Qinglang Miaoherbertx
authored andcommitted
crypto: allwinner - Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent fde2f57 commit 560daf9

2 files changed

Lines changed: 4 additions & 26 deletions

File tree

‎drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static struct sun8i_ce_alg_template ce_algs[] = {
283283
};
284284

285285
#ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG
286-
static int sun8i_ce_dbgfs_read(struct seq_file *seq, void *v)
286+
static int sun8i_ce_debugfs_show(struct seq_file *seq, void *v)
287287
{
288288
struct sun8i_ce_dev *ce = seq->private;
289289
int i;
@@ -306,18 +306,7 @@ static int sun8i_ce_dbgfs_read(struct seq_file *seq, void *v)
306306
return 0;
307307
}
308308

309-
static int sun8i_ce_dbgfs_open(struct inode *inode, struct file *file)
310-
{
311-
return single_open(file, sun8i_ce_dbgfs_read, inode->i_private);
312-
}
313-
314-
static const struct file_operations sun8i_ce_debugfs_fops = {
315-
.owner = THIS_MODULE,
316-
.open = sun8i_ce_dbgfs_open,
317-
.read = seq_read,
318-
.llseek = seq_lseek,
319-
.release = single_release,
320-
};
309+
DEFINE_SHOW_ATTRIBUTE(sun8i_ce_debugfs);
321310
#endif
322311

323312
static void sun8i_ce_free_chanlist(struct sun8i_ce_dev *ce, int i)

‎drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static struct sun8i_ss_alg_template ss_algs[] = {
267267
};
268268

269269
#ifdef CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG
270-
static int sun8i_ss_dbgfs_read(struct seq_file *seq, void *v)
270+
static int sun8i_ss_debugfs_show(struct seq_file *seq, void *v)
271271
{
272272
struct sun8i_ss_dev *ss = seq->private;
273273
int i;
@@ -290,18 +290,7 @@ static int sun8i_ss_dbgfs_read(struct seq_file *seq, void *v)
290290
return 0;
291291
}
292292

293-
static int sun8i_ss_dbgfs_open(struct inode *inode, struct file *file)
294-
{
295-
return single_open(file, sun8i_ss_dbgfs_read, inode->i_private);
296-
}
297-
298-
static const struct file_operations sun8i_ss_debugfs_fops = {
299-
.owner = THIS_MODULE,
300-
.open = sun8i_ss_dbgfs_open,
301-
.read = seq_read,
302-
.llseek = seq_lseek,
303-
.release = single_release,
304-
};
293+
DEFINE_SHOW_ATTRIBUTE(sun8i_ss_debugfs);
305294
#endif
306295

307296
static void sun8i_ss_free_flows(struct sun8i_ss_dev *ss, int i)

0 commit comments

Comments
 (0)