Skip to contentSkip to conversation

Fix warning for missing export.h in Hyper-V drivers

PATCH Applied Naman Jain 6 participants 13 messages Jun 11, 2025 – Jul 15, 2025

Subsystems (11)
Networking Network drivers x86 KVM +7 more subsystems
lore
Share & tools
lore

Naman Jain

author
#0 lore raw

cover Fix warning for missing export.h in Hyper-V drivers

When the kernel is compiled with W=1 option, a warning is reported
if a .c file exports a symbol but does not include export.h header
file. This warning was added in below patch, which merged recently:
commit a934a57a42f6 ("scripts/misc-check: check missing #include <linux/export.h> when W=1")

Fix this issue in Hyper-V drivers. This does not bring any functional changes.

The one in drivers/hv/vmbus_drv.c is going to be fixed with
https://lore.kernel.org/all/[email protected]/
so it is not included in this series.

Naman Jain (6):
Drivers: hv: Fix warnings for missing export.h header inclusion x86/hyperv: Fix warnings for missing export.h header inclusion
KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
clocksource: hyper-v: Fix warnings for missing export.h header
inclusion
PCI: hv: Fix warnings for missing export.h header inclusion
net: mana: Fix warnings for missing export.h header inclusion

 arch/x86/hyperv/hv_init.c                       | 1 +
 arch/x86/hyperv/irqdomain.c                     | 1 +
 arch/x86/hyperv/ivm.c                           | 1 +
 arch/x86/hyperv/nested.c                        | 1 +
 arch/x86/kvm/hyperv.c                           | 1 +
 arch/x86/kvm/kvm_onhyperv.c                     | 1 +
 drivers/clocksource/hyperv_timer.c              | 1 +
 drivers/hv/channel.c                            | 1 +
 drivers/hv/channel_mgmt.c                       | 1 +
 drivers/hv/hv_proc.c                            | 1 +
 drivers/hv/mshv_common.c                        | 1 +
 drivers/hv/mshv_root_hv_call.c                  | 1 +
 drivers/hv/ring_buffer.c                        | 1 +
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 1 +
 drivers/net/ethernet/microsoft/mana/mana_en.c   | 1 +
 drivers/pci/controller/pci-hyperv-intf.c        | 1 +
 16 files changed, 16 insertions(+)

base-commit: 475c850a7fdd0915b856173186d5922899d65686

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/6 Drivers: hv: Fix warnings for missing export.h header inclusion

Fix below warning in Hyper-V drivers that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/hv/channel.c           | 1 +
 drivers/hv/channel_mgmt.c      | 1 +
 drivers/hv/hv_proc.c           | 1 +
 drivers/hv/mshv_common.c       | 1 +
 drivers/hv/mshv_root_hv_call.c | 1 +
 drivers/hv/ring_buffer.c       | 1 +
 6 files changed, 6 insertions(+)
drivers/hv/channel.c +1 -0
index 35f26fa1ffe7..7c7c66e0dc3f 100644
@@ -18,6 +18,7 @@
 #include <linux/uio.h>
 #include <linux/interrupt.h>
 #include <linux/set_memory.h>
+#include <linux/export.h>
 #include <asm/page.h>
 #include <asm/mshyperv.h>
 
drivers/hv/channel_mgmt.c +1 -0
index 6e084c207414..65dd299e2944 100644
@@ -20,6 +20,7 @@
 #include <linux/delay.h>
 #include <linux/cpu.h>
 #include <linux/hyperv.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 #include <linux/sched/isolation.h>
 
drivers/hv/hv_proc.c +1 -0
index 7d7ecb6f6137..fbb4eb3901bb 100644
@@ -6,6 +6,7 @@
 #include <linux/slab.h>
 #include <linux/cpuhotplug.h>
 #include <linux/minmax.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 /*
drivers/hv/mshv_common.c +1 -0
index 2575e6d7a71f..6f227a8a5af7 100644
@@ -13,6 +13,7 @@
 #include <linux/mm.h>
 #include <asm/mshyperv.h>
 #include <linux/resume_user_mode.h>
+#include <linux/export.h>
 
 #include "mshv.h"
 
drivers/hv/mshv_root_hv_call.c +1 -0
index a222a16107f6..c9c274f29c3c 100644
@@ -9,6 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "mshv_root.h"
drivers/hv/ring_buffer.c +1 -0
index 3c9b02471760..23ce1fb70de1 100644
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/prefetch.h>
 #include <linux/io.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "hyperv_vmbus.h"
Signature · 1 line
2.34.1
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] Drivers: hv: Fix warnings for missing export.h header inclusion

Quoted 80 lines · Naman Jain

