Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5438151pxu; Thu, 22 Oct 2020 02:13:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIuaQ91p10GrHyJ3lHRGNoAQOBFQBXTUYlD68zMV8heOI6ENMi/Y8KwWilM2Pv+UVB+kOg X-Received: by 2002:a17:906:399b:: with SMTP id h27mr1317733eje.105.1603358032799; Thu, 22 Oct 2020 02:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603358032; cv=none; d=google.com; s=arc-20160816; b=NXqWt9DdPpBqo8GYaAKpjx7po9fXjzk/YtdK8NNFJPhuHgoeDsPW2A1eLgvw4+ikO4 iglrqOBYvobghOndAaG5SWXQynr4bCTCcdwyy10vs46Tisz3NWfYpyB3YQ4WzPcWr8ur PI9//4iUlbYxnNUOVmttKbddLJ+ANeWxdsDI9PTFvw83FGItHQf8JWq1ay72nevq2qcq v1X5OwWcuM29a2B4nZ9/LO7mi8hCyBXIWa2D4BSo/NLMo7m6JE7qwshcRgdhbaWk/D7K Yyrs/W8qGFCz87Xf1u4I3fz/rBxDocXBdgSyNI5tZ3rKeuWpyIj7dXQ3h+S3yZj7P7RE yPoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=TF1pFF41ZeE/nvoThKphz9spjLp+iW9an/IzpnuMKAY=; b=X+mX90DCnpLNg7KVcrt+dCETSrTGtTuEGyt+eUb7kTM5rKnUiywvTrzH1t2mFrqufP Yuwm5pl79NR3GOn+pdEAtZAW9dFaSzogpD6HKppEUwvdc4fiGpEOXUGA/fHfMoi4q5ou wu/zF+epge2bUr/AXjmyty/tYyAXeb1E3iM89MpXwXuXjl6S3swYsVpF0R76ru768fFr X0d8jlq5yjsYId9u/i3l9klDjRlVFAssjTzbSPBT39EMSmlX8Eif89fLGf/DvnoXJWFJ bwTLd5ffjTg+p8DQSZirNTknCJzbKFRUIuSmFXKLOIVj55aavtufw5scZ69r+M96CmS3 udiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fx21si451660ejb.458.2020.10.22.02.13.30; Thu, 22 Oct 2020 02:13:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2509395AbgJVIj2 (ORCPT + 99 others); Thu, 22 Oct 2020 04:39:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:15759 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2509384AbgJVIj1 (ORCPT ); Thu, 22 Oct 2020 04:39:27 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 49D07166FD9E9F0C1324; Thu, 22 Oct 2020 16:39:24 +0800 (CST) Received: from huawei.com (10.69.192.56) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Thu, 22 Oct 2020 16:39:16 +0800 From: Luo Jiaxing To: , , CC: , , , , , , , , , , , Subject: [PATCH v1 5/5] drm/i915/display: Introduce DEFINE_STORE_ATTRIBUTE for debugfs Date: Thu, 22 Oct 2020 16:39:57 +0800 Message-ID: <1603355997-32350-6-git-send-email-luojiaxing@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1603355997-32350-1-git-send-email-luojiaxing@huawei.com> References: <1603355997-32350-1-git-send-email-luojiaxing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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