@@ -31,7 +31,8 @@ MODULE_DESCRIPTION("Raspberry Pi Mouse device driver");
3131
3232/*
3333 * --- Device Numbers ---
34- * used in rtmouse_i2c.c
34+ * used in rtmouse_i2c.c, dev_init_module()
35+ * and cleanup_each_dev()
3536 */
3637const unsigned int NUM_DEV [ID_DEV_SIZE ] = {
3738 [ID_DEV_LED ] = 4 , [ID_DEV_SWITCH ] = 3 , [ID_DEV_SENSOR ] = 1 ,
@@ -40,7 +41,7 @@ const unsigned int NUM_DEV[ID_DEV_SIZE] = {
4041
4142/*
4243 * --- Device Names ---
43- * used in rtmouse_dev.c
44+ * used in rtmouse_dev.c and dev_init_module()
4445 */
4546const char * NAME_DEV [ID_DEV_SIZE ] = {[ID_DEV_LED ] = "rtled" ,
4647 [ID_DEV_SWITCH ] = "rtswitch" ,
@@ -51,19 +52,6 @@ const char *NAME_DEV[ID_DEV_SIZE] = {[ID_DEV_LED] = "rtled",
5152 [ID_DEV_MOTOREN ] = "rtmotoren" ,
5253 [ID_DEV_MOTOR ] = "rtmotor" };
5354
54- /*
55- * --- Device Names(+%u) ---
56- * used in rtmouse_dev.c
57- */
58- const char * NAME_DEV_U [ID_DEV_SIZE ] = {[ID_DEV_LED ] = "rtled%u" ,
59- [ID_DEV_SWITCH ] = "rtswitch%u" ,
60- [ID_DEV_SENSOR ] = "rtlightsensor%u" ,
61- [ID_DEV_BUZZER ] = "rtbuzzer%u" ,
62- [ID_DEV_MOTORRAWR ] = "rtmotor_raw_r%u" ,
63- [ID_DEV_MOTORRAWL ] = "rtmotor_raw_l%u" ,
64- [ID_DEV_MOTOREN ] = "rtmotoren%u" ,
65- [ID_DEV_MOTOR ] = "rtmotor%u" };
66-
6755// used in by rtmouse_dev.c and cleanup_each_dev()
6856int _major_dev [ID_DEV_SIZE ] = {
6957 [ID_DEV_LED ] = DEV_MAJOR , [ID_DEV_SWITCH ] = DEV_MAJOR ,
@@ -80,21 +68,25 @@ int _minor_dev[ID_DEV_SIZE] = {
8068
8169/*
8270 * --- General Options ---
83- * used in rtmouse_dev.c
71+ * used in rtmouse_dev.c and dev_cleanup_module()
8472 */
8573struct class * class_dev [ID_DEV_SIZE ] = {
8674 [ID_DEV_LED ] = NULL , [ID_DEV_SWITCH ] = NULL ,
8775 [ID_DEV_SENSOR ] = NULL , [ID_DEV_BUZZER ] = NULL ,
8876 [ID_DEV_MOTORRAWR ] = NULL , [ID_DEV_MOTORRAWL ] = NULL ,
8977 [ID_DEV_MOTOREN ] = NULL , [ID_DEV_MOTOR ] = NULL };
9078
91- // used in rtmouse_i2c.c
79+ // used in rtmouse_i2c.c and dev_cleanup_module()
9280struct cdev * cdev_array = NULL ;
81+
82+ // used in rtmouse_i2c.c
9383volatile int cdev_index = 0 ;
9484
95- // used in rtmouse_dev.c
85+ // used in rtmouse_dev.c and rtmouse_gpio.c
9686volatile void __iomem * pwm_base ;
9787volatile uint32_t * gpio_base ;
88+
89+ // used in rtmouse_dev.c, rtmouse_i2c.c and rtmouse_spi.c
9890struct mutex lock ;
9991
10092/* --- Static variables --- */
0 commit comments