MIPS: Cleanups to PCI related code
v2 cover MIPS: Cleanups to PCI related code
Cleans up PCI related code.
v2:
- Convert also return 0 -> return PCIBIOS_SUCCESSFUL
Ilpo Järvinen (4):
MIPS: lantiq: Remove unused function pointer variables
MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device()
MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE()
arch/mips/pci/fixup-ath79.c | 2 +- arch/mips/pci/fixup-lantiq.c | 9 --------- arch/mips/pci/ops-tx4927.c | 18 +++++++++++------- 3 files changed, 12 insertions(+), 17 deletions(-)
Signature · 1 line
2.39.2
PATCH v2 1/4 MIPS: lantiq: Remove unused function pointer variables
Ever since introduction in the commit e47d488935ed ("MIPS: Lantiq: Add PCI controller support.") ltqpci_plat_dev_init has been unused. In 57c8cb8f2429 ("MIPS: pci: convert lantiq driver to OF") also ltq_pci_plat_arch_init was introduced.
With those commit being more than 10 years ago, it seem neither is going to get used anytime soon. Thus, remove both unused function pointer variables.
--- arch/mips/pci/fixup-lantiq.c | 9 --------- 1 file changed, 9 deletions(-)
arch/mips/pci/fixup-lantiq.c +0 -9
@@ -7,17 +7,8 @@#include <linux/of_pci.h> #include <linux/pci.h> -int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) =NULL ; -int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) =NULL ; -int pcibios_plat_dev_init (struct pci_dev *dev) { -if (ltq_pci_plat_arch_init) -return ltq_pci_plat_arch_init (dev); - -if (ltq_pci_plat_dev_init) -return ltq_pci_plat_dev_init (dev); -return 0 ; }
Signature · 1 line
2.39.2
PATCH v2 2/4 MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device()
In reply to Ilpo Järvinenpcibios_plat_dev_init() is called from pcibios_enable_device() that should return normal errnos, not PCIBIOS return codes. In this case the impact is only cosmetic because PCIBIOS_SUCCESSFUL equals 0 that is success code with errnos as well. Nonetheless, remove the inconsistency by replacing the PCIBIOS_SUCCESSFUL with 0.
--- arch/mips/pci/fixup-ath79.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/pci/fixup-ath79.c +1 -1
@@ -9,7 +9,7 @@int pcibios_plat_dev_init (struct pci_dev *dev) { -return PCIBIOS_SUCCESSFUL ; +return 0 ; }int pcibios_map_irq (const struct pci_dev *dev,u8 slot,u8 pin)
Signature · 1 line
2.39.2
PATCH v2 3/4 MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
In reply to Ilpo Järvinenpci_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.
--- arch/mips/pci/ops-tx4927.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/mips/pci/ops-tx4927.c +10 -6
@@ -60,7 +60,7 @@ static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where, {if (bus->parent ==NULL && devfn >=PCI_DEVFN (TX4927_PCIC_MAX_DEVNU ,0 )) -return -1 ; +return PCIBIOS_DEVICE_NOT_FOUND ; __raw_writel(((bus->number & 0xff) << 0x10) | ((devfn & 0xff) << 0x08) | (where & 0xfc) | (bus->parent ? 1 : 0),
@@ -69,7 +69,7 @@ static int mkaddr(struct pci_bus *bus, unsigned int devfn, int where,__raw_writel ((__raw_readl (&pcicptr->pcistatus) &0x0000ffff ) | (PCI_STATUS_REC_MASTER_ABORT <<16 ), &pcicptr->pcistatus); -return 0 ; +return PCIBIOS_SUCCESSFUL ; }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, int where, int size, u32 *val) { struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus); +int ret; -if (mkaddr (bus, devfn, where, pcicptr)) { + ret =mkaddr (bus, devfn, where, pcicptr); +if (ret !=PCIBIOS_SUCCESSFUL ) { *val =0xffffffff ; -return -1 ; +return ret; }switch (size) {case 1 :
@@ -162,9 +164,11 @@ static int tx4927_pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) { struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(bus); +int ret; -if (mkaddr (bus, devfn, where, pcicptr)) -return -1 ; + ret =mkaddr (bus, devfn, where, pcicptr); +if (ret !=PCIBIOS_SUCCESSFUL ) +return ret;switch (size) {case 1 :icd_writeb (val, where &3 , pcicptr);
Signature · 1 line
2.39.2
PATCH v2 4/4 MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE()
In reply to Ilpo JärvinenInstead of literal, PCI error value should be set with PCI_SET_ERROR_RESPONSE(). Use it in tx4927_pci_config_read().
--- arch/mips/pci/ops-tx4927.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/pci/ops-tx4927.c +1 -1
@@ -144,7 +144,7 @@ static int tx4927_pci_config_read(struct pci_bus *bus, unsigned int devfn, ret =mkaddr (bus, devfn, where, pcicptr);if (ret !=PCIBIOS_SUCCESSFUL ) { - *val =0xffffffff ; +PCI_SET_ERROR_RESPONSE (val);return ret; }switch (size) {
Signature · 1 line
2.39.2
Quoted 12 lines · Ilpo Järvinen
Cleans up PCI related code.
v2:
- Convert also return 0 -> returnPCIBIOS_SUCCESSFULIlpo Järvinen (4):
MIPS: lantiq: Remove unused function pointer variables
MIPS: ath79: Don't return PCIBIOS_* code frompcibios_enable_device()
MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
MIPS: TXx9: UsePCI_SET_ERROR_RESPONSE()
Quoted 4 lines
arch/mips/pci/fixup-ath79.c | 2 +- arch/mips/pci/fixup-lantiq.c | 9 --------- arch/mips/pci/ops-tx4927.c | 18 +++++++++++------- 3 files changed, 12 insertions(+), 17 deletions(-)
For the whole series:
Thanks,
Sergio Paracuellos
Thomas Bogendoerfer
maintainerQuoted 11 lines · Ilpo Järvinen
Cleans up PCI related code.
v2:
- Convert also return 0 -> returnPCIBIOS_SUCCESSFULIlpo Järvinen (4):
MIPS: lantiq: Remove unused function pointer variables
MIPS: ath79: Don't return PCIBIOS_* code frompcibios_enable_device()
MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
MIPS: TXx9: UsePCI_SET_ERROR_RESPONSE()
Quoted 4 lines
arch/mips/pci/fixup-ath79.c | 2 +- arch/mips/pci/fixup-lantiq.c | 9 --------- arch/mips/pci/ops-tx4927.c | 18 +++++++++++------- 3 files changed, 12 insertions(+), 17 deletions(-)
series applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]