--- zzzz-none-000/linux-4.9.279/kernel/resource.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/kernel/resource.c 2023-02-08 11:43:43.000000000 +0000 @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -169,10 +170,41 @@ .release = seq_release, }; +#if defined(CONFIG_AVM_ENHANCED) +struct resource gpio_resource = { + .name = "gpio", + .start = 0, + .end = ARCH_NR_GPIOS, + .flags = IORESOURCE_IO +}; +EXPORT_SYMBOL(gpio_resource); +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +static int iogpio_open(struct inode *inode, struct file *file) +{ + int res = seq_open(file, &resource_op); + if (!res) { + struct seq_file *m = file->private_data; + m->private = &gpio_resource; + } + return res; +} + +static struct file_operations proc_gpio_operations = { + .open = iogpio_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ + static int __init ioresources_init(void) { proc_create("ioports", 0, NULL, &proc_ioports_operations); proc_create("iomem", 0, NULL, &proc_iomem_operations); +#if defined(CONFIG_AVM_ENHANCED) + proc_create("iogpio", 0, NULL, &proc_gpio_operations); +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ return 0; } __initcall(ioresources_init);