#register using the alloc_chrdev_region and unregister using the unregister_chrdev_region and then define the struct Sculldev and allocate the memory for it and then pointing the address of kmalloc with this struct type pointer.. RCS file: cleanup.c,v Working file: cleanup.c head: 1.6 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 6; selected revisions: 6 description: use the module_exit(exitfn) and define the declaration of exitfn ---------------------------- revision 1.6 date: 2014/05/06 03:28:56; author: root; state: Exp; lines: +1 -0 kfree the memory allocated during kmalloc. ---------------------------- revision 1.5 date: 2014/05/06 02:35:09; author: root; state: Exp; lines: +2 -1 include the declaration.h in this. ---------------------------- revision 1.4 date: 2014/05/06 02:32:49; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.3 date: 2014/05/06 02:30:41; author: root; state: Exp; lines: +1 -1 the function name we use as __ ---------------------------- revision 1.2 date: 2014/05/06 02:06:30; author: root; state: Exp; lines: +3 -1 call unregister_chrdev_region for the unregistration. ---------------------------- revision 1.1 date: 2014/05/06 01:00:24; author: root; state: Exp; Initial revision ============================================================================= RCS file: declaration.h,v Working file: declaration.h head: 1.3 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: declare the extern variable as dev, nod, minorno and majorno. ---------------------------- revision 1.3 date: 2014/05/06 06:25:08; author: root; state: Exp; lines: +2 -2 *** empty log message *** ---------------------------- revision 1.2 date: 2014/05/06 03:29:21; author: root; state: Exp; lines: +6 -0 declare a structure SkullDev with a structure cdev define in cdev,h ---------------------------- revision 1.1 date: 2014/05/06 02:07:46; author: root; state: Exp; Initial revision ============================================================================= RCS file: header.h,v Working file: header.h head: 1.9 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 9; selected revisions: 9 description: including the linux/modules. includding the linux/init. define GPL. ---------------------------- revision 1.9 date: 2014/05/06 06:36:59; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.8 date: 2014/05/06 06:33:38; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.7 date: 2014/05/06 06:31:04; author: root; state: Exp; lines: +2 -0 include slab.h for the kmalloc and kdev_t for the Macros MINOR and MAJOR. ---------------------------- revision 1.6 date: 2014/05/06 06:26:43; author: root; state: Exp; lines: +1 -0 include cdev.h header file for struct cdev ---------------------------- revision 1.5 date: 2014/05/06 06:24:27; author: root; state: Exp; lines: +4 -0 declare the struct SkullDev in header instead of in declaration.h. ---------------------------- revision 1.4 date: 2014/05/06 02:12:04; author: root; state: Exp; lines: +4 -4 redfine the macro in header file again. ---------------------------- revision 1.3 date: 2014/05/06 02:03:21; author: root; state: Exp; lines: +17 -0 include the linux/fs.h difine the macros DEVNAME N ---------------------------- revision 1.2 date: 2014/05/06 01:04:44; author: root; state: Exp; lines: +1 -1 correct the license GPL ---------------------------- revision 1.1 date: 2014/05/06 00:58:23; author: root; state: Exp; Initial revision ============================================================================= RCS file: init.c,v Working file: init.c head: 1.12 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 12; selected revisions: 12 description: use the module_init(initfn) and define the declaration of initfn ---------------------------- revision 1.12 date: 2014/05/06 06:44:23; author: root; state: Exp; lines: +2 -1 initilize the struct ScullDev above the function name ---------------------------- revision 1.11 date: 2014/05/06 06:24:59; author: root; state: Exp; lines: +5 -5 *** empty log message *** ---------------------------- revision 1.10 date: 2014/05/06 03:34:40; author: root; state: Exp; lines: +5 -5 *** empty log message *** ---------------------------- revision 1.9 date: 2014/05/06 03:31:46; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.8 date: 2014/05/06 03:26:36; author: root; state: Exp; lines: +9 -0 call kmalloc and allocate the space uptp the structure SkullDev. SkullDev is used to map the memory of the Device Driver. defint the *skulldev which is extern and define in the struct SkullDev ---------------------------- revision 1.7 date: 2014/05/06 02:55:59; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.6 date: 2014/05/06 02:31:58; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.5 date: 2014/05/06 02:30:20; author: root; state: Exp; lines: +2 -2 the fuction name we use __ ---------------------------- revision 1.4 date: 2014/05/06 02:24:27; author: root; state: Exp; lines: +2 -2 *** empty log message *** ---------------------------- revision 1.3 date: 2014/05/06 02:17:40; author: root; state: Exp; lines: +5 -2 initialize the extern variable to MACRO within the function itself ---------------------------- revision 1.2 date: 2014/05/06 02:05:12; author: root; state: Exp; lines: +21 -1 call alloc chr_dev region to register the DD into kernel and then call MAJOR and MINOR to display ita majorno and mno. ---------------------------- revision 1.1 date: 2014/05/06 00:59:15; author: root; state: Exp; Initial revision =============================================================================