summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-11-13 03:30:44 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-17 23:50:20 +0200
commit3eb264d3deaa39b38ecf69baebe40f0a66103449 (patch)
tree6e27dd06d56ae017e3aa23c5c12dbb163ed1bfb2
parente024bf03b682185454bc175b21409116a148b924 (diff)
2002-11-12 Roland McGrath <roland@frob.com>
* oskit/ds_routines.c (dev_open_com): Revert last change. The hash table should not hold a reference.
-rw-r--r--oskit/ds_routines.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/oskit/ds_routines.c b/oskit/ds_routines.c
index 9e944776..f231c581 100644
--- a/oskit/ds_routines.c
+++ b/oskit/ds_routines.c
@@ -396,13 +396,11 @@ dev_open_com (oskit_device_t *com_device, dev_mode_t mode, device_t *devp,
dev->mode = mode;
dev->ops = 0;
- /* The newly allocated device has one reference on it. The slot hash
- table will hold one reference, and we will consume another below. */
- assert (dev->ref_count == 1);
- dev->ref_count == 2;
-
- /* Put the device in the hash table under its COM device.
- After this point we need to use device_lock. */
+ /* Put the device in the hash table under its COM device. We hold the
+ only reference to the device, and releasing that reference will remove
+ it from the hash table. While it's live, someone else might come
+ along and find it in the hash table and get their own reference to
+ keep it there. After this point we need to use device_lock. */
simple_lock (&dev_hash_lock);
dev_hash_enter (dev);
simple_unlock (&dev_hash_lock);