From: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] PCI: Cleanup early_dump_pci_device()
Date: Tue, 10 Jun 2025 07:26:57 -0700 [thread overview]
Message-ID: <875bccf2-2922-4958-9385-ca1dcd508367@linux.intel.com> (raw)
In-Reply-To: <20250610105820.7126-2-ilpo.jarvinen@linux.intel.com>
On 6/10/25 3:58 AM, Ilpo Järvinen wrote:
> Convert 256 to PCI_CFG_SPACE_SIZE and 4 to sizeof(u32) and
> avoid i / 4 construct by changing the iteration.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> drivers/pci/probe.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index c00634e5a2ed..f08e754c404b 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -3,6 +3,7 @@
> * PCI detection and setup code
> */
>
> +#include <linux/array_size.h>
> #include <linux/kernel.h>
> #include <linux/delay.h>
> #include <linux/init.h>
> @@ -1912,16 +1913,16 @@ static int pci_intx_mask_broken(struct pci_dev *dev)
>
> static void early_dump_pci_device(struct pci_dev *pdev)
> {
> - u32 value[256 / 4];
> + u32 value[PCI_CFG_SPACE_SIZE / sizeof(u32)];
> int i;
>
> pci_info(pdev, "config space:\n");
>
> - for (i = 0; i < 256; i += 4)
> - pci_read_config_dword(pdev, i, &value[i / 4]);
> + for (i = 0; i < ARRAY_SIZE(value); i++)
> + pci_read_config_dword(pdev, i * sizeof(u32), &value[i]);
>
> print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1,
> - value, 256, false);
> + value, ARRAY_SIZE(value) * sizeof(u32), false);
> }
>
> static const char *pci_type_str(struct pci_dev *dev)
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
next prev parent reply other threads:[~2025-06-10 14:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 10:58 [PATCH 1/3] PCI: Use header type defines in pci_setup_device() Ilpo Järvinen
2025-06-10 10:58 ` [PATCH 2/3] PCI: Cleanup early_dump_pci_device() Ilpo Järvinen
2025-06-10 14:26 ` Sathyanarayanan Kuppuswamy [this message]
2025-06-10 10:58 ` [PATCH 3/3] PCI: Cleanup pci_scan_child_bus_extend() loop Ilpo Järvinen
2025-06-10 14:28 ` Sathyanarayanan Kuppuswamy
2025-06-10 14:26 ` [PATCH 1/3] PCI: Use header type defines in pci_setup_device() Sathyanarayanan Kuppuswamy
2025-08-06 22:56 ` 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=875bccf2-2922-4958-9385-ca1dcd508367@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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