summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/wcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/isa/wcd.c')
-rw-r--r--sys/i386/isa/wcd.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/sys/i386/isa/wcd.c b/sys/i386/isa/wcd.c
index 527d14a..bb7d4db 100644
--- a/sys/i386/isa/wcd.c
+++ b/sys/i386/isa/wcd.c
@@ -34,9 +34,11 @@
#ifdef JREMOD
#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#define CDEV_MAJOR 69
#define BDEV_MAJOR 19
-static void wcd_devsw_install();
#endif /*JREMOD */
extern int wcdattach(struct atapi*, int, struct atapi_params*, int, struct kern_devconf*);
@@ -322,9 +324,6 @@ wcdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug,
strncpy (t->description + strlen(t->description),
ap->model, sizeof(ap->model));
dev_attach (&t->cf);
-#ifdef JREMOD
- wcd_devsw_install();
-#endif /*JREMOD*/
return (1);
}
@@ -1182,19 +1181,35 @@ struct cdevsw wcd_cdevsw =
static wcd_devsw_installed = 0;
-static void wcd_devsw_install()
+static void wcd_drvinit(void *unused)
{
- dev_t descript;
+ dev_t dev;
+ dev_t dev_chr;
+
if( ! wcd_devsw_installed ) {
- descript = makedev(CDEV_MAJOR,0);
- cdevsw_add(&descript,&wcd_cdevsw,NULL);
-#if defined(BDEV_MAJOR)
- descript = makedev(BDEV_MAJOR,0);
- bdevsw_add(&descript,&wcd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&dev,&wcd_cdevsw,NULL);
+ dev_chr = dev;
+ dev = makedev(BDEV_MAJOR,0);
+ bdevsw_add(&dev,&wcd_bdevsw,NULL);
wcd_devsw_installed = 1;
- }
+#ifdef DEVFS
+ {
+ int x;
+/* default for a simple device with no probe routine (usually delete this) */
+ x=devfs_add_devsw(
+/* path name devsw minor type uid gid perm*/
+ "/", "rwcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
+ x=devfs_add_devsw(
+/* path name devsw minor type uid gid perm*/
+ "/", "wcd", major(dev), 0, DV_BLK, 0, 0, 0600);
+ }
+ }
+#endif
}
+
+SYSINIT(wcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wcd_drvinit,NULL)
+
#endif /* JREMOD */
#endif /* NWCD && NWDC && ATAPI */
OpenPOWER on IntegriCloud