Results 1 to 1 of 1
Hi there. I need to create a kernel-module. in there i need to make a new device via class_create and device_create. it won't work and i can't see any error...plz ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-10-2009 #1Just Joined!
- Join Date
- Jul 2009
- Posts
- 2
class_create won't work
Hi there. I need to create a kernel-module. in there i need to make a new device via class_create and device_create. it won't work and i can't see any error...plz help...here is my sourcecode:
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#define bsMAJOR 240
MODULE_DESCRIPTION("");
MODULE_AUTHOR("");
MODULE_LICENSE("GPL");
static char *name;
module_param(name, charp, 0644);
struct mydevice {
struct device *parent;
struct device *this_device;
dev_t dev;
int pid;
int pgdir;
char name[20];
};
struct class *bs_class;
struct mydevice zdev;
static int bs_init_module(void)
{
printk( "<0> Module BS init\n" );
zdev.dev = MKDEV(bsMAJOR, 10);
bs_class = class_create (THIS_MODULE, "bs_class");
zdev.this_device = device_create(bs_class,NULL,zdev.dev,NULL,"Bla");
return 0;
}
static void bs_exit_module(void)
{
printk( "<0> Module BS exit\n" );
}
module_init(bs_init_module);
module_exit(bs_exit_module);


Reply With Quote
