diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2009-12-04 03:06:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-01-17 08:55:33 -0500 |
commit | 50d82602760c99d2c954c33360990c00146532cd (patch) | |
tree | 306752bbddb8dbe146c4d2f348c6453e3396ba5b /drivers/media/dvb/mantis/mantis_ca.c | |
parent | 8ce571f5e7eb7186f676af3b60af7980c2fc7929 (diff) |
V4L/DVB (13737): [Mantis] Register the CA device, dummy functions for now
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_ca.c')
-rw-r--r-- | drivers/media/dvb/mantis/mantis_ca.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c new file mode 100644 index 000000000000..6e440d31b79b --- /dev/null +++ b/drivers/media/dvb/mantis/mantis_ca.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | Mantis PCI bridge driver | ||
3 | |||
4 | Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #include "mantis_common.h" | ||
22 | #include "mantis_link.h" | ||
23 | #include "mantis_hif.h" | ||
24 | |||
25 | |||
26 | static int mantis_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long parg) | ||
27 | { | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | static int mantis_ca_open(struct inode *inode, struct file *file) | ||
32 | { | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int mantis_ca_release(struct inode *inode, struct file *file) | ||
37 | { | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static ssize_t mantis_ca_read(struct file *file, char __user *buffer, size_t count, loff_t *ofset) | ||
42 | { | ||
43 | struct dvb_device *dvbdev = file->private_data; | ||
44 | struct mantis_ca *ca = dvbdev->priv; | ||
45 | |||
46 | int status; | ||
47 | |||
48 | return 0; | ||
49 | error: | ||
50 | return status; | ||
51 | } | ||
52 | |||
53 | static ssize_t mantis_ca_write(struct file *file, const char __user *buffer, size_t count, loff_t *offset) | ||
54 | { | ||
55 | struct dvb_device *dvbdev = file->private_data; | ||
56 | struct mantis_ca *ca = dvbdev->priv; | ||
57 | |||
58 | int status; | ||
59 | |||
60 | return 0; | ||
61 | error: | ||
62 | return status; | ||
63 | } | ||
64 | |||
65 | static struct file_operations mantis_fops = { | ||
66 | .owner = THIS_MODULE, | ||
67 | .ioctl = mantis_ca_ioctl, | ||
68 | .open = mantis_ca_open, | ||
69 | .release = mantis_ca_release, | ||
70 | .read = mantis_ca_read, | ||
71 | .write = mantis_ca_write, | ||
72 | }; | ||
73 | |||
74 | static struct dvb_device mantis_ca = { | ||
75 | .priv = NULL, | ||
76 | .users = 1, | ||
77 | .readers = 1, | ||
78 | .writers = 1, | ||
79 | .fops = &mantis_fops, | ||
80 | }; | ||
81 | |||
82 | struct dvb_device *mantis_ca_init(struct mantis_pci *mantis) | ||
83 | { | ||
84 | int ret; | ||
85 | |||
86 | struct dvb_device *dvbdev; | ||
87 | struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter; | ||
88 | struct mantis_ca *ca; | ||
89 | |||
90 | if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) { | ||
91 | dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting .."); | ||
92 | return NULL; | ||
93 | } | ||
94 | |||
95 | ca->ca_priv = mantis; | ||
96 | mantis->mantis_ca = ca; | ||
97 | mantis_evmgr_init(ca); | ||
98 | |||
99 | dprintk(verbose, MANTIS_ERROR, 0, "CA: Registering Mantis Adapter(%d) Slot(0)\n", mantis->num); | ||
100 | if (dvb_register_device(dvb_adapter, &dvbdev, &mantis_ca, ca, DVB_DEVICE_CA) == 0) { | ||
101 | ca->ca_dev = dvbdev; | ||
102 | return ca->ca_dev; | ||
103 | } | ||
104 | return 0; | ||
105 | |||
106 | error: | ||
107 | if (ca != NULL) { | ||
108 | dprintk(verbose, MANTIS_ERROR, 1, "Error .."); | ||
109 | if (ca->ca_dev != NULL) | ||
110 | dvb_unregister_device(ca->ca_dev); | ||
111 | |||
112 | kfree(ca); | ||
113 | } | ||
114 | return NULL; | ||
115 | } | ||
116 | |||
117 | void mantis_ca_exit(struct mantis_pci *mantis) | ||
118 | { | ||
119 | struct mantis_ca *ca = mantis->mantis_ca; | ||
120 | |||
121 | mantis_evmgr_exit(ca); | ||
122 | dprintk(verbose, MANTIS_ERROR, 0, "CA: Unregister Mantis Adapter(%d) Slot(0)\n", mantis->num); | ||
123 | if (ca->ca_dev) | ||
124 | dvb_unregister_device(ca->ca_dev); | ||
125 | |||
126 | kfree(ca); | ||
127 | } | ||