* Make sure Shutdown() can be called more than once (ie. reset the members as

needed).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36210 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-04-13 12:23:01 +00:00
parent 2e7bd0169f
commit f735ce7d79
@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2009, Haiku. * Copyright 2001-2010, Haiku.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -9,6 +9,7 @@
* Axel Dörfler, [email protected] * Axel Dörfler, [email protected]
*/ */
/*! Accelerant based HWInterface implementation */ /*! Accelerant based HWInterface implementation */
@@ -400,18 +401,24 @@ AccelerantHWInterface::_SetupDefaultHooks()
status_t status_t
AccelerantHWInterface::Shutdown() AccelerantHWInterface::Shutdown()
{ {
if (fAccelerantHook) { if (fAccelerantHook != NULL) {
uninit_accelerant UninitAccelerant uninit_accelerant uninitAccelerant
= (uninit_accelerant)fAccelerantHook(B_UNINIT_ACCELERANT, NULL); = (uninit_accelerant)fAccelerantHook(B_UNINIT_ACCELERANT, NULL);
if (UninitAccelerant) if (uninitAccelerant != NULL)
UninitAccelerant(); uninitAccelerant();
fAccelerantHook = NULL;
} }
if (fAccelerantImage >= 0) if (fAccelerantImage >= 0) {
unload_add_on(fAccelerantImage); unload_add_on(fAccelerantImage);
fAccelerantImage = -1;
}
if (fCardFD >= 0) if (fCardFD >= 0) {
close(fCardFD); close(fCardFD);
fCardFD = -1;
}
return B_OK; return B_OK;
} }