# HG changeset patch # User Louis Opter # Date 1325850502 -3600 # Node ID 7089717b63b7171ff8c57b64f4830e5bc8764e92 # Parent eead270c9bb615d66f0a227dc67bcf370d3ed169 WIP on the PCI LKM diff -r eead270c9bb6 -r 7089717b63b7 rathaxes_call_pci_register_unregister_in_the_pci_lkm_sample.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rathaxes_call_pci_register_unregister_in_the_pci_lkm_sample.patch Fri Jan 06 12:48:22 2012 +0100 @@ -0,0 +1,111 @@ +# HG changeset patch +# Parent 3c5e2af745189313fab89aa2674afc3153744f7b +rathaxes: add the pci_{register,unregister}_device calls in the PCI LKM sample + +diff --git a/rathaxes/samples/lkm/lkm.rtx b/rathaxes/samples/lkm/lkm.rtx +--- a/rathaxes/samples/lkm/lkm.rtx ++++ b/rathaxes/samples/lkm/lkm.rtx +@@ -13,10 +13,12 @@ + LKM::init() + { + Log::info("Hello this is LKM"); ++ PCI::register(); + } + + LKM::exit() + { ++ PCI::unregister(); + } + } + +diff --git a/rathaxes/samples/lkm/pci.blt b/rathaxes/samples/lkm/pci.blt +--- a/rathaxes/samples/lkm/pci.blt ++++ b/rathaxes/samples/lkm/pci.blt +@@ -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_device); ++ } ++ } ++ ++ template sequence PCI::unregister() ++ { ++ chunk ::CALL ++ { ++ pci_unregister_driver(&rtx_pci_device); ++ } ++ } + } +diff --git a/rathaxes/samples/lkm/pci.rti b/rathaxes/samples/lkm/pci.rti +--- a/rathaxes/samples/lkm/pci.rti ++++ b/rathaxes/samples/lkm/pci.rti +@@ -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; + } + diff -r eead270c9bb6 -r 7089717b63b7 series --- a/series Fri Jan 06 11:45:25 2012 +0100 +++ b/series Fri Jan 06 12:48:22 2012 +0100 @@ -2,3 +2,4 @@ rathaxes_start_to_implement_pci_stuff_in_the_lkm.patch maintainers_add_add_rathaxes_lkm_in_use_rathaxes_cmake_file.patch rathaxes_fix_lkm_sample_build.patch +rathaxes_call_pci_register_unregister_in_the_pci_lkm_sample.patch