2 Mantis PCI bridge driver
4 Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
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.
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.
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.
21 #include "mantis_common.h"
22 #include "mantis_link.h"
23 #include "mantis_hif.h"
26 static int mantis_ca_ioctl(struct inode
*inode
, struct file
*file
, unsigned int cmd
, unsigned long parg
)
31 static int mantis_ca_open(struct inode
*inode
, struct file
*file
)
36 static int mantis_ca_release(struct inode
*inode
, struct file
*file
)
41 static ssize_t
mantis_ca_read(struct file
*file
, char __user
*buffer
, size_t count
, loff_t
*ofset
)
43 struct dvb_device
*dvbdev
= file
->private_data
;
44 struct mantis_ca
*ca
= dvbdev
->priv
;
53 static ssize_t
mantis_ca_write(struct file
*file
, const char __user
*buffer
, size_t count
, loff_t
*offset
)
55 struct dvb_device
*dvbdev
= file
->private_data
;
56 struct mantis_ca
*ca
= dvbdev
->priv
;
65 static struct file_operations mantis_fops
= {
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
,
74 static struct dvb_device mantis_ca
= {
82 struct dvb_device
*mantis_ca_init(struct mantis_pci
*mantis
)
86 struct dvb_device
*dvbdev
;
87 struct dvb_adapter
*dvb_adapter
= &mantis
->dvb_adapter
;
90 if (!(ca
= kzalloc(sizeof (struct mantis_ca
), GFP_KERNEL
))) {
91 dprintk(verbose
, MANTIS_ERROR
, 1, "Out of memory!, exiting ..");
96 mantis
->mantis_ca
= ca
;
97 mantis_evmgr_init(ca
);
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) {
108 dprintk(verbose
, MANTIS_ERROR
, 1, "Error ..");
109 if (ca
->ca_dev
!= NULL
)
110 dvb_unregister_device(ca
->ca_dev
);
117 void mantis_ca_exit(struct mantis_pci
*mantis
)
119 struct mantis_ca
*ca
= mantis
->mantis_ca
;
121 mantis_evmgr_exit(ca
);
122 dprintk(verbose
, MANTIS_ERROR
, 0, "CA: Unregister Mantis Adapter(%d) Slot(0)\n", mantis
->num
);
124 dvb_unregister_device(ca
->ca_dev
);