This source file includes following definitions.
- mouse_open
- mouse_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <linux/fs.h>
18 #include <linux/errno.h>
19 #include <linux/mouse.h>
20 #include <linux/config.h>
21 #include <linux/kernel.h>
22 #include <linux/major.h>
23
24
25
26
27
28 extern struct file_operations bus_mouse_fops;
29 extern struct file_operations psaux_fops;
30 extern struct file_operations ms_bus_mouse_fops;
31 extern struct file_operations atixl_busmouse_fops;
32
33 extern unsigned long bus_mouse_init(unsigned long);
34 extern unsigned long psaux_init(unsigned long);
35 extern unsigned long ms_bus_mouse_init(unsigned long);
36 extern unsigned long atixl_busmouse_init(unsigned long);
37
38 static int mouse_open(struct inode * inode, struct file * file)
39 {
40 int minor = MINOR(inode->i_rdev);
41
42 switch (minor) {
43 #ifdef CONFIG_BUSMOUSE
44 case BUSMOUSE_MINOR:
45 file->f_op = &bus_mouse_fops;
46 break;
47 #endif
48 #if defined CONFIG_PSMOUSE || defined CONFIG_82C710_MOUSE
49 case PSMOUSE_MINOR:
50 file->f_op = &psaux_fops;
51 break;
52 #endif
53 #ifdef CONFIG_MS_BUSMOUSE
54 case MS_BUSMOUSE_MINOR:
55 file->f_op = &ms_bus_mouse_fops;
56 break;
57 #endif
58 #ifdef CONFIG_ATIXL_BUSMOUSE
59 case ATIXL_BUSMOUSE_MINOR:
60 file->f_op = &atixl_busmouse_fops;
61 break;
62 #endif
63 default:
64 return -ENODEV;
65 }
66 return file->f_op->open(inode,file);
67 }
68
69 static struct file_operations mouse_fops = {
70 NULL,
71 NULL,
72 NULL,
73 NULL,
74 NULL,
75 NULL,
76 NULL,
77 mouse_open,
78 NULL
79 };
80
81 unsigned long mouse_init(unsigned long kmem_start)
82 {
83 #ifdef CONFIG_BUSMOUSE
84 kmem_start = bus_mouse_init(kmem_start);
85 #endif
86 #if defined CONFIG_PSMOUSE || defined CONFIG_82C710_MOUSE
87 kmem_start = psaux_init(kmem_start);
88 #endif
89 #ifdef CONFIG_MS_BUSMOUSE
90 kmem_start = ms_bus_mouse_init(kmem_start);
91 #endif
92 #ifdef CONFIG_ATIXL_BUSMOUSE
93 kmem_start = atixl_busmouse_init(kmem_start);
94 #endif
95 if (register_chrdev(MOUSE_MAJOR,"mouse",&mouse_fops))
96 printk("unable to get major %d for mouse devices\n",
97 MOUSE_MAJOR);
98 return kmem_start;
99 }