From: Bjorn Helgaas <helgaas@kernel.org>
To: Szymon Durawa <szymon.durawa@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
Lukas Wunner <lukas@wunner.de>,
linux-pci@vger.kernel.org,
Nirmal Patel <nirmal.patel@linux.intel.com>,
Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Subject: Re: [RFC PATCH v1 1/3] PCI: vmd: Clean up vmd_enable_domain function
Date: Mon, 28 Oct 2024 16:27:25 -0500 [thread overview]
Message-ID: <20241028212725.GA1118694@bhelgaas> (raw)
In-Reply-To: <20241025150153.983306-2-szymon.durawa@linux.intel.com>
On Fri, Oct 25, 2024 at 05:01:51PM +0200, Szymon Durawa wrote:
> This function is too long and needs to be shortened to make it more readable.
Use the actual function name here instead of "This function".
Include "()" after function names, including in the subject line.
> +enum vmd_resource {
> + VMD_RES_CFGBAR = 0,
> + VMD_RES_MBAR_1, /*VMD Resource MemBAR 1 */
> + VMD_RES_MBAR_2, /*VMD Resource MemBAR 2 */
Add space after "/*".
> @@ -132,10 +144,10 @@ struct vmd_dev {
> struct vmd_irq_list *irqs;
>
> struct pci_sysdata sysdata;
> - struct resource resources[3];
> + struct resource resources[VMD_RES_COUNT];
> struct irq_domain *irq_domain;
> - struct pci_bus *bus;
> - u8 busn_start;
> + struct pci_bus *bus[VMD_BUS_COUNT];
> + u8 busn_start[VMD_BUS_COUNT];
This looks like a combination of things that don't logically need to
be in the same patch, e.g., adding VMD_RES_COUNT (basically cosmetic),
converting "bus" from a scalar to an array (possibly new
functionality?)
> -static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
> +static void vmd_configure_cfgbar(struct vmd_dev *vmd)
> {
> - struct pci_sysdata *sd = &vmd->sysdata;
> - struct resource *res;
> + struct resource *res = &vmd->dev->resource[VMD_CFGBAR];
> +
> + vmd->resources[VMD_RES_CFGBAR] = (struct resource){
> + .name = "VMD CFGBAR",
> + .start = vmd->busn_start[VMD_BUS_0],
> + .end = vmd->busn_start[VMD_BUS_0] +
> + (resource_size(res) >> 20) - 1,
> + .flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED,
> + };
> +}
This might need to be split into several patches, each of which moves
some code from vmd_enable_domain() into a helper function, to make
this easily reviewable. I think generally these are simple, obvious
changes, but when they're all collected together in a single patch,
it's hard to tell that.
Bjorn
next prev parent reply other threads:[~2024-10-28 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 15:01 [RFC PATCH v1 0/3] VMD add PCH rootbus support Szymon Durawa
2024-10-25 15:01 ` [RFC PATCH v1 1/3] PCI: vmd: Clean up vmd_enable_domain function Szymon Durawa
2024-10-28 21:27 ` Bjorn Helgaas [this message]
2024-10-25 15:01 ` [RFC PATCH v1 2/3] PCI: vmd: Add VMD PCH rootbus support Szymon Durawa
2024-10-28 21:50 ` Bjorn Helgaas
2024-10-25 15:01 ` [RFC PATCH v1 3/3] PCI: vmd: Add WA for " Szymon Durawa
2024-10-28 21:53 ` Bjorn Helgaas
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=20241028212725.GA1118694@bhelgaas \
--to=helgaas@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=nirmal.patel@linux.intel.com \
--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