[PATCH] Added some PCI stubs

Denis Kirjanov kirjanov at gmail.com
Tue Sep 14 15:52:35 EDT 2010


Signed-off-by: Denis Kirjanov <kirjanov at gmail.com>
---
 src/pcnet.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/src/pcnet.c b/src/pcnet.c
index 7946394..f320ffd 100644
--- a/src/pcnet.c
+++ b/src/pcnet.c
@@ -2,22 +2,55 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
 
 MODULE_AUTHOR("Dmitry Podgorny <pasis.ua at gmail.com>");
 MODULE_DESCRIPTION("PCNet-PCI II/III Ethernet controller driver");
 MODULE_VERSION("dev");
 MODULE_LICENSE("GPL");
 
+#define DRV_NAME	"pcnet_dummy"
+
+static DEFINE_PCI_DEVICE_TABLE(pcnet_dummy_pci_tbl) = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE) },
+	{ }
+};
+
+static int __devinit pcnet_dummy_init_one(struct pci_dev *pdev,
+		const struct pci_device_id *ent)
+{
+	/* basically pci-skeleton stuff */
+	/* reset the chip at the end */
+	return 0;
+}
+
+static void __devexit pcnet_dummy_remove_one(struct pci_dev *pdev)
+{
+	/* noop */
+}
+
+static struct pci_driver pcnet_dummy_driver = {
+	.name		= DRV_NAME,
+	.id_table	= pcnet_dummy_pci_tbl,
+	.probe		= pcnet_dummy_init_one,
+	.remove		= __devexit_p(pcnet_dummy_remove_one),
+#if 0
+	/* FIXME: add PM hooks */
+#endif
+};
+
 static int __init pcnet_init(void)
 {
 	printk(KERN_INFO "pcnet: module has loaded");
 
-	return 0;
+	return pci_register_driver(&pcnet_dummy_driver);
 }
 
 static void __exit pcnet_exit(void)
 {
 	printk(KERN_INFO "pcnet: module was unloaded");
+	pci_unregister_driver(&pcnet_dummy_driver);
 }
 
 module_init(pcnet_init);
-- 
1.7.0.4




More information about the Kernel-russian mailing list