From: hartkopp Date: Thu, 5 May 2011 14:42:58 +0000 (+0000) Subject: can: make struct can_proto const X-Git-Url: http://rtime.felk.cvut.cz/gitweb/socketcan-devel.git/commitdiff_plain/46ad14d23667bd06ba91c975f85ee9977b529665 can: make struct can_proto const commit 53914b67993c724cec585863755c9ebc8446e83b had the same message. That commit did put everything in place but did not make can_proto const itself. Signed-off-by: Kurt Van Dijck Acked-by: Oliver Hartkopp git-svn-id: svn://svn.berlios.de//socketcan/trunk@1252 030b6a49-0b11-0410-94ab-b0dab22257f2 --- diff --git a/kernel/2.6/include/socketcan/can/core.h b/kernel/2.6/include/socketcan/can/core.h index af7fd65..91bd978 100644 --- a/kernel/2.6/include/socketcan/can/core.h +++ b/kernel/2.6/include/socketcan/can/core.h @@ -56,8 +56,8 @@ struct can_proto { /* function prototypes for the CAN networklayer core (af_can.c) */ -extern int can_proto_register(struct can_proto *cp); -extern void can_proto_unregister(struct can_proto *cp); +extern int can_proto_register(const 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, canid_t mask, diff --git a/kernel/2.6/net/can/af_can.c b/kernel/2.6/net/can/af_can.c index 81756d1..91f8727 100644 --- a/kernel/2.6/net/can/af_can.c +++ b/kernel/2.6/net/can/af_can.c @@ -101,7 +101,7 @@ static kmem_cache_t *rcv_cache; #endif /* 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); struct timer_list can_stattimer; /* timer for statistics update */ @@ -140,9 +140,9 @@ static void can_sock_destruct(struct sock *sk) #endif } -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(); cp = rcu_dereference(proto_tab[protocol]); @@ -167,7 +167,7 @@ static int can_create(struct socket *sock, int protocol) #endif { struct sock *sk; - struct can_proto *cp; + const struct can_proto *cp; int err = 0; sock->state = SS_UNCONNECTED; @@ -858,7 +858,7 @@ drop: * -EBUSY protocol already in use * -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 err = 0; @@ -899,7 +899,7 @@ EXPORT_SYMBOL(can_proto_register); * can_proto_unregister - unregister CAN transport protocol * @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; diff --git a/kernel/2.6/net/can/bcm-prior-2-6-22.c b/kernel/2.6/net/can/bcm-prior-2-6-22.c index bc58c79..10b2008 100644 --- a/kernel/2.6/net/can/bcm-prior-2-6-22.c +++ b/kernel/2.6/net/can/bcm-prior-2-6-22.c @@ -1573,7 +1573,7 @@ static struct proto bcm_proto __read_mostly = { .init = bcm_init, }; -static struct can_proto bcm_can_proto __read_mostly = { +static const struct can_proto bcm_can_proto = { .type = SOCK_DGRAM, .protocol = CAN_BCM, .capability = -1, @@ -1581,7 +1581,7 @@ static struct can_proto bcm_can_proto __read_mostly = { .prot = &bcm_proto, }; #else -static struct can_proto bcm_can_proto __read_mostly = { +static const struct can_proto bcm_can_proto = { .type = SOCK_DGRAM, .protocol = CAN_BCM, .capability = -1, diff --git a/kernel/2.6/net/can/bcm.c b/kernel/2.6/net/can/bcm.c index e293c7e..f715b93 100644 --- a/kernel/2.6/net/can/bcm.c +++ b/kernel/2.6/net/can/bcm.c @@ -1737,7 +1737,7 @@ static struct proto bcm_proto __read_mostly = { .init = bcm_init, }; -static struct can_proto bcm_can_proto __read_mostly = { +static const struct can_proto bcm_can_proto = { .type = SOCK_DGRAM, .protocol = CAN_BCM, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) diff --git a/kernel/2.6/net/can/isotp.c b/kernel/2.6/net/can/isotp.c index d6df442..1282a9c 100644 --- a/kernel/2.6/net/can/isotp.c +++ b/kernel/2.6/net/can/isotp.c @@ -1158,7 +1158,7 @@ static struct proto isotp_proto __read_mostly = { .init = isotp_init, }; -static struct can_proto isotp_can_proto __read_mostly = { +static const struct can_proto isotp_can_proto = { .type = SOCK_DGRAM, .protocol = CAN_ISOTP, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) diff --git a/kernel/2.6/net/can/raw.c b/kernel/2.6/net/can/raw.c index c85607b..3455c61 100644 --- a/kernel/2.6/net/can/raw.c +++ b/kernel/2.6/net/can/raw.c @@ -808,7 +808,7 @@ static struct proto raw_proto __read_mostly = { .init = raw_init, }; -static struct can_proto raw_can_proto __read_mostly = { +static const struct can_proto raw_can_proto = { .type = SOCK_RAW, .protocol = CAN_RAW, .ops = &raw_ops,