EmbLogic's Blog

registering character driver

head 1.15;
access;
symbols;
locks
root:1.15; strict;
comment @ * @;

1.15
date 2014.05.11.08.48.49; author root; state Exp;
branches;
next 1.14;

1.14
date 2014.05.10.07.23.56; author root; state Exp;
branches;
next 1.13;

1.13
date 2014.05.10.07.17.59; author root; state Exp;
branches;
next 1.12;

1.12
date 2014.05.09.10.22.15; author root; state Exp;
branches;
next 1.11;

1.11
date 2014.05.09.10.20.37; author root; state Exp;
branches;
next 1.10;

1.10
date 2014.05.09.07.45.13; author root; state Exp;
branches;
next 1.9;

1.9
date 2014.05.09.07.43.59; author root; state Exp;
branches;
next 1.8;

1.8
date 2014.05.09.07.39.00; author root; state Exp;
branches;
next 1.7;

1.7
date 2014.05.09.07.36.42; author root; state Exp;
branches;
next 1.6;

1.6
date 2014.05.09.07.35.17; author root; state Exp;
branches;
next 1.5;

1.5
date 2014.05.09.07.21.24; author root; state Exp;
branches;
next 1.4;

1.4
date 2014.05.08.11.42.32; author root; state Exp;
branches;
next 1.3;

1.3
date 2014.05.08.07.09.50; author root; state Exp;
branches;
next 1.2;

1.2
date 2014.05.06.11.48.01; author root; state Exp;
branches;
next 1.1;

1.1
date 2014.05.06.11.22.20; author root; state Exp;
branches;
next ;

desc
@initialization done.
@

1.15
log
@aloocated memory using kmalloc.
@
text
@#include”header.h”
#include”declration.c”
//#include”file_op.c”
unsigned int major_no,minor_no,nod;
dev_t dev;
struct sculldev *scull_dev;
module_param(nod,uint,S_IRUGO);
static int __init init_func(void)
{ int ret;
major_no= MAJORNO;
minor_no= MINORNO;
//nod= NOD;
//struct file_operations fops;
printk(KERN_INFO “we are in kernel”);
ret = alloc_chrdev_region(&dev,minor_no,nod,”poonam”);
if(ret<0)
{
printk(KERN_ERR"failed\n");
}
major_no=MAJOR(dev);
minor_no=MINOR(dev);
printk(KERN_INFO"sucessful registration major no =%d\n",major_no);
printk(KERN_INFO"sucessful registration minor no =%d\n",minor_no);
printk(KERN_INFO"nod is =%d\n",nod);
scull_dev = kmalloc((sizeof( struct sculldev)*nod), GFP_KERNEL);
if(!scull_dev)
{
printk(KERN_ERR"kmalloc failure\n");
return -1;
}

printk(KERN_INFO"kmalloc successfull\n");

return 0;
}

module_init(init_func);
@

1.14
log
@*** empty log message ***
@
text
@d6 1
d15 1
a15 1
ret = alloc_chrdev_region(&dev,minor_no,nod,"arjun");
d25 9
@

1.13
log
@add module_param macro
before initilaization function defination
@
text
@d6 1
a6 1
module_param(nod,unsigned int,S_IRUGO);
@

1.12
log
@*** empty log message ***
@
text
@d6 1
d11 1
a11 1
nod= NOD;
d23 1
@

1.11
log
@*** empty log message ***
@
text
@d11 1
a11 1
struct file_operations fops;
d18 2
a19 2
major_no=MAJORNO(dev);
minor_no=MINORNO(dev);
@

1.10
log
@*** empty log message ***
@
text
@d6 3
a8 3
static int init_func(void)
int ret;
{ major_no= MAJORNO;
@

1.9
log
@*** empty log message ***
@
text
@d18 1
a18 1
majro_no=MAJORNO(dev);
@

1.8
log
@*** empty log message ***
@
text
@d7 1
a10 1
int ret;
@

1.7
log
@*** empty log message ***
@
text
@d7 2
a8 2
{ major_no= MAJOR_NO;
minor_no= MINOR_NO;
d18 2
a19 2
majro_no=MAJOR_NO(dev);
minor_no=MINOR_NO(dev);
@

1.6
log
@*** empty log message ***
@
text
@d9 1
a9 1
NOD=nod;
@

1.5
log
@using alloc function
@
text
@d5 1
@

1.4
log
@used file operation variable.
@
text
@d2 1
d4 1
d6 3
a8 1
{
d12 1
a12 1
ret = register_chrdev(0,"mychardevice",&fops);
d17 5
a21 1
printk(KERN_INFO"sucessful registration %d\n",ret);
@

1.3
log
@included file operations in init function.
@
text
@d2 1
a2 1
#include"file_op.c"
d6 1
@

1.2
log
@register my char device.
@
text
@d7 6
a12 1
ret = register(0,"mychardevice",&fops);
@

1.1
log
@Initial revision
@
text
@d2 1
d4 2
a5 1
{
d7 1
@

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>