Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Junxian Huang <huangjunxian6@hisilicon.com>
To: "Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>,
	"Chengchang Tang" <tangchengchang@huawei.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>
Cc: Markus Schneider-Pargmann <msp@baylibre.com>,
	<linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] RDMS/hns: Use named initializer for pci_device_id array
Date: Mon, 11 May 2026 09:53:04 +0800	[thread overview]
Message-ID: <944777a4-7f44-76ab-9cb4-47a02cd1c077@hisilicon.com> (raw)
In-Reply-To: <20260507075437.2669363-2-u.kleine-koenig@baylibre.com>



On 2026/5/7 15:54, Uwe Kleine-König (The Capable Hub) wrote:
> While being more verbose using a named initializer yields easier to
> understand code and doesn't rely on the two hidden zeros in the
> PCI_VDEVICE macro.
> 
> While at it, also drop the explicit zero in the terminating entry.
> 
> This doesn't introduce any changes to the compiled result of the array,
> which was confirmed on x86 and arm64.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> while being a cleanup that can stand on its own this is also a
> preparation for making driver_data an anonymous union that requires that
> .driver_data is initialized by name and not by list order. The union
> allows to make better use of the C type system (see
> https://lore.kernel.org/all/20260507074102.2654314-2-u.kleine-koenig@baylibre.com/
> for an example), but inifiniband won't profit as no driver uses a
> pointer for driver_data.
> 
> Best regards
> Uwe

There is a small typo in the patch subject, it should be "RDMA/hns".
The patch itself looks good to me.

Reviewed-by: Junxian Huang <huangjunxian6@hisilicon.com>

Thanks,
Junxian

> 
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 32 ++++++++++++++++------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index fa36700d0db2..cfe5269ba6a8 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -7249,16 +7249,30 @@ static const struct hns_roce_hw hns_roce_hw_v2 = {
>  };
>  
>  static const struct pci_device_id hns_roce_hw_v2_pci_tbl[] = {
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_200G_RDMA), 0},
> -	{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
> -	 HNAE3_DEV_SUPPORT_ROCE_DCB_BITS},
> +	{
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_200G_RDMA),
> +		.driver_data = 0,
> +	}, {
> +		PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
> +		.driver_data = HNAE3_DEV_SUPPORT_ROCE_DCB_BITS,
> +	},
>  	/* required last entry */
> -	{0, }
> +	{ }
>  };
>  
>  MODULE_DEVICE_TABLE(pci, hns_roce_hw_v2_pci_tbl);
> 
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

  reply	other threads:[~2026-05-11  1:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  7:54 [PATCH] RDMS/hns: Use named initializer for pci_device_id array Uwe Kleine-König (The Capable Hub)
2026-05-11  1:53 ` Junxian Huang [this message]
2026-05-13 18:51 ` Leon Romanovsky
2026-05-13 20:14   ` Uwe Kleine-König (The Capable Hub)

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=944777a4-7f44-76ab-9cb4-47a02cd1c077@hisilicon.com \
    --to=huangjunxian6@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=msp@baylibre.com \
    --cc=tangchengchang@huawei.com \
    --cc=u.kleine-koenig@baylibre.com \
    /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