Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1642262pxk; Fri, 18 Sep 2020 19:49:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5FMuy7ohMlqE88mRrcidz2il9u0+2NG3BphUwfhi366tohii5hJ+swGi78eXetqYk3Vvp X-Received: by 2002:a05:6402:7d2:: with SMTP id u18mr42253841edy.69.1600483781624; Fri, 18 Sep 2020 19:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600483781; cv=none; d=google.com; s=arc-20160816; b=atga5mzW0OLKbOEG6SNNfEmwUDFKNnjafBVGvv+DBf2GzGsbYobdahLbi7idmyRdBO 4IqGjFErjAmq8R/gs4tz2j6J83ZUOz3EPzCCc7cMrKtpFYM5F5p2q4SNAhamiDRd2qCv 0VC7w/zeyhP8EWrluQNXryiIJ2WhXIJiInlpptGKcENJ6BLp9Ip7jK3s1amHMY3jxfsQ EtgQ+lb6EAJ48WR5r8PNFRFgw3L0mVFDe7ufFftWh5HjnGrCBxUv+tBhLiy13NW+B1Ek nFdyucEwvAGlf9qLC6fcbC0JjnwLq0EHvkgx+enRVuY17zujGY5iW5rUxzY/nWnsMKq4 QHDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=iOL7v2QZZGrgyj0VcxTu8KfPfxGPd44DfgVsWFXh5Tw=; b=cGxR3gb5yBFtSfedQz7yf0X/NIkl44ic7rg3QRFBYmWjbGvxMDM+M0Fveg9Zjfl+tB oT2auc+yl2wAlupd7Clr/jcmDwV/4jdNt15YmcX31ebLcR4DTL1mGV5ZfEM9Yjk+U3Mm N4D2m0HFrHZRjpJ8cN+lfS8oQ+QdMB1YeSFDI2GlqzxdtdJKMy4a59RoGd1BgV0az9YR mx1RoIDIWNTwdMC2FSBKbm93n/QYJqCJuzyvuza26YHyLZtm7IiWSikoAreHMjxr9PSs xpRZfgGNQ39G8K2NTI9oOjtLheNPWGljDX9VXUSAk5AYhZq3dBOOyz65mH9Prq3a2RpY dfhA== 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 i24si3746993edb.493.2020.09.18.19.49.18; Fri, 18 Sep 2020 19:49:41 -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 S1726267AbgISCsU (ORCPT + 99 others); Fri, 18 Sep 2020 22:48:20 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13319 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726009AbgISCsT (ORCPT ); Fri, 18 Sep 2020 22:48:19 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3101F85380A276DAB0C9; Sat, 19 Sep 2020 10:48:16 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 10:48:06 +0800 From: Qinglang Miao To: Jakub Kicinski , Kalle Valo , "David S. Miller" , Matthias Brugger CC: , , , , , Qinglang Miao Subject: [PATCH -next v2] mt7601u: Convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 19 Sep 2020 10:48:38 +0800 Message-ID: <20200919024838.14172-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 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 300242bce..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 = seq_read, - .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 = seq_read, - .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.23.0