remove proc stuff

This commit is contained in:
2025-06-04 10:53:23 +01:00
parent 772f53a890
commit 95a3395313

View File

@ -9,7 +9,7 @@
/* Meta Information */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Johannes 4 GNU/Linux");
MODULE_AUTHOR("Wolfgang Hottgenroth");
MODULE_DESCRIPTION("A simple LKM to parse the device tree for a specific device and its properties");
/* Declate the probe and remove functions */
@ -35,25 +35,6 @@ static struct platform_driver my_driver = {
/* GPIO variable */
static struct gpio_desc *my_led = NULL;
static struct proc_dir_entry *proc_file;
/**
* @brief Write data to buffer
*/
static ssize_t my_write(struct file *File, const char *user_buffer, size_t count, loff_t *offs) {
switch (user_buffer[0]) {
case '0':
case '1':
gpiod_set_value(my_led, user_buffer[0] - '0');
default:
break;
}
return count;
}
static struct proc_ops fops = {
.proc_write = my_write,
};
/**
* @brief This function is called on loading the driver
@ -100,15 +81,6 @@ static int dt_probe(struct platform_device *pdev) {
return -1 * IS_ERR(my_led);
}
/* Creating procfs file */
proc_file = proc_create("my-led", 0666, NULL, &fops);
if(proc_file == NULL) {
printk("procfs_test - Error creating /proc/my-led\n");
gpiod_put(my_led);
return -ENOMEM;
}
return 0;
}
@ -118,7 +90,6 @@ static int dt_probe(struct platform_device *pdev) {
static void dt_remove(struct platform_device *pdev) {
printk("dt_gpio - Now I am in the remove function\n");
gpiod_put(my_led);
proc_remove(proc_file);
}
/**