Fix below warning in Hyper-V drivers that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/hv/channel.c           | 1 +
 drivers/hv/channel_mgmt.c      | 1 +
 drivers/hv/hv_proc.c           | 1 +
 drivers/hv/mshv_common.c       | 1 +
 drivers/hv/mshv_root_hv_call.c | 1 +
 drivers/hv/ring_buffer.c       | 1 +
 6 files changed, 6 insertions(+)
drivers/hv/channel.c +1 -0
index 35f26fa1ffe7..7c7c66e0dc3f 100644
@@ -18,6 +18,7 @@
 #include <linux/uio.h>
 #include <linux/interrupt.h>
 #include <linux/set_memory.h>
+#include <linux/export.h>
 #include <asm/page.h>
 #include <asm/mshyperv.h>
 
drivers/hv/channel_mgmt.c +1 -0
index 6e084c207414..65dd299e2944 100644
@@ -20,6 +20,7 @@
 #include <linux/delay.h>
 #include <linux/cpu.h>
 #include <linux/hyperv.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 #include <linux/sched/isolation.h>
 
drivers/hv/hv_proc.c +1 -0
index 7d7ecb6f6137..fbb4eb3901bb 100644
@@ -6,6 +6,7 @@
 #include <linux/slab.h>
 #include <linux/cpuhotplug.h>
 #include <linux/minmax.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 /*
drivers/hv/mshv_common.c +1 -0
index 2575e6d7a71f..6f227a8a5af7 100644
@@ -13,6 +13,7 @@
 #include <linux/mm.h>
 #include <asm/mshyperv.h>
 #include <linux/resume_user_mode.h>
+#include <linux/export.h>
 
 #include "mshv.h"
 
drivers/hv/mshv_root_hv_call.c +1 -0
index a222a16107f6..c9c274f29c3c 100644
@@ -9,6 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "mshv_root.h"
drivers/hv/ring_buffer.c +0 -0
index 3c9b02471760..23ce1fb70de1 100644

drivers/hv/ring_buffer.c line 24

Quoted 7 lines
drivers/hv/ring_buffer.c +1 -0
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/prefetch.h>
 #include <linux/io.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "hyperv_vmbus.h"
author
#3 lore raw

PATCH 2/6 x86/hyperv: Fix warnings for missing export.h header inclusion

In reply to Naman Jain

Fix below warning in Hyper-V drivers that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 arch/x86/hyperv/hv_init.c   | 1 +
 arch/x86/hyperv/irqdomain.c | 1 +
 arch/x86/hyperv/ivm.c       | 1 +
 arch/x86/hyperv/nested.c    | 1 +
 4 files changed, 4 insertions(+)
arch/x86/hyperv/hv_init.c +1 -0
index 3d1d3547095a..afdbda2dd7b7 100644
@@ -34,6 +34,7 @@
 #include <linux/syscore_ops.h>
 #include <clocksource/hyperv_timer.h>
 #include <linux/highmem.h>
+#include <linux/export.h>
 
 void *hv_hypercall_pg;
 EXPORT_SYMBOL_GPL(hv_hypercall_pg);
arch/x86/hyperv/irqdomain.c +1 -0
index 31f0d29cbc5e..f7627bc8fe49 100644
@@ -10,6 +10,7 @@
 
 #include <linux/pci.h>
 #include <linux/irq.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 static int hv_map_interrupt(union hv_device_id device_id, bool level,
arch/x86/hyperv/ivm.c +1 -0
index e93a2f488ff7..ade6c665c97e 100644
@@ -10,6 +10,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/cpu.h>
+#include <linux/export.h>
 #include <asm/svm.h>
 #include <asm/sev.h>
 #include <asm/io.h>
arch/x86/hyperv/nested.c +1 -0
index 1083dc8646f9..8ccbb7c4fc27 100644
@@ -11,6 +11,7 @@
 
 
 #include <linux/types.h>
+#include <linux/export.h>
 #include <hyperv/hvhdk.h>
 #include <asm/mshyperv.h>
 #include <asm/tlbflush.h>
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 3/6 KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion

In reply to Naman Jain

Fix below warning in Hyper-V drivers that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 arch/x86/kvm/hyperv.c       | 1 +
 arch/x86/kvm/kvm_onhyperv.c | 1 +
 2 files changed, 2 insertions(+)
arch/x86/kvm/hyperv.c +1 -0
index 24f0318c50d7..09f9de4555dd 100644
@@ -33,6 +33,7 @@
 #include <linux/sched/cputime.h>
 #include <linux/spinlock.h>
 #include <linux/eventfd.h>
+#include <linux/export.h>
 
 #include <asm/apicdef.h>
 #include <asm/mshyperv.h>
arch/x86/kvm/kvm_onhyperv.c +1 -0
index ded0bd688c65..ba45f8364187 100644
@@ -5,6 +5,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "hyperv.h"
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion

