From patchwork Thu Sep 20 09:12:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10607209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BBEC6CB for ; Thu, 20 Sep 2018 09:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AC3228B9C for ; Thu, 20 Sep 2018 09:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EA5C28BE6; Thu, 20 Sep 2018 09:13:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE46528B9C for ; Thu, 20 Sep 2018 09:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=gRVCpwDY29GYRTXcwXW4+FGDds/c4y98iyw1Sgo7sys=; b=H1F9+q4OwdkidFD76qQDiFQ8KI aL6hZUpU6OV7nVynNhWuLfNMFjNQ5vA1+IIWt+Y7mOQAOrTIkzEKERCHTs5GdlK0N2lheHuZsG/4C xpdpxBVptIe5p36VnGNpM2nhBxzZdVBxPxqPPKeABCPpm+i5dp8OEwYFqtw9UkqGdNahjrXCPO/xs hOt+1xRH8ejV2gecfFML6MHHtFikv1x8m/oZ5p53xPhJz8bQMK4SFh1eVK6GUwXFCpVc8DWetx1hW 8zE4LIZrhCgq136nMbBJPATU2g9PqbR5f3dY3e9YyPLJ1ZSuZBq2CHBVOMTS5r3OLkCuFJOdy+JMD Mz4Lrpdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2v1O-00025T-7P; Thu, 20 Sep 2018 09:13:14 +0000 Received: from mail-wr1-f67.google.com ([209.85.221.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2v0x-00021B-1u for linux-mediatek@lists.infradead.org; Thu, 20 Sep 2018 09:13:06 +0000 Received: by mail-wr1-f67.google.com with SMTP id e1-v6so8601843wrt.3 for ; Thu, 20 Sep 2018 02:12:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yLoxZlVgr8kr0UlHvn0zstixBJYl32WUX+Q9JPkJvmc=; b=BmchvhTaeiCzg9ER8tSa0T6OCTrKvkmFzhmpm0D1B+2oSEwSCkpRu8Wfie8YlwPLWt j+GHmZuBvRF4os45U9pcSaCT0QD5Vi6aKMob4HMcfsOtyaA0zCCTmf0VhazieKabAtJw Uly1J7mNQfv2hIEnOzc1SMmTtqFwOosbI55TCNBLtv/X29kI7nKPWyGidRI+Ey2p5yss TvO+Gr7fOTWstAOSl07tcwLJytcoEpnoPJVpnmCMpLuBbEn+voc6eSo8ixYxm1gy86cD Va3yGGEMKTCQiBrpluEiDNar/pgv2vpO7+luv+d7THCEhy8MbebhW0CuCQ12Gb0eh0rR E0lA== X-Gm-Message-State: APzg51CK2QQkYOuQVv1r+TfpzncfFljeu+wShZ/CwOAtR68V9fhu8DgR tKrKDWtd7sq4X3hCAAjFsm7Flg== X-Google-Smtp-Source: ANB0VdYdlZi43C3mGVhIQjRQm1+5IiuN6mAxvDSj2AHKFnxzV4IuMpOcUQjJBn1JUZ/GuyC6O81lUw== X-Received: by 2002:adf:a35e:: with SMTP id d30-v6mr5764173wrb.31.1537434765443; Thu, 20 Sep 2018 02:12:45 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 34-v6sm35501691wra.20.2018.09.20.02.12.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Sep 2018 02:12:44 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Subject: [PATCH 20/20] mt76x0: use shared debugfs implementation Date: Thu, 20 Sep 2018 11:12:07 +0200 Message-Id: <91751ba6b25f23a8da693d237282988057f1a60a.1537433365.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180920_021247_123743_63C01DB4 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sgruszka@redhat.com, linux-mediatek@lists.infradead.org, linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use mt76 shared debugfs implementation and remove duplicated code Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x0/debugfs.c | 66 +------------------ .../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 - 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c index a34feead2cc4..5fc68bd81d3f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c @@ -18,26 +18,6 @@ #include "mt76x0.h" #include "eeprom.h" -static int -mt76_reg_set(void *data, u64 val) -{ - struct mt76x0_dev *dev = data; - - mt76_wr(dev, dev->debugfs_reg, val); - return 0; -} - -static int -mt76_reg_get(void *data, u64 *val) -{ - struct mt76x0_dev *dev = data; - - *val = mt76_rr(dev, dev->debugfs_reg); - return 0; -} - -DEFINE_SIMPLE_ATTRIBUTE(fops_regval, mt76_reg_get, mt76_reg_set, "0x%08llx\n"); - static int mt76x0_ampdu_stat_read(struct seq_file *file, void *data) { @@ -95,45 +75,6 @@ static const struct file_operations fops_ampdu_stat = { .release = single_release, }; -static int -mt76x0_eeprom_param_read(struct seq_file *file, void *data) -{ - struct mt76x0_dev *dev = file->private; - u16 val; - int i; - - seq_printf(file, "RF freq offset: %hhx\n", - dev->caldata.freq_offset); - seq_printf(file, "RSSI offset: %hhx %hhx\n", - dev->caldata.rssi_offset[0], dev->caldata.rssi_offset[1]); - seq_printf(file, "Temperature offset: %hhx\n", - dev->caldata.temp_offset); - seq_printf(file, "LNA gain: %x\n", dev->caldata.lna_gain); - - val = mt76x02_eeprom_get(&dev->mt76, MT_EE_NIC_CONF_0); - seq_printf(file, "Power Amplifier type %lx\n", - val & MT_EE_NIC_CONF_0_PA_TYPE); - - seq_puts(file, "Per channel power:\n"); - for (i = 0; i < MT76X0_NUM_CHANS; i++) - seq_printf(file, "\t%d chan:%d pwr:%d\n", i, i, - dev->caldata.tx_pwr_per_chan[i]); - return 0; -} - -static int -mt76x0_eeprom_param_open(struct inode *inode, struct file *f) -{ - return single_open(f, mt76x0_eeprom_param_read, inode->i_private); -} - -static const struct file_operations fops_eeprom_param = { - .open = mt76x0_eeprom_param_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - static int mt76x0_read_txpower(struct seq_file *file, void *data) { struct mt76x0_dev *dev = dev_get_drvdata(file->private); @@ -155,16 +96,11 @@ void mt76x0_init_debugfs(struct mt76x0_dev *dev) { struct dentry *dir; - dir = debugfs_create_dir("mt76x0", dev->mt76.hw->wiphy->debugfsdir); + dir = mt76_register_debugfs(&dev->mt76); if (!dir) return; - debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg); - debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev, - &fops_regval); debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat); - debugfs_create_file("eeprom_param", S_IRUSR, dir, dev, - &fops_eeprom_param); debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir, mt76x0_read_txpower); } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h index 101332a35f40..e0b349c921b1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h @@ -94,8 +94,6 @@ struct mt76x0_dev { struct mutex reg_atomic_mutex; struct mutex hw_atomic_mutex; - u32 debugfs_reg; - atomic_t avg_ampdu_len; /* Connection monitoring things */