From nobody Wed Apr 15 00:02:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41C4CC19F2A for ; Fri, 29 Jul 2022 03:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234381AbiG2Dxy (ORCPT ); Thu, 28 Jul 2022 23:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234369AbiG2Dx1 (ORCPT ); Thu, 28 Jul 2022 23:53:27 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D51F7D1F7 for ; Thu, 28 Jul 2022 20:53:00 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id r186so3084240pgr.2 for ; Thu, 28 Jul 2022 20:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CZItQLAW8Jh9MeJoBkGCq+PdE0G2KUuFj2lt1NOdTUA=; b=O3fFypORX/cqgzGrIUgf2Pot+Lkc7E0X+j2SmfEo1pxlmXacUYQKA/jPXr4xz76AA/ Y1GQBfgPev+8r5TPqhRy7cxkrBLqZo65yt5if/r0pTCn7hbBbPqb5ugkg9/xqQTuUItN WH8X9dVRJyA6YgsRyXWmITaeZOQ7kHYF7jDZsm+n6ICT9DVEtYJMmbVySmeFx2FgxDJy eJRkyBjQmjdzFEMq/TPcvIwTMtKcOxr9HuKSIFeNfjr1eumylL3xhgZy5EMTlrtbkXEH JlSfqtnGwZM63uPfmqeAReLBttANrWzY2sXTcXyFrNaCFaQffNm10bIz54A5d5bFY11B oo6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CZItQLAW8Jh9MeJoBkGCq+PdE0G2KUuFj2lt1NOdTUA=; b=5NS4a5qdt7Cd6UHqKQM3UGWzwgt52O+DPxKSeD4m3p5/G03SpNwDEYjStToSB3DpD0 oUrLF8hNuxWF9HURXDvNtJFpn44TUbKcVG11Z5pbvwaBCZKatDAo8S++wLtPnWZEhWNs Pznsk3OwYpGijGq9nTBR92NThnlTml+xqrHsRB4Y0thPyzAqlCR6UK0KuC0qIv+xCZiv 7UqT0Sp/YmNiUlTEswIdnbMIMLuRk2YJgxhj2Ep8OpjiZY2hDSLMNUNAEQKxour1hY5s O3lsfWVLX5qKSOu1JojEZM0GQ1Q1Hm3X7a/Z9Q5hRrRAtkdvJbgwtTT7BsY+MjQxDnpk KPmg== X-Gm-Message-State: AJIora/Dom1CAJ9wkdexogZG+LAEytAqSROPaRgIZCDzTTiIpT+TZ4qZ lefTIi2Kn/4qP0r1ARkIFNU= X-Google-Smtp-Source: AGRyM1tcMTqsjkzewf+x3PSx0NmzvH8winSG1E5ZFeP9ujZHfP6V+TGdx3+kAOBPgDIsQ3Goa4yc+w== X-Received: by 2002:a05:6a00:1806:b0:52a:ec5b:2263 with SMTP id y6-20020a056a00180600b0052aec5b2263mr1589220pfa.1.1659066779543; Thu, 28 Jul 2022 20:52:59 -0700 (PDT) Received: from tong-desktop.local ([2600:1700:3ec7:421f:a06b:5560:ec65:277f]) by smtp.googlemail.com with ESMTPSA id h14-20020a170902680e00b0016d2d2c7df1sm2135478plk.188.2022.07.28.20.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 20:52:59 -0700 (PDT) From: Tong Zhang To: Greg Kroah-Hartman , Tong Zhang , Dan Carpenter , Jakub Kicinski , Saurav Girepunje , Colin Ian King , Nathan Chancellor , Johan Hovold , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v3 1/3] staging: rtl8192u: move debug stuff to its own file Date: Thu, 28 Jul 2022 20:52:18 -0700 Message-Id: <20220729035230.226172-2-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220729035230.226172-1-ztong0001@gmail.com> References: <20220729035230.226172-1-ztong0001@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This is to prepare for moving them to debugfs and fix rmmod warn issue when wlan0 is renamed to something else. Reviewed-by: Dan Carpenter Signed-off-by: Tong Zhang Reported-by: Zheyu Ma Tested-by: Zheyu Ma --- drivers/staging/rtl8192u/Makefile | 1 + drivers/staging/rtl8192u/r8192U.h | 4 + drivers/staging/rtl8192u/r8192U_core.c | 173 ---------------------- drivers/staging/rtl8192u/r8192U_procfs.c | 176 +++++++++++++++++++++++ 4 files changed, 181 insertions(+), 173 deletions(-) create mode 100644 drivers/staging/rtl8192u/r8192U_procfs.c diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/M= akefile index 0be7426b6ebc..5aef46cc90ef 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -8,6 +8,7 @@ ccflags-y +=3D -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SK= B -DTHOMAS_TURBO r8192u_usb-y :=3D r8192U_core.o r8180_93cx6.o r8192U_wx.o \ r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ r819xU_cmdpkt.o r8192U_dm.o r819xU_firmware_img.o \ + r8192U_procfs.o \ ieee80211/ieee80211_crypt.o \ ieee80211/ieee80211_crypt_tkip.o \ ieee80211/ieee80211_crypt_ccmp.o \ diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r= 8192U.h index 14ca00a2789b..e8b6da2adc4d 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1117,4 +1117,8 @@ void EnableHWSecurityConfig8192(struct net_device *de= v); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); =20 +void rtl8192_proc_module_init(void); +void rtl8192_proc_init_one(struct net_device *dev); +void rtl8192_proc_remove_one(struct net_device *dev); + #endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl81= 92u/r8192U_core.c index 2ca925f35830..9e0861fdc64e 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -452,179 +452,6 @@ static struct net_device_stats *rtl8192_stats(struct = net_device *dev); static void rtl8192_restart(struct work_struct *work); static void watch_dog_timer_callback(struct timer_list *t); =20 -/*************************************************************************= *** - * -----------------------------PROCFS STUFF------------------------- - *************************************************************************= ***/ - -static struct proc_dir_entry *rtl8192_proc; - -static int __maybe_unused proc_get_stats_ap(struct seq_file *m, void *v) -{ - struct net_device *dev =3D m->private; - struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); - struct ieee80211_device *ieee =3D priv->ieee80211; - struct ieee80211_network *target; - - list_for_each_entry(target, &ieee->network_list, list) { - const char *wpa =3D "non_WPA"; - - if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) - wpa =3D "WPA"; - - seq_printf(m, "%s %s\n", target->ssid, wpa); - } - - return 0; -} - -static int __maybe_unused proc_get_registers(struct seq_file *m, void *v) -{ - struct net_device *dev =3D m->private; - int i, n, max =3D 0xff; - u8 byte_rd; - - seq_puts(m, "\n####################page 0##################\n "); - - for (n =3D 0; n <=3D max;) { - seq_printf(m, "\nD: %2x > ", n); - - for (i =3D 0; i < 16 && n <=3D max; i++, n++) { - read_nic_byte(dev, 0x000 | n, &byte_rd); - seq_printf(m, "%2x ", byte_rd); - } - } - - seq_puts(m, "\n####################page 1##################\n "); - for (n =3D 0; n <=3D max;) { - seq_printf(m, "\nD: %2x > ", n); - - for (i =3D 0; i < 16 && n <=3D max; i++, n++) { - read_nic_byte(dev, 0x100 | n, &byte_rd); - seq_printf(m, "%2x ", byte_rd); - } - } - - seq_puts(m, "\n####################page 3##################\n "); - for (n =3D 0; n <=3D max;) { - seq_printf(m, "\nD: %2x > ", n); - - for (i =3D 0; i < 16 && n <=3D max; i++, n++) { - read_nic_byte(dev, 0x300 | n, &byte_rd); - seq_printf(m, "%2x ", byte_rd); - } - } - - seq_putc(m, '\n'); - return 0; -} - -static int __maybe_unused proc_get_stats_tx(struct seq_file *m, void *v) -{ - struct net_device *dev =3D m->private; - struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); - - seq_printf(m, - "TX VI priority ok int: %lu\n" - "TX VI priority error int: %lu\n" - "TX VO priority ok int: %lu\n" - "TX VO priority error int: %lu\n" - "TX BE priority ok int: %lu\n" - "TX BE priority error int: %lu\n" - "TX BK priority ok int: %lu\n" - "TX BK priority error int: %lu\n" - "TX MANAGE priority ok int: %lu\n" - "TX MANAGE priority error int: %lu\n" - "TX BEACON priority ok int: %lu\n" - "TX BEACON priority error int: %lu\n" - "TX queue resume: %lu\n" - "TX queue stopped?: %d\n" - "TX fifo overflow: %lu\n" - "TX VI queue: %d\n" - "TX VO queue: %d\n" - "TX BE queue: %d\n" - "TX BK queue: %d\n" - "TX VI dropped: %lu\n" - "TX VO dropped: %lu\n" - "TX BE dropped: %lu\n" - "TX BK dropped: %lu\n" - "TX total data packets %lu\n", - priv->stats.txviokint, - priv->stats.txvierr, - priv->stats.txvookint, - priv->stats.txvoerr, - priv->stats.txbeokint, - priv->stats.txbeerr, - priv->stats.txbkokint, - priv->stats.txbkerr, - priv->stats.txmanageokint, - priv->stats.txmanageerr, - priv->stats.txbeaconokint, - priv->stats.txbeaconerr, - priv->stats.txresumed, - netif_queue_stopped(dev), - priv->stats.txoverflow, - atomic_read(&(priv->tx_pending[VI_PRIORITY])), - atomic_read(&(priv->tx_pending[VO_PRIORITY])), - atomic_read(&(priv->tx_pending[BE_PRIORITY])), - atomic_read(&(priv->tx_pending[BK_PRIORITY])), - priv->stats.txvidrop, - priv->stats.txvodrop, - priv->stats.txbedrop, - priv->stats.txbkdrop, - priv->stats.txdatapkt - ); - - return 0; -} - -static int __maybe_unused proc_get_stats_rx(struct seq_file *m, void *v) -{ - struct net_device *dev =3D m->private; - struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); - - seq_printf(m, - "RX packets: %lu\n" - "RX urb status error: %lu\n" - "RX invalid urb error: %lu\n", - priv->stats.rxoktotal, - priv->stats.rxstaterr, - priv->stats.rxurberr); - - return 0; -} - -static void rtl8192_proc_module_init(void) -{ - RT_TRACE(COMP_INIT, "Initializing proc filesystem"); - rtl8192_proc =3D proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net); -} - -static void rtl8192_proc_init_one(struct net_device *dev) -{ - struct proc_dir_entry *dir; - - if (!rtl8192_proc) - return; - - dir =3D proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); - if (!dir) - return; - - proc_create_single("stats-rx", S_IFREG | 0444, dir, - proc_get_stats_rx); - proc_create_single("stats-tx", S_IFREG | 0444, dir, - proc_get_stats_tx); - proc_create_single("stats-ap", S_IFREG | 0444, dir, - proc_get_stats_ap); - proc_create_single("registers", S_IFREG | 0444, dir, - proc_get_registers); -} - -static void rtl8192_proc_remove_one(struct net_device *dev) -{ - remove_proc_subtree(dev->name, rtl8192_proc); -} - /*************************************************************************= *** * -----------------------------MISC STUFF------------------------- *************************************************************************= ****/ diff --git a/drivers/staging/rtl8192u/r8192U_procfs.c b/drivers/staging/rtl= 8192u/r8192U_procfs.c new file mode 100644 index 000000000000..cc69d78d5152 --- /dev/null +++ b/drivers/staging/rtl8192u/r8192U_procfs.c @@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0 +/*************************************************************************= *** + * -----------------------------PROCFS STUFF------------------------- + *************************************************************************= ***/ +#include +#include +#include "r8192U.h" + +static struct proc_dir_entry *rtl8192_proc; +static int __maybe_unused proc_get_stats_ap(struct seq_file *m, void *v) +{ + struct net_device *dev =3D m->private; + struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + struct ieee80211_device *ieee =3D priv->ieee80211; + struct ieee80211_network *target; + + list_for_each_entry(target, &ieee->network_list, list) { + const char *wpa =3D "non_WPA"; + + if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) + wpa =3D "WPA"; + + seq_printf(m, "%s %s\n", target->ssid, wpa); + } + + return 0; +} + +static int __maybe_unused proc_get_registers(struct seq_file *m, void *v) +{ + struct net_device *dev =3D m->private; + int i, n, max =3D 0xff; + u8 byte_rd; + + seq_puts(m, "\n####################page 0##################\n "); + + for (n =3D 0; n <=3D max;) { + seq_printf(m, "\nD: %2x > ", n); + + for (i =3D 0; i < 16 && n <=3D max; i++, n++) { + read_nic_byte(dev, 0x000 | n, &byte_rd); + seq_printf(m, "%2x ", byte_rd); + } + } + + seq_puts(m, "\n####################page 1##################\n "); + for (n =3D 0; n <=3D max;) { + seq_printf(m, "\nD: %2x > ", n); + + for (i =3D 0; i < 16 && n <=3D max; i++, n++) { + read_nic_byte(dev, 0x100 | n, &byte_rd); + seq_printf(m, "%2x ", byte_rd); + } + } + + seq_puts(m, "\n####################page 3##################\n "); + for (n =3D 0; n <=3D max;) { + seq_printf(m, "\nD: %2x > ", n); + + for (i =3D 0; i < 16 && n <=3D max; i++, n++) { + read_nic_byte(dev, 0x300 | n, &byte_rd); + seq_printf(m, "%2x ", byte_rd); + } + } + + seq_putc(m, '\n'); + return 0; +} + +static int __maybe_unused proc_get_stats_tx(struct seq_file *m, void *v) +{ + struct net_device *dev =3D m->private; + struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + + seq_printf(m, + "TX VI priority ok int: %lu\n" + "TX VI priority error int: %lu\n" + "TX VO priority ok int: %lu\n" + "TX VO priority error int: %lu\n" + "TX BE priority ok int: %lu\n" + "TX BE priority error int: %lu\n" + "TX BK priority ok int: %lu\n" + "TX BK priority error int: %lu\n" + "TX MANAGE priority ok int: %lu\n" + "TX MANAGE priority error int: %lu\n" + "TX BEACON priority ok int: %lu\n" + "TX BEACON priority error int: %lu\n" + "TX queue resume: %lu\n" + "TX queue stopped?: %d\n" + "TX fifo overflow: %lu\n" + "TX VI queue: %d\n" + "TX VO queue: %d\n" + "TX BE queue: %d\n" + "TX BK queue: %d\n" + "TX VI dropped: %lu\n" + "TX VO dropped: %lu\n" + "TX BE dropped: %lu\n" + "TX BK dropped: %lu\n" + "TX total data packets %lu\n", + priv->stats.txviokint, + priv->stats.txvierr, + priv->stats.txvookint, + priv->stats.txvoerr, + priv->stats.txbeokint, + priv->stats.txbeerr, + priv->stats.txbkokint, + priv->stats.txbkerr, + priv->stats.txmanageokint, + priv->stats.txmanageerr, + priv->stats.txbeaconokint, + priv->stats.txbeaconerr, + priv->stats.txresumed, + netif_queue_stopped(dev), + priv->stats.txoverflow, + atomic_read(&(priv->tx_pending[VI_PRIORITY])), + atomic_read(&(priv->tx_pending[VO_PRIORITY])), + atomic_read(&(priv->tx_pending[BE_PRIORITY])), + atomic_read(&(priv->tx_pending[BK_PRIORITY])), + priv->stats.txvidrop, + priv->stats.txvodrop, + priv->stats.txbedrop, + priv->stats.txbkdrop, + priv->stats.txdatapkt + ); + + return 0; +} + +static int __maybe_unused proc_get_stats_rx(struct seq_file *m, void *v) +{ + struct net_device *dev =3D m->private; + struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + + seq_printf(m, + "RX packets: %lu\n" + "RX urb status error: %lu\n" + "RX invalid urb error: %lu\n", + priv->stats.rxoktotal, + priv->stats.rxstaterr, + priv->stats.rxurberr); + + return 0; +} + +void rtl8192_proc_module_init(void) +{ + RT_TRACE(COMP_INIT, "Initializing proc filesystem"); + rtl8192_proc =3D proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net); +} + +void rtl8192_proc_init_one(struct net_device *dev) +{ + struct proc_dir_entry *dir; + + if (!rtl8192_proc) + return; + + dir =3D proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); + if (!dir) + return; + + proc_create_single("stats-rx", S_IFREG | 0444, dir, + proc_get_stats_rx); + proc_create_single("stats-tx", S_IFREG | 0444, dir, + proc_get_stats_tx); + proc_create_single("stats-ap", S_IFREG | 0444, dir, + proc_get_stats_ap); + proc_create_single("registers", S_IFREG | 0444, dir, + proc_get_registers); +} + +void rtl8192_proc_remove_one(struct net_device *dev) +{ + remove_proc_subtree(dev->name, rtl8192_proc); +} + --=20 2.25.1 From nobody Wed Apr 15 00:02:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BF09C00144 for ; Fri, 29 Jul 2022 03:54:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234355AbiG2DyI (ORCPT ); Thu, 28 Jul 2022 23:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234475AbiG2Dxk (ORCPT ); Thu, 28 Jul 2022 23:53:40 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A8087D7AC for ; Thu, 28 Jul 2022 20:53:11 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id d7so36711pgc.13 for ; Thu, 28 Jul 2022 20:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=B50b+uTrKKFimaEMaPsMfW1YYtJusLaGj9KK7WXDqKE=; b=aO36RuuCokBgjntt/kMhD9Q+4WEs7uzCFMMcsSYnt4tObZGBrDjLOqW8OeHcYWGgeI ZOKpdlx00xzVWCRRBJT8s4dBFEWVxkrZD6kfuk30iy1FlgHooiVVmMDjqIAQZL2ZCr6+ Z3NaNboW6nXEqj/zl8SPjkwdp7r3ZYcGIvKYUFads0pCjRjBLad+uPpGHdPCMUeXO1Hf wR0DD0LIEwcH4ipuYyMeY5qBGK5bONHtzx6o19AuKdUI/1DiphFrvzeA9H8bQeQ2UnI2 YuSkCcPkAwaBDC6cDYNwCQvBybiYC28EKB+VQk6ezTO7AYn3zpKqakat6A2FB8zEYON/ V+3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B50b+uTrKKFimaEMaPsMfW1YYtJusLaGj9KK7WXDqKE=; b=R16LCp6ApLRpenKV7WJbZHX7Rh4BXQBgoD0hth6BNeCSlmybk9czQozl/j/+rlQ8ZF 8MKSaQ1MtiLbyyI6r8QNaoe0xQfvce+LTyrM+MvIKQWh+cVXQZvlsVbuQzs21dCTMLsQ 9Qblhul00T4WWsqzpEIi5neoBqrdmEf83pTNo//KyX/yXwy4U8m9m7oB14oqy2zMBrFq hAqVyoop7cNjqsvydV+h4fh4KqFIM0csTRGZAVIjh/lPwiM9WwGVGD47UNa+2zU7VJxS UbXe47W0b1+qoFLS2kn0I97ZgdU6QlO43XmNBG1Tp8I0Z3iLO5iMnE2BM79vvUvGVo/0 9RCA== X-Gm-Message-State: AJIora9p4pFzS+2VC6tJ6LRq6ZkwOYETQDLa98kZvZ35rFYmGdr6J9HA rFxV+ygqEoIh8kjREwmpHFY= X-Google-Smtp-Source: AGRyM1t85ewpow1d6Mn4lZuRAJnrTPp9BydAE7pvj8kTZimuc9jE565X0OFzrAxwsDv30UhP3Ferxg== X-Received: by 2002:aa7:8e0e:0:b0:52b:49ca:a7d6 with SMTP id c14-20020aa78e0e000000b0052b49caa7d6mr1557903pfr.77.1659066790634; Thu, 28 Jul 2022 20:53:10 -0700 (PDT) Received: from tong-desktop.local ([2600:1700:3ec7:421f:a06b:5560:ec65:277f]) by smtp.googlemail.com with ESMTPSA id h14-20020a170902680e00b0016d2d2c7df1sm2135478plk.188.2022.07.28.20.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 20:53:10 -0700 (PDT) From: Tong Zhang To: Greg Kroah-Hartman , Dan Carpenter , Tong Zhang , Jakub Kicinski , Colin Ian King , Saurav Girepunje , Johan Hovold , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v3 2/3] staging: rtl8192u: move debug files to debugfs Date: Thu, 28 Jul 2022 20:52:19 -0700 Message-Id: <20220729035230.226172-3-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220729035230.226172-1-ztong0001@gmail.com> References: <20220729035230.226172-1-ztong0001@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There are 4 debug files created under /proc/net/[Devname]. Due to this is purely for debuging as files are created read only, move this to debugfs like other NIC drivers do instead of using procfs. The directory structure will be like the following /sys/kernel/debug/r8192u_usb/wlan0/stats-rx /sys/kernel/debug/r8192u_usb/wlan0/stats-rx /sys/kernel/debug/r8192u_usb/wlan0/stats-ap /sys/kernel/debug/r8192u_usb/wlan0/registers This is also to prepare for address rmmod warn issue. Reviewed-by: Dan Carpenter Signed-off-by: Tong Zhang Reported-by: Zheyu Ma Tested-by: Zheyu Ma --- drivers/staging/rtl8192u/Makefile | 2 +- drivers/staging/rtl8192u/r8192U.h | 10 ++- drivers/staging/rtl8192u/r8192U_core.c | 21 +++--- .../{r8192U_procfs.c =3D> r8192U_debugfs.c} | 65 ++++++++++--------- 4 files changed, 54 insertions(+), 44 deletions(-) rename drivers/staging/rtl8192u/{r8192U_procfs.c =3D> r8192U_debugfs.c} (6= 9%) diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/M= akefile index 5aef46cc90ef..d32dfd89a606 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -8,7 +8,7 @@ ccflags-y +=3D -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SK= B -DTHOMAS_TURBO r8192u_usb-y :=3D r8192U_core.o r8180_93cx6.o r8192U_wx.o \ r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ r819xU_cmdpkt.o r8192U_dm.o r819xU_firmware_img.o \ - r8192U_procfs.o \ + r8192U_debugfs.o \ ieee80211/ieee80211_crypt.o \ ieee80211/ieee80211_crypt_tkip.o \ ieee80211/ieee80211_crypt_ccmp.o \ diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r= 8192U.h index e8b6da2adc4d..920a6a154860 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1061,6 +1061,9 @@ typedef struct r8192_priv { struct delayed_work gpio_change_rf_wq; struct delayed_work initialgain_operate_wq; struct workqueue_struct *priv_wq; + + /* debugfs */ + struct dentry *debugfs_dir; } r8192_priv; =20 /* For rtl8187B */ @@ -1117,8 +1120,9 @@ void EnableHWSecurityConfig8192(struct net_device *de= v); void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent); =20 -void rtl8192_proc_module_init(void); -void rtl8192_proc_init_one(struct net_device *dev); -void rtl8192_proc_remove_one(struct net_device *dev); +void rtl8192_debugfs_init_one(struct net_device *dev); +void rtl8192_debugfs_exit_one(struct net_device *dev); +void rtl8192_debugfs_init(void); +void rtl8192_debugfs_exit(void); =20 #endif diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl81= 92u/r8192U_core.c index 9e0861fdc64e..865bc0dc7c71 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -56,7 +56,6 @@ double __extendsfdf2(float a) #include "r8192U_dm.h" #include #include -#include #include /* FIXME: check if 2.6.7 is ok */ =20 @@ -4557,7 +4556,7 @@ static int rtl8192_usb_probe(struct usb_interface *in= tf, goto fail2; =20 RT_TRACE(COMP_INIT, "dev name=3D=3D=3D=3D=3D=3D=3D> %s\n", dev->name); - rtl8192_proc_init_one(dev); + rtl8192_debugfs_init_one(dev); =20 RT_TRACE(COMP_INIT, "Driver probe completed\n"); return 0; @@ -4591,10 +4590,11 @@ static void rtl8192_usb_disconnect(struct usb_inter= face *intf) struct net_device *dev =3D usb_get_intfdata(intf); struct r8192_priv *priv =3D ieee80211_priv(dev); =20 - unregister_netdev(dev); =20 RT_TRACE(COMP_DOWN, "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>wlan driver = to be removed\n"); - rtl8192_proc_remove_one(dev); + rtl8192_debugfs_exit_one(dev); + + unregister_netdev(dev); =20 rtl8192_down(dev); kfree(priv->pFirmware); @@ -4615,10 +4615,11 @@ static int __init rtl8192_usb_module_init(void) RT_TRACE(COMP_INIT, "Initializing module"); RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); =20 + rtl8192_debugfs_init(); ret =3D ieee80211_debug_init(); if (ret) { pr_err("ieee80211_debug_init() failed %d\n", ret); - return ret; + goto debugfs_exit; } =20 ret =3D ieee80211_crypto_init(); @@ -4645,14 +4646,12 @@ static int __init rtl8192_usb_module_init(void) goto crypto_ccmp_exit; } =20 - rtl8192_proc_module_init(); ret =3D usb_register(&rtl8192_usb_driver); if (ret) - goto rtl8192_proc_module_exit; + goto crypto_wep_exit; return ret; =20 -rtl8192_proc_module_exit: - remove_proc_entry(RTL819XU_MODULE_NAME, init_net.proc_net); +crypto_wep_exit: ieee80211_crypto_wep_exit(); crypto_ccmp_exit: ieee80211_crypto_ccmp_exit(); @@ -4662,18 +4661,20 @@ static int __init rtl8192_usb_module_init(void) ieee80211_crypto_deinit(); debug_exit: ieee80211_debug_exit(); +debugfs_exit: + rtl8192_debugfs_exit(); return ret; } =20 static void __exit rtl8192_usb_module_exit(void) { usb_deregister(&rtl8192_usb_driver); - remove_proc_entry(RTL819XU_MODULE_NAME, init_net.proc_net); ieee80211_crypto_wep_exit(); ieee80211_crypto_ccmp_exit(); ieee80211_crypto_tkip_exit(); ieee80211_crypto_deinit(); ieee80211_debug_exit(); + rtl8192_debugfs_exit(); RT_TRACE(COMP_DOWN, "Exiting"); } =20 diff --git a/drivers/staging/rtl8192u/r8192U_procfs.c b/drivers/staging/rtl= 8192u/r8192U_debugfs.c similarity index 69% rename from drivers/staging/rtl8192u/r8192U_procfs.c rename to drivers/staging/rtl8192u/r8192U_debugfs.c index cc69d78d5152..79cd095114ca 100644 --- a/drivers/staging/rtl8192u/r8192U_procfs.c +++ b/drivers/staging/rtl8192u/r8192U_debugfs.c @@ -1,13 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 /*************************************************************************= *** - * -----------------------------PROCFS STUFF------------------------- + * -----------------------------DEGUGFS STUFF------------------------- *************************************************************************= ***/ -#include +#include #include #include "r8192U.h" =20 -static struct proc_dir_entry *rtl8192_proc; -static int __maybe_unused proc_get_stats_ap(struct seq_file *m, void *v) +#define R8192U_DEBUGFS_DIR_NAME "r8192u_usb" + +static int rtl8192_usb_stats_ap_show(struct seq_file *m, void *v) { struct net_device *dev =3D m->private; struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); @@ -26,7 +27,7 @@ static int __maybe_unused proc_get_stats_ap(struct seq_fi= le *m, void *v) return 0; } =20 -static int __maybe_unused proc_get_registers(struct seq_file *m, void *v) +static int rtl8192_usb_registers_show(struct seq_file *m, void *v) { struct net_device *dev =3D m->private; int i, n, max =3D 0xff; @@ -67,7 +68,7 @@ static int __maybe_unused proc_get_registers(struct seq_f= ile *m, void *v) return 0; } =20 -static int __maybe_unused proc_get_stats_tx(struct seq_file *m, void *v) +static int rtl8192_usb_stats_tx_show(struct seq_file *m, void *v) { struct net_device *dev =3D m->private; struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); @@ -126,7 +127,7 @@ static int __maybe_unused proc_get_stats_tx(struct seq_= file *m, void *v) return 0; } =20 -static int __maybe_unused proc_get_stats_rx(struct seq_file *m, void *v) +static int rtl8192_usb_stats_rx_show(struct seq_file *m, void *v) { struct net_device *dev =3D m->private; struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); @@ -142,35 +143,39 @@ static int __maybe_unused proc_get_stats_rx(struct se= q_file *m, void *v) return 0; } =20 -void rtl8192_proc_module_init(void) +DEFINE_SHOW_ATTRIBUTE(rtl8192_usb_stats_rx); +DEFINE_SHOW_ATTRIBUTE(rtl8192_usb_stats_tx); +DEFINE_SHOW_ATTRIBUTE(rtl8192_usb_stats_ap); +DEFINE_SHOW_ATTRIBUTE(rtl8192_usb_registers); + +void rtl8192_debugfs_init_one(struct net_device *dev) +{ + struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + struct dentry *parent_dir =3D debugfs_lookup(R8192U_DEBUGFS_DIR_NAME, NUL= L); + struct dentry *dir =3D debugfs_create_dir(dev->name, parent_dir); + + debugfs_create_file("stats-rx", 0444, dir, dev, &rtl8192_usb_stats_rx_fop= s); + debugfs_create_file("stats-tx", 0444, dir, dev, &rtl8192_usb_stats_tx_fop= s); + debugfs_create_file("stats-ap", 0444, dir, dev, &rtl8192_usb_stats_ap_fop= s); + debugfs_create_file("registers", 0444, dir, dev, &rtl8192_usb_registers_f= ops); + + priv->debugfs_dir =3D dir; +} + +void rtl8192_debugfs_exit_one(struct net_device *dev) { - RT_TRACE(COMP_INIT, "Initializing proc filesystem"); - rtl8192_proc =3D proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net); + struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + + debugfs_remove_recursive(priv->debugfs_dir); } =20 -void rtl8192_proc_init_one(struct net_device *dev) +void rtl8192_debugfs_init(void) { - struct proc_dir_entry *dir; - - if (!rtl8192_proc) - return; - - dir =3D proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); - if (!dir) - return; - - proc_create_single("stats-rx", S_IFREG | 0444, dir, - proc_get_stats_rx); - proc_create_single("stats-tx", S_IFREG | 0444, dir, - proc_get_stats_tx); - proc_create_single("stats-ap", S_IFREG | 0444, dir, - proc_get_stats_ap); - proc_create_single("registers", S_IFREG | 0444, dir, - proc_get_registers); + debugfs_create_dir(R8192U_DEBUGFS_DIR_NAME, NULL); } =20 -void rtl8192_proc_remove_one(struct net_device *dev) +void rtl8192_debugfs_exit(void) { - remove_proc_subtree(dev->name, rtl8192_proc); + debugfs_remove_recursive(debugfs_lookup(R8192U_DEBUGFS_DIR_NAME, NULL)); } =20 --=20 2.25.1 From nobody Wed Apr 15 00:02:06 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02122C3F6B0 for ; Fri, 29 Jul 2022 03:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234163AbiG2DyO (ORCPT ); Thu, 28 Jul 2022 23:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234499AbiG2Dxo (ORCPT ); Thu, 28 Jul 2022 23:53:44 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A47317D1CA for ; Thu, 28 Jul 2022 20:53:22 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id b9so3566851pfp.10 for ; Thu, 28 Jul 2022 20:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+RQ5jl0QZSNw11sMEYyKmhqkb/IQTFMm9WWtDB/yiG4=; b=JKKq4lgBFOs5kA9DHxls2r0V0nUa9DgcuppsEOpgLbHO2asFLBvA4nlO0SLjfXYImx L4D9qo2TKzvcWPWtfVUpwy2c35yeS0rYIO9d9eCZFRqHZ0zbGNXJArPGnYY9PNlMEOdf bNjAWk8pr48FZgq1KIGAERU2WdPHjxwEN6oMWznvwTKSLVmGDkqizKhTOsWy+29KF3+9 jAMjhixxbXebLzKckyNyrmwr8pzE1oB2MMSHw8tGTGcJDkybwpunkcbm9WJY36C7os3Q aaYDMhQxqOaVaACH6IueJxhdiCAlaFtPpe6nTio0UUhiNeSGNGSp8pT+FTB6pSIknM6m ajoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+RQ5jl0QZSNw11sMEYyKmhqkb/IQTFMm9WWtDB/yiG4=; b=g/6wrmhWJAAiKf/ZXeekzsilhrVPAL+w6Xz2nmz1u6A5/aEWhPXElVh6RWPwR5lOKw lh5oT3eiZSukwjo19h/j9lNN/T7CwHZnxvBdIyan+cWDS2XdPjXUB468YiAZc+atSQTk NxZBdY6+gzVTIMjMw/kszYohO6Po/DC/JL4ahsvvyincu1ZoMiD2GhKIF/rXiNJtHg1w cvbP2KkN8J1MfHXPXiC1uN93M5JCObxa5lDLloqeVjSsRhxnaWoSy2l+gWORw9C7b7M2 Sq3XIIOvHFUpBvJJBO2t/HrlkpVDBL+fzo5zWkyuSJEHlPG9PkZ2hSt519C1XYUxl62J LXuQ== X-Gm-Message-State: AJIora/6VrG8shskEBKoiF3lNUqU0zCrvBQU67dSt/PtQhSOE6Q2himX nuvGEPZMmU7bw1CQQ22NL10= X-Google-Smtp-Source: AGRyM1sGqYdaiGUmCAdFLSmDl00nWSX1oXgslThHgn+h7hlMqMIT0F7c/8jYs6biiJ/yJjo6W+l8CA== X-Received: by 2002:aa7:8d94:0:b0:52b:a70e:ae89 with SMTP id i20-20020aa78d94000000b0052ba70eae89mr1901086pfr.23.1659066801787; Thu, 28 Jul 2022 20:53:21 -0700 (PDT) Received: from tong-desktop.local ([2600:1700:3ec7:421f:a06b:5560:ec65:277f]) by smtp.googlemail.com with ESMTPSA id h14-20020a170902680e00b0016d2d2c7df1sm2135478plk.188.2022.07.28.20.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 20:53:21 -0700 (PDT) From: Tong Zhang To: Greg Kroah-Hartman , Tong Zhang , Dan Carpenter , Jakub Kicinski , Saurav Girepunje , Colin Ian King , Nathan Chancellor , Johan Hovold , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Cc: Zheyu Ma Subject: [PATCH v3 3/3] staging: rtl8192u: fix rmmod warn when device is renamed Date: Thu, 28 Jul 2022 20:52:20 -0700 Message-Id: <20220729035230.226172-4-ztong0001@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220729035230.226172-1-ztong0001@gmail.com> References: <20220729035230.226172-1-ztong0001@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This driver creates 4 debug files under [devname] folder. The devname could be wlan0 initially, however it could be renamed later to e.g. enx00e04c00000. This will cause problem during debug file teardown since it uses netdev->name, which is no longer wlan0. To solve this problem, add a notifier to handle device renaming. Also note that we cannot simply do debugfs_lookup to find out old dentry since by the time the notifier is called, netdev->name is already changed to new name. Reported-by: Zheyu Ma Tested-by: Zheyu Ma Reviewed-by: Dan Carpenter Signed-off-by: Tong Zhang --- drivers/staging/rtl8192u/r8192U.h | 1 + drivers/staging/rtl8192u/r8192U_core.c | 32 +++++++++++++++++++++++ drivers/staging/rtl8192u/r8192U_debugfs.c | 12 +++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r= 8192U.h index 920a6a154860..420ab696fc3e 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1122,6 +1122,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 Ke= yIndex, u16 KeyType, =20 void rtl8192_debugfs_init_one(struct net_device *dev); void rtl8192_debugfs_exit_one(struct net_device *dev); +void rtl8192_debugfs_rename_one(struct net_device *dev); void rtl8192_debugfs_init(void); void rtl8192_debugfs_exit(void); =20 diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl81= 92u/r8192U_core.c index 865bc0dc7c71..0a60ef20107c 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4606,6 +4606,30 @@ static void rtl8192_usb_disconnect(struct usb_interf= ace *intf) RT_TRACE(COMP_DOWN, "wlan driver removed\n"); } =20 +static int rtl8192_usb_netdev_event(struct notifier_block *nb, unsigned lo= ng event, + void *data) +{ + struct net_device *netdev =3D netdev_notifier_info_to_dev(data); + + if (netdev->netdev_ops !=3D &rtl8192_netdev_ops) + goto out; + + switch (event) { + case NETDEV_CHANGENAME: + rtl8192_debugfs_rename_one(netdev); + break; + default: + break; + } + +out: + return NOTIFY_DONE; +} + +static struct notifier_block rtl8192_usb_netdev_notifier =3D { + .notifier_call =3D rtl8192_usb_netdev_event, +}; + static int __init rtl8192_usb_module_init(void) { int ret; @@ -4615,6 +4639,12 @@ static int __init rtl8192_usb_module_init(void) RT_TRACE(COMP_INIT, "Initializing module"); RT_TRACE(COMP_INIT, "Wireless extensions version %d", WIRELESS_EXT); =20 + ret =3D register_netdevice_notifier(&rtl8192_usb_netdev_notifier); + if (ret) { + pr_err("register_netdevice_notifier failed %d\n", ret); + return ret; + } + rtl8192_debugfs_init(); ret =3D ieee80211_debug_init(); if (ret) { @@ -4663,6 +4693,7 @@ static int __init rtl8192_usb_module_init(void) ieee80211_debug_exit(); debugfs_exit: rtl8192_debugfs_exit(); + unregister_netdevice_notifier(&rtl8192_usb_netdev_notifier); return ret; } =20 @@ -4675,6 +4706,7 @@ static void __exit rtl8192_usb_module_exit(void) ieee80211_crypto_deinit(); ieee80211_debug_exit(); rtl8192_debugfs_exit(); + unregister_netdevice_notifier(&rtl8192_usb_netdev_notifier); RT_TRACE(COMP_DOWN, "Exiting"); } =20 diff --git a/drivers/staging/rtl8192u/r8192U_debugfs.c b/drivers/staging/rt= l8192u/r8192U_debugfs.c index 79cd095114ca..e80cfe24facf 100644 --- a/drivers/staging/rtl8192u/r8192U_debugfs.c +++ b/drivers/staging/rtl8192u/r8192U_debugfs.c @@ -150,7 +150,7 @@ DEFINE_SHOW_ATTRIBUTE(rtl8192_usb_registers); =20 void rtl8192_debugfs_init_one(struct net_device *dev) { - struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + struct r8192_priv *priv =3D ieee80211_priv(dev); struct dentry *parent_dir =3D debugfs_lookup(R8192U_DEBUGFS_DIR_NAME, NUL= L); struct dentry *dir =3D debugfs_create_dir(dev->name, parent_dir); =20 @@ -164,11 +164,19 @@ void rtl8192_debugfs_init_one(struct net_device *dev) =20 void rtl8192_debugfs_exit_one(struct net_device *dev) { - struct r8192_priv *priv =3D (struct r8192_priv *)ieee80211_priv(dev); + struct r8192_priv *priv =3D ieee80211_priv(dev); =20 debugfs_remove_recursive(priv->debugfs_dir); } =20 +void rtl8192_debugfs_rename_one(struct net_device *dev) +{ + struct r8192_priv *priv =3D ieee80211_priv(dev); + struct dentry *parent_dir =3D debugfs_lookup(R8192U_DEBUGFS_DIR_NAME, NUL= L); + + debugfs_rename(parent_dir, priv->debugfs_dir, parent_dir, dev->name); +} + void rtl8192_debugfs_init(void) { debugfs_create_dir(R8192U_DEBUGFS_DIR_NAME, NULL); --=20 2.25.1