aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug.c')
-rw-r--r--drivers/pci/hotplug.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
index 1c97e7dd130b..2b5352a7dffc 100644
--- a/drivers/pci/hotplug.c
+++ b/drivers/pci/hotplug.c
@@ -3,12 +3,9 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include "pci.h" 4#include "pci.h"
5 5
6int pci_uevent(struct device *dev, char **envp, int num_envp, 6int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
7 char *buffer, int buffer_size)
8{ 7{
9 struct pci_dev *pdev; 8 struct pci_dev *pdev;
10 int i = 0;
11 int length = 0;
12 9
13 if (!dev) 10 if (!dev)
14 return -ENODEV; 11 return -ENODEV;
@@ -17,37 +14,24 @@ int pci_uevent(struct device *dev, char **envp, int num_envp,
17 if (!pdev) 14 if (!pdev)
18 return -ENODEV; 15 return -ENODEV;
19 16
20 if (add_uevent_var(envp, num_envp, &i, 17 if (add_uevent_var(env, "PCI_CLASS=%04X", pdev->class))
21 buffer, buffer_size, &length,
22 "PCI_CLASS=%04X", pdev->class))
23 return -ENOMEM; 18 return -ENOMEM;
24 19
25 if (add_uevent_var(envp, num_envp, &i, 20 if (add_uevent_var(env, "PCI_ID=%04X:%04X", pdev->vendor, pdev->device))
26 buffer, buffer_size, &length,
27 "PCI_ID=%04X:%04X", pdev->vendor, pdev->device))
28 return -ENOMEM; 21 return -ENOMEM;
29 22
30 if (add_uevent_var(envp, num_envp, &i, 23 if (add_uevent_var(env, "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
31 buffer, buffer_size, &length,
32 "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
33 pdev->subsystem_device)) 24 pdev->subsystem_device))
34 return -ENOMEM; 25 return -ENOMEM;
35 26
36 if (add_uevent_var(envp, num_envp, &i, 27 if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
37 buffer, buffer_size, &length,
38 "PCI_SLOT_NAME=%s", pci_name(pdev)))
39 return -ENOMEM; 28 return -ENOMEM;
40 29
41 if (add_uevent_var(envp, num_envp, &i, 30 if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
42 buffer, buffer_size, &length,
43 "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
44 pdev->vendor, pdev->device, 31 pdev->vendor, pdev->device,
45 pdev->subsystem_vendor, pdev->subsystem_device, 32 pdev->subsystem_vendor, pdev->subsystem_device,
46 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), 33 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
47 (u8)(pdev->class))) 34 (u8)(pdev->class)))
48 return -ENOMEM; 35 return -ENOMEM;
49
50 envp[i] = NULL;
51
52 return 0; 36 return 0;
53} 37}