datapath: avoid warnings in vport_from_priv
authorDaniele Di Proietto <daniele.di.proietto@gmail.com>
Thu, 23 Jan 2014 22:25:37 +0000 (23:25 +0100)
committerJesse Gross <jesse@nicira.com>
Mon, 3 Feb 2014 22:05:12 +0000 (14:05 -0800)
This change, firstly, avoids declaring the formal parameter const,
since it is treated as non const. (to avoid -Wcast-qual)
Secondly, it cast the pointer from void* to u8*, since it is used
in arithmetic (to avoid -Wpointer-arith)

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/vport.h

index 2cf2b18..de79d8c 100644 (file)
@@ -186,9 +186,9 @@ static inline void *vport_priv(const struct vport *vport)
  * the result of a hash table lookup.  @priv must point to the start of the
  * private data area.
  */
-static inline struct vport *vport_from_priv(const void *priv)
+static inline struct vport *vport_from_priv(void *priv)
 {
-       return (struct vport *)(priv - ALIGN(sizeof(struct vport), VPORT_ALIGN));
+       return (struct vport *)((u8 *)priv - ALIGN(sizeof(struct vport), VPORT_ALIGN));
 }
 
 void ovs_vport_receive(struct vport *, struct sk_buff *,