diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/pci/ops-mace.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/arch/mips/pci/ops-mace.c b/arch/mips/pci/ops-mace.c index 8008e31c5e81..2025f1f3e9f5 100644 --- a/arch/mips/pci/ops-mace.c +++ b/arch/mips/pci/ops-mace.c | |||
@@ -29,22 +29,20 @@ | |||
29 | * 4 N/C | 29 | * 4 N/C |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define chkslot(_bus,_devfn) \ | 32 | static inline int mkaddr(struct pci_bus *bus, unsigned int devfn, |
33 | do { \ | 33 | unsigned int reg) |
34 | if ((_bus)->number > 0 || PCI_SLOT (_devfn) < 1 \ | 34 | { |
35 | || PCI_SLOT (_devfn) > 3) \ | 35 | return ((bus->number & 0xff) << 16) | |
36 | return PCIBIOS_DEVICE_NOT_FOUND; \ | 36 | (devfn & 0xff) << 8) | |
37 | } while (0) | 37 | (reg & 0xfc); |
38 | } | ||
38 | 39 | ||
39 | #define mkaddr(_devfn, _reg) \ | ||
40 | ((((_devfn) & 0xffUL) << 8) | ((_reg) & 0xfcUL)) | ||
41 | 40 | ||
42 | static int | 41 | static int |
43 | mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, | 42 | mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
44 | int reg, int size, u32 *val) | 43 | int reg, int size, u32 *val) |
45 | { | 44 | { |
46 | chkslot(bus, devfn); | 45 | mace->pci.config_addr = mkaddr(bus, devfn, reg); |
47 | mace->pci.config_addr = mkaddr(devfn, reg); | ||
48 | switch (size) { | 46 | switch (size) { |
49 | case 1: | 47 | case 1: |
50 | *val = mace->pci.config_data.b[(reg & 3) ^ 3]; | 48 | *val = mace->pci.config_data.b[(reg & 3) ^ 3]; |
@@ -66,8 +64,7 @@ static int | |||
66 | mace_pci_write_config(struct pci_bus *bus, unsigned int devfn, | 64 | mace_pci_write_config(struct pci_bus *bus, unsigned int devfn, |
67 | int reg, int size, u32 val) | 65 | int reg, int size, u32 val) |
68 | { | 66 | { |
69 | chkslot(bus, devfn); | 67 | mace->pci.config_addr = mkaddr(bus, devfn, reg); |
70 | mace->pci.config_addr = mkaddr(devfn, reg); | ||
71 | switch (size) { | 68 | switch (size) { |
72 | case 1: | 69 | case 1: |
73 | mace->pci.config_data.b[(reg & 3) ^ 3] = val; | 70 | mace->pci.config_data.b[(reg & 3) ^ 3] = val; |