Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1059823ybh; Thu, 16 Jul 2020 01:54:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3cPJLPR9IVC+3ik9iiwbs7MEX0Y4Q9EsaJNLeG41wgqfilO6tfN0AYJxYJIQhpo3pNte/ X-Received: by 2002:a17:906:dbe9:: with SMTP id yd9mr2789784ejb.75.1594889690357; Thu, 16 Jul 2020 01:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594889690; cv=none; d=google.com; s=arc-20160816; b=RISFWcjtbp9o3D5zxQn6B/tyvi4h6xkpdgedi18Bpg/ylZGaB7PnWHCKIW+60Izqsp J6xHFrtpTn1XmE9KCBMZCFZzyxdqe0Xpgyr8crSPJ/8/LJmUsqXMlYsgNlbR3+zplZup rgda2IZI2wZ14SBVdmkvOOlcQs3en79+CDDVKxVorVSjGNF9csFG3403cuYX68fXFaNi ordZ/KpOQtfNrLYTKUDYkuI+jT4WtxD9y68HUPosZjwMaetIiR3cPKlm9CH1d0yHid0n 1uXuy/jV5ZgS3pc1B9hXOdRLuPfkIMIou7g9dthNNtI6+KGhK3ZqA5bgKaLP30CVQY5y sAQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YiiEAlvjUWpO3VgUOjWJhtbGgJa6kPwW0u8DK7SSxK0=; b=yVKWcg9Nn8aP8wk8v2+zeEFlbo1kvTmlxqvuSSAU7Jn7abTZAdTG7GKIcnc3FjSy86 kc+g5QymLas9HvTBLrOkfbfz2/INktWPCseAdrG7MfwkwpT/lNoSI/EmYYnYKUW6nQ68 /5rP9kulbjA8Bwga443dgSml8+/X/Ija0XU/Khqe3ktOgC5zemeEaRIlv0auPdSzQEFk rDbhD9OWJqA6on9sXpU5/pKc/L3soq+Mo+ynhYwaLsAZT9WkToD3C1BoXN20aQnrdoOT DZS8/CX8xZnCVyRI3EeCHpboIXUkkNhQ9kS7VrBLRIqy05LRw4l5NEPrLqA4Dpui4fLD WbSQ== 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 dn13si2779259edb.186.2020.07.16.01.54.27; Thu, 16 Jul 2020 01:54:50 -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 S1728097AbgGPIyB (ORCPT + 99 others); Thu, 16 Jul 2020 04:54:01 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7862 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725975AbgGPIyA (ORCPT ); Thu, 16 Jul 2020 04:54:00 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 98C79304D547A792A00C; Thu, 16 Jul 2020 16:53:56 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Thu, 16 Jul 2020 16:53:56 +0800 From: Qinglang Miao To: Greg Kroah-Hartman , Jakub Kicinski CC: , open list Subject: [PATCH -next] mt7601u: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 16 Jul 2020 16:57:49 +0800 Message-ID: <20200716085749.11105-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao --- .../net/wireless/mediatek/mt7601u/debugfs.c | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt7601u/debugfs.c b/drivers/net/wireless/mediatek/mt7601u/debugfs.c index eaabba20d..20669eacb 100644 --- a/drivers/net/wireless/mediatek/mt7601u/debugfs.c +++ b/drivers/net/wireless/mediatek/mt7601u/debugfs.c @@ -30,7 +30,7 @@ mt76_reg_get(void *data, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n"); static int -mt7601u_ampdu_stat_read(struct seq_file *file, void *data) +mt7601u_ampdu_stat_show(struct seq_file *file, void *data) { struct mt7601u_dev *dev = file->private; int i, j; @@ -73,21 +73,10 @@ mt7601u_ampdu_stat_read(struct seq_file *file, void *data) return 0; } -static int -mt7601u_ampdu_stat_open(struct inode *inode, struct file *f) -{ - return single_open(f, mt7601u_ampdu_stat_read, inode->i_private); -} - -static const struct file_operations fops_ampdu_stat = { - .open = mt7601u_ampdu_stat_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(mt7601u_ampdu_stat); static int -mt7601u_eeprom_param_read(struct seq_file *file, void *data) +mt7601u_eeprom_param_show(struct seq_file *file, void *data) { struct mt7601u_dev *dev = file->private; struct mt7601u_rate_power *rp = &dev->ee->power_rate_table; @@ -131,18 +120,7 @@ mt7601u_eeprom_param_read(struct seq_file *file, void *data) return 0; } -static int -mt7601u_eeprom_param_open(struct inode *inode, struct file *f) -{ - return single_open(f, mt7601u_eeprom_param_read, inode->i_private); -} - -static const struct file_operations fops_eeprom_param = { - .open = mt7601u_eeprom_param_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(mt7601u_eeprom_param); void mt7601u_init_debugfs(struct mt7601u_dev *dev) { @@ -157,6 +135,6 @@ void mt7601u_init_debugfs(struct mt7601u_dev *dev) debugfs_create_u32("regidx", 0600, dir, &dev->debugfs_reg); debugfs_create_file("regval", 0600, dir, dev, &fops_regval); - debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat); - debugfs_create_file("eeprom_param", 0400, dir, dev, &fops_eeprom_param); + debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt7601u_ampdu_stat_fops); + debugfs_create_file("eeprom_param", 0400, dir, dev, &mt7601u_eeprom_param_fops); } -- 2.17.1