/alps/kmm

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/kmm

« back to all changes in this revision

Viewing changes to dev.c

  • Committer: Suren A. Chilingaryan
  • Date: 2015-12-02 18:03:58 UTC
  • Revision ID: csa@suren.me-20151202180358-3k401zf10ltlpj0m
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
6
#include <linux/fs.h>
 
7
#include <linux/slab.h>
 
8
 
 
9
 
 
10
#include "mod.h"
 
11
#include "dev.h"
 
12
#include "debug.h"
 
13
 
 
14
int kmm_device_open(struct inode *inode, struct file *filp)
 
15
{
 
16
    kmm_dev_t *dev;
 
17
 
 
18
    dev = container_of( inode->i_cdev, kmm_dev_t, cdev);
 
19
    filp->private_data = dev;
 
20
    
 
21
    mod_info("open\n");
 
22
 
 
23
    return 0;
 
24
}
 
25
 
 
26
int kmm_device_release(struct inode *inode, struct file *filp)
 
27
{
 
28
    mod_info("close\n");
 
29
 
 
30
    return 0;
 
31
}
 
32
 
 
33
 
 
34
static struct file_operations kmm_fops = {
 
35
    .owner = THIS_MODULE,
 
36
//      .unlocked_ioctl = pcidriver_ioctl,
 
37
//      .mmap = pcidriver_mmap,
 
38
    .open = kmm_device_open,
 
39
    .release = kmm_device_release,
 
40
};
 
41
 
 
42
const struct file_operations *kmm_get_fops(void)
 
43
{
 
44
    return &kmm_fops;
 
45
}
 
 
b'\\ No newline at end of file'