From: David Schleef Date: Thu, 2 May 2002 19:00:54 +0000 (+0000) Subject: Added devfs support X-Git-Tag: r0_7_65~70 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2d7bf0d84b8a4c09a0a9548087264e772758585a;p=comedi.git Added devfs support --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 50e1e968..2e23fe79 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -1730,7 +1731,7 @@ static int __init comedi_init(void) int i; printk("comedi: version " COMEDI_RELEASE " - David Schleef \n"); - if(register_chrdev(COMEDI_MAJOR,"comedi",&comedi_fops)){ + if(devfs_register_chrdev(COMEDI_MAJOR,"comedi",&comedi_fops)){ printk("comedi: unable to get major %d\n",COMEDI_MAJOR); return -EIO; } @@ -1745,6 +1746,13 @@ static int __init comedi_init(void) /* XXX requires /proc interface */ comedi_proc_init(); + + for(i=0;i<4;i++){ + char name[20]; + sprintf(name, "comedi%d", i); + devfs_register(NULL, name, DEVFS_FL_DEFAULT, + COMEDI_MAJOR, i, 0660 | S_IFCHR, &comedi_fops, NULL); + } comedi_rt_init(); @@ -1758,7 +1766,14 @@ static void __exit comedi_cleanup(void) if(MOD_IN_USE) printk("comedi: module in use -- remove delayed\n"); - unregister_chrdev(COMEDI_MAJOR,"comedi"); + for(i=0;i<4;i++){ + char name[20]; + sprintf(name, "comedi%d", i); + devfs_unregister(devfs_find_handle(NULL, name, + COMEDI_MAJOR, i, DEVFS_SPECIAL_CHR, 0)); + } + + devfs_unregister_chrdev(COMEDI_MAJOR,"comedi"); comedi_proc_cleanup();