V4L/DVB (13737): [Mantis] Register the CA device, dummy functions for now
[deliverable/linux.git] / drivers / media / dvb / mantis / mantis_ca.c
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 }
This page took 0.043275 seconds and 6 git commands to generate.