~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to net/bluetooth/af_bluetooth.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        "slock-AF_BLUETOOTH-BTPROTO_AVDTP",
72
72
};
73
73
 
74
 
static inline void bt_sock_reclassify_lock(struct socket *sock, int proto)
 
74
void bt_sock_reclassify_lock(struct sock *sk, int proto)
75
75
{
76
 
        struct sock *sk = sock->sk;
77
 
 
78
 
        if (!sk)
79
 
                return;
80
 
 
 
76
        BUG_ON(!sk);
81
77
        BUG_ON(sock_owned_by_user(sk));
82
78
 
83
79
        sock_lock_init_class_and_name(sk,
84
80
                        bt_slock_key_strings[proto], &bt_slock_key[proto],
85
81
                                bt_key_strings[proto], &bt_lock_key[proto]);
86
82
}
 
83
EXPORT_SYMBOL(bt_sock_reclassify_lock);
87
84
 
88
85
int bt_sock_register(int proto, const struct net_proto_family *ops)
89
86
{
145
142
 
146
143
        if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
147
144
                err = bt_proto[proto]->create(net, sock, proto, kern);
148
 
                bt_sock_reclassify_lock(sock, proto);
 
145
                if (!err)
 
146
                        bt_sock_reclassify_lock(sock->sk, proto);
149
147
                module_put(bt_proto[proto]->owner);
150
148
        }
151
149
 
156
154
 
157
155
void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
158
156
{
159
 
        write_lock_bh(&l->lock);
 
157
        write_lock(&l->lock);
160
158
        sk_add_node(sk, &l->head);
161
 
        write_unlock_bh(&l->lock);
 
159
        write_unlock(&l->lock);
162
160
}
163
161
EXPORT_SYMBOL(bt_sock_link);
164
162
 
165
163
void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
166
164
{
167
 
        write_lock_bh(&l->lock);
 
165
        write_lock(&l->lock);
168
166
        sk_del_node_init(sk);
169
 
        write_unlock_bh(&l->lock);
 
167
        write_unlock(&l->lock);
170
168
}
171
169
EXPORT_SYMBOL(bt_sock_unlink);
172
170
 
199
197
 
200
198
        BT_DBG("parent %p", parent);
201
199
 
202
 
        local_bh_disable();
203
200
        list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
204
201
                sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
205
202
 
206
 
                bh_lock_sock(sk);
 
203
                lock_sock(sk);
207
204
 
208
205
                /* FIXME: Is this check still needed */
209
206
                if (sk->sk_state == BT_CLOSED) {
210
 
                        bh_unlock_sock(sk);
 
207
                        release_sock(sk);
211
208
                        bt_accept_unlink(sk);
212
209
                        continue;
213
210
                }
214
211
 
215
212
                if (sk->sk_state == BT_CONNECTED || !newsock ||
216
 
                                                bt_sk(parent)->defer_setup) {
 
213
                    test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) {
217
214
                        bt_accept_unlink(sk);
218
215
                        if (newsock)
219
216
                                sock_graft(sk, newsock);
220
217
 
221
 
                        bh_unlock_sock(sk);
222
 
                        local_bh_enable();
 
218
                        release_sock(sk);
223
219
                        return sk;
224
220
                }
225
221
 
226
 
                bh_unlock_sock(sk);
 
222
                release_sock(sk);
227
223
        }
228
 
        local_bh_enable();
229
224
 
230
225
        return NULL;
231
226
}
415
410
        list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
416
411
                sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
417
412
                if (sk->sk_state == BT_CONNECTED ||
418
 
                                        (bt_sk(parent)->defer_setup &&
419
 
                                                sk->sk_state == BT_CONNECT2))
 
413
                    (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags) &&
 
414
                     sk->sk_state == BT_CONNECT2))
420
415
                        return POLLIN | POLLRDNORM;
421
416
        }
422
417
 
455
450
                        sk->sk_state == BT_CONFIG)
456
451
                return mask;
457
452
 
458
 
        if (sock_writeable(sk))
 
453
        if (!test_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags) && sock_writeable(sk))
459
454
                mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
460
455
        else
461
456
                set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);