Re: [PATCH -next] memory: Convert to DEFINE_SHOW_ATTRIBUTE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





在 2020/7/18 5:14, Pavel Machek 写道:
On Thu 2020-07-16 17:03:03, Qinglang Miao wrote:
From: Yongqiang Liu <liuyongqiang13@xxxxxxxxxx>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yongqiang Liu <liuyongqiang13@xxxxxxxxxx>
---
  drivers/memory/emif.c               | 22 ++--------------------
  drivers/memory/tegra/tegra124-emc.c | 14 +-------------
  2 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 58a82eea5..aab8ddad7 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -131,16 +131,7 @@ static int emif_regdump_show(struct seq_file *s, void *unused)
  	return 0;
  }
-static int emif_regdump_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, emif_regdump_show, inode->i_private);
-}
-
-static const struct file_operations emif_regdump_fops = {
-	.open			= emif_regdump_open,
-	.read_iter			= seq_read_iter,
-	.release		= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(emif_regdump);

This is not equivalent (and I guess changelog should mention that).

Along with other changes, we get:

         .owner          = THIS_MODULE,
         .llseek         = seq_lseek,

. Is that okay thing to add?
									Pavel

Hi Pavel,

​You're right, I should of mention it in changelog.

​There's no impact theoretically with these two changes. Here's my thoughs:

1. The llseek method is used to change the current read/write position in a file which can be ignored if you don't use it. 2. The owner is not even a method. Instead, it is a pointer to the module that “owns” this structure; it is used by the kernel to maintain the module's usage count which I believe can be ignored.

If you don't mind I can send a new patch with more specific changelog.

​Thanks.

Qinglang

.






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux