Commit 3b32a9bf authored by Hongchen Zhang's avatar Hongchen Zhang
Browse files

PCI: fix kabi error caused by pm_suspend_target_state

LoongArch inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6BWFP



--------------------------------

fix kabi error caused by pm_suspend_target_state,used only
by loongson devices.

Signed-off-by: default avatarHongchen Zhang <zhanghongchen@loongson.cn>
parent 1f46f3a1
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -32,7 +32,9 @@
#include <asm/dma.h>
#include <linux/aer.h>
#include <linux/bitfield.h>
#ifdef CONFIG_MACH_LOONGSON64
#include <linux/suspend.h>
#endif
#include "pci.h"

DEFINE_MUTEX(pci_slot_mutex);
@@ -173,11 +175,15 @@ static bool pci_bridge_d3_disable;
/* Force bridge_d3 for all PCIe ports */
static bool pci_bridge_d3_force;

#ifdef CONFIG_MACH_LOONGSON64

#ifndef CONFIG_PM_SLEEP
suspend_state_t pm_suspend_target_state;
#define pm_suspend_target_state (PM_SUSPEND_ON)
#endif

#endif

static int __init pcie_port_pm_setup(char *str)
{
	if (!strcmp(str, "off"))
@@ -6153,8 +6159,9 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
{
	u16 v;
	int ret;
#ifdef CONFIG_MACH_LOONGSON64
	struct pci_host_bridge *bridge = pci_find_host_bridge(dev->bus);

#endif
	if (rq < 128 || rq > 4096 || !is_power_of_2(rq))
		return -EINVAL;

@@ -6172,6 +6179,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)

	v = (ffs(rq) - 8) << 12;

#ifdef CONFIG_MACH_LOONGSON64
	if (pm_suspend_target_state == PM_SUSPEND_ON &&
		bridge->no_inc_mrrs) {
		int max_mrrs = pcie_get_readrq(dev);
@@ -6181,6 +6189,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
			return -EINVAL;
		}
	}
#endif

	ret = pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
						  PCI_EXP_DEVCTL_READRQ, v);