From patchwork Wed Jun 10 16:31:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 6583101 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7CFD5C0020 for ; Wed, 10 Jun 2015 16:32:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BBA120592 for ; Wed, 10 Jun 2015 16:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC1E2205BE for ; Wed, 10 Jun 2015 16:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933892AbbFJQcJ (ORCPT ); Wed, 10 Jun 2015 12:32:09 -0400 Received: from mailrelay110.isp.belgacom.be ([195.238.20.137]:6993 "EHLO mailrelay110.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933910AbbFJQb6 (ORCPT ); Wed, 10 Jun 2015 12:31:58 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=eWtaKQUTUbzTvYESxgzcVvJXO5dQmjbJ/tTWSlQWV0k= c=1 sm=2 a=4c5uVEBkhm8vsg89xdUA:9 a=P3yl5X9ub9hU5xOk:21 a=8mdROPEKIO-6nF6g:21 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2C4HgAlZXhV/5QztFtcgxABgTKrcwUBAQEBAQEFAYEEAZJchgmBOj0QAQEBAQEBAYEKQQOEOyOBGjeIMgHSEYYZijAdhBcFnwCNRoo1JGJmAYIxPDGCRwEBAQ Received: from 148.51-180-91.adsl-dyn.isp.belgacom.be (HELO localhost.home.) ([91.180.51.148]) by relay.skynet.be with ESMTP; 10 Jun 2015 18:31:58 +0200 From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Julia Lawall , Fabian Frederick , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile() Date: Wed, 10 Jun 2015 18:31:51 +0200 Message-Id: <1433953911-23735-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.4.2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick --- drivers/infiniband/hw/mthca/mthca_profile.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c index 8edb28a..15d0644 100644 --- a/drivers/infiniband/hw/mthca/mthca_profile.c +++ b/drivers/infiniband/hw/mthca/mthca_profile.c @@ -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); @@ -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) {