From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Fabian Frederick <fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>,
Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile()
Date: Fri, 12 Jun 2015 11:24:17 -0400 [thread overview]
Message-ID: <557AF9A1.80003@redhat.com> (raw)
In-Reply-To: <1433953911-23735-1-git-send-email-fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
On 06/10/2015 12:31 PM, Fabian Frederick wrote:
> Use kernel.h macro definition.
>
> Thanks to Julia Lawall for Coccinelle scripting support.
>
> Signed-off-by: Fabian Frederick <fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
Thanks, applied.
> ---
> 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) {
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Doug Ledford <dledford@redhat.com>
To: Fabian Frederick <fabf@skynet.be>, linux-kernel@vger.kernel.org
Cc: Julia Lawall <Julia.Lawall@lip6.fr>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile()
Date: Fri, 12 Jun 2015 11:24:17 -0400 [thread overview]
Message-ID: <557AF9A1.80003@redhat.com> (raw)
In-Reply-To: <1433953911-23735-1-git-send-email-fabf@skynet.be>
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
On 06/10/2015 12:31 PM, Fabian Frederick wrote:
> Use kernel.h macro definition.
>
> Thanks to Julia Lawall for Coccinelle scripting support.
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
Thanks, applied.
> ---
> 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) {
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]
next prev parent reply other threads:[~2015-06-12 15:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-10 16:31 [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile() Fabian Frederick
2015-06-10 16:31 ` Fabian Frederick
[not found] ` <1433953911-23735-1-git-send-email-fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
2015-06-12 15:24 ` Doug Ledford [this message]
2015-06-12 15:24 ` Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=557AF9A1.80003@redhat.com \
--to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=Julia.Lawall-L2FTfq7BK8M@public.gmane.org \
--cc=fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.