]> err.no Git - linux-2.6/commitdiff
[PATCH] PCI: add MODALIAS to hotplug event for pci devices
authorGreg KH <gregkh@suse.de>
Thu, 5 May 2005 18:57:25 +0000 (11:57 -0700)
committerGreg KH <gregkh@suse.de>
Tue, 17 May 2005 21:31:12 +0000 (14:31 -0700)
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/hotplug.c

index 6a1a976c4bffdc8f4b07f4e5d44cd4c0eba3c433..3903f8c559b603989068767f30bae7fceb2144f6 100644 (file)
@@ -52,6 +52,16 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
        if ((buffer_size - length <= 0) || (i >= num_envp))
                return -ENOMEM;
 
+       envp[i++] = scratch;
+       length += scnprintf (scratch, buffer_size - length,
+                           "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n",
+                           pdev->vendor, pdev->device,
+                           pdev->subsystem_vendor, pdev->subsystem_device,
+                           (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
+                           (u8)(pdev->class));
+       if ((buffer_size - length <= 0) || (i >= num_envp))
+               return -ENOMEM;
+
        envp[i] = NULL;
 
        return 0;