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()
This commit is contained in:
Poul-Henning Kamp 2003-09-26 10:41:44 +00:00
parent 26b0e90ca2
commit 4866f95d76
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120465
6 changed files with 9 additions and 90 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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);