Larry Finger <[email protected]> writes:

> From: Ping-Ke Shih <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Larry Finger <[email protected]>
> Cc: Yan-Hsuan Chuang <[email protected]>
> Cc: Birming Chiu <[email protected]>
> Cc: Shaofu <[email protected]>
> Cc: Steven Ting <[email protected]>

[...]

> +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

Reply via email to