复制 ret = driver_create_file(&(hello_driver.driver), &driver_attr_peng); if (ret < 0){ dev_err(&pdev->dev, "could not create sysfs files/n"); ret = -ENOENT; } 这几个名字之间关系如下:
struct resource *res; static int hello_probe(struct platform_device *pdev) { int ret; printk("match ok /n");
ret = driver_create_file(&(hello_driver.driver), &driver_attr_peng); if (ret < 0){ dev_err(&pdev->dev, "could not create sysfs files/n"); ret = -ENOENT; }