[ovs-dev] [PATCH 7/7] datapath: Drop constness of datapath pointers.

Jesse Gross jesse at nicira.com
Wed Dec 29 23:41:35 UTC 2010


A few places marked struct datapath pointers as const since they
didn't expect to make modifications.  However, when compiled with
lockdep the datapath mutex pointer is passed to lockdep_is_held(),
which has a non-const argument.  That provoked warnings about
casting away the const, so this drops the const from the original
pointers.

Reported-by: Ben Pfaff <blp at nicira.com>
Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/datapath.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 13afe59..0ca24be 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -94,14 +94,13 @@ static struct datapath *get_dp_locked(int dp_idx)
 	return dp;
 }
 
-static struct tbl *get_table_protected(const struct datapath *dp)
+static struct tbl *get_table_protected(struct datapath *dp)
 {
 	return rcu_dereference_protected(dp->table,
 					 lockdep_is_held(&dp->mutex));
 }
 
-static struct vport *get_vport_protected(const struct datapath *dp,
-					 u16 port_no)
+static struct vport *get_vport_protected(struct datapath *dp, u16 port_no)
 {
 	return rcu_dereference_protected(dp->ports[port_no],
 					 lockdep_is_held(&dp->mutex));
@@ -128,7 +127,7 @@ static int dp_fill_ifinfo(struct sk_buff *skb,
 			  const struct vport *port,
 			  int event, unsigned int flags)
 {
-	const struct datapath *dp = port->dp;
+	struct datapath *dp = port->dp;
 	int ifindex = vport_get_ifindex(port);
 	int iflink = vport_get_iflink(port);
 	struct ifinfomsg *hdr;
-- 
1.7.1





More information about the dev mailing list