diff mbox series

[5/5] KVM: x86: Clean up redundant pr_fmt(fmt) macro definition for svm

Message ID 20210809093410.59304-6-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Clean up redundant macro definitions | expand

Commit Message

Like Xu Aug. 9, 2021, 9:34 a.m. UTC
From: Like Xu <likexu@tencent.com>

The svm specific pr_fmt(fmt) macro is repeatedly defined in svm code
and the new one has never been used outside the svm context.

Let's move it to svm.h without any intended functional changes.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/kvm/svm/avic.c   | 2 --
 arch/x86/kvm/svm/nested.c | 2 --
 arch/x86/kvm/svm/svm.c    | 2 --
 arch/x86/kvm/svm/svm.h    | 3 +++
 4 files changed, 3 insertions(+), 6 deletions(-)

Comments

Paolo Bonzini Aug. 10, 2021, 5:48 p.m. UTC | #1
On 09/08/21 11:34, Like Xu wrote:
> +#undef pr_fmt
> +#define pr_fmt(fmt) "SVM: " fmt
> +
>   #include <linux/kvm_types.h>

Why do you need the #undef?

Paolo
Like Xu Aug. 12, 2021, 1 p.m. UTC | #2
On 11/8/2021 1:48 am, Paolo Bonzini wrote:
> On 09/08/21 11:34, Like Xu wrote:
>> +#undef pr_fmt
>> +#define pr_fmt(fmt) "SVM: " fmt
>> +
>>   #include <linux/kvm_types.h>
> 
> Why do you need the #undef?
> 
> Paolo
> 
>
I've seen most of the redefinition code for 'pr_fmt' like this,
for example:

- 3bfaf95cb1fe81872df884956c704469e68a5bee
- d157aa0fb241646e8818f699653ed983e6581b11
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index a8ad78a2faa1..8b055f9ad9fe 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -12,8 +12,6 @@ 
  *   Avi Kivity   <avi@qumranet.com>
  */
 
-#define pr_fmt(fmt) "SVM: " fmt
-
 #include <linux/kvm_types.h>
 #include <linux/hashtable.h>
 #include <linux/amd-iommu.h>
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 57c288ba6ef0..3080776a55a5 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -12,8 +12,6 @@ 
  *   Avi Kivity   <avi@qumranet.com>
  */
 
-#define pr_fmt(fmt) "SVM: " fmt
-
 #include <linux/kvm_types.h>
 #include <linux/kvm_host.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 2b6632d4c76f..4a3f8ef56daa 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1,5 +1,3 @@ 
-#define pr_fmt(fmt) "SVM: " fmt
-
 #include <linux/kvm_host.h>
 
 #include "irq.h"
diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
index bd0fe94c2920..76d5fe3f00dc 100644
--- a/arch/x86/kvm/svm/svm.h
+++ b/arch/x86/kvm/svm/svm.h
@@ -15,6 +15,9 @@ 
 #ifndef __SVM_SVM_H
 #define __SVM_SVM_H
 
+#undef pr_fmt
+#define pr_fmt(fmt) "SVM: " fmt
+
 #include <linux/kvm_types.h>
 #include <linux/kvm_host.h>
 #include <linux/bits.h>