o ipx: remove MOD_{INC,DEC}_USE_COUNT

Now the core networking infrastructure will (finally) do that for the net protocol
families, its just a matter of setting the ->owner field in the registered struct
net_proto_family to THIS_MODULE.
parent ee639b13
...@@ -95,18 +95,6 @@ static struct ipx_interface *ipx_internal_net; ...@@ -95,18 +95,6 @@ static struct ipx_interface *ipx_internal_net;
atomic_t ipx_sock_nr; atomic_t ipx_sock_nr;
#endif #endif
static void ipxcfg_set_auto_create(char val)
{
if (ipxcfg_auto_create_interfaces != val) {
if (val)
MOD_INC_USE_COUNT;
else
MOD_DEC_USE_COUNT;
ipxcfg_auto_create_interfaces = val;
}
}
static void ipxcfg_set_auto_select(char val) static void ipxcfg_set_auto_select(char val)
{ {
ipxcfg_auto_select_primary = val; ipxcfg_auto_select_primary = val;
...@@ -373,7 +361,6 @@ static void __ipxitf_down(struct ipx_interface *intrfc) ...@@ -373,7 +361,6 @@ static void __ipxitf_down(struct ipx_interface *intrfc)
if (intrfc->if_dev) if (intrfc->if_dev)
dev_put(intrfc->if_dev); dev_put(intrfc->if_dev);
kfree(intrfc); kfree(intrfc);
MOD_DEC_USE_COUNT;
} }
static void ipxitf_down(struct ipx_interface *intrfc) static void ipxitf_down(struct ipx_interface *intrfc)
...@@ -949,7 +936,6 @@ static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum, ...@@ -949,7 +936,6 @@ static struct ipx_interface *ipxitf_alloc(struct net_device *dev, __u32 netnum,
intrfc->if_sklist = NULL; intrfc->if_sklist = NULL;
atomic_set(&intrfc->refcnt, 1); atomic_set(&intrfc->refcnt, 1);
spin_lock_init(&intrfc->if_sklist_lock); spin_lock_init(&intrfc->if_sklist_lock);
MOD_INC_USE_COUNT;
} }
return intrfc; return intrfc;
...@@ -1272,7 +1258,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg) ...@@ -1272,7 +1258,7 @@ static int ipxitf_ioctl(unsigned int cmd, void *arg)
case SIOCAIPXITFCRT: case SIOCAIPXITFCRT:
if (get_user(val, (unsigned char *) arg)) if (get_user(val, (unsigned char *) arg))
return -EFAULT; return -EFAULT;
ipxcfg_set_auto_create(val); ipxcfg_auto_create_interfaces = val;
break; break;
case SIOCAIPXPRISLT: case SIOCAIPXPRISLT:
...@@ -1690,13 +1676,12 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1690,13 +1676,12 @@ static int ipx_create(struct socket *sock, int protocol)
struct ipx_opt *ipx = NULL; struct ipx_opt *ipx = NULL;
struct sock *sk; struct sock *sk;
MOD_INC_USE_COUNT;
switch (sock->type) { switch (sock->type) {
case SOCK_DGRAM: case SOCK_DGRAM:
sk = sk_alloc(PF_IPX, GFP_KERNEL, 1, NULL); sk = sk_alloc(PF_IPX, GFP_KERNEL, 1, NULL);
ret = -ENOMEM; ret = -ENOMEM;
if (!sk) if (!sk)
goto decmod; goto out;
ipx = ipx_sk(sk) = kmalloc(sizeof(*ipx), GFP_KERNEL); ipx = ipx_sk(sk) = kmalloc(sizeof(*ipx), GFP_KERNEL);
if (!ipx) if (!ipx)
goto outsk; goto outsk;
...@@ -1713,7 +1698,7 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1713,7 +1698,7 @@ static int ipx_create(struct socket *sock, int protocol)
*/ */
case SOCK_STREAM: /* Allow higher levels to piggyback */ case SOCK_STREAM: /* Allow higher levels to piggyback */
default: default:
goto decmod; goto out;
} }
#ifdef IPX_REFCNT_DEBUG #ifdef IPX_REFCNT_DEBUG
atomic_inc(&ipx_sock_nr); atomic_inc(&ipx_sock_nr);
...@@ -1727,8 +1712,6 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1727,8 +1712,6 @@ static int ipx_create(struct socket *sock, int protocol)
return ret; return ret;
outsk: outsk:
sk_free(sk); sk_free(sk);
decmod:
MOD_DEC_USE_COUNT;
goto out; goto out;
} }
...@@ -1745,10 +1728,6 @@ static int ipx_release(struct socket *sock) ...@@ -1745,10 +1728,6 @@ static int ipx_release(struct socket *sock)
__set_bit(SOCK_DEAD, &sk->flags); __set_bit(SOCK_DEAD, &sk->flags);
sock->sk = NULL; sock->sk = NULL;
ipx_destroy_socket(sk); ipx_destroy_socket(sk);
if (sock->type == SOCK_DGRAM)
MOD_DEC_USE_COUNT;
out: out:
return 0; return 0;
} }
...@@ -2252,6 +2231,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -2252,6 +2231,7 @@ static int ipx_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static struct net_proto_family ipx_family_ops = { static struct net_proto_family ipx_family_ops = {
.family = PF_IPX, .family = PF_IPX,
.create = ipx_create, .create = ipx_create,
.owner = THIS_MODULE,
}; };
static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = { static struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
......
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