annotate vidix/dhahelper/dhahelper.c @ 33432:4ecf8f0b024c

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