]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ieee1394: lock smaller region by host_num_alloc mutex
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Tue, 10 Oct 2006 19:11:43 +0000 (21:11 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 7 Dec 2006 20:29:21 +0000 (21:29 +0100)
We need the mutex only around the iteration over existing hosts.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/ieee1394/hosts.c

index b935e08695a995c3701c7ca06670c549797414ef..25573bad81e06aa20ce5796964d50af8b933bf0c 100644 (file)
@@ -157,10 +157,9 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
        h->speed_map = (u8 *)(h->csr.speed_map + 2);
 
        mutex_lock(&host_num_alloc);
-
        while (nodemgr_for_each_host(&hostnum, alloc_hostnum_cb))
                hostnum++;
-
+       mutex_unlock(&host_num_alloc);
        h->id = hostnum;
 
        memcpy(&h->device, &nodemgr_dev_template_host, sizeof(h->device));
@@ -175,8 +174,6 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
        class_device_register(&h->class_dev);
        get_device(&h->device);
 
-       mutex_unlock(&host_num_alloc);
-
        return h;
 }