|
|
5766b0 |
From b6e18eb57f3dd104704d0a5ec3d2f051645b9068 Mon Sep 17 00:00:00 2001
|
|
|
5766b0 |
From: Adam Jackson <ajax@redhat.com>
|
|
|
5766b0 |
Date: Wed, 19 Jun 2019 14:23:56 -0400
|
|
|
5766b0 |
Subject: [PATCH xserver] linux: Fix platform device PCI detection for complex
|
|
|
5766b0 |
bus topologies
|
|
|
5766b0 |
|
|
|
5766b0 |
Suppose you're in a Hyper-V guest and are trying to use PCI passthrough.
|
|
|
5766b0 |
The ID_PATH that udev will construct for that looks something like
|
|
|
5766b0 |
"acpi-VMBUS:00-pci-b8c8:00:00.0", and obviously looking for "pci-" in
|
|
|
5766b0 |
the first four characters of that is going to not work.
|
|
|
5766b0 |
|
|
|
5766b0 |
Instead, strstr. I suppose it's possible you could have _multiple_ PCI
|
|
|
5766b0 |
buses in the path, in which case you'd want strrstr, if that were a
|
|
|
5766b0 |
thing.
|
|
|
5766b0 |
---
|
|
|
5766b0 |
config/udev.c | 6 +++---
|
|
|
5766b0 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
5766b0 |
|
|
|
5766b0 |
diff --git a/config/udev.c b/config/udev.c
|
|
|
5766b0 |
index 314acba6ce..6e11aa3b88 100644
|
|
|
5766b0 |
--- a/config/udev.c
|
|
|
5766b0 |
+++ b/config/udev.c
|
|
|
5766b0 |
@@ -474,7 +474,7 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
|
|
|
5766b0 |
config_odev_probe_proc_ptr probe_callback)
|
|
|
5766b0 |
{
|
|
|
5766b0 |
struct OdevAttributes *attribs = config_odev_allocate_attributes();
|
|
|
5766b0 |
- const char *value;
|
|
|
5766b0 |
+ const char *value, *str;
|
|
|
5766b0 |
|
|
|
5766b0 |
attribs->path = XNFstrdup(path);
|
|
|
5766b0 |
attribs->syspath = XNFstrdup(syspath);
|
|
|
5766b0 |
@@ -482,8 +482,8 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
|
|
|
5766b0 |
attribs->minor = minor;
|
|
|
5766b0 |
|
|
|
5766b0 |
value = udev_device_get_property_value(udev_device, "ID_PATH");
|
|
|
5766b0 |
- if (value && !strncmp(value, "pci-", 4)) {
|
|
|
5766b0 |
- attribs->busid = XNFstrdup(value);
|
|
|
5766b0 |
+ if (value && (str = strstr(value, "pci-"))) {
|
|
|
5766b0 |
+ attribs->busid = XNFstrdup(str);
|
|
|
5766b0 |
attribs->busid[3] = ':';
|
|
|
5766b0 |
}
|
|
|
5766b0 |
|
|
|
5766b0 |
--
|
|
|
5766b0 |
2.21.0
|
|
|
5766b0 |
|