Commit 476d95bd authored by Wei Yongjun's avatar Wei Yongjun Committed by Doug Ledford

IB/hfi1: Using kfree_rcu() to simplify the code

The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.
Signed-off-by: default avatarWei Yongjun <weiyj.lk@gmail.com>
Tested-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Tested-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 69b9f4a4
......@@ -1656,7 +1656,6 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd)
struct hfi1_devdata *hfi1_init_dd(struct pci_dev *,
const struct pci_device_id *);
void hfi1_free_devdata(struct hfi1_devdata *);
void cc_state_reclaim(struct rcu_head *rcu);
struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra);
/* LED beaconing functions */
......
......@@ -1333,7 +1333,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd)
spin_unlock(&ppd->cc_state_lock);
if (cc_state)
call_rcu(&cc_state->rcu, cc_state_reclaim);
kfree_rcu(cc_state, rcu);
}
free_credit_return(dd);
......
......@@ -3398,7 +3398,7 @@ static void apply_cc_state(struct hfi1_pportdata *ppd)
spin_unlock(&ppd->cc_state_lock);
call_rcu(&old_cc_state->rcu, cc_state_reclaim);
kfree_rcu(old_cc_state, rcu);
}
static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
......@@ -3553,13 +3553,6 @@ static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
return reply((struct ib_mad_hdr *)smp);
}
void cc_state_reclaim(struct rcu_head *rcu)
{
struct cc_state *cc_state = container_of(rcu, struct cc_state, rcu);
kfree(cc_state);
}
static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
struct ib_device *ibdev, u8 port,
u32 *resp_len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment