Skip to contentSkip to conversation

PCI: probe: Fix spacing around operators

PATCH In review [email protected] 2 participants 3 messages Mar 3 – Mar 4 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: probe: Fix spacing around operators

From: "haoyu.lu" <[email protected]>

Fix checkpatch.pl warnings for missing spaces around operators:

- size-1 -> size - 1

- PCI_BRIDGE_RESOURCES+i -> PCI_BRIDGE_RESOURCES + i

- 60*1000 -> 60 * 1000

---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/probe.c +3 -3
index bccc7a4bdd79..e54fa8a9f377 100644
@@ -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] = &dev->resource[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 * 1000))
 		return NULL;
 
 	dev = pci_alloc_dev(bus);
Signature · 1 line
2.53.0.windows.1
#1 lore raw
Quoted 28 lines · On Tue, 3 Mar 2026, [email protected] wrote:

From: "haoyu.lu" <[email protected]>

Fix checkpatch.pl warnings for missing spaces around operators:

- size-1 -> size - 1

- PCI_BRIDGE_RESOURCES+i -> PCI_BRIDGE_RESOURCES + i

- 60*1000 -> 60 * 1000

---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/probe.c +1 -1
index bccc7a4bdd79..e54fa8a9f377 100644
@@ -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

drivers/pci/probe.c void pci_read_bridge_bases(struct pci_bus *child) · line 597

Quoted 5 lines
drivers/pci/probe.c +1 -1
@@ -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] = &dev->resource[PCI_BRIDGE_RESOURCES + i];

Convert to pci_resource_n().

drivers/pci/probe.c static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) · line 2603

Quoted 9 lines
drivers/pci/probe.c +1 -1
 	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 * 1000))

This should use linux/units.h *_PER_* constant instead of 1000.

Quoted 4 lines
drivers/pci/probe.c +0 -0
 		return NULL;
 
 	dev = pci_alloc_dev(bus);
Signature · 1 line
 i.
#2 lore raw

PATCH v2 1/1 PCI: probe: Use helper macros and constants

In reply to [email protected]

From: "haoyu.lu" <[email protected]>

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)

---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/probe.c +3 -3
index bccc7a4bdd79..d5b27d03355c 100644
@@ -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);
Signature · 1 line
2.53.0.windows.1