From: Andrew Lunn <andrew@lunn.ch>
To: Junyang Han <han.junyang@zte.com.cn>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
andrew+netdev@lunn.ch, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, ran.ming@zte.com.cn, han.chengfei@zte.com.cn,
zhang.yanze@zte.com.cn
Subject: Re: [PATCH net-next 2/3] net/ethernet/zte/dinghai: add logging infrastructure
Date: Wed, 15 Apr 2026 16:19:25 +0200 [thread overview]
Message-ID: <fe3501da-13a7-461d-bba7-790618f067e1@lunn.ch> (raw)
In-Reply-To: <20260415015334.2018453-2-han.junyang@zte.com.cn>
> +#define dh_dbg(__dev, format, ...) \
> + dev_dbg((__dev)->device, "%s:%d:(pid %d): " format, \
> + __func__, __LINE__, current->pid, \
> + ##__VA_ARGS__)
> +
> +#define dh_dbg_once(__dev, format, ...) \
> + dev_dbg_once((__dev)->device, \
> + "%s:%d:(pid %d): " format, \
> + __func__, __LINE__, current->pid, \
> + ##__VA_ARGS__)
There is a dislike for adding wrappers around the existing kernel log
functions. What value does this add?
> +int debug_print;
> +module_param(debug_print, int, 0644);
Module parameters are not liked.
> +module_param_named(debug_mask, dh_debug_mask, uint, 0644);
> +MODULE_PARM_DESC(debug_mask, "debug mask: 1 = dump cmd data, 2 =
> dump cmd exec time, 3 = both. Default=0");
> +static bool probe_vf = 1;
> +module_param(probe_vf, bool, 0644);
> +MODULE_PARM_DESC(probe_vf, "probe_vf: 0 = N, 1 = Y");
I suggest you remove all these.
Debug code is reasonable to have during development. But once the
driver actually works, it should not be needed.
> const struct pci_device_id dh_pf_pci_table[] = {
> @@ -39,26 +47,34 @@ static int dh_pf_pci_init(struct dh_core_dev *dev)
> pci_set_drvdata(dev->pdev, dev);
>
> ret = pci_enable_device(dev->pdev);
> - if (ret)
> + if (ret) {
> + LOG_ERR("pci_enable_device failed: %d\n", ret);
dev_err(dev, ..)
> return -ENOMEM;
> + }
>
> ret = dma_set_mask_and_coherent(dev->device, DMA_BIT_MASK(64));
> if (ret) {
> ret = dma_set_mask_and_coherent(dev->device, DMA_BIT_MASK(32));
> - if (ret)
> + if (ret) {
> + LOG_ERR("dma_set_mask_and_coherent failed: %d\n", ret);
dev_err(dev, ...
And maybe it should actually be dev_err_probe() if this is a probe
function, and you need to handle -EPROBE_DEFER.
Debug logging should be limited to actual debug stuff. Please use the
standard logging primitives for anything which is not debug, so
dev_err(), dev_warn(), dev_info(). netdev_err(), netdev_warn() etc.
Andrew
next prev parent reply other threads:[~2026-04-15 14:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 1:53 [PATCH net-next 1/3] net/ethernet: add ZTE network driver support Junyang Han
2026-04-15 1:53 ` [PATCH net-next 2/3] net/ethernet/zte/dinghai: add logging infrastructure Junyang Han
2026-04-15 14:19 ` Andrew Lunn [this message]
2026-04-15 1:53 ` [PATCH net-next 3/3] net/ethernet/zte/dinghai: add hardware register access and PCI capability scanning Junyang Han
2026-04-15 14:31 ` Andrew Lunn
2026-04-15 14:10 ` [PATCH net-next 1/3] net/ethernet: add ZTE network driver support Andrew Lunn
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=fe3501da-13a7-461d-bba7-790618f067e1@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=han.chengfei@zte.com.cn \
--cc=han.junyang@zte.com.cn \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ran.ming@zte.com.cn \
--cc=zhang.yanze@zte.com.cn \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox