platform/x86: int3472: make common part a separate module
Subsystems (2)
PATCH 1/1 platform/x86: int3472: make common part a separate module
From: Arnd Bergmann <[email protected]>
Linking an object file into multiple modules is not supported and causes a W=1 warning:
scripts/Makefile.build:236: drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules: intel_skl_int3472_discrete intel_skl_int3472_tps68470
Split out the common part here into a separate module to make it more reliable.
--- drivers/platform/x86/intel/int3472/Makefile | 9 ++++++--- drivers/platform/x86/intel/int3472/common.c | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/platform/x86/intel/int3472/Makefile +6 -3
@@ -1,4 +1,7 @@ obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \ - intel_skl_int3472_tps68470.o -intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o common.o -intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o common.o + intel_skl_int3472_tps68470.o \ + intel_skl_int3472_common.o +intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o +intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o + +intel_skl_int3472_common-y += common.o
drivers/platform/x86/intel/int3472/common.c +7 -0
@@ -29,6 +29,7 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev, char *ireturn obj; } +EXPORT_SYMBOL_GPL (skl_int3472_get_acpi_buffer);int skl_int3472_fill_cldb (struct acpi_device *adev,struct int3472_cldb *cldb) {
@@ -52,6 +53,7 @@ int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb)kfree (obj);return ret; } +EXPORT_SYMBOL_GPL (skl_int3472_fill_cldb);/* sensor_adev_ret may be NULL, name_ret must not be NULL */ int skl_int3472_get_sensor_adev_and_name(struct device *dev,
@@ -80,3 +82,8 @@ int skl_int3472_get_sensor_adev_and_name(struct device *dev,return ret; } +EXPORT_SYMBOL_GPL (skl_int3472_get_sensor_adev_and_name); + +MODULE_DESCRIPTION ("Intel SkyLake INT3472 ACPI Device Driver library" ); +MODULE_AUTHOR ("Daniel Scally <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.39.2
Quoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Linking an object file into multiple modules is not supported and causes a W=1 warning:
scripts/Makefile.build:236:drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules:intel_skl_int3472_discreteintel_skl_int3472_tps68470Split out the common part here into a separate module to make it more reliable.
...
drivers/platform/x86/intel/int3472/Makefile line 3
Quoted 5 lines
obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \
drivers/platform/x86/intel/int3472/Makefile +2
-1- intel_skl_int3472_tps68470.o + intel_skl_int3472_tps68470.o \ + intel_skl_int3472_common.o
A nit: Can this be put above instead?
...
Quoted 1 line
+EXPORT_SYMBOL_GPL(skl_int3472_get_sensor_adev_and_name);
Are these namespaced?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 14 lines · Andy Shevchenko
Quoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Linking an object file into multiple modules is not supported and causes a W=1 warning:
scripts/Makefile.build:236:drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules:intel_skl_int3472_discreteintel_skl_int3472_tps68470Split out the common part here into a separate module to make it more reliable.
...
Quoted 7 lines
drivers/platform/x86/intel/int3472/Makefile line 3
Quoted 5 lines
obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \
drivers/platform/x86/intel/int3472/Makefile +2
-1- intel_skl_int3472_tps68470.o + intel_skl_int3472_tps68470.o \ + intel_skl_int3472_common.oA nit: Can this be put above instead?
I've changed it like this now, is that what you meant?
obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_common.o \
intel_skl_int3472_discrete.o \
intel_skl_int3472_tps68470.o \intel_skl_int3472_common-y += common.o intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o
Quoted 5 lines
...
Quoted 1 line
+EXPORT_SYMBOL_GPL(skl_int3472_get_sensor_adev_and_name);
Are these namespaced?
No, is there any advantage to making them namespaced?
It's only a few symbols and they have proper prefixes.
Arnd
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Andy Shevchenko
On Wed, May 29, 2024 at 12:50 PM Arnd Bergmann <[email protected]> wrote:
...
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \
drivers/platform/x86/intel/int3472/Makefile +2
-1- intel_skl_int3472_tps68470.o + intel_skl_int3472_tps68470.o \ + intel_skl_int3472_common.o
Quoted 8 lines
Quoted 1 line
A nit: Can this be put above instead?
I've changed it like this now, is that what you meant?
obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_common.o \ intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o \
Without the last trailing \, but yes.
Quoted 3 lines
intel_skl_int3472_common-y += common.o intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o
...
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+EXPORT_SYMBOL_GPL(skl_int3472_get_sensor_adev_and_name);
Are these namespaced?
No, is there any advantage to making them namespaced?
Yes, to clean up the global namespace.
Quoted 1 line
It's only a few symbols and they have proper prefixes.
It's different from the exported namespace.
The function prefixes are needed due to C language, as we can't have two functions named the same. The export OTOH is what used for linking modules and if there is no need to have it exported globally, if, for example, compiling in this one.
So, can we move to the exported namespace at the same time?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Andy Shevchenko
On Wed, May 29, 2024 at 12:50 PM Arnd Bergmann <[email protected]>
It's different from the exported namespace.
The function prefixes are needed due to C language, as we can't have two functions named the same. The export OTOH is what used for linking modules and if there is no need to have it exported globally, if, for example, compiling in this one.So, can we move to the exported namespace at the same time?
Maybe you can come up with a patch then? I have no idea which namespace to use here, seeing that there are already six differnet namespaces in use in drivers/platform/x86/intel/ but none of them seem to be a good fit for this one.
Are you asking to just define another namespace here? How would I define what the rules about using this namespace are, and where are they documented?
Arnd
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Andy Shevchenko
On Wed, May 29, 2024 at 12:50 PM Arnd Bergmann <[email protected]>
It's different from the exported namespace.
The function prefixes are needed due to C language, as we can't have two functions named the same. The export OTOH is what used for linking modules and if there is no need to have it exported globally, if, for example, compiling in this one.
Quoted 3 lines
Quoted 1 line
So, can we move to the exported namespace at the same time?
Maybe you can come up with a patch then?
Yes, why not.
Quoted 6 lines
I have no idea
which namespace to use here, seeing that there are already six differnet namespaces in use indrivers/platform/x86/intel/but none of them seem to be a good fit for this one.Are you asking to just define another namespace here?
Yes.
Quoted 2 lines
How would I define what the rules about using this namespace are, and where are they documented?
Currently we use a common sense, like a pattern:SUBSYSTEM_DRIVER
or so.
In this case INTEL_INT3472 is good enough as it's unique enough to not collide with anything else in Intel's world (okay, I hope that we learnt our mistakes in the past and won't issue same ACPI ID for different devices).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Linking an object file into multiple modules is not supported and causes a W=1 warning:
Quoted 7 lines
scripts/Makefile.build:236:drivers/platform/x86/intel/int3472/Makefile: common.o is added to multiple modules:intel_skl_int3472_discreteintel_skl_int3472_tps68470Split out the common part here into a separate module to make it more reliable.
Fixes a2f9fbc247ee ("platform/x86: int3472: Split into 2 drivers")Signed-off-by Arnd Bergmann <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
I've fixed the following checkpatch warning while applying this:
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 49 lines
--- drivers/platform/x86/intel/int3472/Makefile | 9 ++++++--- drivers/platform/x86/intel/int3472/common.c | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-)drivers/platform/x86/intel/int3472/Makefile +6
-3@@ -1,4 +1,7 @@ obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \ - intel_skl_int3472_tps68470.o -intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o common.o -intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o common.o + intel_skl_int3472_tps68470.o \ + intel_skl_int3472_common.o +intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o led.o +intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o + +intel_skl_int3472_common-y += common.odrivers/platform/x86/intel/int3472/common.c +7
-0@@ -29,6 +29,7 @@ union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev, char *ireturn obj; } +EXPORT_SYMBOL_GPL (skl_int3472_get_acpi_buffer);int skl_int3472_fill_cldb (struct acpi_device *adev,struct int3472_cldb *cldb) {@@ -52,6 +53,7 @@ int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb)kfree (obj);return ret; } +EXPORT_SYMBOL_GPL (skl_int3472_fill_cldb);/* sensor_adev_ret may be NULL, name_ret must not be NULL */ int skl_int3472_get_sensor_adev_and_name(struct device *dev,@@ -80,3 +82,8 @@ int skl_int3472_get_sensor_adev_and_name(struct device *dev,return ret; } +EXPORT_SYMBOL_GPL (skl_int3472_get_sensor_adev_and_name); + +MODULE_DESCRIPTION ("Intel SkyLake INT3472 ACPI Device Driver library" ); +MODULE_AUTHOR ("Daniel Scally <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );