* Fixed removing from device list with only one device info present

* Removed now unnecessary devfs calls again
* Add an explanation in device_removed()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23442 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-01-12 16:13:01 +00:00
parent 1d99d469a0
commit 215772237b
2 changed files with 7 additions and 9 deletions

View File

@ -48,9 +48,11 @@ remove_device_info(hid_device_info *device)
acquire_sem(gDeviceListLock);
if (sDeviceList == device)
if (sDeviceList == device) {
sDeviceList = device->next;
else {
--sDeviceCount;
gDeviceListChanged = true;
} else {
hid_device_info *previous;
for (previous = sDeviceList; previous != NULL; previous = previous->next) {
if (previous->next == device) {

View File

@ -21,10 +21,6 @@
#include <string.h>
#include <unistd.h>
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
#include <fs/devfs.h>
#endif
#define MAX_BUTTONS 16
static status_t hid_device_added(const usb_device *dev, void **cookie);
@ -876,13 +872,13 @@ hid_device_removed(void *cookie)
free(device->insns);
delete_device(device);
} else {
// If the input_server has opened us this will always be the case.
// We unpublish our node in the devfs which will notify the mouse
// add-on to unregister and release us.
DPRINTF_INFO((MY_ID "%s still open\n", device->name));
device->active = false;
}
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
devfs_unpublish_device(device->name, true);
#endif
return B_OK;
}