Re: [PATCH 02/49] staging: rtl8723bs: replace DBG_871X_SEL log macro with netdev_dbg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2021-04-23 at 16:57 +0200, Fabio Aiuto wrote:
> replace DBG_871X_SEL log macro with the net device driver
> recommended netdev_dbg().
> 
> This macro by default does a raw printk, and the alternative
> behaviour, never triggered is a seq_print() call.
[]
> diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c
[]
> @@ -23,9 +23,10 @@ void mac_reg_dump(void *sel, struct adapter *adapter)
>  	for (i = 0x0; i < 0x800; i += 4) {
>  		if (j%4 == 1)
>  			netdev_dbg(adapter->pnetdev, "0x%03x", i);
> -		DBG_871X_SEL(sel, " 0x%08x ", rtw_read32(adapter, i));
> +		netdev_dbg(adapter->pnetdev, " 0x%08x ",
> +			   rtw_read32(adapter, i));
>  		if ((j++)%4 == 0)
> -			DBG_871X_SEL(sel, "\n");
> +			netdev_dbg(adapter->pnetdev, "\n");
>  	}

This makes a mess of the output as each netdev_dbg call
is a separate line.

Dumping 1000 register lines into output logs seems impolite
at best, even for debugging.

This _might_ be rewritten to something like:

void dump_4_regs(struct adapter *adapter, int offset)
{
	u32 reg[4];
	int i;

	for (i = 0; i < 4; i++)
		reg[i] = rtw_read32(adapter, offset + i);

	netdev_dbg(adapter->pnetdev, "0x%03x 0x%08x 0x%08x 0x%08x 0x%08x\n",
		   i, reg[0], reg[1], reg[2], reg[3]);
}

void mac_reg_dump(...)
{
	...

	for (i = 0; i < 0x800; i += 4)
		dump_4_regs(adapter, i);







[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux