Re: Probable module bug in linux-2.6.5-1.358

From: Stephen Hemminger
Date: Thu Oct 07 2004 - 20:27:11 EST


I can't reproduce your problem with a simple dummy character device.

-------------
/*
* Minimum driver to test character device stuff.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/device.h>

#define MYMAJOR 204

static int dummy_open(struct inode *inode, struct file *file)
{
pr_info("dummy_open (%d)\n", iminor(inode));
return 0;
}

static int dummy_release(struct inode *inode, struct file *file)
{
pr_info("dummy_release (%d)\n", iminor(inode));
return 0;
}

static struct file_operations dummy_ops = {
.owner = THIS_MODULE,
.open = dummy_open,
.release = dummy_release,
};

static int __init dummy_init(void)
{
pr_info("dummy module init\n");
return register_chrdev(MYMAJOR, "dummy", &dummy_ops);
}

static void __exit dummy_exit(void)
{
pr_info("dummy module unloaded\n");
unregister_chrdev(MYMAJOR, "dummy");
}

module_init(dummy_init);
module_exit(dummy_exit);

MODULE_LICENSE("GPL");


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/