Re: [alsa-devel] [PATCH v4 08/15] soundwire: add initial definitions for sdw_master_device

From: Pierre-Louis Bossart
Date: Fri Dec 13 2019 - 18:25:30 EST



No, I mean the new MODULE_NAMESPACE() support that is in the kernel.
I'll move the greybus code to use it too, but when you are adding new
apis, it just makes sense to use it then as well.

Greg, would the patch below be what you had in mind?
Thanks
-Pierre


diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile
index 76a5c52b12b4..5bad8422887e 100644
--- a/drivers/soundwire/Makefile
+++ b/drivers/soundwire/Makefile
@@ -7,9 +7,11 @@ ccflags-y += -DDEBUG
#Bus Objs
soundwire-bus-objs := bus_type.o bus.o master.o slave.o mipi_disco.o stream.o
obj-$(CONFIG_SOUNDWIRE) += soundwire-bus.o
+ccflags-$(CONFIG_SOUNDWIRE) += -DDEFAULT_SYMBOL_NAMESPACE=SDW_CORE

soundwire-generic-allocation-objs := generic_bandwidth_allocation.o
obj-$(CONFIG_SOUNDWIRE_GENERIC_ALLOCATION) += soundwire-generic-allocation.o
+ccflags-$(CONFIG_SOUNDWIRE_GENERIC_ALLOCATION) += -DDEFAULT_SYMBOL_NAMESPACE=SDW_CORE

ifdef CONFIG_DEBUG_FS
soundwire-bus-objs += debugfs.o
@@ -18,6 +20,7 @@ endif
#Cadence Objs
soundwire-cadence-objs := cadence_master.o
obj-$(CONFIG_SOUNDWIRE_CADENCE) += soundwire-cadence.o
+ccflags-$(CONFIG_SOUNDWIRE_CADENCE) += -DDEFAULT_SYMBOL_NAMESPACE=SDW_CADENCE

#Intel driver
soundwire-intel-objs := intel.o
@@ -25,3 +28,4 @@ obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel.o

soundwire-intel-init-objs := intel_init.o
obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel-init.o
+ccflags-$(CONFIG_SOUNDWIRE_INTEL) += -DDEFAULT_SYMBOL_NAMESPACE=SDW_INTEL
diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index cf96532b0a8e..89ed97e303b9 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -1517,3 +1517,4 @@ EXPORT_SYMBOL(sdw_cdns_alloc_pdi);

MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("Cadence Soundwire Library");
+MODULE_IMPORT_NS(SDW_CORE);
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 0b510e198928..2be9c365d342 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1823,3 +1823,5 @@ EXPORT_SYMBOL(intel_sdw_driver);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_ALIAS("platform:int-sdw");
MODULE_DESCRIPTION("Intel Soundwire Master Driver");
+MODULE_IMPORT_NS(SDW_CADENCE);
+MODULE_IMPORT_NS(SDW_CORE);
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 834a09bafdcc..0685be32012d 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -432,3 +432,5 @@ EXPORT_SYMBOL(sdw_intel_exit);

MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("Intel Soundwire Init Library");
+MODULE_IMPORT_NS(SDW_CADENCE);
+MODULE_IMPORT_NS(SDW_CORE);