This patch is part of the lw_rwlock patchset, it removes the
bt_proto_rwlock lock from af_bluetooth.c and uses the newly available
linux/lw_rwlock.h
Signed-off-by: Frederik Deweerdt <[email protected]>
--- v2.6.18-rc2-mm1~ori/net/bluetooth/af_bluetooth.c 2006-07-27 11:46:12.000000000 +0200
+++ v2.6.18-rc2-mm1/net/bluetooth/af_bluetooth.c 2006-07-28 16:22:50.000000000 +0200
@@ -27,6 +27,7 @@
#include <linux/module.h>
#include <linux/spinlock.h>
+#include <linux/lw_rwlock.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/errno.h>
@@ -54,7 +55,7 @@
/* Bluetooth sockets */
#define BT_MAX_PROTO 8
static struct net_proto_family *bt_proto[BT_MAX_PROTO];
-static DEFINE_RWLOCK(bt_proto_rwlock);
+static DEFINE_LW_RWLOCK(bt_proto_rwlock);
int bt_sock_register(int proto, struct net_proto_family *ops)
{
@@ -65,12 +66,12 @@ int bt_sock_register(int proto, struct n
err = -EEXIST;
- write_lock(&bt_proto_rwlock);
+ lw_write_lock(&bt_proto_rwlock);
if (bt_proto[proto] == NULL) {
err = 0;
bt_proto[proto] = ops;
}
- write_unlock(&bt_proto_rwlock);
+ lw_write_unlock(&bt_proto_rwlock);
return err;
}
@@ -84,12 +85,12 @@ int bt_sock_unregister(int proto)
return -EINVAL;
err = -ENOENT;
- write_lock(&bt_proto_rwlock);
+ lw_write_lock(&bt_proto_rwlock);
if (bt_proto[proto]) {
err = 0;
bt_proto[proto] = NULL;
}
- write_unlock(&bt_proto_rwlock);
+ lw_write_unlock(&bt_proto_rwlock);
return err;
}
@@ -108,12 +109,12 @@ static int bt_sock_create(struct socket
}
#endif
err = -EPROTONOSUPPORT;
- read_lock(&bt_proto_rwlock);
+ lw_read_lock(&bt_proto_rwlock);
if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
err = bt_proto[proto]->create(sock, proto);
module_put(bt_proto[proto]->owner);
}
- read_unlock(&bt_proto_rwlock);
+ lw_read_unlock(&bt_proto_rwlock);
return err;
}
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]