/alps/bar_resolve

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/bar_resolve
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/types.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/slab.h>

#include "mod.h"
#include "dev.h"
#include "debug.h"

#define sysfs_attr(name) do { \
	if (device_create_file(dev->dev, &dev_attr_##name) != 0) \
				goto probe_device_create_fail; \
    } while (0)


int test_device_open(struct inode *inode, struct file *filp)
{
    test_dev_t *test;

    test = container_of( inode->i_cdev, test_dev_t, cdev);
    filp->private_data = test;
    
    mod_info("open\n");

    
    return 0;
}

int test_device_release(struct inode *inode, struct file *filp)
{
    test_dev_t *test = (test_dev_t*)filp->private_data;

    mod_info("close\n");

    return 0;
}


static struct file_operations test_fops = {
    .owner = THIS_MODULE,
//	.unlocked_ioctl = pcidriver_ioctl,
//	.mmap = pcidriver_mmap,
    .open = test_device_open,
    .release = test_device_release,
};

const struct file_operations *test_get_fops(void)
{
    return &test_fops;
}