comparison rathaxes_housekeeping_in_the_e1000_sample.patch @ 99:e2c237d6c37b

Update patches against David's new decl system
author Louis Opter <louis@lse.epita.fr>
date Thu, 22 Nov 2012 22:47:25 -0800
parents
children
comparison
equal deleted inserted replaced
98:147519512c3d 99:e2c237d6c37b
1 # HG changeset patch
2 # Parent b18529e8c43ef374112772b5caaec1089d50e57b
3 rathaxes: a little bit of cleanup in the e1000 sample
4
5 - Remove an old & useless comment;
6 - Keep the decl block on top in the types templates.
7
8
9 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
10 --- a/rathaxes/samples/e1000/e1000.blt
11 +++ b/rathaxes/samples/e1000/e1000.blt
12 @@ -2,11 +2,6 @@
13 {
14 template type e1000::RxDescriptor()
15 {
16 - chunk LKM::includes()
17 - {
18 - #include <linux/types.h>
19 - }
20 -
21 decl data_types()
22 {
23 struct rtx_e1000_rx_descriptor
24 @@ -20,7 +15,12 @@
25 };
26 }
27
28 - method init()
29 + chunk LKM::includes()
30 + {
31 + #include <linux/types.h>
32 + }
33 +
34 + method init()
35 {
36 }
37
38 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
39 --- a/rathaxes/samples/e1000/ethernet.blt
40 +++ b/rathaxes/samples/e1000/ethernet.blt
41 @@ -2,6 +2,11 @@
42 {
43 template type Ethernet::ProtocolId()
44 {
45 + decl data_types()
46 + {
47 + typedef unsigned short rtx_ether_protocol_id;
48 + }
49 +
50 chunk LKM::prototypes()
51 {
52 static const char *rtx_ethernet_protocol_id_to_str(unsigned short);
53 @@ -35,11 +40,6 @@
54 }
55 }
56
57 - decl data_types()
58 - {
59 - typedef unsigned short rtx_ether_protocol_id;
60 - }
61 -
62 method to_str()
63 {
64 rtx_ethernet_protocol_id_to_str(${self});
65 @@ -52,16 +52,16 @@
66
67 template type Ethernet::AbstractDevice()
68 {
69 + decl data_types()
70 + {
71 + struct net_device;
72 + }
73 +
74 chunk LKM::includes()
75 {
76 #include <linux/netdevice.h>
77 }
78
79 - decl data_types()
80 - {
81 - struct net_device;
82 - }
83 -
84 map
85 {
86 }
87 @@ -69,11 +69,6 @@
88
89 template type Ethernet::Device()
90 {
91 - chunk LKM::includes()
92 - {
93 - #include <linux/etherdevice.h>
94 - }
95 -
96 decl data_types()
97 {
98 struct rtx_ethernet_dev
99 @@ -93,6 +88,11 @@
100 };
101 }
102
103 + chunk LKM::includes()
104 + {
105 + #include <linux/etherdevice.h>
106 + }
107 +
108 method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
109 {
110 ${self} = netdev_priv(${net_dev});
111 diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
112 --- a/rathaxes/samples/e1000/pci.blt
113 +++ b/rathaxes/samples/e1000/pci.blt
114 @@ -2,16 +2,16 @@
115 {
116 template type PCI::AbstractDevice()
117 {
118 + decl data_types()
119 + {
120 + struct pci_dev;
121 + }
122 +
123 chunk LKM::includes()
124 {
125 #include <linux/pci.h>
126 }
127
128 - decl data_types()
129 - {
130 - struct pci_dev;
131 - }
132 -
133 method init(PCI::AbstractDevice)
134 {
135 }
136 @@ -41,14 +41,6 @@
137 };
138 }
139
140 - method init(PCI::AbstractDevice pdev)
141 - {
142 - ${self}->pdev = ${pdev};
143 - ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
144 - ${self}->ioaddr = NULL;
145 - ${self}->context = NULL;
146 - }
147 -
148 chunk LKM::prototypes()
149 {
150 static int rtx_pci_device_enable(struct rtx_pci_dev *);
151 @@ -79,6 +71,14 @@
152 }
153 }
154
155 + method init(PCI::AbstractDevice pdev)
156 + {
157 + ${self}->pdev = ${pdev};
158 + ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
159 + ${self}->ioaddr = NULL;
160 + ${self}->context = NULL;
161 + }
162 +
163 method enable()
164 {
165 rtx_pci_device_enable(${self});
166 @@ -225,10 +225,6 @@
167 {
168 chunk LKM::data()
169 {
170 - /*
171 - * CNorm doesn't seem to like "dynamic" arrays (i.e: you always
172 - * have to specify the exact size).
173 - */
174 static struct pci_device_id rtx_pci_device_table[] = {
175 { ${config.vendor_id}, ${config.product_id}, PCI_ANY_ID, PCI_ANY_ID },
176 { 0, }