Mercurial > archived > louis > epitech > mq > rathaxes
view rathaxes_call_pci_register_unregister_in_the_pci_lkm_sample.patch @ 9:7d51609a0ff1
rathaxes: fix bad variable name
author | Thomas Sanchez <thomas.sanchz@gmail.com> |
---|---|
date | Fri, 06 Jan 2012 12:55:07 +0100 |
parents | 7089717b63b7 |
children |
line wrap: on
line source
# HG changeset patch # Parent 6761c243013d320ab7c35a3bf537956eb4c228fa rathaxes: add the pci_{register,unregister}_device calls in the PCI LKM sample diff -r 6761c243013d rathaxes/samples/lkm/lkm.blt --- a/rathaxes/samples/lkm/lkm.blt Fri Jan 06 12:49:00 2012 +0100 +++ b/rathaxes/samples/lkm/lkm.blt Fri Jan 06 12:54:49 2012 +0100 @@ -33,6 +33,8 @@ static int __attribute__((__section__(".init.text"))) rtx_module_init(void) { ${pointcut ::IMPLEMENTATION}; + + return 0; } module_init(rtx_module_init); diff -r 6761c243013d rathaxes/samples/lkm/lkm.rtx --- a/rathaxes/samples/lkm/lkm.rtx Fri Jan 06 12:49:00 2012 +0100 +++ b/rathaxes/samples/lkm/lkm.rtx Fri Jan 06 12:54:49 2012 +0100 @@ -13,10 +13,12 @@ LKM::init() { Log::info("Hello this is LKM"); + PCI::register(); } LKM::exit() { + PCI::unregister(); } } diff -r 6761c243013d rathaxes/samples/lkm/pci.blt --- a/rathaxes/samples/lkm/pci.blt Fri Jan 06 12:49:00 2012 +0100 +++ b/rathaxes/samples/lkm/pci.blt Fri Jan 06 12:54:49 2012 +0100 @@ -35,25 +35,6 @@ const struct pci_device_id *); } - chunk LKM::data() - { - /* - * CNorm doesn't seem to like "dynamic" arrays (i.e: you always - * have to specify the exact size). - */ - static struct pci_device_id rtx_pci_device_table[2] = { - { ${config.vendor_id}, ${config.product_id}, 0, PCI_ANY_ID, PCI_ANY_ID }, - { 0, } - }; - - static struct pci_driver rtx_pci_driver = { - .name = ${config.name}, - .id_table = rtx_pci_device_table, - .probe = rtx_pci_probe, - .remove = rtx_pci_remove - }; - } - chunk LKM::code() { static int /* __devinit */ rtx_pci_probe(struct pci_dev *pdev, @@ -98,4 +79,39 @@ } } } + + template sequence PCI::register() + { + chunk LKM::data() + { + /* + * CNorm doesn't seem to like "dynamic" arrays (i.e: you always + * have to specify the exact size). + */ + static struct pci_device_id rtx_pci_device_table[2] = { + { ${config.vendor_id}, ${config.product_id}, 0, PCI_ANY_ID, PCI_ANY_ID }, + { 0, } + }; + + static struct pci_driver rtx_pci_driver = { + .name = ${config.name}, + .id_table = rtx_pci_device_table, + .probe = rtx_pci_probe, + .remove = rtx_pci_remove + }; + } + + chunk ::CALL + { + pci_register_driver(&rtx_pci_driver); + } + } + + template sequence PCI::unregister() + { + chunk ::CALL + { + pci_unregister_driver(&rtx_pci_driver); + } + } } diff -r 6761c243013d rathaxes/samples/lkm/pci.rti --- a/rathaxes/samples/lkm/pci.rti Fri Jan 06 12:49:00 2012 +0100 +++ b/rathaxes/samples/lkm/pci.rti Fri Jan 06 12:54:49 2012 +0100 @@ -8,12 +8,17 @@ provided sequence PCI::register() { provided chunk ::CALL; + provided chunk LKM::data; + } + + provided sequence PCI::unregister() + { + provided chunk ::CALL; } required sequence PCI::probe(PCI::Device) { provided chunk LKM::prototypes; - provided chunk LKM::data; provided chunk LKM::code; }