* [net-next-2.6 PATCH] can: make struct can_proto const
@ 2011-05-04 4:40 Kurt Van Dijck
[not found] ` <20110504044057.GC278-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Kurt Van Dijck @ 2011-05-04 4:40 UTC (permalink / raw)
To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
netdev-u79uwXL29TY76Z2rM5mHXA
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-/BeEPy95v10@public.gmane.org>
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 6f70a6d..5ce6b5d 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -44,8 +44,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/net/can/af_can.c b/net/can/af_can.c
index a8dcaa4..5b52762 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -84,7 +84,7 @@ static DEFINE_SPINLOCK(can_rcvlists_lock);
static struct kmem_cache *rcv_cache __read_mostly;
/* 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 */
@@ -115,9 +115,9 @@ static void can_sock_destruct(struct sock *sk)
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();
cp = rcu_dereference(proto_tab[protocol]);
@@ -132,7 +132,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct sock *sk;
- struct can_proto *cp;
+ const struct can_proto *cp;
int err = 0;
sock->state = SS_UNCONNECTED;
@@ -691,7 +691,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;
@@ -728,7 +728,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/net/can/bcm.c b/net/can/bcm.c
index 8a6a05e..cced806 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1601,7 +1601,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,
.ops = &bcm_ops,
diff --git a/net/can/raw.c b/net/can/raw.c
index 0eb39a7..dea99a6 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -774,7 +774,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,
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20110504044057.GC278-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>]
* Re: [net-next-2.6 PATCH] can: make struct can_proto const [not found] ` <20110504044057.GC278-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org> @ 2011-05-04 20:34 ` Oliver Hartkopp [not found] ` <4DC1B86A.40308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Oliver Hartkopp @ 2011-05-04 20:34 UTC (permalink / raw) To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w, netdev-u79uwXL29TY76Z2rM5mHXA On 04.05.2011 06:40, Kurt Van Dijck wrote: > 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-/BeEPy95v10@public.gmane.org> > Acked-by: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> Thanks Kurt! > diff --git a/include/linux/can/core.h b/include/linux/can/core.h > index 6f70a6d..5ce6b5d 100644 > --- a/include/linux/can/core.h > +++ b/include/linux/can/core.h > @@ -44,8 +44,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/net/can/af_can.c b/net/can/af_can.c > index a8dcaa4..5b52762 100644 > --- a/net/can/af_can.c > +++ b/net/can/af_can.c > @@ -84,7 +84,7 @@ static DEFINE_SPINLOCK(can_rcvlists_lock); > static struct kmem_cache *rcv_cache __read_mostly; > > /* 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 */ > @@ -115,9 +115,9 @@ static void can_sock_destruct(struct sock *sk) > 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(); > cp = rcu_dereference(proto_tab[protocol]); > @@ -132,7 +132,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, > int kern) > { > struct sock *sk; > - struct can_proto *cp; > + const struct can_proto *cp; > int err = 0; > > sock->state = SS_UNCONNECTED; > @@ -691,7 +691,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; > @@ -728,7 +728,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/net/can/bcm.c b/net/can/bcm.c > index 8a6a05e..cced806 100644 > --- a/net/can/bcm.c > +++ b/net/can/bcm.c > @@ -1601,7 +1601,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, > .ops = &bcm_ops, > diff --git a/net/can/raw.c b/net/can/raw.c > index 0eb39a7..dea99a6 100644 > --- a/net/can/raw.c > +++ b/net/can/raw.c > @@ -774,7 +774,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, > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4DC1B86A.40308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>]
* Re: [net-next-2.6 PATCH] can: make struct can_proto const [not found] ` <4DC1B86A.40308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> @ 2011-05-04 21:08 ` David Miller 0 siblings, 0 replies; 3+ messages in thread From: David Miller @ 2011-05-04 21:08 UTC (permalink / raw) To: socketcan-fJ+pQTUTwRTk1uMJSBkQmQ Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w, netdev-u79uwXL29TY76Z2rM5mHXA From: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> Date: Wed, 04 May 2011 22:34:50 +0200 > On 04.05.2011 06:40, Kurt Van Dijck wrote: >> 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-/BeEPy95v10@public.gmane.org> >> > > Acked-by: Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> Applied. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-04 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 4:40 [net-next-2.6 PATCH] can: make struct can_proto const Kurt Van Dijck
[not found] ` <20110504044057.GC278-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-05-04 20:34 ` Oliver Hartkopp
[not found] ` <4DC1B86A.40308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-05-04 21:08 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).