1
#include <linux/init.h>
2
#include <linux/module.h>
3
#include <linux/device.h>
4
#include <linux/types.h>
5
#include <linux/cdev.h>
7
#include <linux/slab.h>
13
#define sysfs_attr(name) do { \
14
if (device_create_file(dev->dev, &dev_attr_##name) != 0) \
15
goto probe_device_create_fail; \
19
int test_device_open(struct inode *inode, struct file *filp)
23
test = container_of( inode->i_cdev, test_dev_t, cdev);
24
filp->private_data = test;
32
int test_device_release(struct inode *inode, struct file *filp)
34
test_dev_t *test = (test_dev_t*)filp->private_data;
42
static struct file_operations test_fops = {
44
// .unlocked_ioctl = pcidriver_ioctl,
45
// .mmap = pcidriver_mmap,
46
.open = test_device_open,
47
.release = test_device_release,
50
const struct file_operations *test_get_fops(void)