From patchwork Sat Sep 22 11:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10611397 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 6CB69157B for ; Sat, 22 Sep 2018 11:49:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D7082BF7F for ; Sat, 22 Sep 2018 11:49:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525852BF9B; Sat, 22 Sep 2018 11:49:02 +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 59EAD2BF7F for ; Sat, 22 Sep 2018 11:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728618AbeIVRjJ (ORCPT ); Sat, 22 Sep 2018 13:39:09 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36340 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbeIVRjJ (ORCPT ); Sat, 22 Sep 2018 13:39:09 -0400 Received: by mail-wm1-f65.google.com with SMTP id y13-v6so987470wmi.1 for ; Sat, 22 Sep 2018 04:45:51 -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=Bn9IWtird3q6jCPLfxMn7Oe06u3EHQYqnT1tjxvp2yM=; b=g/E4//ZOOiNwt2Tbj24nenW+kn4ME1NXh7K4EeUJOwFzi61dKcGUk3dBxFpNQA1fyl EE3hHVgrfK00m77TNeJXYg0glEl3NE1btiwD0Yn3VNvDRDYuFVyEoeJ16PCI8wDCylWh w0vZzDjeOLPyxXOmJaAMLcxjfpcb6MoBI3AIkLStPLq4E0q1/xVW2p18twoeTsUtpV3h eI6tCUTliZV04aU7YpGCuWJ8LT3F6lttAnwN+hR2r53IdZIbMICwU2pE/bq27+0Lw2no O2pWxOOzEw0aE6R/r+tGGjFgISy9nzsHZY+MIR86eP1Ph6bDcEZMPHe5mRZpJUSDUy2R F5UA== X-Gm-Message-State: APzg51DGESxhqqC4LUqoZHFE/BmPfbGEI7Is705HIFRhzUnUzpGVQ5ZT z/KzhIaOPhsChKNl3Yd8D7ZMlg== X-Google-Smtp-Source: ACcGV63JBeocpFoHP2qxZr9PXyU2XOWW6uGI9CgCokfFI+QbkeTx6FxtbWPZiPWi4RvaGt3J4IRlTw== X-Received: by 2002:a1c:d98a:: with SMTP id q132-v6mr1311254wmg.78.1537616750313; Sat, 22 Sep 2018 04:45:50 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 04:45:49 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH 3/9] mt76: move rate_txpower handler in mt76 debugfs Date: Sat, 22 Sep 2018 13:45:31 +0200 Message-Id: <20180922114537.24004-4-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 Move rate_txpower handler in mt76 debugfs in order to be reused in mt76x0 driver and remove duplicated code Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/debugfs.c | 19 +++++++++++++++++++ .../wireless/mediatek/mt76/mt76x2_debugfs.c | 10 ---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/debugfs.c b/drivers/net/wireless/mediatek/mt76/debugfs.c index 03ce635334fa..a5adf22c3ffa 100644 --- a/drivers/net/wireless/mediatek/mt76/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/debugfs.c @@ -68,6 +68,23 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, } EXPORT_SYMBOL_GPL(mt76_seq_puts_array); +static int mt76_read_rate_txpower(struct seq_file *s, void *data) +{ + struct mt76_dev *dev = dev_get_drvdata(s->private); + + mt76_seq_puts_array(s, "CCK", dev->rate_power.cck, + ARRAY_SIZE(dev->rate_power.cck)); + mt76_seq_puts_array(s, "OFDM", dev->rate_power.ofdm, + ARRAY_SIZE(dev->rate_power.ofdm)); + mt76_seq_puts_array(s, "STBC", dev->rate_power.stbc, + ARRAY_SIZE(dev->rate_power.stbc)); + mt76_seq_puts_array(s, "HT", dev->rate_power.ht, + ARRAY_SIZE(dev->rate_power.ht)); + mt76_seq_puts_array(s, "VHT", dev->rate_power.vht, + ARRAY_SIZE(dev->rate_power.vht)); + return 0; +} + struct dentry *mt76_register_debugfs(struct mt76_dev *dev) { struct dentry *dir; @@ -84,6 +101,8 @@ struct dentry *mt76_register_debugfs(struct mt76_dev *dev) if (dev->otp.data) debugfs_create_blob("otp", 0400, dir, &dev->otp); debugfs_create_devm_seqfile(dev->dev, "queues", dir, mt76_queues_read); + debugfs_create_devm_seqfile(dev->dev, "rate_txpower", dir, + mt76_read_rate_txpower); return dir; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c index 527c94d07d67..ea373bae1522 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c @@ -55,16 +55,6 @@ static int read_txpower(struct seq_file *file, void *data) mt76_seq_puts_array(file, "Delta", dev->target_power_delta, ARRAY_SIZE(dev->target_power_delta)); - 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; }