Skip to contentSkip to conversation

i2c: designware: Actually make use of the I2C_DW_COMMON and I2C_DW symbol namespaces

PATCH Superseded Uwe Kleine-König 4 participants 10 messages Dec 3, 2024 – Dec 28, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: designware: Actually make use of the I2C_DW_COMMON and I2C_DW symbol namespaces

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

Fixes fd57a3325a77 ("i2c: designware: Move exports to I2C_DW namespaces")

---
Hello,

this is based on current Linus Torvalds's master branch and depends on the topmost commit there.

Best regards
Uwe

 drivers/i2c/busses/i2c-designware-common.c | 5 +++--
 drivers/i2c/busses/i2c-designware-slave.c  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-designware-common.c +3 -2
index 183a35038eef..8eb7bd640f8d 100644
@@ -8,6 +8,9 @@
  * Copyright (C) 2007 MontaVista Software Inc.
  * Copyright (C) 2009 Provigent Ltd.
  */
+
+#define DEFAULT_SYMBOL_NAMESPACE	"I2C_DW_COMMON"
+
 #include <linux/acpi.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
@@ -29,8 +32,6 @@
 #include <linux/types.h>
 #include <linux/units.h>
 
-#define DEFAULT_SYMBOL_NAMESPACE	"I2C_DW_COMMON"
-
 #include "i2c-designware-core.h"
 
 static const char *const abort_sources[] = {
drivers/i2c/busses/i2c-designware-slave.c +3 -2
index dc2b788eac5b..5cd4a5f7a472 100644
@@ -6,6 +6,9 @@
  *
  * Copyright (C) 2016 Synopsys Inc.
  */
+
+#define DEFAULT_SYMBOL_NAMESPACE	"I2C_DW"
+
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/errno.h>
@@ -16,8 +19,6 @@
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
-#define DEFAULT_SYMBOL_NAMESPACE	"I2C_DW"
-
 #include "i2c-designware-core.h"
 
 static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev)

base-commit: ceb8bf2ceaa77fe222fe8fe32cb7789c9099ddf1

Signature · 1 line
2.45.2
#1 lore raw
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hello Andy,

Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

Did you test your statement? I did on top of v6.13-rc1:

- Remove the MODULE_IMPORT_NS(I2C_DW_COMMON) statements from drivers/i2c/busses/i2c-designware-master.c, drivers/i2c/busses/i2c-designware-pcidrv.c, drivers/i2c/busses/i2c-designware-platdrv.c and drivers/i2c/busses/i2c-designware-slave.c
=> Built fine, ergo the symbols are not in the I2C_DW_COMMON namespace.

- On top of the previous: Add an #undef for DEFAULT_SYMBOL_NAMESPACE directly before the #define
=> Built fine, ergo the #undef doesn't make the namespace define work.

- On top of the previous: Move #undef + #define above the #includes => Several warnings like:

WARNING: modpost: module i2c-designware-platform uses symbol i2c_dw_prepare_clk from namespace I2C_DW_COMMON, but does not import it.

Ergo the position of the definition is relevant.

- On top of the previous: Drop the #undef => same as before, ergo the #undef is not needed.

Independent of what is in the docs that matches my understandment of C.

I don't expect that DEFAULT_SYMBOL_NAMESPACE to be already defined. If there was a definition already, a #define without #undef results (under some likely conditions) in a compiler warning. With the #undef this warning would be suppressed. So the #undef is something like a --force switch that I prefer not to use without reason, because I want to get the warning if my expectations are not met.

So I still think the patch is fine as is.

Best regards
Uwe

#3 lore raw
Quoted 5 lines · Uwe Kleine-König
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

Quoted 7 lines
Quoted 5 lines

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

Did you test your statement?

I speak the documentation.

Quoted 27 lines

I did on top of v6.13-rc1:

- Remove the MODULE_IMPORT_NS(I2C_DW_COMMON) statements from drivers/i2c/busses/i2c-designware-master.c, drivers/i2c/busses/i2c-designware-pcidrv.c, drivers/i2c/busses/i2c-designware-platdrv.c and drivers/i2c/busses/i2c-designware-slave.c
=> Built fine, ergo the symbols are not in the I2C_DW_COMMON namespace.

- On top of the previous: Add an #undef for DEFAULT_SYMBOL_NAMESPACE directly before the #define
=> Built fine, ergo the #undef doesn't make the namespace define work.

- On top of the previous: Move #undef + #define above the #includes => Several warnings like:

WARNING: modpost: module i2c-designware-platform uses symbol i2c_dw_prepare_clk from namespace I2C_DW_COMMON, but does not import it.

Ergo the position of the definition is relevant.

- On top of the previous: Drop the #undef => same as before, ergo the #undef is not needed.

Independent of what is in the docs that matches my understandment of C.

Quoted 8 lines

I don't expect that DEFAULT_SYMBOL_NAMESPACE to be already defined. If there was a definition already, a #define without #undef results (under some likely conditions) in a compiler warning. With the #undef this warning would be suppressed. So the #undef is something like a --force switch that I prefer not to use without reason, because I want to get the warning if my expectations are not met.

So I still think the patch is fine as is.

Perhaps we need to update the documentation first.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Hello,

Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Uwe Kleine-König
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

[...]

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Best regards
Uwe

#5 lore raw
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Uwe Kleine-König
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

[...]

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Thank you!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Acked-by
#6 lore raw
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Uwe Kleine-König
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

[...]

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Thank you!

Andy: is this your reviewed by? If so then

#7 lore raw
Quoted 14 lines · Jarkko Nikula
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Uwe Kleine-König
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

[...]

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Thank you!

Andy: is this your reviewed by? If so then

I would like to have a clarifications from Documentation to be settled down first. When it's done, depending on the outcome it may or may not be my Rb tag.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#8 lore raw

Hi,

Quoted 22 lines · Andy Shevchenko
Quoted 14 lines · Jarkko Nikula
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Uwe Kleine-König
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thank you!

Andy: is this your reviewed by? If so then

I would like to have a clarifications from Documentation to be settled down first. When it's done, depending on the outcome it may or may not be my Rb tag.

ping! Andy, I don't feel like merging this patch without your ack as you had quite many comments here.

Can you please check here again?

Thanks,
Andi

#9 lore raw
Quoted 16 lines · Andi Shyti
Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Jarkko Nikula
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Uwe Kleine-König
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Uwe Kleine-König
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Uwe Kleine-König

DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.

As in the other email I pointed out the doc says that we need to undef the symbol. No need to move it around.

The only requirement is to place that before any EXPORT_SYMBOL*() we want to add it to.

[...]

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Perhaps we need to update the documentation first.

I addressed that in https://lore.kernel.org/all/3dd7ff6fa0a636de86e091286016be8c90e03631.1733305665.git.ukleinek@kernel.org/

Thank you!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Andy: is this your reviewed by? If so then

I would like to have a clarifications from Documentation to be settled down first. When it's done, depending on the outcome it may or may not be my Rb tag.

ping! Andy,

Sorry, I'm on vacation till mid-January.

Quoted 2 lines

I don't feel like merging this patch without your ack as you had quite many comments here.

Yeah, it seems now we got the second approach, we need to choose one and document it. This just makes my point: documentation needs to have clarification to make sure everybody got it right and provide a unified solution.

Quoted 1 line

Can you please check here again?

FWIW, technically the patch is correct and needed, but see above.

Signature · 2 lines
With Best Regards,
Andy Shevchenko