Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp383325pxk; Thu, 17 Sep 2020 05:51:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE3+trjvaAbbzayN1NRtwnQIJrr7PelRTMMYEsPFhhoyqo5VGaiYriERBogooCZy8Eg9cb X-Received: by 2002:a17:906:7143:: with SMTP id z3mr29591349ejj.361.1600347088470; Thu, 17 Sep 2020 05:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600347088; cv=none; d=google.com; s=arc-20160816; b=O14uvxJttaLVCf2NIpJC9U//dbt7yy/+SVAWS5BkkvS0sfOr3ldMrBRX5Z7C7iQdtV CLp3/S0efqdZSb2Lb7CfjEMg9vGt/VK3QLDv7sXaV5hLzoUVQI/q9psIQsoXXTgTW75y k0dUZHf9iNRA2ximwOB4Xa25LXTpMKbZHjgrAE61TXvdogi+zebGgHG2PLlZJH4LoewA 1oYkDuw2yxeCgmM7oQGfrGYA4WAWBX+QfrQnn4k17GZbw/eIR3lKNcejxKPIt9YhozM9 9PVhZDJsJPzIO2jojZMuQfWhwL8m+kPDiQDqH2V28VKM5COTqRLnnQSTatAA3bxvRiWt IizA== 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=ms10d5/IqDlg1UU1YmHiBmdiN44i0BS3uEahHhpvpjs=; b=XsdYx6ntNsCXJ4Uv9/0XRTbTOsmRTtmU7V5ngOWcuPQEkDnsqLh1o+5YU8ab27+pWJ +DP59uOuAV1n7iDkjZDJJVnvx5XxoLFD5hVA9JNn0meg+PMquWXn1YYOiBdSYdfnDs9/ CqfAeNu9eSUoGrc1RDV7YhD+dVVzeT4nWnf2dz/B356m+2C/nUtl6R3L/njUyEuFLy9L JTDcnS/hTbp6Al8dmNOknUC+i7MaWUlbGSxCB8ignf+YzfQx+Sq2V4kbN6Buo3ahtpPx d4vMAWsAioewz80vgRxDGg1hdSGaSkNfbqZL40lQPVrv5ltpZgw5whyKOv9Uvop+BKS1 oQIQ== 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 mb10si14003192ejb.35.2020.09.17.05.51.04; Thu, 17 Sep 2020 05:51:28 -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 S1727067AbgIQMto (ORCPT + 99 others); Thu, 17 Sep 2020 08:49:44 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12833 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727016AbgIQMou (ORCPT ); Thu, 17 Sep 2020 08:44:50 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2D97E76B3A852E820812; Thu, 17 Sep 2020 20:44:41 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Thu, 17 Sep 2020 20:44:31 +0800 From: Qinglang Miao To: Ioana Ciornei , Ioana Radulescu , "David S. Miller" , "Jakub Kicinski" CC: , , Qinglang Miao Subject: [PATCH -next v2] dpaa2-eth: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 17 Sep 2020 20:45:08 +0800 Message-ID: <20200917124508.102754-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 Signed-off-by: Qinglang Miao --- v2: based on linux-next(20200917), and can be applied to mainline cleanly now. .../freescale/dpaa2/dpaa2-eth-debugfs.c | 63 ++----------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c index 56d9927fb..b87db0846 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c @@ -42,24 +42,7 @@ static int dpaa2_dbg_cpu_show(struct seq_file *file, void *offset) return 0; } -static int dpaa2_dbg_cpu_open(struct inode *inode, struct file *file) -{ - int err; - struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private; - - err = single_open(file, dpaa2_dbg_cpu_show, priv); - if (err < 0) - netdev_err(priv->net_dev, "single_open() failed\n"); - - return err; -} - -static const struct file_operations dpaa2_dbg_cpu_ops = { - .open = dpaa2_dbg_cpu_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_cpu); static char *fq_type_to_str(struct dpaa2_eth_fq *fq) { @@ -106,24 +89,7 @@ static int dpaa2_dbg_fqs_show(struct seq_file *file, void *offset) return 0; } -static int dpaa2_dbg_fqs_open(struct inode *inode, struct file *file) -{ - int err; - struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private; - - err = single_open(file, dpaa2_dbg_fqs_show, priv); - if (err < 0) - netdev_err(priv->net_dev, "single_open() failed\n"); - - return err; -} - -static const struct file_operations dpaa2_dbg_fq_ops = { - .open = dpaa2_dbg_fqs_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_fqs); static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) { @@ -151,24 +117,7 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) return 0; } -static int dpaa2_dbg_ch_open(struct inode *inode, struct file *file) -{ - int err; - struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private; - - err = single_open(file, dpaa2_dbg_ch_show, priv); - if (err < 0) - netdev_err(priv->net_dev, "single_open() failed\n"); - - return err; -} - -static const struct file_operations dpaa2_dbg_ch_ops = { - .open = dpaa2_dbg_ch_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_ch); void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) { @@ -179,13 +128,13 @@ void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) priv->dbg.dir = dir; /* per-cpu stats file */ - debugfs_create_file("cpu_stats", 0444, dir, priv, &dpaa2_dbg_cpu_ops); + debugfs_create_file("cpu_stats", 0444, dir, priv, &dpaa2_dbg_cpu_fops); /* per-fq stats file */ - debugfs_create_file("fq_stats", 0444, dir, priv, &dpaa2_dbg_fq_ops); + debugfs_create_file("fq_stats", 0444, dir, priv, &dpaa2_dbg_fqs_fops); /* per-fq stats file */ - debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_ops); + debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_fops); } void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv) -- 2.23.0