# HG changeset patch
# Parent b18529e8c43ef374112772b5caaec1089d50e57b
rathaxes: a little bit of cleanup in the e1000 sample

- Remove an old & useless comment;
- Keep the decl block on top in the types templates.


diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
--- a/rathaxes/samples/e1000/e1000.blt
+++ b/rathaxes/samples/e1000/e1000.blt
@@ -2,11 +2,6 @@
 {
     template type   e1000::RxDescriptor()
     {
-        chunk   LKM::includes()
-        {
-            #include <linux/types.h>
-        }
-
         decl    data_types()
         {
             struct rtx_e1000_rx_descriptor
@@ -20,7 +15,12 @@
             };
         }
 
-        method init()
+        chunk   LKM::includes()
+        {
+            #include <linux/types.h>
+        }
+
+        method  init()
         {
         }
 
diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
--- a/rathaxes/samples/e1000/ethernet.blt
+++ b/rathaxes/samples/e1000/ethernet.blt
@@ -2,6 +2,11 @@
 {
     template type   Ethernet::ProtocolId()
     {
+        decl data_types()
+        {
+            typedef unsigned short  rtx_ether_protocol_id;
+        }
+
         chunk LKM::prototypes()
         {
             static const char   *rtx_ethernet_protocol_id_to_str(unsigned short);
@@ -35,11 +40,6 @@
             }
         }
 
-        decl data_types()
-        {
-            typedef unsigned short  rtx_ether_protocol_id;
-        }
-
         method to_str()
         {
             rtx_ethernet_protocol_id_to_str(${self});
@@ -52,16 +52,16 @@
 
     template type   Ethernet::AbstractDevice()
     {
+        decl  data_types()
+        {
+            struct net_device;
+        }
+
         chunk LKM::includes()
         {
             #include <linux/netdevice.h>
         }
 
-        decl  data_types()
-        {
-            struct net_device;
-        }
-
         map
         {
         }
@@ -69,11 +69,6 @@
 
     template type   Ethernet::Device()
     {
-        chunk LKM::includes()
-        {
-            #include <linux/etherdevice.h>
-        }
-
         decl  data_types()
         {
             struct rtx_ethernet_dev
@@ -93,6 +88,11 @@
             };
         }
 
+        chunk LKM::includes()
+        {
+            #include <linux/etherdevice.h>
+        }
+
         method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
         {
             ${self} = netdev_priv(${net_dev});
diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
--- a/rathaxes/samples/e1000/pci.blt
+++ b/rathaxes/samples/e1000/pci.blt
@@ -2,16 +2,16 @@
 {
     template type   PCI::AbstractDevice()
     {
+        decl    data_types()
+        {
+            struct pci_dev;
+        }
+
         chunk   LKM::includes()
         {
             #include <linux/pci.h>
         }
 
-        decl    data_types()
-        {
-            struct pci_dev;
-        }
-
         method  init(PCI::AbstractDevice)
         {
         }
@@ -41,14 +41,6 @@
             };
         }
 
-        method  init(PCI::AbstractDevice pdev)
-        {
-            ${self}->pdev = ${pdev};
-            ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
-            ${self}->ioaddr = NULL;
-            ${self}->context = NULL;
-        }
-
         chunk   LKM::prototypes()
         {
             static int  rtx_pci_device_enable(struct rtx_pci_dev *);
@@ -79,6 +71,14 @@
             }
         }
 
+        method  init(PCI::AbstractDevice pdev)
+        {
+            ${self}->pdev = ${pdev};
+            ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
+            ${self}->ioaddr = NULL;
+            ${self}->context = NULL;
+        }
+
         method  enable()
         {
             rtx_pci_device_enable(${self});
@@ -225,10 +225,6 @@
     {
         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[] = {
                 { ${config.vendor_id}, ${config.product_id}, PCI_ANY_ID, PCI_ANY_ID },
                 { 0, }
