Re: [PATCH net-next v2] drivers: ethernet: tulip: Fix indentation of printk
From: Andrew Lunn
Date: Thu Jul 08 2021 - 13:59:24 EST
On Thu, Jul 08, 2021 at 01:48:24PM -0400, Carlos Bilbao wrote:
> Fix indentation of printk that starts at the beginning of the line and does
> not have a KERN_<LEVEL>.
>
> Signed-off-by: Carlos Bilbao <bilbao@xxxxxx>
> ---
> drivers/net/ethernet/dec/tulip/de4x5.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
> index b125d7faefdf..0d8ddfdd5c09 100644
> --- a/drivers/net/ethernet/dec/tulip/de4x5.c
> +++ b/drivers/net/ethernet/dec/tulip/de4x5.c
> @@ -3169,7 +3169,7 @@ dc2114x_autoconf(struct net_device *dev)
>
> default:
> lp->tcount++;
> -printk("Huh?: media:%02x\n", lp->media);
> + printk(KERN_NOTICE "Huh?: media:%02x\n", lp->media);
> lp->media = INIT;
> break;
> }
Since this is a network driver, and you have a net_device structure,
the best practice is to use
netdev_notice(dev, "Huh?: media:%02x\n", lp->media);
You could go through this driver and change all printk() to
netdev_dbg(), netdev_err(), netdev_info etc. The advantage of these
calls is that they make it clear which network interface is outputting
the message.
Other subsystems have similar calls. If there are not subsystem
specific print functions, but you have a struct device, it is best to
use dev_err(), dev_dbg(), dev_info() etc. These functions will make it
clear which device is printing the message.
Andrew