comparison rathaxes_call_pci_register_unregister_in_the_pci_lkm_sample.patch @ 8:7089717b63b7

WIP on the PCI LKM
author Louis Opter <louis@lse.epitech.net>
date Fri, 06 Jan 2012 12:48:22 +0100
parents
children 7d51609a0ff1
comparison
equal deleted inserted replaced
7:eead270c9bb6 8:7089717b63b7
1 # HG changeset patch
2 # Parent 3c5e2af745189313fab89aa2674afc3153744f7b
3 rathaxes: add the pci_{register,unregister}_device calls in the PCI LKM sample
4
5 diff --git a/rathaxes/samples/lkm/lkm.rtx b/rathaxes/samples/lkm/lkm.rtx
6 --- a/rathaxes/samples/lkm/lkm.rtx
7 +++ b/rathaxes/samples/lkm/lkm.rtx
8 @@ -13,10 +13,12 @@
9 LKM::init()
10 {
11 Log::info("Hello this is LKM");
12 + PCI::register();
13 }
14
15 LKM::exit()
16 {
17 + PCI::unregister();
18 }
19 }
20
21 diff --git a/rathaxes/samples/lkm/pci.blt b/rathaxes/samples/lkm/pci.blt
22 --- a/rathaxes/samples/lkm/pci.blt
23 +++ b/rathaxes/samples/lkm/pci.blt
24 @@ -35,25 +35,6 @@
25 const struct pci_device_id *);
26 }
27
28 - chunk LKM::data()
29 - {
30 - /*
31 - * CNorm doesn't seem to like "dynamic" arrays (i.e: you always
32 - * have to specify the exact size).
33 - */
34 - static struct pci_device_id rtx_pci_device_table[2] = {
35 - { ${config.vendor_id}, ${config.product_id}, 0, PCI_ANY_ID, PCI_ANY_ID },
36 - { 0, }
37 - };
38 -
39 - static struct pci_driver rtx_pci_driver = {
40 - .name = ${config.name},
41 - .id_table = rtx_pci_device_table,
42 - .probe = rtx_pci_probe,
43 - .remove = rtx_pci_remove
44 - };
45 - }
46 -
47 chunk LKM::code()
48 {
49 static int /* __devinit */ rtx_pci_probe(struct pci_dev *pdev,
50 @@ -98,4 +79,39 @@
51 }
52 }
53 }
54 +
55 + template sequence PCI::register()
56 + {
57 + chunk LKM::data()
58 + {
59 + /*
60 + * CNorm doesn't seem to like "dynamic" arrays (i.e: you always
61 + * have to specify the exact size).
62 + */
63 + static struct pci_device_id rtx_pci_device_table[2] = {
64 + { ${config.vendor_id}, ${config.product_id}, 0, PCI_ANY_ID, PCI_ANY_ID },
65 + { 0, }
66 + };
67 +
68 + static struct pci_driver rtx_pci_driver = {
69 + .name = ${config.name},
70 + .id_table = rtx_pci_device_table,
71 + .probe = rtx_pci_probe,
72 + .remove = rtx_pci_remove
73 + };
74 + }
75 +
76 + chunk ::CALL
77 + {
78 + pci_register_driver(&rtx_pci_device);
79 + }
80 + }
81 +
82 + template sequence PCI::unregister()
83 + {
84 + chunk ::CALL
85 + {
86 + pci_unregister_driver(&rtx_pci_device);
87 + }
88 + }
89 }
90 diff --git a/rathaxes/samples/lkm/pci.rti b/rathaxes/samples/lkm/pci.rti
91 --- a/rathaxes/samples/lkm/pci.rti
92 +++ b/rathaxes/samples/lkm/pci.rti
93 @@ -8,12 +8,17 @@
94 provided sequence PCI::register()
95 {
96 provided chunk ::CALL;
97 + provided chunk LKM::data;
98 + }
99 +
100 + provided sequence PCI::unregister()
101 + {
102 + provided chunk ::CALL;
103 }
104
105 required sequence PCI::probe(PCI::Device)
106 {
107 provided chunk LKM::prototypes;
108 - provided chunk LKM::data;
109 provided chunk LKM::code;
110 }
111