Skip to content

Commit 923cfd0

Browse files
ij-inteltsbogend
authored andcommitted
MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
pci_ops .read/.write must return PCIBIOS_* codes but tx4927_pci_config_read/write() return -1 when mkaddr() cannot find devfn from the root bus. Return PCIBIOS_DEVICE_NOT_FOUND instead and pass that onward in the call chain instead of overwriting the return value. Also converts 0 -> PCIBIOS_SUCCESSFUL which has only cosmetic impact. Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergio Paracuellos <[email protected]> Reviewed-by: Sergio Paracuellos <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 10e51eb commit 923cfd0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

arch/mips/pci/ops-tx4927.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where,
6060
{
6161
if (bus->parent == NULL &&
6262
devfn >= PCI_DEVFN(TX4927_PCIC_MAX_DEVNU, 0))
63-
return -1;
63+
return PCIBIOS_DEVICE_NOT_FOUND;
6464
__raw_writel(((bus->number & 0xff) << 0x10)
6565
| ((devfn & 0xff) << 0x08) | (where & 0xfc)
6666
| (bus->parent ? 1 : 0),
@@ -69,7 +69,7 @@ static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where,
6969
__raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
7070
| (PCI_STATUS_REC_MASTER_ABORT << 16),
7171
&pcicptr->pcistatus);
72-
return 0;
72+
return PCIBIOS_SUCCESSFUL;
7373
}
7474

7575
static int check_abort(struct tx4927_pcic_reg __iomem *pcicptr)
@@ -140,10 +140,12 @@ static int tx4927_pci_config_read(struct pci_bus *bus, unsigned int devfn,
140140
int where, int size, u32 *val)
141141
{
142142
struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus);
143+
int ret;
143144

144-
if (mkaddr(bus, devfn, where, pcicptr)) {
145+
ret = mkaddr(bus, devfn, where, pcicptr);
146+
if (ret != PCIBIOS_SUCCESSFUL) {
145147
*val = 0xffffffff;
146-
return -1;
148+
return ret;
147149
}
148150
switch (size) {
149151
case 1:
@@ -162,9 +164,11 @@ static int tx4927_pci_config_write(struct pci_bus *bus, unsigned int devfn,
162164
int where, int size, u32 val)
163165
{
164166
struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus);
167+
int ret;
165168

166-
if (mkaddr(bus, devfn, where, pcicptr))
167-
return -1;
169+
ret = mkaddr(bus, devfn, where, pcicptr);
170+
if (ret != PCIBIOS_SUCCESSFUL)
171+
return ret;
168172
switch (size) {
169173
case 1:
170174
icd_writeb(val, where & 3, pcicptr);

0 commit comments

Comments
 (0)