I am trying to retrieve data from a proc file in proc file operations using pde_data(file_inode(file)). The file has been created using proc_create_data("version", 0666, dir, &version_fops, base_addr);.
I have:
#include <linux/proc_fs.h>void proc_create(const struct proc_dir_entry *dir, void __iomem *base_addr) { printk(KERN_INFO "%s: base addr: %px\n", __FUNCTION__, base_addr); proc_create_data("version", 0666, dir, &kibo_version_fops, base_addr);}ssize_t version_proc_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) { void __iomem *base_addr = PDE_DATA(file_inode(file)); printk(KERN_INFO "proc read base addr: %px\n", base_addr); // (...) implementation}In proc_create I read the correct base address, but not in version_proc_read.The code has been sampled from working code with the only difference that the proc file was top level, i.e. not in a proc directory.
How can I retrieve the data associated to my proc file?