static int __init ar71xx_machine_setup(void) { ar71xx_gpio_init(); ar71xx_add_device_uart(); ar71xx_add_device_wdt(); mips_machine_setup(); return 0; }
static __init int register_proc(void) { unsigned char i, flag = 0; char proc_name[32]; int gpiocount = 32; /* create directory gpio */ gpio_dir = proc_mkdir("gpio", NULL); if (gpio_dir == NULL) goto fault; // gpio_dir->owner = THIS_MODULE; for (i = 0; i < gpiocount * 3; i++) //create for every GPIO "x_in"," x_out" and "x_dir" { if (i / gpiocount == 0) { flag = GPIO_IN; sprintf(proc_name, "%i_in", i); } if (i / gpiocount == 1) { flag = GPIO_OUT; sprintf(proc_name, "%i_out", i % gpiocount); } if (i / gpiocount == 2) { flag = GPIO_DIR; sprintf(proc_name, "%i_dir", i % gpiocount); } proc_gpio = proc_create_data(proc_name, S_IRUGO, gpio_dir, &fops_data, ((i % gpiocount) | flag)); } proc_gpio = proc_create("info", S_IRUGO, gpio_dir, &fops_info); printk(KERN_NOTICE "gpio_proc: module loaded and /proc/gpio/ created\n"); ar71xx_gpio_init(); return 0; fault: cleanup_proc(); return -EFAULT; }