[FreeBSD] We need to call drm_detach before we free dev->driver.

The driver is in control of the show, so when you try and unload a module
the driver detach routine is called first.  It is what drives the whole
unload process and so lots of panics occur if dev->driver is already
free.
main
Robert Noland 2008-09-08 16:40:52 -04:00
parent 2880c86eb2
commit 828ae3f6b8
9 changed files with 36 additions and 9 deletions

View File

@ -122,10 +122,13 @@ static int
i915_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t i915_methods[] = {

View File

@ -96,10 +96,13 @@ static int
mach64_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t mach64_methods[] = {

View File

@ -142,10 +142,13 @@ static int
mga_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t mga_methods[] = {

View File

@ -95,10 +95,13 @@ static int
r128_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t r128_methods[] = {

View File

@ -100,10 +100,13 @@ static int
radeon_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t radeon_methods[] = {

View File

@ -86,10 +86,13 @@ static int
savage_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t savage_methods[] = {

View File

@ -80,10 +80,13 @@ static int
sis_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t sis_methods[] = {

View File

@ -82,10 +82,13 @@ static int
tdfx_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t tdfx_methods[] = {

View File

@ -93,10 +93,13 @@ static int
via_detach(device_t nbdev)
{
struct drm_device *dev = device_get_softc(nbdev);
int ret;
ret = drm_detach(nbdev);
free(dev->driver, M_DRM);
return drm_detach(nbdev);
return ret;
}
static device_method_t via_methods[] = {