From: Andrew Lunn <andrew@lunn.ch>
To: han.junyang@zte.com.cn
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
ran.ming@zte.com.cn, han.chengfei@zte.com.cn,
zhang.yanze@zte.com.cn
Subject: Re: [PATCH net-next v6 2/2] dinghai: add hardware register access and PCI? capability scanning
Date: Tue, 16 Jun 2026 21:49:49 +0200 [thread overview]
Message-ID: <ea19f9f8-2004-47d2-8497-a5b608072e36@lunn.ch> (raw)
In-Reply-To: <20260616213550502kLzSZF2DiQyd9Dl0Dv0Gz@zte.com.cn>
> +int zxdh_pf_common_cfg_init(struct dh_core_dev *dh_dev)
> +{
> + struct zxdh_pf_device *pf_dev = dh_dev->priv;
> + struct pci_dev *pdev = dh_dev->pdev;
> + int common;
> +
> + /* check for a common config: if not, use legacy mode (bar 0). */
> + common = zxdh_pf_pci_find_capability(pdev, ZXDH_PCI_CAP_COMMON_CFG,
> + IORESOURCE_IO | IORESOURCE_MEM,
> + &pf_dev->modern_bars);
> + if (common == 0) {
> + dev_err(dh_dev->device,
> + "missing capabilities %i, leaving for legacy driver\n",
> + common);
That looks double odd. Normally you would use !common. Also, you know
common is 0, so why use "%i", when it could be just '0'.
> +int zxdh_pf_notify_cfg_init(struct dh_core_dev *dh_dev)
> +{
> + struct zxdh_pf_device *pf_dev = dh_dev->priv;
> + struct pci_dev *pdev = dh_dev->pdev;
> + u32 notify_length;
> + u32 notify_offset;
> + int notify;
> +
> + /* If common is there, these should be too... */
> + notify = zxdh_pf_pci_find_capability(pdev, ZXDH_PCI_CAP_NOTIFY_CFG,
> + IORESOURCE_IO | IORESOURCE_MEM,
> + &pf_dev->modern_bars);
> + if (notify == 0) {
> + dev_err(dh_dev->device, "missing capabilities %i\n", notify);
> + return -EINVAL;
> + }
> +
Same again.
Andrew
---
pw-bot: cr
prev parent reply other threads:[~2026-06-16 19:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 13:21 [PATCH net-next v6 0/2] Add ZTE DingHai Ethernet PF driver han.junyang
2026-06-16 13:30 ` [PATCH net-next v6 1/2] dinghai: add ZTE network driver support han.junyang
2026-06-16 19:39 ` Andrew Lunn
2026-06-17 8:30 ` Uwe Kleine-König
2026-06-16 13:35 ` [PATCH net-next v6 2/2] dinghai: add hardware register access and PCI capability scanning han.junyang
2026-06-16 19:49 ` Andrew Lunn [this message]
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=ea19f9f8-2004-47d2-8497-a5b608072e36@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=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®