diff options
| author | lonkaars <loek@pipeframe.xyz> | 2024-05-14 13:42:06 +0200 | 
|---|---|---|
| committer | lonkaars <loek@pipeframe.xyz> | 2024-05-14 13:42:06 +0200 | 
| commit | 80c37bca675f02fb2bfe71f6ae5ba0232c65bd40 (patch) | |
| tree | 03e10a0b2b8d6784eecdb40c997a00fad063d9dc /driver/fopdrv.c | |
| parent | 891595b9307eb2695411d8e32e4addd9cd927ec8 (diff) | |
week 2 done: fix driver (reboot'd)week-2
Diffstat (limited to 'driver/fopdrv.c')
| -rw-r--r-- | driver/fopdrv.c | 10 | 
1 files changed, 2 insertions, 8 deletions
diff --git a/driver/fopdrv.c b/driver/fopdrv.c index 18a1d35..87aa30e 100644 --- a/driver/fopdrv.c +++ b/driver/fopdrv.c @@ -7,8 +7,6 @@ bool printed = false;  // driver/char/mem.c read_null (/dev/null)  ssize_t fop_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { -	printk("%s(<file>, <buf>, %u, <ppos>)\n", __PRETTY_FUNCTION__, count); -  	if (count < 2) return 0;  	if (printed) return 0; @@ -29,8 +27,6 @@ ssize_t fop_read(struct file *file, char __user *buf, size_t count, loff_t *ppos  }  ssize_t fop_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { -	printk("%s(<file>, <buf>, %u, <ppos>)\n", __PRETTY_FUNCTION__, count); -  	// only allow single character as input  	if (count < 1) return count;  	if (count > 2) return count; @@ -44,11 +40,11 @@ ssize_t fop_write(struct file *file, const char __user *buf, size_t count, loff_  	barrier();  	if (input_buf[0] == '0') { -		printk("TODO: TURN OFF OUTPUT\n"); +		printk(DRV_NAME": OUTPUT OFF\n");  		iowrite32((1<<PIN), gpio1 + GPIO_CLEARDATAOUT); wmb();  	}  	if (input_buf[0] == '1') { -		printk("TODO: TURN ON OUTPUT\n"); +		printk(DRV_NAME": OUTPUT ON\n");  		iowrite32((1<<PIN), gpio1 + GPIO_SETDATAOUT); wmb();  	} @@ -58,7 +54,6 @@ ssize_t fop_write(struct file *file, const char __user *buf, size_t count, loff_  }  int fop_open(struct inode * inode, struct file * file) { -	printk("%s(<inode>, <file>)\n", __PRETTY_FUNCTION__);  	printed = false;  	return 0;  	// 0 seems to be a safe return value as it's used in driver/char/mem.c. The @@ -68,7 +63,6 @@ int fop_open(struct inode * inode, struct file * file) {  }  int fop_release(struct inode * inode, struct file * file) { -	printk("%s(<inode>, <file>)\n", __PRETTY_FUNCTION__);  	return 0;  	// same as above, but found in driver/char/lp.c  }  |