Commit 999fdfc4 authored by Chas Williams's avatar Chas Williams Committed by Hideaki Yoshifuji

[ATM]: Use sk_state_change() and eliminate vcc->callback().

parent 6d012ae2
......@@ -297,7 +297,6 @@ struct atm_vcc {
short itf; /* interface number */
struct sockaddr_atmsvc local;
struct sockaddr_atmsvc remote;
void (*callback)(struct atm_vcc *vcc);
int reply; /* also used by ATMTCP */
/* Multipoint part ------------------------------------------------- */
struct atm_vcc *session; /* session VCC descriptor */
......
......@@ -235,6 +235,14 @@ static void vcc_sock_destruct(struct sock *sk)
kfree(sk->sk_protinfo);
}
static void vcc_def_wakeup(struct sock *sk)
{
read_lock(&sk->sk_callback_lock);
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
wake_up(sk->sk_sleep);
read_unlock(&sk->sk_callback_lock);
}
int vcc_create(struct socket *sock, int protocol, int family)
{
......@@ -248,6 +256,7 @@ int vcc_create(struct socket *sock, int protocol, int family)
if (!sk)
return -ENOMEM;
sock_init_data(NULL, sk);
sk->sk_state_change = vcc_def_wakeup;
vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL);
if (!vcc) {
......@@ -258,7 +267,6 @@ int vcc_create(struct socket *sock, int protocol, int family)
memset(vcc, 0, sizeof(*vcc));
vcc->sk = sk;
vcc->dev = NULL;
vcc->callback = NULL;
memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */
......
......@@ -137,11 +137,8 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
}
vcc->sk->sk_ack_backlog++;
skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
if (vcc->callback) {
DPRINTK("waking vcc->sleep 0x%p\n",
&vcc->sleep);
vcc->callback(vcc);
}
DPRINTK("waking vcc->sleep 0x%p\n", &vcc->sleep);
vcc->sk->sk_state_change(vcc->sk);
as_indicate_complete:
release_sock(vcc->sk);
return 0;
......@@ -159,7 +156,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
(int) msg->type);
return -EINVAL;
}
if (vcc->callback) vcc->callback(vcc);
vcc->sk->sk_state_change(vcc->sk);
dev_kfree_skb(skb);
return 0;
}
......
......@@ -43,14 +43,6 @@ static int svc_create(struct socket *sock,int protocol);
*/
void svc_callback(struct atm_vcc *vcc)
{
wake_up(&vcc->sleep);
}
static int svc_shutdown(struct socket *sock,int how)
{
return 0;
......@@ -547,7 +539,6 @@ static int svc_create(struct socket *sock,int protocol)
sock->ops = &svc_proto_ops;
error = vcc_create(sock, protocol, AF_ATMSVC);
if (error) return error;
ATM_SD(sock)->callback = svc_callback;
ATM_SD(sock)->local.sas_family = AF_ATMSVC;
ATM_SD(sock)->remote.sas_family = AF_ATMSVC;
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment