diff e1000_rework_without_explicit_call.patch @ 33:60a59bf708df

merge
author Thomas Sanchez <thomas.sanchz@gmail.com>
date Sun, 08 Jan 2012 00:39:56 +0100
parents
children 62fba8b9db06
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/e1000_rework_without_explicit_call.patch	Sun Jan 08 00:39:56 2012 +0100
@@ -0,0 +1,108 @@
+# HG changeset patch
+# Parent c3265ca219d51aa493db9639444eba7d72812e69
+rathaxes: initialize the e1000 sepcific code in an elegant implicit way
+
+diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.blt
+--- a/rathaxes/samples/lkm/e1000.blt	Sun Jan 08 00:13:22 2012 +0100
++++ b/rathaxes/samples/lkm/e1000.blt	Sun Jan 08 00:35:30 2012 +0100
+@@ -27,9 +27,9 @@
+         }
+     }
+ 
+-    template sequence   e1000::create()
++    template sequence   e1000::create_device()
+     {
+-        chunk ::CALL
++        chunk Ethernet::create_device()
+         {
+             rtx_ether_ctx->hw_ctx.bars = pci_select_bars(pdev, IORESOURCE_MEM);
+             if (pci_enable_device_mem(pdev))
+@@ -54,11 +54,15 @@
+                 ${Log::info("e1000::create: pci_ioremap_bar failed")};
+             }
+         }
++
++        chunk ::CALL
++        {
++        }
+     }
+ 
+-    template sequence   e1000::destroy()
++    template sequence   e1000::destroy_device()
+     {
+-        chunk ::CALL
++        chunk   Ethernet::destroy_device
+         {
+             // XXX: add a check in order to avoid freeing none allocated
+             // resources.
+@@ -67,5 +71,9 @@
+             pci_release_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars);
+             pci_release_region(pdev, 0);
+         }
++
++        chunk   ::CALL
++        {
++        }
+     }
+ }
+diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.rti
+--- a/rathaxes/samples/lkm/e1000.rti	Sun Jan 08 00:13:22 2012 +0100
++++ b/rathaxes/samples/lkm/e1000.rti	Sun Jan 08 00:35:30 2012 +0100
+@@ -3,13 +3,15 @@
+     provided type   e1000::Context;
+ 
+     /* Not sure if we need the argument */
+-    provided sequence   e1000::create()
++    provided sequence   e1000::create_device()
+     {
++        provided chunk  Ethernet::create_device;
+         provided chunk  ::CALL;
+     }
+ 
+-    provided sequence   e1000::destroy()
++    provided sequence   e1000::destroy_device()
+     {
++        provided chunk  Ethernet::destroy_device;
+         provided chunk  ::CALL;
+     }
+ }
+diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/ethernet.blt
+--- a/rathaxes/samples/lkm/ethernet.blt	Sun Jan 08 00:13:22 2012 +0100
++++ b/rathaxes/samples/lkm/ethernet.blt	Sun Jan 08 00:35:30 2012 +0100
+@@ -173,6 +173,7 @@
+             /* same problem as above with ${pdev} */
+             //pci_set_drvdata(${pdev}, net_dev);
+             pci_set_drvdata(pdev, net_dev);
++            ${pointcut Ethernet::create_device};
+         }
+ 
+         chunk   ::CALL
+@@ -186,6 +187,8 @@
+         {
+             struct net_device *net_dev = pci_get_drvdata(pdev);
+ 
++            ${pointcut Ethernet::destroy_device};
++
+             unregister_netdev(net_dev);
+             /*
+              * If we had some cleanup todo with struct rtx_ether_ctx we would
+diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/ethernet.rti
+--- a/rathaxes/samples/lkm/ethernet.rti	Sun Jan 08 00:13:22 2012 +0100
++++ b/rathaxes/samples/lkm/ethernet.rti	Sun Jan 08 00:35:30 2012 +0100
+@@ -33,6 +33,8 @@
+         provided chunk  LKM::data;
+         provided chunk  PCI::pci_probe_hook;
+         provided chunk  ::CALL;
++
++        provided pointcut   Ethernet::create_device;
+     }
+ 
+     /* Likely extends PCI::remove */
+@@ -40,5 +42,7 @@
+     {
+         provided chunk  ::CALL;
+         provided chunk  PCI::pci_remove_hook;
++
++        provided pointcut   Ethernet::destroy_device;
+     }
+ }