/* * 读取设备寄存器val的值,保存在page缓冲区中 */ static ssize_t hello_proc_read(char* page, char** start, off_t off, int count, int* eof, void* data){ if(off > 0){ *eof = 1; return 0; } return __hello_get_val(hello_dev, page); }
/*读取设备属性val*/ static ssize_t hello_val_show(struct device* dev, struct device_attribute* attr, char* buf) { struct hello_android_dev* hdev = (struct hello_android_dev*)dev_get_drvdata(dev); return __hello_get_val(hdev, buf); }