From: Andrey Panin <pazke@orbita1.ru>
To: perex@suse.cz
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH][RFC] driverfs support for ISAPNP
Date: Thu, 14 Mar 2002 14:49:45 +0300 [thread overview]
Message-ID: <20020314114945.GB283@pazke.ipt> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 238 bytes --]
Hi,
attached patch adds initial driverfs support to ISAPNP driver.
Please take a look at it.
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #1.2: patch-isapnp-driverfs --]
[-- Type: text/plain, Size: 2199 bytes --]
diff -urN -X /usr/share/dontdiff linux.vanilla/drivers/pnp/isapnp.c linux/drivers/pnp/isapnp.c
--- linux.vanilla/drivers/pnp/isapnp.c Tue Mar 5 19:44:02 2002
+++ linux/drivers/pnp/isapnp.c Tue Mar 5 23:57:44 2002
@@ -2273,6 +2273,39 @@
EXPORT_SYMBOL(isapnp_register_driver);
EXPORT_SYMBOL(isapnp_unregister_driver);
+static struct device_driver isapnp_device_driver = {};
+
+static inline int isapnp_init_device_tree(void)
+{
+ struct pci_bus *card;
+ struct pci_dev *parent = pci_find_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
+
+ isapnp_for_each_card(card) {
+ struct list_head *devlist;
+
+ card->dev = isapnp_alloc(sizeof(*card->dev));
+ if (!card->dev)
+ break;
+ snprintf(card->dev->name, sizeof(card->dev->name), "%s", card->name);
+ sprintf(card->dev->bus_id, "isapnp%d", card->number);
+ card->dev->parent = parent ? &parent->dev : NULL;
+ card->dev->driver = &isapnp_device_driver;
+ device_register(card->dev);
+
+ for (devlist = card->devices.next; devlist != &card->devices; devlist = devlist->next) {
+ struct pci_dev *dev = pci_dev_b(devlist);
+
+ snprintf(dev->dev.name, sizeof(dev->dev.name), "%s", dev->name);
+ sprintf(dev->dev.bus_id, "%d", dev->devfn);
+ dev->dev.parent = card->dev;
+ dev->dev.driver = &isapnp_device_driver;
+ device_register(&dev->dev);
+ }
+ }
+
+ return 0;
+}
+
int __init isapnp_init(void)
{
int cards;
@@ -2351,6 +2384,9 @@
} else {
printk(KERN_INFO "isapnp: No Plug & Play card found\n");
}
+
+ isapnp_init_device_tree();
+
#ifdef CONFIG_PROC_FS
isapnp_proc_init();
#endif
@@ -2361,10 +2397,28 @@
#ifdef MODULE
+static inline void isapnp_cleanup_device_tree(void)
+{
+ struct pci_bus *card;
+
+ isapnp_for_each_card(card) {
+ struct list_head *devlist;
+
+ for (devlist = card->devices.next; devlist != &card->devices; devlist = devlist->next) {
+ struct pci_dev *dev = pci_dev_b(devlist);
+
+ put_device(&dev->dev);
+ }
+ put_device(card->dev);
+ }
+}
+
void cleanup_module(void)
{
- if (isapnp_detected)
+ if (isapnp_detected) {
+ isapnp_cleanup_device_tree();
isapnp_free_all_resources();
+ }
}
#else
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
reply other threads:[~2002-03-14 11:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20020314114945.GB283@pazke.ipt \
--to=pazke@orbita1.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@suse.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®