Magellan Linux

Contents of /trunk/hal/patches/hal-0.5.10-don-t-add-pci-devices-without-pci-vendor-product-ID.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 597 - (show annotations) (download)
Mon May 19 19:05:19 2008 UTC (16 years ago) by niro
File size: 1645 byte(s)
-gentoo patches

1 From f5872070521064bd0692aeae4ada9f50bf2541d0 Mon Sep 17 00:00:00 2001
2 From: Danny Kukawka <danny.kukawka@web.de>
3 Date: Thu, 6 Dec 2007 20:43:37 +0100
4 Subject: [PATCH] don't add pci devices without pci vendor/product ID
5
6 Since pci.vendor_id and pci.product_id are mandatory for devices in the pci
7 namespace/subsystem and get also used to generate the UDI, I would propose to
8 not add pci devices which miss one of the IDs to the device tree.
9
10 This would e.g. prevent to add the /sys/bus/pci/slot devices which get
11 generated by the pciehp kernel modul under linux, since they don't provide
12 their IDs.
13 ---
14 hald/linux/device.c | 8 ++++++--
15 1 files changed, 6 insertions(+), 2 deletions(-)
16
17 diff --git a/hald/linux/device.c b/hald/linux/device.c
18 index 6175a0c..2e68378 100644
19 --- a/hald/linux/device.c
20 +++ b/hald/linux/device.c
21 @@ -1535,8 +1535,12 @@ pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
22
23 hal_util_set_driver (d, "info.linux.driver", sysfs_path);
24
25 - hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16);
26 - hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16);
27 + if(!hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16) ||
28 + !hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16)) {
29 + HAL_ERROR(("Could not get PCI product or vendor ID, don't add device, this info is mandatory!"));
30 + return NULL;
31 + }
32 +
33 hal_util_set_int_from_file (d, "pci.subsys_product_id", sysfs_path, "subsystem_device", 16);
34 hal_util_set_int_from_file (d, "pci.subsys_vendor_id", sysfs_path, "subsystem_vendor", 16);
35
36 --
37 1.5.3.7
38