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

can: make struct can_proto const

commit 53914b67 had the
same message. That commit did put everything in place but
did not make can_proto const itself.
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 5a412ad7
...@@ -44,8 +44,8 @@ struct can_proto { ...@@ -44,8 +44,8 @@ struct can_proto {
/* function prototypes for the CAN networklayer core (af_can.c) */ /* function prototypes for the CAN networklayer core (af_can.c) */
extern int can_proto_register(struct can_proto *cp); extern int can_proto_register(const struct can_proto *cp);
extern void can_proto_unregister(struct can_proto *cp); extern void can_proto_unregister(const struct can_proto *cp);
extern int can_rx_register(struct net_device *dev, canid_t can_id, extern int can_rx_register(struct net_device *dev, canid_t can_id,
canid_t mask, canid_t mask,
......
...@@ -84,7 +84,7 @@ static DEFINE_SPINLOCK(can_rcvlists_lock); ...@@ -84,7 +84,7 @@ static DEFINE_SPINLOCK(can_rcvlists_lock);
static struct kmem_cache *rcv_cache __read_mostly; static struct kmem_cache *rcv_cache __read_mostly;
/* table of registered CAN protocols */ /* table of registered CAN protocols */
static struct can_proto *proto_tab[CAN_NPROTO] __read_mostly; static const struct can_proto *proto_tab[CAN_NPROTO] __read_mostly;
static DEFINE_MUTEX(proto_tab_lock); static DEFINE_MUTEX(proto_tab_lock);
struct timer_list can_stattimer; /* timer for statistics update */ struct timer_list can_stattimer; /* timer for statistics update */
...@@ -115,9 +115,9 @@ static void can_sock_destruct(struct sock *sk) ...@@ -115,9 +115,9 @@ static void can_sock_destruct(struct sock *sk)
skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_receive_queue);
} }
static struct can_proto *can_try_module_get(int protocol) static const struct can_proto *can_try_module_get(int protocol)
{ {
struct can_proto *cp; const struct can_proto *cp;
rcu_read_lock(); rcu_read_lock();
cp = rcu_dereference(proto_tab[protocol]); cp = rcu_dereference(proto_tab[protocol]);
...@@ -132,7 +132,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, ...@@ -132,7 +132,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
int kern) int kern)
{ {
struct sock *sk; struct sock *sk;
struct can_proto *cp; const struct can_proto *cp;
int err = 0; int err = 0;
sock->state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED;
...@@ -691,7 +691,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -691,7 +691,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
* -EBUSY protocol already in use * -EBUSY protocol already in use
* -ENOBUF if proto_register() fails * -ENOBUF if proto_register() fails
*/ */
int can_proto_register(struct can_proto *cp) int can_proto_register(const struct can_proto *cp)
{ {
int proto = cp->protocol; int proto = cp->protocol;
int err = 0; int err = 0;
...@@ -728,7 +728,7 @@ EXPORT_SYMBOL(can_proto_register); ...@@ -728,7 +728,7 @@ EXPORT_SYMBOL(can_proto_register);
* can_proto_unregister - unregister CAN transport protocol * can_proto_unregister - unregister CAN transport protocol
* @cp: pointer to CAN protocol structure * @cp: pointer to CAN protocol structure
*/ */
void can_proto_unregister(struct can_proto *cp) void can_proto_unregister(const struct can_proto *cp)
{ {
int proto = cp->protocol; int proto = cp->protocol;
......
...@@ -1601,7 +1601,7 @@ static struct proto bcm_proto __read_mostly = { ...@@ -1601,7 +1601,7 @@ static struct proto bcm_proto __read_mostly = {
.init = bcm_init, .init = bcm_init,
}; };
static struct can_proto bcm_can_proto __read_mostly = { static const struct can_proto bcm_can_proto = {
.type = SOCK_DGRAM, .type = SOCK_DGRAM,
.protocol = CAN_BCM, .protocol = CAN_BCM,
.ops = &bcm_ops, .ops = &bcm_ops,
......
...@@ -774,7 +774,7 @@ static struct proto raw_proto __read_mostly = { ...@@ -774,7 +774,7 @@ static struct proto raw_proto __read_mostly = {
.init = raw_init, .init = raw_init,
}; };
static struct can_proto raw_can_proto __read_mostly = { static const struct can_proto raw_can_proto = {
.type = SOCK_RAW, .type = SOCK_RAW,
.protocol = CAN_RAW, .protocol = CAN_RAW,
.ops = &raw_ops, .ops = &raw_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