* [PATCH v2 0/4] MIPS: Cleanups to PCI related code
@ 2024-02-08 12:09 Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 1/4] MIPS: lantiq: Remove unused function pointer variables Ilpo Järvinen
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2024-02-08 12:09 UTC (permalink / raw)
To: Thomas Bogendoerfer, linux-mips, linux-kernel, Sergio Paracuellos
Cc: Ilpo Järvinen
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(-)
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] MIPS: lantiq: Remove unused function pointer variables
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
@ 2024-02-08 12:09 ` Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 2/4] MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device() Ilpo Järvinen
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2024-02-08 12:09 UTC (permalink / raw)
To: Thomas Bogendoerfer, linux-mips, linux-kernel, Sergio Paracuellos
Cc: Ilpo Järvinen
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.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
arch/mips/pci/fixup-lantiq.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/arch/mips/pci/fixup-lantiq.c b/arch/mips/pci/fixup-lantiq.c
index 13009666204f..8bcc136976dc 100644
--- a/arch/mips/pci/fixup-lantiq.c
+++ b/arch/mips/pci/fixup-lantiq.c
@@ -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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device()
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 1/4] MIPS: lantiq: Remove unused function pointer variables Ilpo Järvinen
@ 2024-02-08 12:09 ` Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 3/4] MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write() Ilpo Järvinen
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2024-02-08 12:09 UTC (permalink / raw)
To: Thomas Bogendoerfer, linux-mips, linux-kernel, Sergio Paracuellos
Cc: Ilpo Järvinen
pcibios_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.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
arch/mips/pci/fixup-ath79.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/pci/fixup-ath79.c b/arch/mips/pci/fixup-ath79.c
index 09a4ce53424f..6a6c4f58f7f4 100644
--- a/arch/mips/pci/fixup-ath79.c
+++ b/arch/mips/pci/fixup-ath79.c
@@ -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)
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write()
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 1/4] MIPS: lantiq: Remove unused function pointer variables Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 2/4] MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device() Ilpo Järvinen
@ 2024-02-08 12:09 ` Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 4/4] MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE() Ilpo Järvinen
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2024-02-08 12:09 UTC (permalink / raw)
To: Thomas Bogendoerfer, linux-mips, linux-kernel, Sergio Paracuellos
Cc: Ilpo Järvinen
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 <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
arch/mips/pci/ops-tx4927.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index f7802f100401..670efbc5c585 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -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);
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE()
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
` (2 preceding siblings ...)
2024-02-08 12:09 ` [PATCH v2 3/4] MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write() Ilpo Järvinen
@ 2024-02-08 12:09 ` Ilpo Järvinen
2024-02-08 12:21 ` [PATCH v2 0/4] MIPS: Cleanups to PCI related code Sergio Paracuellos
2024-02-20 13:39 ` Thomas Bogendoerfer
5 siblings, 0 replies; 7+ messages in thread
From: Ilpo Järvinen @ 2024-02-08 12:09 UTC (permalink / raw)
To: Thomas Bogendoerfer, linux-mips, linux-kernel, Sergio Paracuellos
Cc: Ilpo Järvinen
Instead of literal, PCI error value should be set with
PCI_SET_ERROR_RESPONSE(). Use it in tx4927_pci_config_read().
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
arch/mips/pci/ops-tx4927.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index 670efbc5c585..37087f4137ee 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -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) {
--
2.39.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] MIPS: Cleanups to PCI related code
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
` (3 preceding siblings ...)
2024-02-08 12:09 ` [PATCH v2 4/4] MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE() Ilpo Järvinen
@ 2024-02-08 12:21 ` Sergio Paracuellos
2024-02-20 13:39 ` Thomas Bogendoerfer
5 siblings, 0 replies; 7+ messages in thread
From: Sergio Paracuellos @ 2024-02-08 12:21 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel
On Thu, Feb 8, 2024 at 1:10 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> 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(-)
For the whole series:
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmal.com>
Thanks,
Sergio Paracuellos
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] MIPS: Cleanups to PCI related code
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
` (4 preceding siblings ...)
2024-02-08 12:21 ` [PATCH v2 0/4] MIPS: Cleanups to PCI related code Sergio Paracuellos
@ 2024-02-20 13:39 ` Thomas Bogendoerfer
5 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2024-02-20 13:39 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: linux-mips, linux-kernel, Sergio Paracuellos
On Thu, Feb 08, 2024 at 02:09:55PM +0200, Ilpo Järvinen wrote:
> 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(-)
series applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-20 13:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 12:09 [PATCH v2 0/4] MIPS: Cleanups to PCI related code Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 1/4] MIPS: lantiq: Remove unused function pointer variables Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 2/4] MIPS: ath79: Don't return PCIBIOS_* code from pcibios_enable_device() Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 3/4] MIPS: PCI: Return PCIBIOS_* from tx4927_pci_config_read/write() Ilpo Järvinen
2024-02-08 12:09 ` [PATCH v2 4/4] MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE() Ilpo Järvinen
2024-02-08 12:21 ` [PATCH v2 0/4] MIPS: Cleanups to PCI related code Sergio Paracuellos
2024-02-20 13:39 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).