Skip to content

Commit 2b50070

Browse files
committed
コメントなど微修正
1 parent 6e95fbf commit 2b50070

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

.test/lint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ lint_driver () {
1010
python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse_dev.c
1111
python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse_spi.c
1212
python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse_i2c.c
13+
python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse_gpio.c
1314
python3 $SRC_DIR/.test/bin/run-clang-format.py rtmouse.h
1415
popd
1516
}

src/drivers/rtmouse.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
// Raspberry Pi 2 B : 2
5353
// Raspberry Pi 3 B/A+/B+ : 2
5454
// Raspberry Pi 4 B : 4
55-
#define RASPBERRYPI 4
55+
#define RASPBERRYPI 2
5656

5757
/* --- Device ID --- */
5858
#define ID_DEV_LED 0
@@ -252,9 +252,8 @@ struct rtcnt_device_info {
252252
int raw_pulse_count;
253253
};
254254

255-
/* --- used in rtmouse_dev_fops.c --- */
255+
/* --- used in rtmouse_dev.c --- */
256256
extern const char *NAME_DEV[ID_DEV_SIZE];
257-
extern const char *NAME_DEV_U[ID_DEV_SIZE];
258257
extern int _major_dev[ID_DEV_SIZE];
259258
extern int _minor_dev[ID_DEV_SIZE];
260259
extern struct class *class_dev[ID_DEV_SIZE];

src/drivers/rtmouse_dev.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@
2525
static unsigned int motor_l_freq_is_positive = 1;
2626
static unsigned int motor_r_freq_is_positive = 1;
2727

28+
/*
29+
* --- Device Names(+%u) ---
30+
* used in register_dev()
31+
*/
32+
static const char *NAME_DEV_U[ID_DEV_SIZE] = {[ID_DEV_LED] = "rtled%u",
33+
[ID_DEV_SWITCH] = "rtswitch%u",
34+
[ID_DEV_SENSOR] = "rtlightsensor%u",
35+
[ID_DEV_BUZZER] = "rtbuzzer%u",
36+
[ID_DEV_MOTORRAWR] = "rtmotor_raw_r%u",
37+
[ID_DEV_MOTORRAWL] = "rtmotor_raw_l%u",
38+
[ID_DEV_MOTOREN] = "rtmotoren%u",
39+
[ID_DEV_MOTOR] = "rtmotor%u"};
40+
2841
/*
2942
* i2c_counter_set - set value to I2C pulse counter
3043
* called by rtcnt_write()

src/drivers/rtmouse_main.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
3637
const 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
*/
4546
const 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()
6856
int _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
*/
8573
struct 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()
9280
struct cdev *cdev_array = NULL;
81+
82+
// used in rtmouse_i2c.c
9383
volatile int cdev_index = 0;
9484

95-
// used in rtmouse_dev.c
85+
// used in rtmouse_dev.c and rtmouse_gpio.c
9686
volatile void __iomem *pwm_base;
9787
volatile uint32_t *gpio_base;
88+
89+
// used in rtmouse_dev.c, rtmouse_i2c.c and rtmouse_spi.c
9890
struct mutex lock;
9991

10092
/* --- Static variables --- */

0 commit comments

Comments
 (0)