linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: zip: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-07-16  9:03 Qinglang Miao
  2020-07-23  7:23 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Qinglang Miao @ 2020-07-16  9:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Herbert Xu, David S. Miller
  Cc: linux-crypto, linux-kernel

From: Liu Shixin <liushixin2@huawei.com>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 drivers/crypto/cavium/zip/zip_main.c | 44 ++++------------------------
 1 file changed, 6 insertions(+), 38 deletions(-)

diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
index 451e97fd8..d35216e2f 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -460,7 +460,7 @@ static void zip_unregister_compression_device(void)
 #include <linux/debugfs.h>
 
 /* Displays ZIP device statistics */
-static int zip_show_stats(struct seq_file *s, void *unused)
+static int zip_stats_show(struct seq_file *s, void *unused)
 {
 	u64 val = 0ull;
 	u64 avg_chunk = 0ull, avg_cr = 0ull;
@@ -523,7 +523,7 @@ static int zip_show_stats(struct seq_file *s, void *unused)
 }
 
 /* Clears stats data */
-static int zip_clear_stats(struct seq_file *s, void *unused)
+static int zip_clear_show(struct seq_file *s, void *unused)
 {
 	int index = 0;
 
@@ -558,7 +558,7 @@ static struct zip_registers zipregs[64] = {
 };
 
 /* Prints registers' contents */
-static int zip_print_regs(struct seq_file *s, void *unused)
+static int zip_regs_show(struct seq_file *s, void *unused)
 {
 	u64 val = 0;
 	int i = 0, index = 0;
@@ -584,41 +584,9 @@ static int zip_print_regs(struct seq_file *s, void *unused)
 	return 0;
 }
 
-static int zip_stats_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, zip_show_stats, NULL);
-}
-
-static const struct file_operations zip_stats_fops = {
-	.owner = THIS_MODULE,
-	.open  = zip_stats_open,
-	.read_iter  = seq_read_iter,
-	.release = single_release,
-};
-
-static int zip_clear_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, zip_clear_stats, NULL);
-}
-
-static const struct file_operations zip_clear_fops = {
-	.owner = THIS_MODULE,
-	.open  = zip_clear_open,
-	.read_iter  = seq_read_iter,
-	.release = single_release,
-};
-
-static int zip_regs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, zip_print_regs, NULL);
-}
-
-static const struct file_operations zip_regs_fops = {
-	.owner = THIS_MODULE,
-	.open  = zip_regs_open,
-	.read_iter  = seq_read_iter,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(zip_stats);
+DEFINE_SHOW_ATTRIBUTE(zip_clear);
+DEFINE_SHOW_ATTRIBUTE(zip_regs);
 
 /* Root directory for thunderx_zip debugfs entry */
 static struct dentry *zip_debugfs_root;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] crypto: zip: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-16  9:03 [PATCH -next] crypto: zip: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-07-23  7:23 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-07-23  7:23 UTC (permalink / raw)
  To: Qinglang Miao; +Cc: gregkh, davem, linux-crypto, linux-kernel

Qinglang Miao <miaoqinglang@huawei.com> wrote:
>
> @@ -584,41 +584,9 @@ static int zip_print_regs(struct seq_file *s, void *unused)
>        return 0;
> }
> 
> -static int zip_stats_open(struct inode *inode, struct file *file)
> -{
> -       return single_open(file, zip_show_stats, NULL);
> -}
> -
> -static const struct file_operations zip_stats_fops = {
> -       .owner = THIS_MODULE,
> -       .open  = zip_stats_open,
> -       .read_iter  = seq_read_iter,
> -       .release = single_release,
> -};

This patch doesn't apply either.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  9:03 [PATCH -next] crypto: zip: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-07-23  7:23 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).