diff mbox series

[2/2] pwm: lpss: Define DEFAULT_SYMBOL_NAMESPACE earlier

Message ID 9f0e30c514a846aec72655a52deaed276467a07e.1733245406.git.ukleinek@kernel.org (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series pwm: lpss: module namespace fixes | expand

Commit Message

Uwe Kleine-König Dec. 3, 2024, 5:16 p.m. UTC
DEFAULT_SYMBOL_NAMESPACE must be already defined when <linux/export.h>
is included. So move the define above the include block.

With the DEFAULT_SYMBOL_NAMESPACE being defined too late, the exported
symbols end up in the default namespace. So the modules making use of
the symbols defined in pwm-lpss.c can import these just fine and just
import the the PWM_LPSS namespace without any gain.

Fixes: a3682d2fe3c3 ("pwm: lpss: Move exported symbols to PWM_LPSS namespace")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 drivers/pwm/pwm-lpss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko Dec. 3, 2024, 7:19 p.m. UTC | #1
On Tue, Dec 03, 2024 at 06:16:15PM +0100, Uwe Kleine-König wrote:
> DEFAULT_SYMBOL_NAMESPACE must be already defined when <linux/export.h>
> is included. So move the define above the include block.
> 
> With the DEFAULT_SYMBOL_NAMESPACE being defined too late, the exported
> symbols end up in the default namespace. So the modules making use of
> the symbols defined in pwm-lpss.c can import these just fine and just
> import the the PWM_LPSS namespace without any gain.

Documentation disagrees with you. But, you are right, a lurking bug is here as
we need to undef existing define.

> -#define DEFAULT_SYMBOL_NAMESPACE PWM_LPSS
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 867e2bc8c601..9519d1b06869 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -10,6 +10,8 @@ 
  * Author: Alan Cox <alan@linux.intel.com>
  */
 
+#define DEFAULT_SYMBOL_NAMESPACE PWM_LPSS
+
 #include <linux/bits.h>
 #include <linux/delay.h>
 #include <linux/io.h>
@@ -19,8 +21,6 @@ 
 #include <linux/pm_runtime.h>
 #include <linux/time.h>
 
-#define DEFAULT_SYMBOL_NAMESPACE PWM_LPSS
-
 #include "pwm-lpss.h"
 
 #define PWM				0x00000000