o appletalk: 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 3bbc2e54
...@@ -190,10 +190,9 @@ static void atalk_destroy_timer(unsigned long data) ...@@ -190,10 +190,9 @@ static void atalk_destroy_timer(unsigned long data)
struct sock *sk = (struct sock *)data; struct sock *sk = (struct sock *)data;
if (!atomic_read(&sk->wmem_alloc) && if (!atomic_read(&sk->wmem_alloc) &&
!atomic_read(&sk->rmem_alloc) && test_bit(SOCK_DEAD, &sk->flags)) { !atomic_read(&sk->rmem_alloc) && test_bit(SOCK_DEAD, &sk->flags))
sock_put(sk); sock_put(sk);
MOD_DEC_USE_COUNT; else {
} else {
sk->timer.expires = jiffies + SOCK_DESTROY_TIME; sk->timer.expires = jiffies + SOCK_DESTROY_TIME;
add_timer(&sk->timer); add_timer(&sk->timer);
} }
...@@ -205,10 +204,9 @@ extern inline void atalk_destroy_socket(struct sock *sk) ...@@ -205,10 +204,9 @@ extern inline void atalk_destroy_socket(struct sock *sk)
skb_queue_purge(&sk->receive_queue); skb_queue_purge(&sk->receive_queue);
if (!atomic_read(&sk->wmem_alloc) && if (!atomic_read(&sk->wmem_alloc) &&
!atomic_read(&sk->rmem_alloc) && test_bit(SOCK_DEAD, &sk->flags)) { !atomic_read(&sk->rmem_alloc) && test_bit(SOCK_DEAD, &sk->flags))
sock_put(sk); sock_put(sk);
MOD_DEC_USE_COUNT; else {
} else {
init_timer(&sk->timer); init_timer(&sk->timer);
sk->timer.expires = jiffies + SOCK_DESTROY_TIME; sk->timer.expires = jiffies + SOCK_DESTROY_TIME;
sk->timer.function = atalk_destroy_timer; sk->timer.function = atalk_destroy_timer;
...@@ -249,7 +247,6 @@ static void atif_drop_device(struct net_device *dev) ...@@ -249,7 +247,6 @@ static void atif_drop_device(struct net_device *dev)
*iface = tmp->next; *iface = tmp->next;
kfree(tmp); kfree(tmp);
dev->atalk_ptr = NULL; dev->atalk_ptr = NULL;
MOD_DEC_USE_COUNT;
} else } else
iface = &tmp->next; iface = &tmp->next;
} }
...@@ -259,13 +256,10 @@ static void atif_drop_device(struct net_device *dev) ...@@ -259,13 +256,10 @@ static void atif_drop_device(struct net_device *dev)
static struct atalk_iface *atif_add_device(struct net_device *dev, static struct atalk_iface *atif_add_device(struct net_device *dev,
struct atalk_addr *sa) struct atalk_addr *sa)
{ {
struct atalk_iface *iface; struct atalk_iface *iface = kmalloc(sizeof(*iface), GFP_KERNEL);
MOD_INC_USE_COUNT;
iface = kmalloc(sizeof(*iface), GFP_KERNEL);
if (!iface) if (!iface)
goto out_mem; goto out;
iface->dev = dev; iface->dev = dev;
dev->atalk_ptr = iface; dev->atalk_ptr = iface;
...@@ -278,9 +272,6 @@ static struct atalk_iface *atif_add_device(struct net_device *dev, ...@@ -278,9 +272,6 @@ static struct atalk_iface *atif_add_device(struct net_device *dev,
write_unlock_bh(&atalk_interfaces_lock); write_unlock_bh(&atalk_interfaces_lock);
out: out:
return iface; return iface;
out_mem:
MOD_DEC_USE_COUNT;
goto out;
} }
/* Perform phase 2 AARP probing on our tentative address */ /* Perform phase 2 AARP probing on our tentative address */
...@@ -982,17 +973,16 @@ static int atalk_create(struct socket *sock, int protocol) ...@@ -982,17 +973,16 @@ static int atalk_create(struct socket *sock, int protocol)
struct atalk_sock *at; struct atalk_sock *at;
int rc = -ESOCKTNOSUPPORT; int rc = -ESOCKTNOSUPPORT;
MOD_INC_USE_COUNT;
/* /*
* We permit SOCK_DGRAM and RAW is an extension. It is trivial to do * We permit SOCK_DGRAM and RAW is an extension. It is trivial to do
* and gives you the full ELAP frame. Should be handy for CAP 8) * and gives you the full ELAP frame. Should be handy for CAP 8)
*/ */
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
goto decmod; goto out;
rc = -ENOMEM; rc = -ENOMEM;
sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, 1, NULL); sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, 1, NULL);
if (!sk) if (!sk)
goto decmod; goto out;
at = at_sk(sk) = kmalloc(sizeof(*at), GFP_KERNEL); at = at_sk(sk) = kmalloc(sizeof(*at), GFP_KERNEL);
if (!at) if (!at)
goto outsk; goto outsk;
...@@ -1005,8 +995,6 @@ static int atalk_create(struct socket *sock, int protocol) ...@@ -1005,8 +995,6 @@ static int atalk_create(struct socket *sock, int protocol)
return rc; return rc;
outsk: outsk:
sk_free(sk); sk_free(sk);
decmod:
MOD_DEC_USE_COUNT;
goto out; goto out;
} }
...@@ -1785,6 +1773,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1785,6 +1773,7 @@ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static struct net_proto_family atalk_family_ops = { static struct net_proto_family atalk_family_ops = {
.family = PF_APPLETALK, .family = PF_APPLETALK,
.create = atalk_create, .create = atalk_create,
.owner = THIS_MODULE,
}; };
static struct proto_ops SOCKOPS_WRAPPED(atalk_dgram_ops) = { static struct proto_ops SOCKOPS_WRAPPED(atalk_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