annotate vidix/dhahelper/dhahelper.c @ 30102:9b479e2f365d

add tm2x / tm2a binary decoder
author compn
date Wed, 30 Dec 2009 19:37:19 +0000
parents 0f1b5b68af32
children 892f4b4e1d5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
1 /*
27006
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
2 * Direct Hardware Access (DHA) kernel helper
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
3 *
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
4 * Copyright (C) 2002 Alex Beregszaszi <alex@fsn.hu>
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
5 * This file is part of MPlayer.
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
6 *
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
7 * MPlayer is free software; you can redistribute it and/or modify
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
8 * it under the terms of the GNU General Public License as published by
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
10 * (at your option) any later version.
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
11 *
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
12 * MPlayer is distributed in the hope that it will be useful,
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
15 * GNU General Public License for more details.
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
16 *
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
17 * You should have received a copy of the GNU General Public License along
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
20 */
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
21
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
22 /*
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
23 Accessing hardware from userspace as USER (no root needed!)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
24
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
25 Tested on 2.2.x (2.2.19) and 2.4.x (2.4.3,2.4.17).
27006
ad17225e13b4 Add standard license headers.
diego
parents: 26901
diff changeset
26
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
27 WARNING! THIS MODULE VIOLATES SEVERAL SECURITY LINES! DON'T USE IT
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
28 ON PRODUCTION SYSTEMS, ONLY AT HOME, ON A "SINGLE-USER" SYSTEM.
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
29 NO WARRANTY!
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
30
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
31 Tech:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
32 Communication between userspace and kernelspace goes over character
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
33 device using ioctl.
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
34
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
35 Usage:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
36 mknod -m 666 /dev/dhahelper c 180 0
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
37
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
38 Also you can change the major number, setting the "dhahelper_major"
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
39 module parameter, the default is 180, specified in dhahelper.h.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
40
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
41 Note: do not use other than minor==0, the module forbids it.
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
42
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
43 TODO:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
44 * do memory mapping without fops:mmap
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
45 * implement unmap memory
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
46 * select (request?) a "valid" major number (from Linux project? ;)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
47 * make security
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
48 * is pci handling needed? (libdha does this with lowlevel port funcs)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
49 * is mttr handling needed?
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
50 * test on older kernels (2.0.x (?))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
51 */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
52
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
53 #ifndef MODULE
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
54 #define MODULE
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
55 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
56
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
57 #ifndef __KERNEL__
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
58 #define __KERNEL__
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
59 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
60
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
61 #include <linux/config.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
62
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
63 #ifdef CONFIG_MODVERSION
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
64 #define MODVERSION
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
65 #include <linux/modversions.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
66 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
67
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
68 #include <linux/version.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
69 #include <linux/module.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
70 #include <linux/types.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
71 #include <linux/kernel.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
72 #include <linux/sched.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
73 #include <linux/mm.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
74 #include <linux/string.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
75 #include <linux/errno.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
76
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
77 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
78 #include <linux/malloc.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
79 #else
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
80 #include <linux/slab.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
81 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
82
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
83 #include <linux/pci.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
84 #include <linux/ioport.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
85 #include <linux/init.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
86
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
87 #include <asm/uaccess.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
88 #include <asm/system.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
89 #include <asm/io.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
90
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
91 #include <linux/mman.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
92
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
93 #include <linux/fs.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
94 #include <linux/unistd.h>
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
95
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
96 #include "dhahelper.h"
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
97
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
98 MODULE_AUTHOR("Alex Beregszaszi <alex@fsn.hu>");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
99 MODULE_DESCRIPTION("Provides userspace access to hardware (security violation!)");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
100 #ifdef MODULE_LICENSE
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
101 MODULE_LICENSE("GPL");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
102 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
103
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
104 static int dhahelper_major = DEFAULT_MAJOR;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
105 MODULE_PARM(dhahelper_major, "i");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
106 MODULE_PARM_DESC(dhahelper_major, "Major number of dhahelper characterdevice");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
107
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
108 /* 0 = silent */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
109 /* 1 = report errors (default) */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
110 /* 2 = debug */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
111 static int dhahelper_verbosity = 1;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
112 MODULE_PARM(dhahelper_verbosity, "i");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
113 MODULE_PARM_DESC(dhahelper_verbosity, "Level of verbosity (0 = silent, 1 = only errors, 2 = debug)");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
114
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
115 static dhahelper_memory_t last_mem_request;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
116
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
117
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
118 static int dhahelper_open(struct inode *inode, struct file *file)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
119 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
120 if (dhahelper_verbosity > 1)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
121 printk(KERN_DEBUG "dhahelper: device opened\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
122
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
123 if (MINOR(inode->i_rdev) != 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
124 return -ENXIO;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
125
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
126 MOD_INC_USE_COUNT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
127
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
128 return 0;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
129 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
130
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
131 static int dhahelper_release(struct inode *inode, struct file *file)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
132 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
133 if (dhahelper_verbosity > 1)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
134 printk(KERN_DEBUG "dhahelper: device released\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
135
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
136 if (MINOR(inode->i_rdev) != 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
137 return -ENXIO;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
138
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
139 MOD_DEC_USE_COUNT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
140
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
141 return 0;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
142 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
143
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
144 static int dhahelper_ioctl(struct inode *inode, struct file *file,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
145 unsigned int cmd, unsigned long arg)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
146 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
147 if (dhahelper_verbosity > 1)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
148 printk(KERN_DEBUG "dhahelper: ioctl(cmd=%x, arg=%lx)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
149 cmd, arg);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
150
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
151 if (MINOR(inode->i_rdev) != 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
152 return -ENXIO;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
153
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
154 switch(cmd)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
155 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
156 case DHAHELPER_GET_VERSION:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
157 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
158 int version = API_VERSION;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
159
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
160 if (copy_to_user((int *)arg, &version, sizeof(int)))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
161 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
162 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
163 printk(KERN_ERR "dhahelper: failed copy to userspace\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
164 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
165 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
166
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
167 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
168 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
169 case DHAHELPER_PORT:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
170 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
171 dhahelper_port_t port;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
172
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
173 if (copy_from_user(&port, (dhahelper_port_t *)arg, sizeof(dhahelper_port_t)))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
174 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
175 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
176 printk(KERN_ERR "dhahelper: failed copy from userspace\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
177 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
178 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
179
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
180 switch(port.operation)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
181 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
182 case PORT_OP_READ:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
183 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
184 switch(port.size)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
185 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
186 case 1:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
187 port.value = inb(port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
188 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
189 case 2:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
190 port.value = inw(port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
191 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
192 case 4:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
193 port.value = inl(port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
194 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
195 default:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
196 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
197 printk(KERN_ERR "dhahelper: invalid port read size (%d)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
198 port.size);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
199 return -EINVAL;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
200 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
201 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
202 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
203 case PORT_OP_WRITE:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
204 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
205 switch(port.size)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
206 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
207 case 1:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
208 outb(port.value, port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
209 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
210 case 2:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
211 outw(port.value, port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
212 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
213 case 4:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
214 outl(port.value, port.addr);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
215 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
216 default:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
217 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
218 printk(KERN_ERR "dhahelper: invalid port write size (%d)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
219 port.size);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
220 return -EINVAL;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
221 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
222 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
223 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
224 default:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
225 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
226 printk(KERN_ERR "dhahelper: invalid port operation (%d)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
227 port.operation);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
228 return -EINVAL;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
229 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
230
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
231 /* copy back only if read was performed */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
232 if (port.operation == PORT_OP_READ)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
233 if (copy_to_user((dhahelper_port_t *)arg, &port, sizeof(dhahelper_port_t)))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
234 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
235 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
236 printk(KERN_ERR "dhahelper: failed copy to userspace\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
237 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
238 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
239
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
240 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
241 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
242 case DHAHELPER_MEMORY:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
243 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
244 dhahelper_memory_t mem;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
245
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
246 if (copy_from_user(&mem, (dhahelper_memory_t *)arg, sizeof(dhahelper_memory_t)))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
247 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
248 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
249 printk(KERN_ERR "dhahelper: failed copy from userspace\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
250 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
251 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
252
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
253 switch(mem.operation)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
254 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
255 case MEMORY_OP_MAP:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
256 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
257 #if 1
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
258 memcpy(&last_mem_request, &mem, sizeof(dhahelper_memory_t));
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
259 #else
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
260 mem.ret = do_mmap(file, mem.start, mem.size, PROT_READ|PROT_WRITE,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
261 MAP_SHARED, mem.offset);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
262 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
263
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
264 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
265 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
266 case MEMORY_OP_UNMAP:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
267 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
268 default:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
269 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
270 printk(KERN_ERR "dhahelper: invalid memory operation (%d)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
271 mem.operation);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
272 return -EINVAL;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
273 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
274
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
275 if (copy_to_user((dhahelper_memory_t *)arg, &mem, sizeof(dhahelper_memory_t)))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
276 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
277 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
278 printk(KERN_ERR "dhahelper: failed copy to userspace\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
279 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
280 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
281
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
282 break;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
283 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
284 default:
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
285 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
286 printk(KERN_ERR "dhahelper: invalid ioctl (%x)\n", cmd);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
287 return -EINVAL;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
288 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
289
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
290 return 0;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
291 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
292
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
293 static int dhahelper_mmap(struct file *file, struct vm_area_struct *vma)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
294 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
295 if (last_mem_request.operation != MEMORY_OP_MAP)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
296 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
297 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
298 printk(KERN_ERR "dhahelper: mapping not requested before mmap\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
299 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
300 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
301
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
302 if (dhahelper_verbosity > 1)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
303 printk(KERN_INFO "dhahelper: mapping %x (size: %x)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
304 last_mem_request.start+last_mem_request.offset, last_mem_request.size);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
305
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
306 if (remap_page_range(0, last_mem_request.start + last_mem_request.offset,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
307 last_mem_request.size, vma->vm_page_prot))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
308 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
309 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
310 printk(KERN_ERR "dhahelper: error mapping memory\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
311 return -EFAULT;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
312 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
313
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
314 return 0;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
315 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
316
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
317 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
318 static struct file_operations dhahelper_fops =
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
319 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
320 /*llseek*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
321 /*read*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
322 /*write*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
323 /*readdir*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
324 /*poll*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
325 /*ioctl*/ dhahelper_ioctl,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
326 /*mmap*/ dhahelper_mmap,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
327 /*open*/ dhahelper_open,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
328 /*flush*/ NULL,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
329 /*release*/ dhahelper_release,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
330 /* zero out the last 5 entries too ? */
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
331 };
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
332 #else
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
333 static struct file_operations dhahelper_fops =
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
334 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
335 owner: THIS_MODULE,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
336 ioctl: dhahelper_ioctl,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
337 mmap: dhahelper_mmap,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
338 open: dhahelper_open,
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
339 release: dhahelper_release
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
340 };
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
341 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
342
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
343 #if KERNEL_VERSION < KERNEL_VERSION(2,4,0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
344 int init_module(void)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
345 #else
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
346 static int __init init_dhahelper(void)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
347 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
348 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
349 printk(KERN_INFO "Direct Hardware Access kernel helper (C) Alex Beregszaszi\n");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
350
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
351 if(register_chrdev(dhahelper_major, "dhahelper", &dhahelper_fops))
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
352 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
353 if (dhahelper_verbosity > 0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
354 printk(KERN_ERR "dhahelper: unable to register character device (major: %d)\n",
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
355 dhahelper_major);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
356 return -EIO;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
357 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27006
diff changeset
358
26901
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
359 return 0;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
360 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
361
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
362 #if KERNEL_VERSION < KERNEL_VERSION(2,4,0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
363 void cleanup_module(void)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
364 #else
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
365 static void __exit exit_dhahelper(void)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
366 #endif
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
367 {
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
368 unregister_chrdev(dhahelper_major, "dhahelper");
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
369 }
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
370
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
371 EXPORT_NO_SYMBOLS;
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
372
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
373 #if KERNEL_VERSION >= KERNEL_VERSION(2,4,0)
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
374 module_init(init_dhahelper);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
375 module_exit(exit_dhahelper);
af5408de478f Rename kernelhelper to dhahelper, that name is more fitting.
diego
parents:
diff changeset
376 #endif