summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-11-28 03:58:46 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-11-28 03:58:46 +0000
commitb63ad0882a16a5d28003e57f2b0b81dee3fb322b (patch)
tree0a343ce219e2b8b38a5d702d66032c57b83d9720 /drivers/pci
parenta9d7bff9a84dba79609a0002e5321b74c4d64c64 (diff)
Merge with 2.4.0-test11.
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c54
-rw-r--r--drivers/pci/pci.ids3
-rw-r--r--drivers/pci/proc.c2
3 files changed, 56 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ea13f254d..f90c23520 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -20,6 +20,8 @@
#include <linux/ioport.h>
#include <linux/spinlock.h>
#include <linux/pm.h>
+#include <linux/slab.h>
+#include <linux/kmod.h> /* for hotplug_path */
#include <asm/page.h>
#include <asm/dma.h> /* isa_dma_bridge_buggy */
@@ -343,6 +345,49 @@ pci_unregister_driver(struct pci_driver *drv)
#ifdef CONFIG_HOTPLUG
+#ifndef FALSE
+#define FALSE (0)
+#define TRUE (!FALSE)
+#endif
+
+static void
+run_sbin_hotplug(struct pci_dev *pdev, int insert)
+{
+ int i;
+ char *argv[3], *envp[7];
+ char id[20], sub_id[24], bus_id[64], class_id[20];
+
+ if (!hotplug_path[0])
+ return;
+
+ sprintf(class_id, "PCI_CLASS=%X", pdev->class >> 8);
+ sprintf(id, "PCI_ID=%X/%X", pdev->vendor, pdev->device);
+ sprintf(sub_id, "PCI_SUBSYS_ID=%X/%X", pdev->subsystem_vendor, pdev->subsystem_device);
+ sprintf(bus_id, "PCI_BUS_ID=%s", pdev->slot_name);
+
+ i = 0;
+ argv[i++] = hotplug_path;
+ argv[i++] = "pci";
+ argv[i] = 0;
+
+ i = 0;
+ /* minimal command environment */
+ envp[i++] = "HOME=/";
+ envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+
+ /* other stuff we want to pass to /sbin/hotplug */
+ envp[i++] = id;
+ envp[i++] = sub_id;
+ envp[i++] = bus_id;
+ if (insert)
+ envp[i++] = "ACTION=add";
+ else
+ envp[i++] = "ACTION=remove";
+ envp[i] = 0;
+
+ call_usermodehelper (argv [0], argv, envp);
+}
+
void
pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
{
@@ -358,9 +403,13 @@ pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
if (drv->remove && pci_announce_device(drv, dev))
break;
}
+
+ /* notify userspace of new hotplug device */
+ run_sbin_hotplug(dev, TRUE);
}
-static void pci_free_resources(struct pci_dev *dev)
+static void
+pci_free_resources(struct pci_dev *dev)
{
int i;
@@ -385,6 +434,9 @@ pci_remove_device(struct pci_dev *dev)
#ifdef CONFIG_PROC_FS
pci_proc_detach_device(dev);
#endif
+
+ /* notify userspace of hotplug device removal */
+ run_sbin_hotplug(dev, FALSE);
}
#endif
diff --git a/drivers/pci/pci.ids b/drivers/pci/pci.ids
index bfb9de0be..df9937fd2 100644
--- a/drivers/pci/pci.ids
+++ b/drivers/pci/pci.ids
@@ -1472,7 +1472,8 @@
10b7 3590 TokenLink Velocity XL Adapter
4500 3c450 Cyclone/unknown
5055 3c555 Laptop Hurricane
- 6055 3c556 Laptop Hurricane
+ 6055 3c556 Laptop Tornado
+ 6056 3c556B Laptop Hurricane
5057 3c575 [Megahertz] 10/100 LAN CardBus
10b7 5a57 3C575 Megahertz 10/100 LAN Cardbus PC Card
5157 3CCFE575BT Cyclone CardBus
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 81902c572..049cdcf35 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -279,7 +279,7 @@ int pci_proc_detach_device(struct pci_dev *dev)
struct proc_dir_entry *e;
if ((e = dev->procent)) {
- if (e->count)
+ if (atomic_read(&e->count))
return -EBUSY;
remove_proc_entry(e->name, dev->bus->procdir);
dev->procent = NULL;