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

From: Pierre-Louis Bossart
Date: Mon Dec 16 2019 - 10:45:11 EST




On 12/14/19 2:27 AM, Greg KH wrote:
On Fri, Dec 13, 2019 at 05:25:23PM -0600, Pierre-Louis Bossart wrote:

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

Don't use ccflags, just use the correct MODULE_EXPORT_NS() tag instead.

The documentation [1] states

"
Defining namespaces for all symbols of a subsystem can be very verbose and may become hard to maintain. Therefore a default define (DEFAULT_SYMBOL_NAMESPACE) is been provided, that, if set, will become the default for all EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL() macro expansions that do not specify a namespace.
"

If the ccflags option is not supported or no longer desired, it'd be worth updating the documentation for dummies like me. I took the wording as a hint to avoid using MODULE_EXPORT_NS.

And "SDW_CORE" is odd, "SOUNDWIRE" instead?

'sdw' is the prefix used everywhere for SoundWire symbols.

[1] https://www.kernel.org/doc/html/latest/core-api/symbol-namespaces.html