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 { ...@@ -297,7 +297,6 @@ struct atm_vcc {
short itf; /* interface number */ short itf; /* interface number */
struct sockaddr_atmsvc local; struct sockaddr_atmsvc local;
struct sockaddr_atmsvc remote; struct sockaddr_atmsvc remote;
void (*callback)(struct atm_vcc *vcc);
int reply; /* also used by ATMTCP */ int reply; /* also used by ATMTCP */
/* Multipoint part ------------------------------------------------- */ /* Multipoint part ------------------------------------------------- */
struct atm_vcc *session; /* session VCC descriptor */ struct atm_vcc *session; /* session VCC descriptor */
......
...@@ -235,6 +235,14 @@ static void vcc_sock_destruct(struct sock *sk) ...@@ -235,6 +235,14 @@ static void vcc_sock_destruct(struct sock *sk)
kfree(sk->sk_protinfo); 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) int vcc_create(struct socket *sock, int protocol, int family)
{ {
...@@ -248,6 +256,7 @@ 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) if (!sk)
return -ENOMEM; return -ENOMEM;
sock_init_data(NULL, sk); sock_init_data(NULL, sk);
sk->sk_state_change = vcc_def_wakeup;
vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL); vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL);
if (!vcc) { if (!vcc) {
...@@ -258,7 +267,6 @@ int vcc_create(struct socket *sock, int protocol, int family) ...@@ -258,7 +267,6 @@ int vcc_create(struct socket *sock, int protocol, int family)
memset(vcc, 0, sizeof(*vcc)); memset(vcc, 0, sizeof(*vcc));
vcc->sk = sk; vcc->sk = sk;
vcc->dev = NULL; vcc->dev = NULL;
vcc->callback = NULL;
memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc)); memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc)); memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */ 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) ...@@ -137,11 +137,8 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
} }
vcc->sk->sk_ack_backlog++; vcc->sk->sk_ack_backlog++;
skb_queue_tail(&vcc->sk->sk_receive_queue, skb); skb_queue_tail(&vcc->sk->sk_receive_queue, skb);
if (vcc->callback) { DPRINTK("waking vcc->sleep 0x%p\n", &vcc->sleep);
DPRINTK("waking vcc->sleep 0x%p\n", vcc->sk->sk_state_change(vcc->sk);
&vcc->sleep);
vcc->callback(vcc);
}
as_indicate_complete: as_indicate_complete:
release_sock(vcc->sk); release_sock(vcc->sk);
return 0; return 0;
...@@ -159,7 +156,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb) ...@@ -159,7 +156,7 @@ static int sigd_send(struct atm_vcc *vcc,struct sk_buff *skb)
(int) msg->type); (int) msg->type);
return -EINVAL; return -EINVAL;
} }
if (vcc->callback) vcc->callback(vcc); vcc->sk->sk_state_change(vcc->sk);
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return 0;
} }
......
...@@ -43,14 +43,6 @@ static int svc_create(struct socket *sock,int protocol); ...@@ -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) static int svc_shutdown(struct socket *sock,int how)
{ {
return 0; return 0;
...@@ -547,7 +539,6 @@ static int svc_create(struct socket *sock,int protocol) ...@@ -547,7 +539,6 @@ static int svc_create(struct socket *sock,int protocol)
sock->ops = &svc_proto_ops; sock->ops = &svc_proto_ops;
error = vcc_create(sock, protocol, AF_ATMSVC); error = vcc_create(sock, protocol, AF_ATMSVC);
if (error) return error; if (error) return error;
ATM_SD(sock)->callback = svc_callback;
ATM_SD(sock)->local.sas_family = AF_ATMSVC; ATM_SD(sock)->local.sas_family = AF_ATMSVC;
ATM_SD(sock)->remote.sas_family = AF_ATMSVC; ATM_SD(sock)->remote.sas_family = AF_ATMSVC;
return 0; 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