Larry Finger <Larry.Finger@xxxxxxxxxxxx> writes: > From: Ping-Ke Shih <pkshih@xxxxxxxxxxx> > > Use debugfs to dump register and btcoex status. > > We create topdir in /sys/kernel/debug/rtlwifi/, and use the MAC address > as subdirectory with several entries to dump mac_reg, bb_reg, rf_reg etc. > An example is > /sys/kernel/debug/rtlwifi/00-11-22-33-44-55-66/mac_0 > > This change permits examination of device registers in a dynamic manner, > a feature not available with the current debug mechanism. Not just dump but apparently also to write to registers, I see a write_reg file there which takes commands like "h2c", "rf" and none meaning BB/MAC registers. IMHO it would be cleaner to have separate files for each register type, currently rtl_debugfs_set_write_reg() is pretty ugly. > Signed-off-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx> > Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx> > Cc: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx> > Cc: Birming Chiu <birming@xxxxxxxxxxx> > Cc: Shaofu <shaofu@xxxxxxxxxxx> > Cc: Steven Ting <steventing@xxxxxxxxxxx> [...] > +static ssize_t rtl_debugfs_set_write_reg(struct file *filp, > + const char __user *buffer, > + size_t count, loff_t *loff) > +{ > + struct rtl_debgufs_priv *debugfs_priv = filp->private_data; > + struct rtl_priv *rtlpriv = debugfs_priv->rtlpriv; > + struct ieee80211_hw *hw = rtlpriv->hw; > + char tmp[32 + 1]; > + int tmp_len; > + u32 addr, val, len; > + int num; > + > + if (count < 3) { > + /*printk("argument size is less than 3\n");*/ > + return -EFAULT; > + } Commented out code. I saw few other cases in this patch also. -- Kalle Valo