comparison e1000_rework_without_explicit_call.patch @ 34:62fba8b9db06

Minor fixes
author Thomas Sanchez <thomas.sanchz@gmail.com>
date Sun, 08 Jan 2012 01:02:43 +0100
parents 60a59bf708df
children
comparison
equal deleted inserted replaced
33:60a59bf708df 34:62fba8b9db06
1 # HG changeset patch 1 # HG changeset patch
2 # Parent c3265ca219d51aa493db9639444eba7d72812e69 2 # Parent 1cfa6a46c673fae191ce982e2ebd471f9a53ee90
3 rathaxes: initialize the e1000 sepcific code in an elegant implicit way 3 rathaxes: initialize the e1000 sepcific code in an elegant implicit way
4 4
5 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.blt 5 diff -r 1cfa6a46c673 rathaxes/samples/lkm/e1000.blt
6 --- a/rathaxes/samples/lkm/e1000.blt Sun Jan 08 00:13:22 2012 +0100 6 --- a/rathaxes/samples/lkm/e1000.blt Sun Jan 08 01:01:14 2012 +0100
7 +++ b/rathaxes/samples/lkm/e1000.blt Sun Jan 08 00:35:30 2012 +0100 7 +++ b/rathaxes/samples/lkm/e1000.blt Sun Jan 08 01:02:13 2012 +0100
8 @@ -27,9 +27,9 @@ 8 @@ -27,9 +27,9 @@
9 } 9 }
10 } 10 }
11 11
12 - template sequence e1000::create() 12 - template sequence e1000::create()
15 - chunk ::CALL 15 - chunk ::CALL
16 + chunk Ethernet::create_device() 16 + chunk Ethernet::create_device()
17 { 17 {
18 rtx_ether_ctx->hw_ctx.bars = pci_select_bars(pdev, IORESOURCE_MEM); 18 rtx_ether_ctx->hw_ctx.bars = pci_select_bars(pdev, IORESOURCE_MEM);
19 if (pci_enable_device_mem(pdev)) 19 if (pci_enable_device_mem(pdev))
20 @@ -54,11 +54,15 @@ 20 @@ -54,18 +54,25 @@
21 ${Log::info("e1000::create: pci_ioremap_bar failed")}; 21 ${Log::info("e1000::create: pci_ioremap_bar failed")};
22 } 22 }
23 } 23 }
24 + 24 +
25 + chunk ::CALL 25 + chunk ::CALL
33 - chunk ::CALL 33 - chunk ::CALL
34 + chunk Ethernet::destroy_device 34 + chunk Ethernet::destroy_device
35 { 35 {
36 // XXX: add a check in order to avoid freeing none allocated 36 // XXX: add a check in order to avoid freeing none allocated
37 // resources. 37 // resources.
38 @@ -67,5 +71,9 @@ 38 struct rtx_ethernet_dev* rtx_ether_ctx = netdev_priv(net_dev);
39 iounmap(rtx_ether_ctx->hw_ctx.ioaddr);
39 pci_release_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars); 40 pci_release_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars);
40 pci_release_region(pdev, 0); 41 - pci_release_region(pdev, 0);
41 } 42 + }
42 + 43 +
43 + chunk ::CALL 44 + chunk ::CALL
44 + { 45 + {
45 + } 46 }
46 } 47 }
47 } 48 }
48 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.rti 49 diff -r 1cfa6a46c673 rathaxes/samples/lkm/e1000.rti
49 --- a/rathaxes/samples/lkm/e1000.rti Sun Jan 08 00:13:22 2012 +0100 50 --- a/rathaxes/samples/lkm/e1000.rti Sun Jan 08 01:01:14 2012 +0100
50 +++ b/rathaxes/samples/lkm/e1000.rti Sun Jan 08 00:35:30 2012 +0100 51 +++ b/rathaxes/samples/lkm/e1000.rti Sun Jan 08 01:02:13 2012 +0100
51 @@ -3,13 +3,15 @@ 52 @@ -3,13 +3,15 @@
52 provided type e1000::Context; 53 provided type e1000::Context;
53 54
54 /* Not sure if we need the argument */ 55 /* Not sure if we need the argument */
55 - provided sequence e1000::create() 56 - provided sequence e1000::create()
64 { 65 {
65 + provided chunk Ethernet::destroy_device; 66 + provided chunk Ethernet::destroy_device;
66 provided chunk ::CALL; 67 provided chunk ::CALL;
67 } 68 }
68 } 69 }
69 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/ethernet.blt 70 diff -r 1cfa6a46c673 rathaxes/samples/lkm/ethernet.blt
70 --- a/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 00:13:22 2012 +0100 71 --- a/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 01:01:14 2012 +0100
71 +++ b/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 00:35:30 2012 +0100 72 +++ b/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 01:02:13 2012 +0100
72 @@ -173,6 +173,7 @@ 73 @@ -173,6 +173,7 @@
73 /* same problem as above with ${pdev} */ 74 /* same problem as above with ${pdev} */
74 //pci_set_drvdata(${pdev}, net_dev); 75 //pci_set_drvdata(${pdev}, net_dev);
75 pci_set_drvdata(pdev, net_dev); 76 pci_set_drvdata(pdev, net_dev);
76 + ${pointcut Ethernet::create_device}; 77 + ${pointcut Ethernet::create_device};
84 + ${pointcut Ethernet::destroy_device}; 85 + ${pointcut Ethernet::destroy_device};
85 + 86 +
86 unregister_netdev(net_dev); 87 unregister_netdev(net_dev);
87 /* 88 /*
88 * If we had some cleanup todo with struct rtx_ether_ctx we would 89 * If we had some cleanup todo with struct rtx_ether_ctx we would
89 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/ethernet.rti 90 diff -r 1cfa6a46c673 rathaxes/samples/lkm/ethernet.rti
90 --- a/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 00:13:22 2012 +0100 91 --- a/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 01:01:14 2012 +0100
91 +++ b/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 00:35:30 2012 +0100 92 +++ b/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 01:02:13 2012 +0100
92 @@ -33,6 +33,8 @@ 93 @@ -33,6 +33,8 @@
93 provided chunk LKM::data; 94 provided chunk LKM::data;
94 provided chunk PCI::pci_probe_hook; 95 provided chunk PCI::pci_probe_hook;
95 provided chunk ::CALL; 96 provided chunk ::CALL;
96 + 97 +
104 provided chunk PCI::pci_remove_hook; 105 provided chunk PCI::pci_remove_hook;
105 + 106 +
106 + provided pointcut Ethernet::destroy_device; 107 + provided pointcut Ethernet::destroy_device;
107 } 108 }
108 } 109 }
110 diff -r 1cfa6a46c673 rathaxes/samples/lkm/lkm.rtx
111 --- a/rathaxes/samples/lkm/lkm.rtx Sun Jan 08 01:01:14 2012 +0100
112 +++ b/rathaxes/samples/lkm/lkm.rtx Sun Jan 08 01:02:13 2012 +0100
113 @@ -20,30 +20,14 @@
114 Log::info("We have one packet to transmit!");
115 }
116
117 -// PCI::probe(PCI::Device dev)
118 -// {
119 -// Log::info("Probe the device");
120 -// Ethernet::init(dev);
121 -// e1000::create();
122 -// }
123 -
124 -// PCI::remove(PCI::Device dev)
125 -// {
126 -// Log::info("Remove the pci device");
127 -// e1000::destroy();
128 -// Ethernet::exit(dev);
129 -// }
130 -
131 LKM::init()
132 {
133 Log::info("Hello this is LKM");
134 - // PCI::register();
135 }
136
137 LKM::exit()
138 {
139 Log::info("Good bye this was LKM");
140 - // PCI::unregister();
141 }
142 }
143