o af_netrom: 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 7e258ac6
...@@ -62,34 +62,25 @@ static spinlock_t nr_list_lock; ...@@ -62,34 +62,25 @@ static spinlock_t nr_list_lock;
static struct proto_ops nr_proto_ops; static struct proto_ops nr_proto_ops;
static void nr_free_sock(struct sock *sk)
{
sk_free(sk);
MOD_DEC_USE_COUNT;
}
static struct sock *nr_alloc_sock(void) static struct sock *nr_alloc_sock(void)
{ {
struct sock *sk;
nr_cb *nr; nr_cb *nr;
struct sock *sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL);
MOD_INC_USE_COUNT; if (!sk)
if ((sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL)) == NULL) goto out;
goto decmod;
nr = nr_sk(sk) = kmalloc(sizeof(*nr), GFP_ATOMIC); nr = nr_sk(sk) = kmalloc(sizeof(*nr), GFP_ATOMIC);
if (!nr) if (!nr)
goto frees; goto frees;
memset(nr, 0x00, sizeof(*nr)); memset(nr, 0x00, sizeof(*nr));
nr->sk = sk; nr->sk = sk;
out:
out: return sk; return sk;
frees: sk_free(sk); frees:
sk_free(sk);
sk = NULL; sk = NULL;
decmod: MOD_DEC_USE_COUNT;
goto out; goto out;
} }
...@@ -300,9 +291,8 @@ void nr_destroy_socket(struct sock *sk) ...@@ -300,9 +291,8 @@ void nr_destroy_socket(struct sock *sk)
sk->timer.function = nr_destroy_timer; sk->timer.function = nr_destroy_timer;
sk->timer.data = (unsigned long)sk; sk->timer.data = (unsigned long)sk;
add_timer(&sk->timer); add_timer(&sk->timer);
} else { } else
nr_free_sock(sk); sk_free(sk);
}
} }
/* /*
...@@ -1232,6 +1222,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -1232,6 +1222,7 @@ static int nr_get_info(char *buffer, char **start, off_t offset, int length)
static struct net_proto_family nr_family_ops = { static struct net_proto_family nr_family_ops = {
.family = PF_NETROM, .family = PF_NETROM,
.create = nr_create, .create = nr_create,
.owner = THIS_MODULE,
}; };
static struct proto_ops nr_proto_ops = { static struct proto_ops nr_proto_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