diff options
author | Roland Dreier <roland@topspin.com> | 2005-06-27 14:36:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-27 15:11:45 -0700 |
commit | a03a5a67b243e9a24805ee18272ad25e5b2ca92c (patch) | |
tree | 5e4a1d3ec8482a482caa6697cba12a819ef6aa8a /drivers/infiniband/hw/mthca/mthca_mr.c | |
parent | a852092e8cb305595ff630dfc3e9b25966a98276 (diff) |
[PATCH] IB/mthca: Move mthca_is_memfree checks
Make mthca_table_put() and mthca_table_put_range() NOPs if the device is not
mem-free, so that we don't have to have "if (mthca_is_memfree())" tests in the
callers of these functions. This makes our code more readable and
maintainable, and saves a couple dozen bytes of text in ib_mthca.ko as well.
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_mr.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_mr.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c index 8960fc2306b..29e5fe708b8 100644 --- a/drivers/infiniband/hw/mthca/mthca_mr.c +++ b/drivers/infiniband/hw/mthca/mthca_mr.c @@ -195,10 +195,8 @@ static void mthca_free_mtt(struct mthca_dev *dev, u32 seg, int order, struct mthca_buddy* buddy) { mthca_buddy_free(buddy, seg, order); - - if (mthca_is_memfree(dev)) - mthca_table_put_range(dev, dev->mr_table.mtt_table, seg, - seg + (1 << order) - 1); + mthca_table_put_range(dev, dev->mr_table.mtt_table, seg, + seg + (1 << order) - 1); } static inline u32 tavor_hw_index_to_key(u32 ind) @@ -299,8 +297,7 @@ int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd, return err; err_out_table: - if (mthca_is_memfree(dev)) - mthca_table_put(dev, dev->mr_table.mpt_table, key); + mthca_table_put(dev, dev->mr_table.mpt_table, key); err_out_mpt_free: mthca_free(&dev->mr_table.mpt_alloc, key); @@ -437,8 +434,7 @@ err_out_free_mtt: mthca_free_mtt(dev, mr->first_seg, mr->order, &dev->mr_table.mtt_buddy); err_out_table: - if (mthca_is_memfree(dev)) - mthca_table_put(dev, dev->mr_table.mpt_table, key); + mthca_table_put(dev, dev->mr_table.mpt_table, key); err_out_mpt_free: mthca_free(&dev->mr_table.mpt_alloc, key); @@ -452,9 +448,8 @@ static void mthca_free_region(struct mthca_dev *dev, u32 lkey, int order, if (order >= 0) mthca_free_mtt(dev, first_seg, order, buddy); - if (mthca_is_memfree(dev)) - mthca_table_put(dev, dev->mr_table.mpt_table, - arbel_key_to_hw_index(lkey)); + mthca_table_put(dev, dev->mr_table.mpt_table, + arbel_key_to_hw_index(lkey)); mthca_free(&dev->mr_table.mpt_alloc, key_to_hw_index(dev, lkey)); } @@ -596,8 +591,7 @@ err_out_free_mtt: dev->mr_table.fmr_mtt_buddy); err_out_table: - if (mthca_is_memfree(dev)) - mthca_table_put(dev, dev->mr_table.mpt_table, key); + mthca_table_put(dev, dev->mr_table.mpt_table, key); err_out_mpt_free: mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey); |