mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] PCI: probe: Use helper macros and constants
@ 2026-03-04  3:46 hechushiguitu666
  0 siblings, 0 replies; 2+ messages in thread
From: hechushiguitu666 @ 2026-03-04  3:46 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, haoyu.lu

From: "haoyu.lu" <hechushiguitu666@gmail.com>

Replace direct resource array access with the pci_resource_n() helper
macro and use MSEC_PER_SEC instead of the bare number 1000.

Changes in v2:
- Use pci_resource_n() for resource array access (Bjorn)
- Use MSEC_PER_SEC (Bjorn)

Signed-off-by: haoyu.lu <hechushiguitu666@gmail.com>
---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bccc7a4bdd79..d5b27d03355c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -119,7 +119,7 @@ static u64 pci_size(u64 base, u64 maxbase, u64 mask)
 	 * Get the lowest of them to find the decode size, and from that
 	 * the extent.
 	 */
-	size = size & ~(size-1);
+	size = size & ~(size - 1);
 
 	/*
 	 * base == maxbase can be valid only if the BAR has already been
@@ -594,7 +594,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 
 	pci_bus_remove_resources(child);
 	for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
-		child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
+		child->resource[i] = pci_resource_n(dev, PCI_BRIDGE_RESOURCES + i);
 
 	pci_read_bridge_io(child->self,
 			   child->resource[PCI_BUS_BRIDGE_IO_WINDOW], false);
@@ -2600,7 +2600,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
 	struct pci_dev *dev;
 	u32 l;
 
-	if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
+	if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60 * MSEC_PER_SEC))
 		return NULL;
 
 	dev = pci_alloc_dev(bus);
-- 
2.53.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2] PCI: probe: Use helper macros and constants
  2026-03-03  7:36 [PATCH] PCI: probe: Fix spacing around operators hechushiguitu666
@ 2026-03-04  6:26 ` hechushiguitu666
  0 siblings, 0 replies; 2+ messages in thread
From: hechushiguitu666 @ 2026-03-04  6:26 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, haoyu.lu

From: "haoyu.lu" <hechushiguitu666@gmail.com>

Replace direct resource array access with the pci_resource_n() helper
macro and use MSEC_PER_SEC instead of the bare number 1000.

Changes in v2:
- Use pci_resource_n() for resource array access (Bjorn)
- Use MSEC_PER_SEC (Bjorn)

Signed-off-by: haoyu.lu <hechushiguitu666@gmail.com>
---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index bccc7a4bdd79..d5b27d03355c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -119,7 +119,7 @@ static u64 pci_size(u64 base, u64 maxbase, u64 mask)
 	 * Get the lowest of them to find the decode size, and from that
 	 * the extent.
 	 */
-	size = size & ~(size-1);
+	size = size & ~(size - 1);
 
 	/*
 	 * base == maxbase can be valid only if the BAR has already been
@@ -594,7 +594,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
 
 	pci_bus_remove_resources(child);
 	for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
-		child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i];
+		child->resource[i] = pci_resource_n(dev, PCI_BRIDGE_RESOURCES + i);
 
 	pci_read_bridge_io(child->self,
 			   child->resource[PCI_BUS_BRIDGE_IO_WINDOW], false);
@@ -2600,7 +2600,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
 	struct pci_dev *dev;
 	u32 l;
 
-	if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000))
+	if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60 * MSEC_PER_SEC))
 		return NULL;
 
 	dev = pci_alloc_dev(bus);
-- 
2.53.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-04  6:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-04  3:46 [PATCH v2] PCI: probe: Use helper macros and constants hechushiguitu666
  -- strict thread matches above, loose matches on Subject: below --
2026-03-03  7:36 [PATCH] PCI: probe: Fix spacing around operators hechushiguitu666
2026-03-04  6:26 ` [PATCH v2] PCI: probe: Use helper macros and constants hechushiguitu666

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®