Commit c8d55a9d authored by Kurt Van Dijck's avatar Kurt Van Dijck Committed by David S. Miller

can: rename can_try_module_get to can_get_proto

can: rename can_try_module_get to can_get_proto

can_try_module_get does return a struct can_proto.
The name explains what is done in so much detail that a caller
may not notice that a struct can_proto is locked/unlocked.
Signed-off-by: default avatarKurt Van Dijck <kurt.van.dijck@eia.be>
Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1650629d
...@@ -115,7 +115,7 @@ static void can_sock_destruct(struct sock *sk) ...@@ -115,7 +115,7 @@ static void can_sock_destruct(struct sock *sk)
skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_receive_queue);
} }
static const struct can_proto *can_try_module_get(int protocol) static const struct can_proto *can_get_proto(int protocol)
{ {
const struct can_proto *cp; const struct can_proto *cp;
...@@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol) ...@@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol)
return cp; return cp;
} }
static inline void can_put_proto(const struct can_proto *cp)
{
module_put(cp->prot->owner);
}
static int can_create(struct net *net, struct socket *sock, int protocol, static int can_create(struct net *net, struct socket *sock, int protocol,
int kern) int kern)
{ {
...@@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, ...@@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
if (!net_eq(net, &init_net)) if (!net_eq(net, &init_net))
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
cp = can_try_module_get(protocol); cp = can_get_proto(protocol);
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
if (!cp) { if (!cp) {
...@@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, ...@@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
printk(KERN_ERR "can: request_module " printk(KERN_ERR "can: request_module "
"(can-proto-%d) failed.\n", protocol); "(can-proto-%d) failed.\n", protocol);
cp = can_try_module_get(protocol); cp = can_get_proto(protocol);
} }
#endif #endif
...@@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, ...@@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
} }
errout: errout:
module_put(cp->prot->owner); can_put_proto(cp);
return err; return err;
} }
......
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