linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] asm-generic: Remove unnecessary ‘0’ values from guest_id
@ 2022-09-19  1:51 Li zeming
  2022-09-19 15:33 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Li zeming @ 2022-09-19  1:51 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu; +Cc: linux-hyperv, linux-arch, linux-kernel, Li zeming

The file variable is assigned guest_id, it does not need to be initialized.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 include/asm-generic/mshyperv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
index c05d2ce9b6cd..cd5ce86c218a 100644
--- a/include/asm-generic/mshyperv.h
+++ b/include/asm-generic/mshyperv.h
@@ -108,7 +108,7 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
 static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
 				       __u64 d_info2)
 {
-	__u64 guest_id = 0;
+	__u64 guest_id;
 
 	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
 	guest_id |= (d_info1 << 48);
-- 
2.18.2


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

* Re: [PATCH] asm-generic: Remove unnecessary ‘0’ values from guest_id
  2022-09-19  1:51 [PATCH] asm-generic: Remove unnecessary ‘0’ values from guest_id Li zeming
@ 2022-09-19 15:33 ` Vitaly Kuznetsov
  2022-09-20  1:21   ` Li zeming
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2022-09-19 15:33 UTC (permalink / raw)
  To: Li zeming
  Cc: linux-hyperv, linux-arch, linux-kernel, Li zeming, kys, haiyangz,
	wei.liu

Li zeming <zeming@nfschina.com> writes:

> The file variable is assigned guest_id, it does not need to be initialized.
>
> Signed-off-by: Li zeming <zeming@nfschina.com>
> ---
>  include/asm-generic/mshyperv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h
> index c05d2ce9b6cd..cd5ce86c218a 100644
> --- a/include/asm-generic/mshyperv.h
> +++ b/include/asm-generic/mshyperv.h
> @@ -108,7 +108,7 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
>  static inline  __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version,
>  				       __u64 d_info2)
>  {
> -	__u64 guest_id = 0;
> +	__u64 guest_id;
>  
>  	guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48);
>  	guest_id |= (d_info1 << 48);

The initializer is certainly not needed, however, if we are to do some
changes, let's be bold. Suggestions:

1) Stop using "__u64" type, "u64" is good enough.

2) Drop all the parameters from the function, both call sites look like

 generate_guest_id(0, LINUX_VERSION_CODE, 0);

3) Rename the function to make it clear it's Hyper-V related,
e.g. "hv_generate_guest_id()".

...

-- 
Vitaly


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

* Re: [PATCH] asm-generic: Remove unnecessary ‘0’ values from guest_id
  2022-09-19 15:33 ` Vitaly Kuznetsov
@ 2022-09-20  1:21   ` Li zeming
  0 siblings, 0 replies; 3+ messages in thread
From: Li zeming @ 2022-09-20  1:21 UTC (permalink / raw)
  To: vkuznets
  Cc: haiyangz, kys, linux-arch, linux-hyperv, linux-kernel, wei.liu, zeming


Thank you very much for your suggestion. I will submit the new version after passing the test code.


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

end of thread, other threads:[~2022-09-20  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  1:51 [PATCH] asm-generic: Remove unnecessary ‘0’ values from guest_id Li zeming
2022-09-19 15:33 ` Vitaly Kuznetsov
2022-09-20  1:21   ` Li zeming

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).