summaryrefslogtreecommitdiff
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-01-18 16:04:39 +0300
committerDavid S. Miller <davem@davemloft.net>2017-01-20 19:43:17 +0300
commit9af15c38254d81c9991eba89335ca7c537d7f2c3 (patch)
treeca35f65647606c5c99c2a1b75a7f8ca184e06a9c /include/linux/device.h
parent02e0bea6c83c657617195135667e6a3f50d3bfb3 (diff)
downloadlinux-9af15c38254d81c9991eba89335ca7c537d7f2c3.tar.xz
device: Implement a bus agnostic dev_num_vf routine
Now that pci_bus_type has num_vf callback set, dev_num_vf can be implemented in a bus type independent way and the check for whether a PCI device is being handled in rtnetlink can be dropped. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 6d73b70a4a5d..bd684fc8ec1d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1144,6 +1144,13 @@ extern int device_online(struct device *dev);
extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
+static inline int dev_num_vf(struct device *dev)
+{
+ if (dev->bus && dev->bus->num_vf)
+ return dev->bus->num_vf(dev);
+ return 0;
+}
+
/*
* Root device objects for grouping under /sys/devices
*/