Re: [PATCH v4 12/12] RFC: watchdog: export core symbols in WATCHDOG_CORE namespace

From: Guenter Roeck
Date: Wed Sep 04 2019 - 08:12:50 EST


On 9/4/19 1:45 AM, Masahiro Yamada wrote:
On Wed, Sep 4, 2019 at 1:10 AM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:

On Tue, Sep 03, 2019 at 04:06:38PM +0100, Matthias Maennich wrote:
Modules using symbols from the WATCHDOG_CORE namespace are required to
explicitly import the namespace. This patch was generated with the
following steps and serves as a reference to use the symbol namespace
feature:

1) Use EXPORT_SYMBOL_NS* macros instead of EXPORT_SYMBOL* for symbols
in watchdog_core.c
2) make (see warnings during modpost about missing imports)
3) make nsdeps

I used 'allmodconfig' for the above steps to ensure all occurrences are
patched.

Defining DEFAULT_SYMBOL_NAMESPACE in the Makefile is not trivial in this
case as not only watchdog_core is defined in drivers/watchdog/Makefile.
Hence this patch uses the variant of using the EXPORT_SYMBOL_NS* macros
to export into a different namespace.

An alternative to this patch would be a single definition line before
any use of EXPORT_SYMBOL*:
#define DEFAULT_SYMBOL_NAMESPACE WATCHDOG_CORE

This patch serves as a reference on how to use the symbol namespaces.

Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Matthias Maennich <maennich@xxxxxxxxxx>

As mentioned before, I am opposed to this set of changes. I don't see
the point of restricting the use of exported symbols in WATCHDOG_CORE.

Guenter


I agree.

I do not like this patch set either.


Note that I don't object to the patch set in general. There may be symbols
which only need be exported in the context of a single subsystem or even
driver (if a driver consists of more than one module). For example, a mfd
driver may export symbols which should only be called by its client drivers.
In such a situation, it may well be beneficial to limit the use of exported
symbols.

I am not sure what good that does in practice (if I understand correctly,
a driver only has to declare that it wants to use a restricted use symbol
if it wants to use it), but that is a different question.

Guenter