* [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile()
@ 2015-06-10 16:31 Fabian Frederick
[not found] ` <1433953911-23735-1-git-send-email-fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2015-06-10 16:31 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Julia Lawall, Fabian Frederick, Doug Ledford, Sean Hefty,
Hal Rosenstock, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Use kernel.h macro definition.
Thanks to Julia Lawall for Coccinelle scripting support.
Signed-off-by: Fabian Frederick <fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
---
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) {
--
2.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile()
[not found] ` <1433953911-23735-1-git-send-email-fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
@ 2015-06-12 15:24 ` Doug Ledford
0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2015-06-12 15:24 UTC (permalink / raw)
To: Fabian Frederick, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Julia Lawall, Sean Hefty, Hal Rosenstock,
linux-rdma-u79uwXL29TY76Z2rM5mHXA
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-12 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 16:31 [PATCH 1/1 linux-next] IB/mthca: use swap() in mthca_make_profile() Fabian Frederick
[not found] ` <1433953911-23735-1-git-send-email-fabf-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
2015-06-12 15:24 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox