linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: conditionally build hv_get_nested_reg()
@ 2023-01-14  1:56 Tom Rix
  2023-01-17 10:11 ` Jinank Jain
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rix @ 2023-01-14  1:56 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, tglx, mingo, bp, dave.hansen, hpa,
	mikelley, jinankjain, nunodasneves
  Cc: x86, linux-hyperv, linux-kernel, Tom Rix

cppcheck reports
[arch/x86/kernel/cpu/mshyperv.c:44]: (style) The function 'hv_get_nested_reg' is never used.

hv_get_nested_reg() is built unconditially but is only used conditionally in
hv_get_register() and hv_set_register() by CONFIG_HYPERV.

Move the conditional #if to also include hv_get_nested_reg()

Fixes: 89acd9b2ff8e ("Drivers: hv: Setup synic registers in case of nested root partition")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 arch/x86/kernel/cpu/mshyperv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index b8bb13daacf7..9ca202970569 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -41,6 +41,7 @@ bool hv_root_partition;
 bool hv_nested;
 struct ms_hyperv_info ms_hyperv;
 
+#if IS_ENABLED(CONFIG_HYPERV)
 static inline unsigned int hv_get_nested_reg(unsigned int reg)
 {
 	switch (reg) {
@@ -61,7 +62,6 @@ static inline unsigned int hv_get_nested_reg(unsigned int reg)
 	}
 }
 
-#if IS_ENABLED(CONFIG_HYPERV)
 u64 hv_get_non_nested_register(unsigned int reg)
 {
 	u64 value;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/hyperv: conditionally build hv_get_nested_reg()
  2023-01-14  1:56 [PATCH] x86/hyperv: conditionally build hv_get_nested_reg() Tom Rix
@ 2023-01-17 10:11 ` Jinank Jain
  2023-01-17 13:12   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Jinank Jain @ 2023-01-17 10:11 UTC (permalink / raw)
  To: Tom Rix, kys, haiyangz, wei.liu, decui, tglx, mingo, bp,
	dave.hansen, hpa, mikelley, nunodasneves
  Cc: x86, linux-hyperv, linux-kernel

Reviewed-by: Jinank Jain <jinankjain@linux.microsoft.com>

On 1/14/2023 7:26 AM, Tom Rix wrote:
> cppcheck reports
> [arch/x86/kernel/cpu/mshyperv.c:44]: (style) The function 'hv_get_nested_reg' is never used.
>
> hv_get_nested_reg() is built unconditially but is only used conditionally in
> hv_get_register() and hv_set_register() by CONFIG_HYPERV.
>
> Move the conditional #if to also include hv_get_nested_reg()
>
> Fixes: 89acd9b2ff8e ("Drivers: hv: Setup synic registers in case of nested root partition")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   arch/x86/kernel/cpu/mshyperv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index b8bb13daacf7..9ca202970569 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -41,6 +41,7 @@ bool hv_root_partition;
>   bool hv_nested;
>   struct ms_hyperv_info ms_hyperv;
>   
> +#if IS_ENABLED(CONFIG_HYPERV)
>   static inline unsigned int hv_get_nested_reg(unsigned int reg)
>   {
>   	switch (reg) {
> @@ -61,7 +62,6 @@ static inline unsigned int hv_get_nested_reg(unsigned int reg)
>   	}
>   }
>   
> -#if IS_ENABLED(CONFIG_HYPERV)
>   u64 hv_get_non_nested_register(unsigned int reg)
>   {
>   	u64 value;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/hyperv: conditionally build hv_get_nested_reg()
  2023-01-17 10:11 ` Jinank Jain
@ 2023-01-17 13:12   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2023-01-17 13:12 UTC (permalink / raw)
  To: Jinank Jain
  Cc: Tom Rix, kys, haiyangz, wei.liu, decui, tglx, mingo, bp,
	dave.hansen, hpa, mikelley, nunodasneves, x86, linux-hyperv,
	linux-kernel

On Tue, Jan 17, 2023 at 03:41:18PM +0530, Jinank Jain wrote:
> Reviewed-by: Jinank Jain <jinankjain@linux.microsoft.com>
> 

I will just fold this into the buggy patch since that has not been sent
to Linus.

Thanks Tom and Jinank.

> On 1/14/2023 7:26 AM, Tom Rix wrote:
> > cppcheck reports
> > [arch/x86/kernel/cpu/mshyperv.c:44]: (style) The function 'hv_get_nested_reg' is never used.
> > 
> > hv_get_nested_reg() is built unconditially but is only used conditionally in
> > hv_get_register() and hv_set_register() by CONFIG_HYPERV.
> > 
> > Move the conditional #if to also include hv_get_nested_reg()
> > 
> > Fixes: 89acd9b2ff8e ("Drivers: hv: Setup synic registers in case of nested root partition")
> > Signed-off-by: Tom Rix <trix@redhat.com>
> > ---
> >   arch/x86/kernel/cpu/mshyperv.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> > index b8bb13daacf7..9ca202970569 100644
> > --- a/arch/x86/kernel/cpu/mshyperv.c
> > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > @@ -41,6 +41,7 @@ bool hv_root_partition;
> >   bool hv_nested;
> >   struct ms_hyperv_info ms_hyperv;
> > +#if IS_ENABLED(CONFIG_HYPERV)
> >   static inline unsigned int hv_get_nested_reg(unsigned int reg)
> >   {
> >   	switch (reg) {
> > @@ -61,7 +62,6 @@ static inline unsigned int hv_get_nested_reg(unsigned int reg)
> >   	}
> >   }
> > -#if IS_ENABLED(CONFIG_HYPERV)
> >   u64 hv_get_non_nested_register(unsigned int reg)
> >   {
> >   	u64 value;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-17 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-14  1:56 [PATCH] x86/hyperv: conditionally build hv_get_nested_reg() Tom Rix
2023-01-17 10:11 ` Jinank Jain
2023-01-17 13:12   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).