Skip to content

Commit

Permalink
IB/mthca: use swap() in mthca_make_profile()
Browse files Browse the repository at this point in the history
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Fabian Frederick authored and Doug Ledford committed Jun 11, 2015
1 parent 1156256 commit ed0de4a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/infiniband/hw/mthca/mthca_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ s64 mthca_make_profile(struct mthca_dev *dev,
u64 mem_base, mem_avail;
s64 total_size = 0;
struct mthca_resource *profile;
struct mthca_resource tmp;
int i, j;

profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
Expand Down Expand Up @@ -136,11 +135,8 @@ s64 mthca_make_profile(struct mthca_dev *dev,
*/
for (i = MTHCA_RES_NUM; i > 0; --i)
for (j = 1; j < i; ++j) {
if (profile[j].size > profile[j - 1].size) {
tmp = profile[j];
profile[j] = profile[j - 1];
profile[j - 1] = tmp;
}
if (profile[j].size > profile[j - 1].size)
swap(profile[j], profile[j - 1]);
}

for (i = 0; i < MTHCA_RES_NUM; ++i) {
Expand Down

0 comments on commit ed0de4a

Please sign in to comment.