PCI: fix issue with busses registering multiple times in sysfs
[platform/kernel/linux-starfive.git] / include / linux / pci.h
index 7215d3b..9010f54 100644 (file)
@@ -278,6 +278,7 @@ struct pci_bus {
        struct device           dev;
        struct bin_attribute    *legacy_io; /* legacy I/O for this bus */
        struct bin_attribute    *legacy_mem; /* legacy mem */
+       unsigned int            is_added:1;
 };
 
 #define pci_bus_b(n)   list_entry(n, struct pci_bus, node)
@@ -301,14 +302,14 @@ struct pci_ops {
        int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
 };
 
-struct pci_raw_ops {
-       int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn,
-                   int reg, int len, u32 *val);
-       int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn,
-                    int reg, int len, u32 val);
-};
-
-extern struct pci_raw_ops *raw_pci_ops;
+/*
+ * ACPI needs to be able to access PCI config space before we've done a
+ * PCI bus scan and created pci_bus structures.
+ */
+extern int raw_pci_read(unsigned int domain, unsigned int bus,
+                       unsigned int devfn, int reg, int len, u32 *val);
+extern int raw_pci_write(unsigned int domain, unsigned int bus,
+                       unsigned int devfn, int reg, int len, u32 val);
 
 struct pci_bus_region {
        resource_size_t start;
@@ -389,6 +390,16 @@ struct pci_driver {
 #define        to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
 
 /**
+ * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table
+ * @_table: device table name
+ *
+ * This macro is used to create a struct pci_device_id array (a device table)
+ * in a generic manner.
+ */
+#define DEFINE_PCI_DEVICE_TABLE(_table) \
+       const struct pci_device_id _table[] __devinitconst
+
+/**
  * PCI_DEVICE - macro used to describe a specific pci device
  * @vend: the 16 bit PCI Vendor ID
  * @dev: the 16 bit PCI Device ID