diff options
author | phk <phk@FreeBSD.org> | 2003-09-26 10:41:44 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-09-26 10:41:44 +0000 |
commit | 30f60296f2c4a04dd8a71dee1209c14403ee5503 (patch) | |
tree | 8795ecabad50a2e053eed8460ee25684d138a2af /sys | |
parent | 6e7e1fbcfa621fca4d4d70560a1b2850c1f2c800 (diff) | |
download | FreeBSD-src-30f60296f2c4a04dd8a71dee1209c14403ee5503.zip FreeBSD-src-30f60296f2c4a04dd8a71dee1209c14403ee5503.tar.gz |
Change fb_attach() and fb_detach() to take a integer unit number rather
than a dev_t.
All of the dev_t's passed were bogusly created with makedev()
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/fb/fb.c | 84 | ||||
-rw-r--r-- | sys/dev/fb/fbreg.h | 4 | ||||
-rw-r--r-- | sys/dev/gfb/gfb_pci.c | 5 | ||||
-rw-r--r-- | sys/isa/vga_isa.c | 2 | ||||
-rw-r--r-- | sys/pc98/cbus/gdc.c | 2 | ||||
-rw-r--r-- | sys/pc98/pc98/pc98gdc.c | 2 |
6 files changed, 9 insertions, 90 deletions
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index d25de42..c47bd12 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -399,7 +399,7 @@ static moduledata_t fb_mod = { DECLARE_MODULE(fb, fb_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); int -fb_attach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) +fb_attach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw) { int s; @@ -409,7 +409,7 @@ fb_attach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) return EINVAL; s = spltty(); - adp->va_minor = minor(dev); + adp->va_minor = unit; vidcdevsw[adp->va_index] = cdevsw; splx(s); @@ -418,7 +418,7 @@ fb_attach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) } int -fb_detach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) +fb_detach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw) { int s; @@ -435,84 +435,6 @@ fb_detach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) return 0; } -#if experimental -static int -fbopen(dev_t dev, int flag, int mode, struct thread *td) -{ - int unit; - - unit = FB_UNIT(dev); - if (unit >= adapters) - return ENXIO; - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_open)(makedev(0, adapter[unit]->va_minor), - flag, mode, td); -} - -static int -fbclose(dev_t dev, int flag, int mode, struct thread *td) -{ - int unit; - - unit = FB_UNIT(dev); - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_close)(makedev(0, adapter[unit]->va_minor), - flag, mode, td); -} - -static int -fbread(dev_t dev, struct uio *uio, int flag) -{ - int unit; - - unit = FB_UNIT(dev); - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_read)(makedev(0, adapter[unit]->va_minor), - uio, flag); -} - -static int -fbwrite(dev_t dev, struct uio *uio, int flag) -{ - int unit; - - unit = FB_UNIT(dev); - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_write)(makedev(0, adapter[unit]->va_minor), - uio, flag); -} - -static int -fbioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) -{ - int unit; - - unit = FB_UNIT(dev); - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_ioctl)(makedev(0, adapter[unit]->va_minor), - cmd, arg, flag, td); -} - -static int -fbmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) -{ - int unit; - - unit = FB_UNIT(dev); - if (vidcdevsw[unit] == NULL) - return ENXIO; - return (*vidcdevsw[unit]->d_mmap)(makedev(0, adapter[unit]->va_minor), - offset, paddr, nprot); -} - -DEV_DRIVER_MODULE(fb, foo, fb_driver, fb_devclass, fb_cdevsw, 0, 0); -#endif - /* * Generic frame buffer cdev driver functions * Frame buffer subdrivers may call these functions to implement common diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index cf9116f..e7c91b6 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -222,9 +222,9 @@ int vid_configure(int flags); #ifdef FB_INSTALL_CDEV /* virtual frame buffer driver functions */ -int fb_attach(dev_t dev, video_adapter_t *adp, +int fb_attach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw); -int fb_detach(dev_t dev, video_adapter_t *adp, +int fb_detach(int unit, video_adapter_t *adp, struct cdevsw *cdevsw); /* generic frame buffer cdev driver functions */ diff --git a/sys/dev/gfb/gfb_pci.c b/sys/dev/gfb/gfb_pci.c index fca19de..4527f0b 100644 --- a/sys/dev/gfb/gfb_pci.c +++ b/sys/dev/gfb/gfb_pci.c @@ -210,7 +210,7 @@ pcigfb_attach(device_t dev) sc->adp->va_info.vi_depth, sc->gfbc->ramdac_name); #ifdef FB_INSTALL_CDEV /* attach a virtual frame buffer device */ - error = fb_attach(makedev(0, unit), sc->adp, sc->cdevsw); + error = fb_attach(unit, sc->adp, sc->cdevsw); if(error) goto fail; if(bootverbose) @@ -249,9 +249,6 @@ pcigfb_detach(device_t dev) int rid; sc = device_get_softc(dev); -#ifdef FB_INSTALL_CDEV - destroy_dev(sc->devt); -#endif /*FB_INSTALL_CDEV*/ bus_teardown_intr(dev, sc->irq, sc->intrhand); rid = 0x0; bus_release_resource(dev, SYS_RES_IRQ, rid, sc->irq); diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index 455d600..c820be2 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -141,7 +141,7 @@ isavga_attach(device_t dev) #ifdef FB_INSTALL_CDEV /* attach a virtual frame buffer device */ - error = fb_attach(makedev(0, VGA_MKMINOR(unit)), sc->adp, &isavga_cdevsw); + error = fb_attach(VGA_MKMINOR(unit), sc->adp, &isavga_cdevsw); if (error) return error; #endif /* FB_INSTALL_CDEV */ diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 9ef5549..6a06c40 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -165,7 +165,7 @@ gdc_attach(device_t dev) #ifdef FB_INSTALL_CDEV /* attach a virtual frame buffer device */ - error = fb_attach(makedev(0, GDC_MKMINOR(device_get_unit(dev))), + error = fb_attach(GDC_MKMINOR(device_get_unit(dev), sc->adp, &gdc_cdevsw); if (error) { gdc_release_resource(dev); diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 9ef5549..6a06c40 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -165,7 +165,7 @@ gdc_attach(device_t dev) #ifdef FB_INSTALL_CDEV /* attach a virtual frame buffer device */ - error = fb_attach(makedev(0, GDC_MKMINOR(device_get_unit(dev))), + error = fb_attach(GDC_MKMINOR(device_get_unit(dev), sc->adp, &gdc_cdevsw); if (error) { gdc_release_resource(dev); |