From patchwork Sat Sep 22 11:45:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10611391 X-Patchwork-Delegate: kvalo@adurom.com 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 990CE17EE for ; Sat, 22 Sep 2018 11:49:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86F5B2BF83 for ; Sat, 22 Sep 2018 11:49:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 779832C0F8; Sat, 22 Sep 2018 11:49:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 074A32BF83 for ; Sat, 22 Sep 2018 11:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729134AbeIVRjP (ORCPT ); Sat, 22 Sep 2018 13:39:15 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:52460 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729025AbeIVRjO (ORCPT ); Sat, 22 Sep 2018 13:39:14 -0400 Received: by mail-wm1-f66.google.com with SMTP id l7-v6so628322wme.2 for ; Sat, 22 Sep 2018 04:45:56 -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; bh=gLQRHTgWVcC5I08/zqlUIPb6owsNlLZcHJ7qnRtPx1o=; b=uXzLV/i19spWbk26rHNNdENcPTCaUu/J8FgG54ZEkdqCvuoWnICTdTrNm/s5P02QkP wtx0sI5zYE0itI/98cs2WiH9xydSDDrddUzIHZZSWH6oym4MSkj7nmzXzxx/qtDgYUSk 48DyYxgqmKfpxrrwD2VgSvzrGOa2lWonEX46pf61SF7H5QzcD9n2oBcoo1SLJfIL7j/z dyh0ZNw96DFYr9bGwRCOU6KUCNL3uomWOHG9JTJ0VfWCnGC3Lg/2SdOMfHt0wwM2mra1 7XK0tBJO9T+ANgXdSZPsyfrOD58hM4bDL6lCGYl62/id68GQ43C1ewmJfUPO6pFjorU1 39Ag== X-Gm-Message-State: APzg51C7kJFQj9EezVDG5rng0GyjFJqpHsufjLn61k7c8YGyzg3WzFsG iWjNnQE96/XqOuvLc0FXgp6l3h4SrWU= X-Google-Smtp-Source: ACcGV60M93RQEJItfsjqGTNkqJtAVR41QRJBr0TQJJ9Imhu/IzTXtUF71GDPhE/h9f8AJx1tBo4xog== X-Received: by 2002:a1c:4156:: with SMTP id o83-v6mr1272786wma.114.1537616755887; Sat, 22 Sep 2018 04:45:55 -0700 (PDT) Received: from localhost.localdomain ([151.66.72.6]) by smtp.gmail.com with ESMTPSA id u4-v6sm19600748wro.47.2018.09.22.04.45.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 04:45:55 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH 8/9] mt76x0: use shared debugfs implementation Date: Sat, 22 Sep 2018 13:45:36 +0200 Message-Id: <20180922114537.24004-9-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.18.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use mt76 shared debugfs implementation and remove duplicated code in mt76x0 driver Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x0/debugfs.c | 80 +------------------ .../wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 - 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c index 75484cd0c9de..ddc1af626b3b 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,71 +75,13 @@ 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; - - 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); - - 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); - - mt76_seq_puts_array(file, "CCK", dev->mt76.rate_power.cck, - ARRAY_SIZE(dev->mt76.rate_power.cck)); - mt76_seq_puts_array(file, "OFDM", dev->mt76.rate_power.ofdm, - ARRAY_SIZE(dev->mt76.rate_power.ofdm)); - mt76_seq_puts_array(file, "STBC", dev->mt76.rate_power.stbc, - ARRAY_SIZE(dev->mt76.rate_power.stbc)); - mt76_seq_puts_array(file, "HT", dev->mt76.rate_power.ht, - ARRAY_SIZE(dev->mt76.rate_power.ht)); - mt76_seq_puts_array(file, "VHT", dev->mt76.rate_power.vht, - ARRAY_SIZE(dev->mt76.rate_power.vht)); - return 0; -} - 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 */