Skip to content

Commit 76dc526

Browse files
Matthias Kaehlckebjorn-helgaas
authored andcommitted
PCI: Make PCI_ROM_ADDRESS_MASK a 32-bit constant
A 64-bit value is not needed since a PCI ROM address consists in 32 bits. This fixes a clang warning about "implicit conversion from 'unsigned long' to 'u32'". Also remove now unnecessary casts to u32 from __pci_read_base() and pci_std_update_resource(). Signed-off-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent c1ae3cf commit 76dc526

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/pci/probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
231231
res->flags |= IORESOURCE_ROM_ENABLE;
232232
l64 = l & PCI_ROM_ADDRESS_MASK;
233233
sz64 = sz & PCI_ROM_ADDRESS_MASK;
234-
mask64 = (u32)PCI_ROM_ADDRESS_MASK;
234+
mask64 = PCI_ROM_ADDRESS_MASK;
235235
}
236236

237237
if (res->flags & IORESOURCE_MEM_64) {

drivers/pci/setup-res.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
6363
mask = (u32)PCI_BASE_ADDRESS_IO_MASK;
6464
new |= res->flags & ~PCI_BASE_ADDRESS_IO_MASK;
6565
} else if (resno == PCI_ROM_RESOURCE) {
66-
mask = (u32)PCI_ROM_ADDRESS_MASK;
66+
mask = PCI_ROM_ADDRESS_MASK;
6767
} else {
6868
mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
6969
new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK;

include/uapi/linux/pci_regs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
#define PCI_SUBSYSTEM_ID 0x2e
115115
#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */
116116
#define PCI_ROM_ADDRESS_ENABLE 0x01
117-
#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
117+
#define PCI_ROM_ADDRESS_MASK (~0x7ffU)
118118

119119
#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */
120120

0 commit comments

Comments
 (0)