Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp807843pxb; Fri, 22 Apr 2022 11:34:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+RiKYMYUjPqDMtk34Uult3eV7AVFiqA7VRYeHqkukn2Q8+oET0LMbriyYfj7RQ+fYeiId X-Received: by 2002:a63:2a96:0:b0:398:7865:d650 with SMTP id q144-20020a632a96000000b003987865d650mr4817804pgq.223.1650652478746; Fri, 22 Apr 2022 11:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650652478; cv=none; d=google.com; s=arc-20160816; b=AY0j2RLSJvmus60Ni6dTC5Mghol++s9yIoDss4cnKnbUHlCMR8mnXWjMZOJMWFoFcw yTeVdF+frzssWeGYrjaEPNFb4FKUXjS3r4x2NEGx6gsITEXssiFrlzL1ciky4InF3sFl tF51EF9PJfL7LNhiBvpLhCqSzzHNNaGiae1kfAPrXtpArATZwiw9kvQc2gjWCdpWOhKc i/VgVA/rQDRy5MUc2FYYO8cZl37O4V1dYmElGYzClA+SVLftEF5EmiRiVZT2W0NzN48n HlS0+jtjebbLEsKqboLnd4udPGocl/+4GdYQRyoHc/QlkhAtvncWMmvxDe8KInbzAF4l 92xg== 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:dkim-signature; bh=b328sYp84i/CvToFx9BMqGedw/IAbOAcUjUC3unR+0k=; b=FKT2wghnKLa5WDUhIgFAgvheFup80BtPn59mBDPxdkFxgJ1H9YsGnutoQgaf306ipu o0C8YCTdpteGqnrcSJ9KlO6rIBffR7oMFHouWuQhxqz0S9AjSFhdWG1Xp0njw9GPR+x6 X1LrWSqKBpoLwIQT7pdMKmqyo+8Ys7mtaxToQmFkWy6y3gfYmRBT/1t/yDXUxBfHtrNY Il2MTm53r0LCCTER1ELm7IQ5eFPR8tlhIFVXp/fdewgWQ+Gy3jkRVS0jphO6vg0L9rUh 9Z8X/m+fswDxoJ2FynbDkdLpO9egWzya7rtCj3emxtlajfxjJsBZa7AcDcoM1nE3jCSd IQiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=go+2Bo+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t18-20020a17090a5d9200b001cbae0331f4si8458797pji.130.2022.04.22.11.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=go+2Bo+2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4ABEBB0A7B; Fri, 22 Apr 2022 11:03:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443054AbiDVBcD (ORCPT + 99 others); Thu, 21 Apr 2022 21:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236892AbiDVBcB (ORCPT ); Thu, 21 Apr 2022 21:32:01 -0400 Received: from m15111.mail.126.com (m15111.mail.126.com [220.181.15.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C77E34991B for ; Thu, 21 Apr 2022 18:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=b328s Yp84i/CvToFx9BMqGedw/IAbOAcUjUC3unR+0k=; b=go+2Bo+2qK87t7eB6c+oo Atu+RHLiaYM/OoANhqq6GbeDToLyMNrYUptCdn7qpK9oLrgDIFezVn6kjgtMFVcv CcYuKed7tcGSJoPhT3CHMieau6v5R+W6ICcVWTUlGTtf6ThywAY9KI3FpT5B3k26 FzpSgMdJUiKtg2teYzWIIU= Received: from ubuntu.localdomain (unknown [58.213.83.157]) by smtp1 (Coremail) with SMTP id C8mowABHTzfABGJiO8MNBA--.8225S4; Fri, 22 Apr 2022 09:28:34 +0800 (CST) From: Bernard Zhao To: Jakub Kicinski , Kalle Valo , "David S. Miller" , Paolo Abeni , Matthias Brugger , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: bernard@vivo.com, Bernard Zhao Subject: [PATCH] net/wireless: add debugfs exit function Date: Thu, 21 Apr 2022 18:28:30 -0700 Message-Id: <20220422012830.342993-1-zhaojunkui2008@126.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: C8mowABHTzfABGJiO8MNBA--.8225S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxWryDur13Jw1kJr4rGr15Jwb_yoW5Gw1xpa yUKa4Ykw18Zr1DJ3y8AF4UAFyrG3Zagry7GF90v34ru348Ar1Fq3W0qFW7Aa40qFWUCa45 tF4UtFnrGryIvFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zizBT7UUUUU= X-Originating-IP: [58.213.83.157] X-CM-SenderInfo: p2kd0y5xqn3xasqqmqqrswhudrp/1tbiYAPqqlpEG-QfMQAAs8 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch add exit debugfs function to mt7601u. Debugfs need to be cleanup when module is unloaded or load fail. Signed-off-by: Bernard Zhao --- drivers/net/wireless/mediatek/mt7601u/debugfs.c | 9 +++++++-- drivers/net/wireless/mediatek/mt7601u/init.c | 1 + drivers/net/wireless/mediatek/mt7601u/mt7601u.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt7601u/debugfs.c b/drivers/net/wireless/mediatek/mt7601u/debugfs.c index 20669eacb66e..5ae27aae685b 100644 --- a/drivers/net/wireless/mediatek/mt7601u/debugfs.c +++ b/drivers/net/wireless/mediatek/mt7601u/debugfs.c @@ -9,6 +9,8 @@ #include "mt7601u.h" #include "eeprom.h" +static struct dentry *dir; + static int mt76_reg_set(void *data, u64 val) { @@ -124,8 +126,6 @@ DEFINE_SHOW_ATTRIBUTE(mt7601u_eeprom_param); void mt7601u_init_debugfs(struct mt7601u_dev *dev) { - struct dentry *dir; - dir = debugfs_create_dir("mt7601u", dev->hw->wiphy->debugfsdir); if (!dir) return; @@ -138,3 +138,8 @@ void mt7601u_init_debugfs(struct mt7601u_dev *dev) debugfs_create_file("ampdu_stat", 0400, dir, dev, &mt7601u_ampdu_stat_fops); debugfs_create_file("eeprom_param", 0400, dir, dev, &mt7601u_eeprom_param_fops); } + +void mt7601u_exit_debugfs(struct mt7601u_dev *dev) +{ + debugfs_remove(dir); +} diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c index 5d9e952b2966..eacdd5785fa6 100644 --- a/drivers/net/wireless/mediatek/mt7601u/init.c +++ b/drivers/net/wireless/mediatek/mt7601u/init.c @@ -427,6 +427,7 @@ void mt7601u_cleanup(struct mt7601u_dev *dev) mt7601u_stop_hardware(dev); mt7601u_dma_cleanup(dev); mt7601u_mcu_cmd_deinit(dev); + mt7601u_exit_debugfs(dev); } struct mt7601u_dev *mt7601u_alloc_device(struct device *pdev) diff --git a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h index a122f1dd38f6..a77bfef0d39f 100644 --- a/drivers/net/wireless/mediatek/mt7601u/mt7601u.h +++ b/drivers/net/wireless/mediatek/mt7601u/mt7601u.h @@ -279,6 +279,7 @@ struct mt7601u_rxwi; extern const struct ieee80211_ops mt7601u_ops; void mt7601u_init_debugfs(struct mt7601u_dev *dev); +void mt7601u_exit_debugfs(struct mt7601u_dev *dev); u32 mt7601u_rr(struct mt7601u_dev *dev, u32 offset); void mt7601u_wr(struct mt7601u_dev *dev, u32 offset, u32 val); -- 2.33.1