All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luo Jiaxing <luojiaxing@huawei.com>
To: <akpm@linux-foundation.org>, <viro@zeniv.linux.org.uk>,
	<andriy.shevchenko@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <martin.petersen@oracle.com>,
	<john.garry@huawei.com>, <himanshu.madhani@cavium.com>,
	<felipe.balbi@linux.intel.com>, <gregkh@linuxfoundation.org>,
	<uma.shankar@intel.com>, <anshuman.gupta@intel.com>,
	<animesh.manna@intel.com>, <linux-usb@vger.kernel.org>,
	<linux-scsi@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH v1 5/5] drm/i915/display: Introduce DEFINE_STORE_ATTRIBUTE for debugfs
Date: Thu, 22 Oct 2020 16:39:57 +0800	[thread overview]
Message-ID: <1603355997-32350-6-git-send-email-luojiaxing@huawei.com> (raw)
In-Reply-To: <1603355997-32350-1-git-send-email-luojiaxing@huawei.com>

Seq instroduce a new helper marco DEFINE_STORE_ATTRIBUTE for
Read-Write file, So we apply it at drm/i915/display to reduce some
duplicate code.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 .../gpu/drm/i915/display/intel_display_debugfs.c   | 55 ++--------------------
 1 file changed, 4 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index 0bf31f9..89d38d2 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -1329,21 +1329,7 @@ static int i915_displayport_test_active_show(struct seq_file *m, void *data)
 	return 0;
 }
 
-static int i915_displayport_test_active_open(struct inode *inode,
-					     struct file *file)
-{
-	return single_open(file, i915_displayport_test_active_show,
-			   inode->i_private);
-}
-
-static const struct file_operations i915_displayport_test_active_fops = {
-	.owner = THIS_MODULE,
-	.open = i915_displayport_test_active_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.write = i915_displayport_test_active_write
-};
+DEFINE_STORE_ATTRIBUTE(i915_displayport_test_active);
 
 static int i915_displayport_test_data_show(struct seq_file *m, void *data)
 {
@@ -1733,19 +1719,7 @@ static ssize_t i915_hpd_storm_ctl_write(struct file *file,
 	return len;
 }
 
-static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, i915_hpd_storm_ctl_show, inode->i_private);
-}
-
-static const struct file_operations i915_hpd_storm_ctl_fops = {
-	.owner = THIS_MODULE,
-	.open = i915_hpd_storm_ctl_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.write = i915_hpd_storm_ctl_write
-};
+DEFINE_STORE_ATTRIBUTE(i915_hpd_storm_ctl);
 
 static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
 {
@@ -1811,14 +1785,7 @@ static ssize_t i915_hpd_short_storm_ctl_write(struct file *file,
 	return len;
 }
 
-static const struct file_operations i915_hpd_short_storm_ctl_fops = {
-	.owner = THIS_MODULE,
-	.open = i915_hpd_short_storm_ctl_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.write = i915_hpd_short_storm_ctl_write,
-};
+DEFINE_STORE_ATTRIBUTE(i915_hpd_short_storm_ctl);
 
 static int i915_drrs_ctl_set(void *data, u64 val)
 {
@@ -2181,21 +2148,7 @@ static ssize_t i915_dsc_fec_support_write(struct file *file,
 	return len;
 }
 
-static int i915_dsc_fec_support_open(struct inode *inode,
-				     struct file *file)
-{
-	return single_open(file, i915_dsc_fec_support_show,
-			   inode->i_private);
-}
-
-static const struct file_operations i915_dsc_fec_support_fops = {
-	.owner = THIS_MODULE,
-	.open = i915_dsc_fec_support_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.write = i915_dsc_fec_support_write
-};
+DEFINE_STORE_ATTRIBUTE(i915_dsc_fec_support);
 
 /**
  * intel_connector_debugfs_add - add i915 specific connector debugfs files
-- 
2.7.4


  parent reply	other threads:[~2020-10-22  8:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22  8:39 [PATCH v1 0/5] Introduce a new helper marco DEFINE_STORE_ATTRIBUTE at seq_file.c Luo Jiaxing
2020-10-22  8:39 ` [PATCH v1 1/5] seq_file: Introduce DEFINE_STORE_ATTRIBUTE() helper macro Luo Jiaxing
2020-10-22 14:22   ` Andy Shevchenko
2020-10-23  8:53     ` luojiaxing
2020-10-22  8:39 ` [PATCH v1 2/5] scsi: hisi_sas: Introduce DEFINE_STORE_ATTRIBUTE for debugfs Luo Jiaxing
2020-10-22  8:39 ` [PATCH v1 3/5] scsi: qla2xxx: " Luo Jiaxing
2020-10-22  8:39 ` [PATCH v1 4/5] usb: dwc3: debugfs: Introduce DEFINE_STORE_ATTRIBUTE Luo Jiaxing
2020-10-22  8:39 ` Luo Jiaxing [this message]
2020-10-22 11:14   ` [PATCH v1 5/5] drm/i915/display: Introduce DEFINE_STORE_ATTRIBUTE for debugfs kernel test robot
2020-10-22 11:14     ` kernel test robot
2020-10-22 12:28 ` [PATCH v1 0/5] Introduce a new helper marco DEFINE_STORE_ATTRIBUTE at seq_file.c Al Viro
2020-10-23  6:29   ` luojiaxing

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=1603355997-32350-6-git-send-email-luojiaxing@huawei.com \
    --to=luojiaxing@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=animesh.manna@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=himanshu.madhani@cavium.com \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=uma.shankar@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.