/*
 * skeldev.c
 *
 * Basic device driver implementation. 
 *
 * COMPILE/LOAD/UNLOAD
 *
 * To compile the device:
 *
 *   $ gcc -D MODULE -D __KERNEL__ -c skeldev.c
 *
 * To load the device:
 *
 *   $ sudo /sbin/insmod skeldev.o
 *   $ sudo mknod /dev/skeldev c <MAJORNUMBER> 0
 *
 * To unload the device:
 *
 *   $ sudo /sbin/rmmod skeldev
 *
 * AUTHOR
 *
 * Emanuele Altieri
 * June 2002
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/version.h>
#include <asm/uaccess.h>

/* MODULE CONFIGURATION */

MODULE_AUTHOR("Emanuele Altieri");
MODULE_DESCRIPTION("Basic Device Driver");
MODULE_LICENSE("GPL");

/* Major number of the module, change it if it causes conflicts! (cannot be
 * greater than 255) */
#define MAJOR_NUMBER 201

int skel_handle;                      /* handle for the device     */
static char* skel_name = "skeldev"; 

static struct file_operations skel_fops = { /* NULL (default actions) */ };

/* Module Initialization */
static int __init skel_init(void)
{
	/* register the module */
	SET_MODULE_OWNER(&skel_fops);
	skel_handle = register_chrdev(
		 MAJOR_NUMBER,             /* major number               */
		 skel_name,                /* name of the kernel module  */
		 &skel_fops                /* file operations            */
		);
	if (skel_handle < 0)
		return(-EBUSY);
	return(0);
} /* skel_init() */

/* Module deconstructor */
static void __exit skel_exit(void)
{
	unregister_chrdev(MAJOR_NUMBER, skel_name);
} /* skel_exit() */

/* Specify init and exit functions */
module_init(skel_init);
module_exit(skel_exit);
