Mercurial > archived > louis > epitech > mq > rathaxes
comparison 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 |
comparison
equal
deleted
inserted
replaced
32:c7c59cebab85 | 33:60a59bf708df |
---|---|
1 # HG changeset patch | |
2 # Parent c3265ca219d51aa493db9639444eba7d72812e69 | |
3 rathaxes: initialize the e1000 sepcific code in an elegant implicit way | |
4 | |
5 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.blt | |
6 --- a/rathaxes/samples/lkm/e1000.blt Sun Jan 08 00:13:22 2012 +0100 | |
7 +++ b/rathaxes/samples/lkm/e1000.blt Sun Jan 08 00:35:30 2012 +0100 | |
8 @@ -27,9 +27,9 @@ | |
9 } | |
10 } | |
11 | |
12 - template sequence e1000::create() | |
13 + template sequence e1000::create_device() | |
14 { | |
15 - chunk ::CALL | |
16 + chunk Ethernet::create_device() | |
17 { | |
18 rtx_ether_ctx->hw_ctx.bars = pci_select_bars(pdev, IORESOURCE_MEM); | |
19 if (pci_enable_device_mem(pdev)) | |
20 @@ -54,11 +54,15 @@ | |
21 ${Log::info("e1000::create: pci_ioremap_bar failed")}; | |
22 } | |
23 } | |
24 + | |
25 + chunk ::CALL | |
26 + { | |
27 + } | |
28 } | |
29 | |
30 - template sequence e1000::destroy() | |
31 + template sequence e1000::destroy_device() | |
32 { | |
33 - chunk ::CALL | |
34 + chunk Ethernet::destroy_device | |
35 { | |
36 // XXX: add a check in order to avoid freeing none allocated | |
37 // resources. | |
38 @@ -67,5 +71,9 @@ | |
39 pci_release_selected_regions(pdev, rtx_ether_ctx->hw_ctx.bars); | |
40 pci_release_region(pdev, 0); | |
41 } | |
42 + | |
43 + chunk ::CALL | |
44 + { | |
45 + } | |
46 } | |
47 } | |
48 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/e1000.rti | |
49 --- a/rathaxes/samples/lkm/e1000.rti Sun Jan 08 00:13:22 2012 +0100 | |
50 +++ b/rathaxes/samples/lkm/e1000.rti Sun Jan 08 00:35:30 2012 +0100 | |
51 @@ -3,13 +3,15 @@ | |
52 provided type e1000::Context; | |
53 | |
54 /* Not sure if we need the argument */ | |
55 - provided sequence e1000::create() | |
56 + provided sequence e1000::create_device() | |
57 { | |
58 + provided chunk Ethernet::create_device; | |
59 provided chunk ::CALL; | |
60 } | |
61 | |
62 - provided sequence e1000::destroy() | |
63 + provided sequence e1000::destroy_device() | |
64 { | |
65 + provided chunk Ethernet::destroy_device; | |
66 provided chunk ::CALL; | |
67 } | |
68 } | |
69 diff -r c3265ca219d5 -r 5c8bb469d5a5 rathaxes/samples/lkm/ethernet.blt | |
70 --- a/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 00:13:22 2012 +0100 | |
71 +++ b/rathaxes/samples/lkm/ethernet.blt Sun Jan 08 00:35:30 2012 +0100 | |
72 @@ -173,6 +173,7 @@ | |
73 /* same problem as above with ${pdev} */ | |
74 //pci_set_drvdata(${pdev}, net_dev); | |
75 pci_set_drvdata(pdev, net_dev); | |
76 + ${pointcut Ethernet::create_device}; | |
77 } | |
78 | |
79 chunk ::CALL | |
80 @@ -186,6 +187,8 @@ | |
81 { | |
82 struct net_device *net_dev = pci_get_drvdata(pdev); | |
83 | |
84 + ${pointcut Ethernet::destroy_device}; | |
85 + | |
86 unregister_netdev(net_dev); | |
87 /* | |
88 * 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 --- a/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 00:13:22 2012 +0100 | |
91 +++ b/rathaxes/samples/lkm/ethernet.rti Sun Jan 08 00:35:30 2012 +0100 | |
92 @@ -33,6 +33,8 @@ | |
93 provided chunk LKM::data; | |
94 provided chunk PCI::pci_probe_hook; | |
95 provided chunk ::CALL; | |
96 + | |
97 + provided pointcut Ethernet::create_device; | |
98 } | |
99 | |
100 /* Likely extends PCI::remove */ | |
101 @@ -40,5 +42,7 @@ | |
102 { | |
103 provided chunk ::CALL; | |
104 provided chunk PCI::pci_remove_hook; | |
105 + | |
106 + provided pointcut Ethernet::destroy_device; | |
107 } | |
108 } |