Quoted 1 line · Naman Jain

Fix below warning in Hyper-V drivers

KVM is quite obviously not a Hyper-V driver.

Quoted 3 lines

that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it. * warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

NAK. I agree with Heiko[*], this is absurd. And if the W=1 change isn't reverted for some reason, I'd rather "fix" all of KVM in one shot, not update random files just because of their name.

Sorry.

[*] https://lore.kernel.org/all/[email protected]

Quoted 33 lines
---
 arch/x86/kvm/hyperv.c       | 1 +
 arch/x86/kvm/kvm_onhyperv.c | 1 +
 2 files changed, 2 insertions(+)
arch/x86/kvm/hyperv.c +1 -0
index 24f0318c50d7..09f9de4555dd 100644
@@ -33,6 +33,7 @@
 #include <linux/sched/cputime.h>
 #include <linux/spinlock.h>
 #include <linux/eventfd.h>
+#include <linux/export.h>
 
 #include <asm/apicdef.h>
 #include <asm/mshyperv.h>
arch/x86/kvm/kvm_onhyperv.c +1 -0
index ded0bd688c65..ba45f8364187 100644
@@ -5,6 +5,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kvm_host.h>
+#include <linux/export.h>
 #include <asm/mshyperv.h>
 
 #include "hyperv.h"
Signature · 1 line
2.34.1
author
#6 lore raw

Re: [PATCH 3/6] KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion

Quoted 9 lines · Sean Christopherson
Quoted 1 line · Naman Jain

Fix below warning in Hyper-V drivers

KVM is quite obviously not a Hyper-V driver.

Quoted 3 lines

that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it. * warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

Quoted 8 lines

NAK. I agree with Heiko[*], this is absurd. And if the W=1 change isn't reverted for some reason, I'd rather "fix" all of KVM in one shot, not update random files just because of their name.

Sorry.

[*] https://lore.kernel.org/all/[email protected]

Sure, thanks for reviewing.

Regards,
Naman

Quoted 33 lines
Quoted 33 lines
---
  arch/x86/kvm/hyperv.c       | 1 +
  arch/x86/kvm/kvm_onhyperv.c | 1 +
  2 files changed, 2 insertions(+)
arch/x86/kvm/hyperv.c +1 -0
index 24f0318c50d7..09f9de4555dd 100644
@@ -33,6 +33,7 @@
  #include <linux/sched/cputime.h>
  #include <linux/spinlock.h>
  #include <linux/eventfd.h>
+#include <linux/export.h>
 
  #include <asm/apicdef.h>
  #include <asm/mshyperv.h>
arch/x86/kvm/kvm_onhyperv.c +1 -0
index ded0bd688c65..ba45f8364187 100644
@@ -5,6 +5,7 @@
  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
  #include <linux/kvm_host.h>
+#include <linux/export.h>
  #include <asm/mshyperv.h>
 
  #include "hyperv.h"
Signature · 1 line
2.34.1
author
#7 lore raw

PATCH 4/6 clocksource: hyper-v: Fix warnings for missing export.h header inclusion

In reply to Naman Jain

Fix below warning in Hyper-V clocksource driver that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/clocksource/hyperv_timer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clocksource/hyperv_timer.c +1 -0
index 09549451dd51..2edc13ca184e 100644
@@ -22,6 +22,7 @@
 #include <linux/irq.h>
 #include <linux/acpi.h>
 #include <linux/hyperv.h>
+#include <linux/export.h>
 #include <clocksource/hyperv_timer.h>
 #include <hyperv/hvhdk.h>
 #include <asm/mshyperv.h>
Signature · 1 line
2.34.1
Acked-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] clocksource: hyper-v: Fix warnings for missing export.h header inclusion

Quoted 15 lines · Naman Jain

Fix below warning in Hyper-V clocksource driver that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/clocksource/hyperv_timer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clocksource/hyperv_timer.c +0 -0
index 09549451dd51..2edc13ca184e 100644

drivers/clocksource/hyperv_timer.c line 28

Quoted 7 lines
drivers/clocksource/hyperv_timer.c +1 -0
@@ -22,6 +22,7 @@
 #include <linux/irq.h>
 #include <linux/acpi.h>
 #include <linux/hyperv.h>
+#include <linux/export.h>
 #include <clocksource/hyperv_timer.h>
 #include <hyperv/hvhdk.h>
 #include <asm/mshyperv.h>
Quoted 3 lines
Signature · 1 line
2.34.1
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
author
#9 lore raw

PATCH 5/6 PCI: hv: Fix warnings for missing export.h header inclusion

In reply to Naman Jain

