x86/UV: Fix conditional in gru_exit
PATCH 1/1 x86/UV: Fix conditional in gru_exit
Fix conditional in gru_exit to match gru_init.
--- drivers/misc/sgi-gru/grufile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/sgi-gru/grufile.c +1 -1
@@ -573,7 +573,7 @@ exit0: static void __exit gru_exit(void) { -if (!is_uv_system ()) +if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ()))return ;gru_teardown_tlb_irqs ();
Quoted 12 lines · Dimitri Sivanich
Fix conditional in
gru_exitto matchgru_init.Signed-off-by Dimitri Sivanich <[email protected]>--- drivers/misc/sgi-gru/grufile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux/drivers/misc/sgi-gru/grufile.c
===================================================================
drivers/misc/sgi-gru/grufile.c exit0: · line 577
Quoted 6 lines
drivers/misc/sgi-gru/grufile.c +1
-1@@ -573,7 +573,7 @@ exit0: static void __exit gru_exit(void) { -if (!is_uv_system ()) +if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ()))return ;
Such an amalgation of three system specific conditionals is disgusting, please at minimum factor out a helper routine so that such mismatches cannot happen.
Thanks,
Ingo
Quoted 8 lines · Ingo Molnar
Review
Quoted 3 lines
(quoted diff) +1
-1- if (!is_uv_system()) + if (!is_uv_system() || (is_uvx_hub() && !is_uv2_hub())) return;Such an amalgation of three system specific conditionals is disgusting, please at minimum factor out a helper routine so that such mismatches cannot happen.
Agreed. Here's a new patch.
Fix supported system conditional in gru_exit.
--- drivers/misc/sgi-gru/grufile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/misc/sgi-gru/grufile.c +6 -2
@@ -58,6 +58,10 @@ static int max_user_cbrs, max_user_dsr_bstatic struct miscdevice gru_miscdev; +static int gru_unsupported (void ) +{ +return !is_uv_system () || (is_uvx_hub () && !is_uv2_hub ()); +}/* * gru_vma_close
@@ -518,7 +522,7 @@ static int __init gru_init(void) {int ret; -if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ())) +if (gru_unsupported ())return 0 ;#if definedCONFIG_IA64
@@ -573,7 +577,7 @@ exit0: static void __exit gru_exit(void) { -if (!is_uv_system ()) +if (gru_unsupported ())return ;gru_teardown_tlb_irqs ();
Quoted 24 lines · Dimitri Sivanich
Quoted 8 lines · Ingo Molnar
drivers/misc/sgi-gru/grufile.c exit0: · line 581
Quoted 3 lines
drivers/misc/sgi-gru/grufile.c +1
-1-if (!is_uv_system ()) +if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ()))return ;Such an amalgation of three system specific conditionals is disgusting, please at minimum factor out a helper routine so that such mismatches cannot happen.
Agreed. Here's a new patch.
Fix supported system conditional in
gru_exit.Signed-off-by Dimitri Sivanich <[email protected]>--- drivers/misc/sgi-gru/grufile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)Index:
linux/drivers/misc/sgi-gru/grufile.c
===================================================================
drivers/misc/sgi-gru/grufile.c static int max_user_cbrs, max_user_dsr_b · line 64
Quoted 7 lines
drivers/misc/sgi-gru/grufile.c +4
-0@@ -58,6 +58,10 @@ static int max_user_cbrs, max_user_dsr_bstatic struct miscdevice gru_miscdev; +static int gru_unsupported (void ) +{ +return !is_uv_system () || (is_uvx_hub () && !is_uv2_hub ()); +}
So the usual pattern is to introduce simple patterns, without logic operations in their name. I.e. "gru_supported()" would be more natural than "gru_not_supported()" or gru_unsupported()".
Thanks,
Ingo
Quoted 11 lines · Ingo Molnar
Review
Quoted 4 lines · Dimitri Sivanich
(quoted diff) +4
-0+static int gru_unsupported(void) +{ + return !is_uv_system() || (is_uvx_hub() && !is_uv2_hub()); +}So the usual pattern is to introduce simple patterns, without logic operations in their name. I.e. "
gru_supported()" would be more natural than "gru_not_supported()" orgru_unsupported()".
OK. Here's a revised version.
Fix supported system conditional in gru_exit.
--- drivers/misc/sgi-gru/grufile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/misc/sgi-gru/grufile.c +8 -3
@@ -6,7 +6,7 @@* This file supports the user system call for file open, close, mmap, etc. * This also incudes the driver initialization code. * -* Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. +* Copyright (c) 2008-2014 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -58,6 +58,11 @@ static int max_user_cbrs, max_user_dsr_bstatic struct miscdevice gru_miscdev; +static int gru_supported (void ) +{ +return is_uv_system () && + (uv_hub_info->hub_revision <UV3_HUB_REVISION_BASE ); +}/* * gru_vma_close
@@ -518,7 +523,7 @@ static int __init gru_init(void) {int ret; -if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ())) +if (!gru_supported ())return 0 ;#if definedCONFIG_IA64
@@ -573,7 +578,7 @@ exit0: static void __exit gru_exit(void) { -if (!is_uv_system ()) +if (!gru_supported ())return ;gru_teardown_tlb_irqs ();
tip-bot for Dimitri Sivanich
merge bot[tip:x86/uv] x86/UV: Fix conditional in gru_exit()
x86/UV: Fix conditional in gru_exit()
Commit-ID: fe455b17de6c881eecf4f9784c3b0483a5e3d19e Gitweb: http://git.kernel.org/tip/fe455b17de6c881eecf4f9784c3b0483a5e3d19e Author: Dimitri Sivanich <[email protected]> AuthorDate: Mon, 31 Mar 2014 10:23:20 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 1 Apr 2014 12:10:45 +0200
x86/UV: Fix conditional in gru_exit()
Fix supported system conditional in gru_exit(), in preparation for UV3.
--- drivers/misc/sgi-gru/grufile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/misc/sgi-gru/grufile.c +8 -3
@@ -6,7 +6,7 @@* This file supports the user system call for file open, close, mmap, etc. * This also incudes the driver initialization code. * -* Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. +* Copyright (c) 2008-2014 Silicon Graphics, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -58,6 +58,11 @@ static int max_user_cbrs, max_user_dsr_bytes;static struct miscdevice gru_miscdev; +static int gru_supported (void ) +{ +return is_uv_system () && + (uv_hub_info->hub_revision <UV3_HUB_REVISION_BASE ); +}/* * gru_vma_close
@@ -518,7 +523,7 @@ static int __init gru_init(void) {int ret; -if (!is_uv_system () || (is_uvx_hub () && !is_uv2_hub ())) +if (!gru_supported ())return 0 ;#if definedCONFIG_IA64
@@ -573,7 +578,7 @@ exit0: static void __exit gru_exit(void) { -if (!is_uv_system ()) +if (!gru_supported ())return ;gru_teardown_tlb_irqs ();