[ifxmips]
[openwrt/svn-archive/archive.git] / package / lqtapi / src / mps / vmmc-link.c
1 #include <linux/kernel.h>
2 #include <linux/slab.h>
3 #include <linux/tapi/tapi.h>
4
5 #include "vmmc-link.h"
6 #include "vmmc-module.h"
7
8 struct vmmc_tapi_link {
9 struct tapi_link tapi_link;
10 struct vmmc_link vmmc_link;
11 };
12
13 struct tapi_link *vmmc_tapi_link_alloc(struct tapi_device *tdev,
14 struct tapi_endpoint *ep1, struct tapi_endpoint *ep2)
15 {
16 struct vmmc_tapi_link *link = kzalloc(sizeof(*link), GFP_KERNEL);
17 struct vmmc_module *module1 = tapi_endpoint_to_vmmc_module(ep1);
18 struct vmmc_module *module2 = tapi_endpoint_to_vmmc_module(ep2);
19
20 vmmc_link_init(&link->vmmc_link, module1, module2);
21
22 return &link->tapi_link;
23 }
24
25 void vmmc_tapi_link_free(struct tapi_device *tdev, struct tapi_link *tapi_link)
26 {
27 struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link,
28 tapi_link);
29
30 vmmc_link_put(&link->vmmc_link);
31 kfree(link);
32 }
33
34 int vmmc_tapi_link_enable(struct tapi_device *tdev,
35 struct tapi_link *tapi_link)
36 {
37 struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link,
38 tapi_link);
39
40 vmmc_link_enable(&link->vmmc_link);
41 return 0;
42 }
43
44 int vmmc_tapi_link_disable(struct tapi_device *tdev,
45 struct tapi_link *tapi_link)
46 {
47 struct vmmc_tapi_link *link = container_of(tapi_link, struct vmmc_tapi_link,
48 tapi_link);
49
50 vmmc_link_disable(&link->vmmc_link);
51 return 0;
52 }