Skip to content

Commit 2948238

Browse files
committed
外部からも使用する関数を整理
1 parent c680610 commit 2948238

File tree

3 files changed

+14
-33
lines changed

3 files changed

+14
-33
lines changed

src/drivers/rtmouse.h

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -252,39 +252,20 @@ struct rtcnt_device_info {
252252
int raw_pulse_count;
253253
};
254254

255-
/* --- rtmouse_dev_fops.c extern --- */
255+
/* --- used in rtmouse_dev_fops.c --- */
256256
extern volatile void __iomem *pwm_base;
257257
extern volatile uint32_t *gpio_base;
258258
extern struct mutex lock;
259259
extern struct spi_board_info mcp3204_info;
260260
extern struct file_operations dev_fops[ID_DEV_SIZE];
261-
262261
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
263262
extern struct device *mcp320x_dev;
264263
#endif
265264

266-
/* --- rtmouse_dev_fops.c function --- */
267-
int dev_open(struct inode *inode, struct file *filep);
268-
int dev_release(struct inode *inode, struct file *filep);
269-
int i2c_dev_open(struct inode *inode, struct file *filep);
270-
int i2c_dev_release(struct inode *inode, struct file *filep);
271-
ssize_t led_write(struct file *filep, const char __user *buf, size_t count,
272-
loff_t *f_pos);
273-
ssize_t buzzer_write(struct file *filep, const char __user *buf, size_t count,
274-
loff_t *f_pos);
275-
ssize_t rawmotor_l_write(struct file *filep, const char __user *buf,
276-
size_t count, loff_t *f_pos);
277-
ssize_t rawmotor_r_write(struct file *filep, const char __user *buf,
278-
size_t count, loff_t *f_pos);
279-
ssize_t motoren_write(struct file *filep, const char __user *buf, size_t count,
280-
loff_t *f_pos);
281-
ssize_t motor_write(struct file *filep, const char __user *buf, size_t count,
282-
loff_t *f_pos);
265+
/* --- used in rtmouse_dev_fops.c --- */
283266
int rpi_gpio_function_set(int pin, uint32_t func);
284267
void rpi_gpio_set32(uint32_t mask, uint32_t val);
285268
void rpi_gpio_clear32(uint32_t mask, uint32_t val);
286269
void rpi_pwm_write32(uint32_t offset, uint32_t val);
287-
int buzzer_init(void);
288-
unsigned int mcp3204_get_value(int channel);
289270

290271
#endif // RTMOUSE_H

