linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Carlos Bilbao <bilbao@vt.edu>
Cc: davem@davemloft.net, Joe Perches <joe@perches.com>,
	kuba@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH net-next v2] drivers: ethernet: tulip: Fix indentation of printk
Date: Thu, 8 Jul 2021 19:59:12 +0200	[thread overview]
Message-ID: <YOc88LkI3KsiyaZF@lunn.ch> (raw)
In-Reply-To: <4352381.cEBGB3zze1@iron-maiden>

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@vt.edu>
> ---
>  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

  reply	other threads:[~2021-07-08 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 15:23 [PATCH] drivers: net: Follow the indentation coding standard on printks Carlos Bilbao
2021-07-08 16:40 ` Joe Perches
2021-07-08 17:33   ` [PATCH net-next v2] " Carlos Bilbao
2021-07-08 17:38     ` Joe Perches
2021-07-08 17:43       ` Carlos Bilbao
2021-07-08 17:48       ` [PATCH net-next v2] drivers: ethernet: tulip: Fix indentation of printk Carlos Bilbao
2021-07-08 17:59         ` Andrew Lunn [this message]
2021-07-08 17:53       ` [PATCH net-next v2] drivers: net: Remove undefined XXXDEBUG on driver sb1000 Carlos Bilbao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOc88LkI3KsiyaZF@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=bilbao@vt.edu \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH net-next v2] drivers: ethernet: tulip: Fix indentation of printk' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).