本文共 555 字,大约阅读时间需要 1 分钟。
static struct bus_type gpio_bus_type = { .name = "gpio",};
static int __init gpiolib_dev_init(void){ int ret; /* Register GPIO sysfs bus */ ret = bus_register(&gpio_bus_type); if (ret < 0) { pr_err("gpiolib: could not register GPIO bus type\n"); return ret; } ret = alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, "gpiochip"); if (ret < 0) { pr_err("gpiolib: failed to allocate char dev region\n"); bus_unregister(&gpio_bus_type); } else { gpiolib_initialized = true; gpiochip_setup_devs(); } return ret;}core_initcall(gpiolib_dev_init);
转载地址:http://vgqti.baihongyu.com/