Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed0de4a8 authored by Fabian Frederick's avatar Fabian Frederick Committed by Doug Ledford
Browse files

IB/mthca: use swap() in mthca_make_profile()



Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 11562568
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -77,7 +77,6 @@ s64 mthca_make_profile(struct mthca_dev *dev,
	u64 mem_base, mem_avail;
	u64 mem_base, mem_avail;
	s64 total_size = 0;
	s64 total_size = 0;
	struct mthca_resource *profile;
	struct mthca_resource *profile;
	struct mthca_resource tmp;
	int i, j;
	int i, j;


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


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