From: Frank Mori Hess Date: Wed, 29 Dec 2004 01:14:44 +0000 (+0000) Subject: add support for udev X-Git-Tag: r0_7_70~77 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0de728b958a97a4ad648cd5c83df9474713c66c0;p=comedi.git add support for udev --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 92d0a825..8531aae2 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1761,6 +1762,8 @@ static struct file_operations comedi_fops={ }; #endif +static struct class_simple *comedi_class; + static int __init comedi_init(void) { int i; @@ -1770,9 +1773,20 @@ static int __init comedi_init(void) printk("comedi: unable to get major %d\n",COMEDI_MAJOR); return -EIO; } + comedi_class = class_simple_create(THIS_MODULE, "comedi"); + if(IS_ERR(comedi_class)) + { + printk("comedi: failed to create class"); + devfs_unregister_chrdev(COMEDI_MAJOR,"comedi"); + return PTR_ERR(comedi_class); + } comedi_devices=(comedi_device *)kmalloc(sizeof(comedi_device)*COMEDI_NDEVICES,GFP_KERNEL); if(!comedi_devices) + { + class_simple_destroy(comedi_class); + devfs_unregister_chrdev(COMEDI_MAJOR,"comedi"); return -ENOMEM; + } memset(comedi_devices,0,sizeof(comedi_device)*COMEDI_NDEVICES); for(i=0;i