rcu_dereference_raw() api is cleaner way of accessing RCU pointer
when no locking is required.

Signed-off-by: Pravin B Shelar <[email protected]>
---
 datapath/datapath.c   |    2 +-
 datapath/flow_table.c |    8 ++++----
 datapath/vport.c      |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 9e2dcfa..5ff10e5 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -1202,7 +1202,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct 
genl_info *info)
        ovs_flow_tbl_remove(&dp->table, flow);
        ovs_unlock();
 
-       reply = ovs_flow_cmd_alloc_info((const struct sw_flow_actions __force 
*)flow->sf_acts,
+       reply = ovs_flow_cmd_alloc_info(rcu_dereference_raw(flow->sf_acts),
                                        info, false);
 
        if (likely(reply)) {
diff --git a/datapath/flow_table.c b/datapath/flow_table.c
index 4efef13..9656cfe 100644
--- a/datapath/flow_table.c
+++ b/datapath/flow_table.c
@@ -146,11 +146,11 @@ static void flow_free(struct sw_flow *flow)
 {
        int node;
 
-       kfree((struct sw_flow_actions __force *)flow->sf_acts);
+       kfree(rcu_dereference_raw(flow->sf_acts));
        for_each_node(node)
                if (flow->stats[node])
                        kmem_cache_free(flow_stats_cache,
-                                       (struct flow_stats __force 
*)flow->stats[node]);
+                                       rcu_dereference_raw(flow->stats[node]));
        kmem_cache_free(flow_cache, flow);
 }
 
@@ -334,10 +334,10 @@ skip_flows:
  * error path. */
 void ovs_flow_tbl_destroy(struct flow_table *table)
 {
-       struct table_instance *ti = (struct table_instance __force *)table->ti;
+       struct table_instance *ti = rcu_dereference_raw(table->ti);
 
        free_percpu(table->mask_cache);
-       kfree((struct mask_array __force *)table->mask_array);
+       kfree(rcu_dereference_raw(table->mask_array));
        table_instance_destroy(ti, false);
 }
 
diff --git a/datapath/vport.c b/datapath/vport.c
index fd52903..18f3956 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -166,7 +166,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct 
vport_ops *ops,
  */
 void ovs_vport_free(struct vport *vport)
 {
-       kfree((struct vport_portids __force *)vport->upcall_portids);
+       kfree(rcu_dereference_raw(vport->upcall_portids));
        free_percpu(vport->percpu_stats);
        kfree(vport);
 }
-- 
1.7.1

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to