src/drivers/rtmouse_dev_fops.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static void reset_signed_count(struct rtcnt_device_info *dev_info, int rtcnt_cou
152152
* mcp3204_get_value - get sensor data from MCP3204
153153
* called by sensor_read()
154154
*/
155-
unsigned int mcp3204_get_value(int channel)
155+
static unsigned int mcp3204_get_value(int channel)
156156
{
157157
struct device *dev;
158158
struct mcp3204_drvdata *data;
@@ -639,7 +639,7 @@ static ssize_t sensor_read(struct file *filep, char __user *buf, size_t count,
639639

640640
/* --- Device File Operation --- */
641641
/* Open Device */
642-
int dev_open(struct inode *inode, struct file *filep)
642+
static int dev_open(struct inode *inode, struct file *filep)
643643
{
644644
int *minor = (int *)kmalloc(sizeof(int), GFP_KERNEL);
645645
int major = MAJOR(inode->i_rdev);
@@ -654,13 +654,13 @@ int dev_open(struct inode *inode, struct file *filep)
654654
}
655655

656656
/* Close device */
657-
int dev_release(struct inode *inode, struct file *filep)
657+
static int dev_release(struct inode *inode, struct file *filep)
658658
{
659659
kfree(filep->private_data);
660660
return 0;
661661
}
662662

663-
int i2c_dev_open(struct inode *inode, struct file *filep)
663+
static int i2c_dev_open(struct inode *inode, struct file *filep)
664664
{
665665
struct rtcnt_device_info *dev_info;
666666
dev_info = container_of(inode->i_cdev, struct rtcnt_device_info, cdev);
@@ -672,13 +672,13 @@ int i2c_dev_open(struct inode *inode, struct file *filep)
672672
return 0;
673673
}
674674

675-
int i2c_dev_release(struct inode *inode, struct file *filep) { return 0; }
675+
static int i2c_dev_release(struct inode *inode, struct file *filep) { return 0; }
676676

677677
/*
678678
* led_write - Trun ON/OFF LEDs
679679
* Write function of /dev/rtled
680680
*/
681-
ssize_t led_write(struct file *filep, const char __user *buf, size_t count,
681+
static ssize_t led_write(struct file *filep, const char __user *buf, size_t count,
682682
loff_t *f_pos)
683683
{
684684
char cval;
@@ -706,7 +706,7 @@ ssize_t led_write(struct file *filep, const char __user *buf, size_t count,
706706
* buzzer_write - Write buzzer frequency
707707
* Write function of /dev/rtbuzzer
708708
*/
709-
ssize_t buzzer_write(struct file *filep, const char __user *buf, size_t count,
709+
static ssize_t buzzer_write(struct file *filep, const char __user *buf, size_t count,
710710
loff_t *f_pos)
711711
{
712712
int ret;
@@ -745,7 +745,7 @@ ssize_t buzzer_write(struct file *filep, const char __user *buf, size_t count,
745745
* rawmotor_l_write - Output frequency to the left motor
746746
* Write function of /dev/rtmotor_raw_l
747747
*/
748-
ssize_t rawmotor_l_write(struct file *filep, const char __user *buf,
748+
static ssize_t rawmotor_l_write(struct file *filep, const char __user *buf,
749749
size_t count, loff_t *f_pos)
750750
{
751751
int freq, ret;
@@ -765,7 +765,7 @@ ssize_t rawmotor_l_write(struct file *filep, const char __user *buf,
765765
* rawmotor_r_write - Output frequency to the right motor
766766
* Write function of /dev/rtmotor_raw_r
767767
*/
768-
ssize_t rawmotor_r_write(struct file *filep, const char __user *buf,
768+
static ssize_t rawmotor_r_write(struct file *filep, const char __user *buf,
769769
size_t count, loff_t *f_pos)
770770
{
771771
int freq, ret;
@@ -786,7 +786,7 @@ ssize_t rawmotor_r_write(struct file *filep, const char __user *buf,
786786
* motoren_write - Turn ON/OFF SteppingMotor Power
787787
* Write function of /dev/rtmotoren
788788
*/
789-
ssize_t motoren_write(struct file *filep, const char __user *buf, size_t count,
789+
static ssize_t motoren_write(struct file *filep, const char __user *buf, size_t count,
790790
loff_t *f_pos)
791791
{
792792
char cval;
@@ -813,7 +813,7 @@ ssize_t motoren_write(struct file *filep, const char __user *buf, size_t count,
813813
* motor_write - Output frequency to right and left both motors
814814
* Write function of /dev/rtmotor
815815
*/
816-
ssize_t motor_write(struct file *filep, const char __user *buf, size_t count,
816+
static ssize_t motor_write(struct file *filep, const char __user *buf, size_t count,
817817
loff_t *f_pos)
818818
{
819819
int tmp;

src/drivers/rtmouse_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ MODULE_DEVICE_TABLE(i2c, i2c_counter_id);
168168
* Initialize buzzer
169169
* return 0 : device close
170170
*/
171-
int buzzer_init(void)
171+
static int buzzer_init(void)
172172
{
173173

174174
rpi_gpio_function_set(BUZZER_BASE, RPI_GPF_OUTPUT); // io is pwm out

0 commit comments

Comments
 (0)