Re: [PATCH v3 2/3] staging: rtl8192u: move debug files to debugfs

Greg Kroah-Hartman
2022-07-29T07:31:17Z

On Thu, Jul 28, 2022 at 08:52:19PM -0700, Tong Zhang wrote:
>
> -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"

KBUILD_MODNAME is a better thing to use here.

> +void rtl8192_debugfs_init_one(struct net_device *dev)
> +{
> + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);

No need to cast.

> + struct dentry *parent_dir = debugfs_lookup(R8192U_DEBUGFS_DIR_NAME, NULL);
> + struct dentry *dir = debugfs_create_dir(dev->name, parent_dir);
> +
> + debugfs_create_file("stats-rx", 0444, dir, dev, &rtl8192_usb_stats_rx_fops);
> + debugfs_create_file("stats-tx", 0444, dir, dev, &rtl8192_usb_stats_tx_fops);
> + debugfs_create_file("stats-ap", 0444, dir, dev, &rtl8192_usb_stats_ap_fops);
> + debugfs_create_file("registers", 0444, dir, dev, &rtl8192_usb_registers_fops);
> +
> + priv->debugfs_dir = dir;
> +}
> +
> +void rtl8192_debugfs_exit_one(struct net_device *dev)
> {
> - RT_TRACE(COMP_INIT, "Initializing proc filesystem");
> - rtl8192_proc = proc_mkdir(RTL819XU_MODULE_NAME, init_net.proc_net);
> + struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);

No need for a cast.

thanks,

greg k-h