Fix below warning in Hyper-V PCI driver that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/pci/controller/pci-hyperv-intf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-hyperv-intf.c +1 -0
index cc96be450360..28b3e93d31c0 100644
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/hyperv.h>
+#include <linux/export.h>
 
 struct hyperv_pci_block_ops hvpci_block_ops;
 EXPORT_SYMBOL_GPL(hvpci_block_ops);
Signature · 1 line
2.34.1
author
#10 lore raw

PATCH 6/6 net: mana: Fix warnings for missing export.h header inclusion

In reply to Naman Jain

Fix below warning in Hyper-V's MANA drivers that comes when kernel is compiled with W=1 option. Include export.h in driver files to fix it.
* warning: EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing

---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 1 +
 drivers/net/ethernet/microsoft/mana/mana_en.c   | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/microsoft/mana/gdma_main.c +1 -0
index 3504507477c6..019e32b60043 100644
@@ -6,6 +6,7 @@
 #include <linux/pci.h>
 #include <linux/utsname.h>
 #include <linux/version.h>
+#include <linux/export.h>
 
 #include <net/mana/mana.h>
 
drivers/net/ethernet/microsoft/mana/mana_en.c +1 -0
index ccd2885c939e..faad1cb880f8 100644
@@ -10,6 +10,7 @@
 #include <linux/filter.h>
 #include <linux/mm.h>
 #include <linux/pci.h>
+#include <linux/export.h>
 
 #include <net/checksum.h>
 #include <net/ip6_checksum.h>
Signature · 1 line
2.34.1
Reviewed-by on the v1 series
#11 lore raw
In reply to Naman Jain
Quoted 40 lines · Naman Jain

When the kernel is compiled with W=1 option, a warning is reported
if a .c file exports a symbol but does not include export.h header
file. This warning was added in below patch, which merged recently:
commit a934a57a42f6 ("scripts/misc-check: check missing #include <linux/export.h> when W=1")

Fix this issue in Hyper-V drivers. This does not bring any functional changes.

The one in drivers/hv/vmbus_drv.c is going to be fixed with
https://lore.kernel.org/all/[email protected]/
so it is not included in this series.

Naman Jain (6):
Drivers: hv: Fix warnings for missing export.h header inclusion x86/hyperv: Fix warnings for missing export.h header inclusion
KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
clocksource: hyper-v: Fix warnings for missing export.h header
inclusion
PCI: hv: Fix warnings for missing export.h header inclusion
net: mana: Fix warnings for missing export.h header inclusion

 arch/x86/hyperv/hv_init.c                       | 1 +
 arch/x86/hyperv/irqdomain.c                     | 1 +
 arch/x86/hyperv/ivm.c                           | 1 +
 arch/x86/hyperv/nested.c                        | 1 +
 arch/x86/kvm/hyperv.c                           | 1 +
 arch/x86/kvm/kvm_onhyperv.c                     | 1 +
 drivers/clocksource/hyperv_timer.c              | 1 +
 drivers/hv/channel.c                            | 1 +
 drivers/hv/channel_mgmt.c                       | 1 +
 drivers/hv/hv_proc.c                            | 1 +
 drivers/hv/mshv_common.c                        | 1 +
 drivers/hv/mshv_root_hv_call.c                  | 1 +
 drivers/hv/ring_buffer.c                        | 1 +
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 1 +
 drivers/net/ethernet/microsoft/mana/mana_en.c   | 1 +
 drivers/pci/controller/pci-hyperv-intf.c        | 1 +
 16 files changed, 16 insertions(+)
Quoted 4 lines

base-commit: 475c850a7fdd0915b856173186d5922899d65686

Signature · 1 line
2.34.1

For the series,

maintainer Applied
#12 lore raw
In reply to Naman Jain
Quoted 12 lines · Naman Jain

When the kernel is compiled with W=1 option, a warning is reported
if a .c file exports a symbol but does not include export.h header
file. This warning was added in below patch, which merged recently:
commit a934a57a42f6 ("scripts/misc-check: check missing #include <linux/export.h> when W=1")

Fix this issue in Hyper-V drivers. This does not bring any functional changes.

The one in drivers/hv/vmbus_drv.c is going to be fixed with
https://lore.kernel.org/all/[email protected]/
so it is not included in this series.

Quoted 8 lines

Naman Jain (6):
Drivers: hv: Fix warnings for missing export.h header inclusion x86/hyperv: Fix warnings for missing export.h header inclusion
KVM: x86: hyper-v: Fix warnings for missing export.h header inclusion
clocksource: hyper-v: Fix warnings for missing export.h header
inclusion
PCI: hv: Fix warnings for missing export.h header inclusion
net: mana: Fix warnings for missing export.h header inclusion

I applied all patches expect the KVM one to hyperv-fixes. Thanks.