Commit 60c8da76 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 269d4b06
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -31,7 +31,9 @@
#include <linux/vmalloc.h>
#include <asm/dma.h>
#include <linux/aer.h>
#ifdef CONFIG_MACH_LOONGSON64
#include <linux/suspend.h>
#endif
#include "pci.h"

DEFINE_MUTEX(pci_slot_mutex);
@@ -148,11 +150,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"))
@@ -5756,8 +5762,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;

@@ -5774,12 +5781,13 @@ 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) {
		if (rq > pcie_get_readrq(dev))
			return -EINVAL;
	}
#endif

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