]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
can: make struct can_proto const
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Thu, 5 May 2011 14:42:58 +0000 (14:42 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Thu, 5 May 2011 14:42:58 +0000 (14:42 +0000)
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 <kurt.van.dijck@eia.be>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1252 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/include/socketcan/can/core.h
kernel/2.6/net/can/af_can.c
kernel/2.6/net/can/bcm-prior-2-6-22.c
kernel/2.6/net/can/bcm.c
kernel/2.6/net/can/isotp.c
kernel/2.6/net/can/raw.c

index af7fd6506149a08c274a452460c628a177c02490..91bd9780959173c2c293640c213d9d5a3c1bd5d6 100644 (file)
@@ -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,
index 81756d15871f6af3397bbb7a036552c2accb5728..91f872764c093749320f5fcf775a8f12cf49fbf6 100644 (file)
@@ -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;
 
index bc58c79e433a02a9fba219069a853e91f21b83ee..10b200838dc3df4bd70cb24f6471ef3b14fbf0c6 100644 (file)
@@ -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,
index e293c7e11ac4cb6458e1f9e9b0fe49e2115e996e..f715b93e1242f661ba7e30d19ca84954f151e2cf 100644 (file)
@@ -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)
index d6df4421cdc761818156fe929f01ea9e2d9c265d..1282a9cbe7fe88cc288f9acd02abd1ddee3d084c 100644 (file)
@@ -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)
index c85607bfc4e4cc594a184cfc531a2be80a6dda54..3455c61e61daa567c62ae5b73742d9e9404c5a78 100644 (file)
@@ -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,