]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
ieee1394: video1394: reorder module init, prepare BKL removal
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 19 May 2008 20:07:28 +0000 (22:07 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 14 Jul 2008 11:06:02 +0000 (13:06 +0200)
This prepares video1394 for removal of the BKL (big kernel lock):
It allows video1394_open() to be called while video1394_init_module()
is still in progress.

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

index fa2bfec0fca2e00ec16114894422f6f5c41a4ccf..918ffc4fc8ace2923f660d452d6f389a488c8b25 100644 (file)
@@ -228,10 +228,8 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
 {
        unsigned long flags;
 
+       hpsb_init_highlevel(hl);
        INIT_LIST_HEAD(&hl->addr_list);
-       INIT_LIST_HEAD(&hl->host_info_list);
-
-       rwlock_init(&hl->host_info_lock);
 
        down_write(&hl_drivers_sem);
        list_add_tail(&hl->hl_list, &hl_drivers);
index eb9fe321e09a37507c6527df82c7abd352db0b2a..bc5d0854c17e940c9509009b098cbf9482f6a695 100644 (file)
@@ -2,7 +2,7 @@
 #define IEEE1394_HIGHLEVEL_H
 
 #include <linux/list.h>
-#include <linux/spinlock_types.h>
+#include <linux/spinlock.h>
 #include <linux/types.h>
 
 struct module;
@@ -103,6 +103,17 @@ int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
 void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
                           void *data, size_t length);
 
+/**
+ * hpsb_init_highlevel - initialize a struct hpsb_highlevel
+ *
+ * This is only necessary if hpsb_get_hostinfo_bykey can be called
+ * before hpsb_register_highlevel.
+ */
+static inline void hpsb_init_highlevel(struct hpsb_highlevel *hl)
+{
+       rwlock_init(&hl->host_info_lock);
+       INIT_LIST_HEAD(&hl->host_info_list);
+}
 void hpsb_register_highlevel(struct hpsb_highlevel *hl);
 void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
 
index e24772d336e1ae6c726d8e0a05ae5ea25a9207e0..069b9f6bf16dae8396d871673c8618eb544967a7 100644 (file)
@@ -1503,6 +1503,8 @@ static int __init video1394_init_module (void)
 {
        int ret;
 
+       hpsb_init_highlevel(&video1394_highlevel);
+
        cdev_init(&video1394_cdev, &video1394_fops);
        video1394_cdev.owner = THIS_MODULE;
        ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);