Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Szymon Durawa" <szymon.durawa@linux.intel.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 5/8] PCI: vmd: Replace hardcoded values with enum and defines
Date: Mon, 21 Sep 2026 14:26:13 +0000	[thread overview]
Message-ID: <20260921142613.D56B61F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260921164316.3860312-6-szymon.durawa@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] pci: incomplete refactoring, hardcoded index '0' used instead of VMD_RES_CFGBAR
--

commit d6af2294e28d1c964e8b78ed89f34bf845a9c3ed
Author: Szymon Durawa <szymon.durawa@linux.intel.com>

PCI: vmd: Replace hardcoded values with enum and defines

Add enum vmd_resource type to replace hardcoded values. Add defines for
vmd bus start number based on VMD restriction value. No functional
changes.

> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 8b59b369f1263..b7c4e22deee58 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c

[ ... ]

> @@ -562,7 +574,7 @@ static resource_size_t vmd_cfgbar_ecam_space(struct vmd_dev *vmd)
>  }
>  static void vmd_domain_reset(struct vmd_dev *vmd)
>  {
> -	u16 bus, max_buses = resource_size(&vmd->resources[0]);
> +	u16 bus, max_buses = resource_size(&vmd->resources[VMD_RES_CFGBAR]);
>  	u8 dev, functions, fn, hdr_type;
>  	unsigned int ecam_bus;
>  	char __iomem *base;

[Severity: Low]
Does this refactoring miss other instances of the hardcoded 0 index?

For example, in the preceding function vmd_cfgbar_ecam_space():

	ecam_start = vmd_bus_to_ecam(vmd, vmd->resources[0].start);

And a few lines further down in vmd_domain_reset():

		ecam_bus = vmd_bus_to_ecam(vmd, vmd->resources[0].start + bus);

Could these also be updated to use VMD_RES_CFGBAR for consistency?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260921164316.3860312-1-szymon.durawa@linux.intel.com?part=5

  reply	other threads:[~2026-09-21 14:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 16:43 [PATCH v8 0/8] VMD add second root bus support Szymon Durawa
2026-09-21 16:43 ` [PATCH v8 1/8] PCI: vmd: Add vmd_bus_enumeration() helper function Szymon Durawa
2026-09-21 14:25   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 2/8] PCI: vmd: Add vmd_configure_cfgbar() " Szymon Durawa
2026-09-21 14:21   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 3/8] PCI: vmd: Add vmd_configure_membar() and vmd_configure_membar1_membar2() Szymon Durawa
2026-09-21 14:25   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 4/8] PCI: vmd: Add vmd_create_bus() Szymon Durawa
2026-09-21 14:27   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 5/8] PCI: vmd: Replace hardcoded values with enum and defines Szymon Durawa
2026-09-21 14:26   ` sashiko-bot [this message]
2026-09-21 16:43 ` [PATCH v8 6/8] PCI: vmd: Convert bus and busn_start to an array Szymon Durawa
2026-09-21 14:26   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 7/8] PCI: vmd: Add support for second rootbus under VMD Szymon Durawa
2026-09-21 14:32   ` sashiko-bot
2026-09-21 16:43 ` [PATCH v8 8/8] PCI: vmd: Workaround for hardwired BUS1 bus number Szymon Durawa
2026-09-21 14:34   ` sashiko-bot
2026-09-22 15:49 ` [PATCH v8 0/8] VMD add second root bus support Manivannan Sadhasivam

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=20260921142613.D56B61F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=szymon.durawa@linux.intel.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