From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, pcihpd-discuss@lists.sourceforge.net
Subject: Re: [BK PATCH] PCI hotplug changes for 2.5.34
Date: Mon, 9 Sep 2002 15:20:16 -0700 [thread overview]
Message-ID: <20020909222016.GH7433@kroah.com> (raw)
In-Reply-To: <20020909221955.GG7433@kroah.com>
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.625 -> 1.626
# drivers/pci/probe.c 1.10 -> 1.11
# include/linux/pci.h 1.40 -> 1.41
# drivers/pci/proc.c 1.17 -> 1.18
# drivers/pci/Makefile 1.13 -> 1.14
# drivers/pci/hotplug.c 1.4 -> 1.5
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/09 greg@kroah.com 1.626
# PCI: hotplug core cleanup to get pci hotplug working again
#
# - removed pci_announce_device_to_drivers() prototype as the function is long gone
# - always call /sbin/hotplug when pci devices are added to the system if
# so configured (this includes during the system bring up.)
# --------------------------------------------
#
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
--- a/drivers/pci/Makefile Mon Sep 9 15:09:49 2002
+++ b/drivers/pci/Makefile Mon Sep 9 15:09:49 2002
@@ -6,10 +6,8 @@
probe.o proc.o search.o compat.o
obj-y += access.o probe.o pci.o pool.o quirks.o \
- compat.o names.o pci-driver.o search.o
+ compat.o names.o pci-driver.o search.o hotplug.o
obj-$(CONFIG_PM) += power.o
-obj-$(CONFIG_HOTPLUG) += hotplug.o
-
obj-$(CONFIG_PROC_FS) += proc.o
ifndef CONFIG_SPARC64
diff -Nru a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
--- a/drivers/pci/hotplug.c Mon Sep 9 15:09:49 2002
+++ b/drivers/pci/hotplug.c Mon Sep 9 15:09:49 2002
@@ -7,8 +7,8 @@
#define TRUE (!FALSE)
#endif
-static void
-run_sbin_hotplug(struct pci_dev *pdev, int insert)
+#ifdef CONFIG_HOTPLUG
+static void run_sbin_hotplug(struct pci_dev *pdev, int insert)
{
int i;
char *argv[3], *envp[8];
@@ -45,13 +45,18 @@
call_usermodehelper (argv [0], argv, envp);
}
+#else
+static void run_sbin_hotplug(struct pci_dev *pdev, int insert) { }
+#endif
/**
- * pci_insert_device - insert a hotplug device
+ * pci_insert_device - insert a pci device
* @dev: the device to insert
* @bus: where to insert it
*
- * Add a new device to the device lists and notify userspace (/sbin/hotplug).
+ * Link the device to both the global PCI device chain and the
+ * per-bus list of devices, add the /proc entry, and notify
+ * userspace (/sbin/hotplug).
*/
void
pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
@@ -78,11 +83,11 @@
}
/**
- * pci_remove_device - remove a hotplug device
+ * pci_remove_device - remove a pci device
* @dev: the device to remove
*
- * Delete the device structure from the device lists and
- * notify userspace (/sbin/hotplug).
+ * Delete the device structure from the device lists,
+ * remove the /proc entry, and notify userspace (/sbin/hotplug).
*/
void
pci_remove_device(struct pci_dev *dev)
@@ -94,10 +99,11 @@
#ifdef CONFIG_PROC_FS
pci_proc_detach_device(dev);
#endif
-
/* notify userspace of hotplug device removal */
run_sbin_hotplug(dev, FALSE);
}
+#ifdef CONFIG_HOTPLUG
EXPORT_SYMBOL(pci_insert_device);
EXPORT_SYMBOL(pci_remove_device);
+#endif
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c Mon Sep 9 15:09:49 2002
+++ b/drivers/pci/probe.c Mon Sep 9 15:09:49 2002
@@ -479,10 +479,10 @@
/*
* Link the device to both the global PCI device chain and
- * the per-bus list of devices.
+ * the per-bus list of devices and call /sbin/hotplug if we
+ * should.
*/
- list_add_tail(&dev->global_list, &pci_devices);
- list_add_tail(&dev->bus_list, &bus->devices);
+ pci_insert_device (dev, bus);
/* Fix up broken headers */
pci_fixup_device(PCI_FIXUP_HEADER, dev);
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
--- a/drivers/pci/proc.c Mon Sep 9 15:09:49 2002
+++ b/drivers/pci/proc.c Mon Sep 9 15:09:49 2002
@@ -18,6 +18,8 @@
#define PCI_CFG_SPACE_SIZE 256
+static int proc_initialized; /* = 0 */
+
static loff_t
proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
{
@@ -410,6 +412,9 @@
struct proc_dir_entry *de, *e;
char name[16];
+ if (!proc_initialized)
+ return -EACCES;
+
if (!(de = bus->procdir)) {
sprintf(name, "%02x", bus->number);
de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
@@ -446,6 +451,9 @@
{
struct proc_dir_entry *de = bus->procdir;
+ if (!proc_initialized)
+ return -EACCES;
+
if (!de) {
char name[16];
sprintf(name, "%02x", bus->number);
@@ -595,6 +603,7 @@
entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
if (entry)
entry->proc_fops = &proc_bus_pci_dev_operations;
+ proc_initialized = 1;
pci_for_each_dev(dev) {
pci_proc_attach_device(dev);
}
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h Mon Sep 9 15:09:49 2002
+++ b/include/linux/pci.h Mon Sep 9 15:09:49 2002
@@ -634,7 +634,6 @@
void pci_remove_device(struct pci_dev *);
struct pci_driver *pci_dev_driver(const struct pci_dev *);
const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev);
-void pci_announce_device_to_drivers(struct pci_dev *);
unsigned int pci_do_scan_bus(struct pci_bus *bus);
struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
next prev parent reply other threads:[~2002-09-09 22:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-09 22:16 [BK PATCH] PCI hotplug changes for 2.5.34 Greg KH
2002-09-09 22:19 ` Greg KH
2002-09-09 22:20 ` Greg KH [this message]
2002-09-09 22:20 ` Greg KH
2002-09-09 22:20 ` Greg KH
2002-09-09 22:21 ` Greg KH
2002-09-09 22:21 ` Greg KH
2002-09-09 22:21 ` Greg KH
2002-09-09 22:22 ` Greg KH
2002-09-09 22:22 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020909222016.GH7433@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pcihpd-discuss@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.