Skip to contentSkip to conversation

crypto: caam: Convert to DEFINE_SHOW_ATTRIBUTE

PATCH Superseded Qinglang Miao 3 participants 3 messages Sep 18, 2020 – Sep 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 crypto: caam: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.

 drivers/crypto/caam/dpseci-debugfs.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)
drivers/crypto/caam/dpseci-debugfs.c +2 -21
index c5bfc923a..0eca8c2fd 100644
@@ -44,33 +44,14 @@ static int dpseci_dbg_fqs_show(struct seq_file *file, void *offset)
 	return 0;
 }
 
-static int dpseci_dbg_fqs_open(struct inode *inode, struct file *file)
-{
-	int err;
-	struct dpaa2_caam_priv *priv;
-
-	priv = (struct dpaa2_caam_priv *)inode->i_private;
-
-	err = single_open(file, dpseci_dbg_fqs_show, priv);
-	if (err < 0)
-		dev_err(priv->dev, "single_open() failed\n");
-
-	return err;
-}
-
-static const struct file_operations dpseci_dbg_fq_ops = {
-	.open = dpseci_dbg_fqs_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(dpseci_dbg_fqs);
 
 void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv)
 {
 	priv->dfs_root = debugfs_create_dir(dev_name(priv->dev), NULL);
 
 	debugfs_create_file("fq_stats", 0444, priv->dfs_root, priv,
-			    &dpseci_dbg_fq_ops);
+			    &dpseci_dbg_fqs_fops);
 }
 
 void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv)
Signature · 1 line
2.23.0
maintainer
#2 lore raw
In reply to Qinglang Miao
Quoted 9 lines · Qinglang Miao

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.

 drivers/crypto/caam/dpseci-debugfs.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt