From: Yangtao Li <tiny.windzz@gmail.com>
To: gregkh@linuxfoundation.org, natechancellor@gmail.com,
kernelpatch@126.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Yangtao Li <tiny.windzz@gmail.com>
Subject: [RESEND] staging: rtlwifi: convert to DEFINE_SHOW_ATTRIBUTE
Date: Sat, 15 Dec 2018 03:56:35 -0500 [thread overview]
Message-ID: <20181215085635.27602-1-tiny.windzz@gmail.com> (raw)
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
drivers/staging/rtlwifi/debug.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtlwifi/debug.c b/drivers/staging/rtlwifi/debug.c
index 8999feda29b4..543889923864 100644
--- a/drivers/staging/rtlwifi/debug.c
+++ b/drivers/staging/rtlwifi/debug.c
@@ -79,24 +79,13 @@ struct rtl_debugfs_priv {
static struct dentry *debugfs_topdir;
-static int rtl_debug_get_common(struct seq_file *m, void *v)
+static int common_show(struct seq_file *m, void *v)
{
struct rtl_debugfs_priv *debugfs_priv = m->private;
return debugfs_priv->cb_read(m, v);
}
-
-static int dl_debug_open_common(struct inode *inode, struct file *file)
-{
- return single_open(file, rtl_debug_get_common, inode->i_private);
-}
-
-static const struct file_operations file_ops_common = {
- .open = dl_debug_open_common,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(common);
static int rtl_debug_get_mac_page(struct seq_file *m, void *v)
{
@@ -439,7 +428,7 @@ static ssize_t rtl_debugfs_common_write(struct file *filp,
return debugfs_priv->cb_write(filp, buffer, count, loff);
}
-static const struct file_operations file_ops_common_write = {
+static const struct file_operations common_write_fops = {
.owner = THIS_MODULE,
.write = rtl_debugfs_common_write,
.open = simple_open,
@@ -488,7 +477,7 @@ static int rtl_debugfs_open_rw(struct inode *inode, struct file *filp)
int ret = 0;
if (filp->f_mode & FMODE_READ)
- ret = single_open(filp, rtl_debug_get_common, inode->i_private);
+ ret = single_open(filp, common_show, inode->i_private);
else
filp->private_data = inode->i_private;
@@ -509,7 +498,7 @@ static struct rtl_debugfs_priv rtl_debug_priv_phydm_cmd = {
.cb_data = 0,
};
-static const struct file_operations file_ops_common_rw = {
+static const struct file_operations common_rw_fops = {
.owner = THIS_MODULE,
.open = rtl_debugfs_open_rw,
.release = rtl_debugfs_close_rw,
@@ -523,7 +512,7 @@ static const struct file_operations file_ops_common_rw = {
rtl_debug_priv_ ##name.rtlpriv = rtlpriv; \
debugfs_create_file(#name, mode, parent, \
&rtl_debug_priv_ ##name, \
- &file_ops_ ##fopname); \
+ &fopname ##fops); \
} while (0)
#define RTL_DEBUGFS_ADD(name) \
--
2.17.0
next reply other threads:[~2018-12-15 8:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-15 8:56 Yangtao Li [this message]
2018-12-15 12:08 ` [RESEND] staging: rtlwifi: convert to DEFINE_SHOW_ATTRIBUTE kbuild test robot
2018-12-17 13:52 ` Greg KH
2018-12-20 21:24 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181215085635.27602-1-tiny.windzz@gmail.com \
--to=tiny.windzz@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernelpatch@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).