[lkml]   [2019]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2] PCI: hv: fix pci-hyperv build when SYSFS not enabled
From: Randy Dunlap <>

Fix build of drivers/pci/controller/pci-hyperv.o when
CONFIG_SYSFS is not set/enabled by adding stubs for
pci_create_slot() and pci_destroy_slot().

Fixes these build errors:

ERROR: "pci_destroy_slot" [drivers/pci/controller/pci-hyperv.ko] undefined!
ERROR: "pci_create_slot" [drivers/pci/controller/pci-hyperv.ko] undefined!

Fixes: a15f2c08c708 ("PCI: hv: support reporting serial number as slot information")

Signed-off-by: Randy Dunlap <>
Cc: Matthew Wilcox <>
Cc: Jake Oshins <>
Cc: "K. Y. Srinivasan" <>
Cc: Haiyang Zhang <>
Cc: Stephen Hemminger <>
Cc: Sasha Levin <>
Cc: Bjorn Helgaas <>
Cc: Dexuan Cui <>
Cc: Yuehaibing <>
- provide non-CONFIG_SYSFS stubs for pci_create_slot() and
pci_destroy_slot() [suggested by Matthew Wilcox <>]
- use the correct Fixes: tag [Dexuan Cui <>]

include/linux/pci.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

--- lnx-52-rc7.orig/include/linux/pci.h
+++ lnx-52-rc7/include/linux/pci.h
@@ -25,6 +25,7 @@
#include <linux/ioport.h>
#include <linux/list.h>
#include <linux/compiler.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/kobject.h>
#include <linux/atomic.h>
@@ -947,14 +948,21 @@ int pci_scan_root_bus_bridge(struct pci_
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
int busnr);
void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
+void pci_dev_assign_slot(struct pci_dev *dev);
struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
const char *name,
struct hotplug_slot *hotplug);
void pci_destroy_slot(struct pci_slot *slot);
-void pci_dev_assign_slot(struct pci_dev *dev);
static inline void pci_dev_assign_slot(struct pci_dev *dev) { }
+static inline struct pci_slot *pci_create_slot(struct pci_bus *parent,
+ int slot_nr,
+ const char *name,
+ struct hotplug_slot *hotplug) {
+ return ERR_PTR(-EINVAL);
+static inline void pci_destroy_slot(struct pci_slot *slot) { }
int pci_scan_slot(struct pci_bus *bus, int devfn);
struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);

 \ /
  Last update: 2019-07-03 19:00    [W:0.077 / U:28.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site