Fix build issue when CONFIG_MODULES is not set
Subsystems (6)
Pratap Nirujogi
maintainerv4 cover Fix build issue when CONFIG_MODULES is not set
When CONFIG_MODULES is not defined, 'adap->owner->name' used in amd_isp4 platform driver will not be valid and is resulting in build failures.
../drivers/platform/x86/amd/amd_isp4.c: In function 'is_isp_i2c_adapter':../drivers/platform/x86/amd/amd_isp4.c:154:35: error: invalid use of undefined type 'struct module'
154 | return !strcmp(adap->owner->name, "i2c_designware_amdisp");
| ^~
To fix this issue, need to make changes both in platform and i2c driver modules.
* In the amd_isp4 x86/platform driver, replace 'adap->owner->name' with 'adap->name', this removes the hard dependency on 'struct module'.
* In i2c amdisp driver, initialize unique name to i2c adapter and also make a change in i2c-designware-common to avoid overwriting with generic name when adap->name[] is already set.
---
Changes v3 -> v4:
* Update MAINTAINERS file with the new isp4_misc.h added
* Fix typo error
Changes v2 -> v3:
* Update commit text for patch 1/3
Changes v1 -> v2:
* Replace snprintf with scnprintf
* Add new isp4 specific misc header file to include the adapter name
* Remove 'Fixes' and 'Link' tags from i2c patches
---
Pratap Nirujogi (3):
i2c: designware: Initialize adapter name only when not set
i2c: amd-isp: Initialize unique adapter name platform/x86: Use i2c adapter name to fix build errors
MAINTAINERS | 1 + drivers/i2c/busses/i2c-designware-amdisp.c | 2 ++ drivers/i2c/busses/i2c-designware-master.c | 5 +++-- drivers/platform/x86/amd/amd_isp4.c | 3 ++- include/linux/soc/amd/isp4_misc.h | 12 ++++++++++++ 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 include/linux/soc/amd/isp4_misc.h
Signature · 1 line
2.43.0
Pratap Nirujogi
maintainerPATCH v4 1/3 i2c: designware: Initialize adapter name only when not set
Check if the adapter name is already set in the driver prior to initializing with generic name in i2c_dw_probe_master(). This check allows to retain the unique adapter name driver has initialized, which platform driver can use to distinguish it from other i2c designware adapters.
--- drivers/i2c/busses/i2c-designware-master.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-designware-master.c +3 -2
@@ -1042,8 +1042,9 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)if (ret)return ret; -snprintf (adap->name,sizeof (adap->name), -"Synopsys DesignWare I2C adapter" ); +if (!adap->name[0 ]) +scnprintf (adap->name,sizeof (adap->name), +"Synopsys DesignWare I2C adapter" ); adap->retries =3 ; adap->algo = &i2c_dw_algo; adap->quirks = &i2c_dw_quirks;
Signature · 1 line
2.43.0
Pratap Nirujogi
maintainerPATCH v4 2/3 i2c: amd-isp: Initialize unique adapter name
In reply to Pratap NirujogiInitialize unique name for amdisp i2c adapter, which is used in the platform driver to detect the matching adapter for i2c_client creation.
Add definition of amdisp i2c adapter name in a new header file (include/linux/soc/amd/isp4_misc.h) as it is referred in different driver modules.
--- MAINTAINERS | 1 + drivers/i2c/busses/i2c-designware-amdisp.c | 2 ++ include/linux/soc/amd/isp4_misc.h | 12 ++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 include/linux/soc/amd/isp4_misc.h
MAINTAINERS +1 -0
@@ -23878,6 +23878,7 @@ M: Bin Du <[email protected]> L: [email protected] S: Maintained F: drivers/i2c/busses/i2c-designware-amdisp.c +F: include/linux/soc/amd/isp4_misc.h SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER M: Jaehoon Chung <[email protected]>
drivers/i2c/busses/i2c-designware-amdisp.c +2 -0
@@ -8,6 +8,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/soc/amd/isp4_misc.h> #include "i2c-designware-core.h"
@@ -62,6 +63,7 @@ static int amd_isp_dw_i2c_plat_probe(struct platform_device *pdev) adap = &isp_i2c_dev->adapter; adap->owner =THIS_MODULE ; +scnprintf (adap->name,sizeof (adap->name),AMDISP_I2C_ADAP_NAME );ACPI_COMPANION_SET (&adap->dev,ACPI_COMPANION (&pdev->dev)); adap->dev.of_node = pdev->dev.of_node;/* use dynamically allocated adapter id */
include/linux/soc/amd/isp4_misc.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/* +* Copyright (C) 2025 Advanced Micro Devices, Inc. +*/ + +#ifndef __SOC_ISP4_MISC_H +#define __SOC_ISP4_MISC_H + +#define AMDISP_I2C_ADAP_NAME "AMDISP DesignWare I2C adapter" + +#endif
Signature · 1 line
2.43.0
Pratap Nirujogi
maintainerPATCH v4 3/3 platform/x86: Use i2c adapter name to fix build errors
In reply to Pratap NirujogiUse adapater->name inplace of adapter->owner->name to fix build issues when CONFIG_MODULES is not defined.
--- drivers/platform/x86/amd/amd_isp4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/amd_isp4.c +2 -1
@@ -11,6 +11,7 @@#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/property.h> +#include <linux/soc/amd/isp4_misc.h> #include <linux/string.h> #include <linux/types.h> #include <linux/units.h>
@@ -151,7 +152,7 @@ MODULE_DEVICE_TABLE(acpi, amdisp_sensor_ids);static inline bool is_isp_i2c_adapter (struct i2c_adapter *adap) { -return !strcmp (adap->owner->name,"i2c_designware_amdisp" ); +return !strcmp (adap->name,AMDISP_I2C_ADAP_NAME ); } static void instantiate_isp_i2c_client(struct amdisp_platform *isp4_platform,
Signature · 1 line
2.43.0
Re: [PATCH v4 3/3] platform/x86: Use i2c adapter name to fix build errors
Quoted 25 lines · Pratap Nirujogi
Use
adapater->nameinplace ofadapter->owner->nameto fix build issues whenCONFIG_MODULESis not defined.Fixes 90b85567e457 ("platform/x86: Add AMD ISP platform config for OV05C10")Reported-by Randy Dunlap <[email protected]>Tested-by Randy Dunlap <[email protected]>Signed-off-by Pratap Nirujogi <[email protected]>--- drivers/platform/x86/amd/amd_isp4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/platform/x86/amd/amd_isp4.c +1
-0@@ -11,6 +11,7 @@#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/property.h> +#include <linux/soc/amd/isp4_misc.h> #include <linux/string.h> #include <linux/types.h> #include <linux/units.h>
drivers/platform/x86/amd/amd_isp4.c MODULE_DEVICE_TABLE(acpi, amdisp_sensor_ids); · line 158
Quoted 8 lines
drivers/platform/x86/amd/amd_isp4.c +1
-1@@ -151,7 +152,7 @@ MODULE_DEVICE_TABLE(acpi, amdisp_sensor_ids);static inline bool is_isp_i2c_adapter (struct i2c_adapter *adap) { -return !strcmp (adap->owner->name,"i2c_designware_amdisp" ); +return !strcmp (adap->name,AMDISP_I2C_ADAP_NAME ); } static void instantiate_isp_i2c_client(struct amdisp_platform *isp4_platform,
Andi, do you want to take this fix series through i2c tree or do you prefer me to take them through pdx86 tree?
--
i.
Ilpo Järvinen
maintainerRe: [PATCH v4 3/3] platform/x86: Use i2c adapter name to fix build errors
Hi Andi,
(ping)
It seems by now people are starting to send workaround fixes (build only with =m) as this series is still pending and compile is breaking because of it.
I'm fine with you taking the entire series through i2c, or just let me know if you want me to take it through pdx86 tree instead.
Quoted 40 lines · Ilpo Järvinen
Quoted 25 lines · Pratap Nirujogi
Use
adapater->nameinplace ofadapter->owner->nameto fix build issues whenCONFIG_MODULESis not defined.Fixes 90b85567e457 ("platform/x86: Add AMD ISP platform config for OV05C10")Reported-by Randy Dunlap <[email protected]>Tested-by Randy Dunlap <[email protected]>Signed-off-by Pratap Nirujogi <[email protected]>--- drivers/platform/x86/amd/amd_isp4.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/platform/x86/amd/amd_isp4.c +1
-0@@ -11,6 +11,7 @@#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/property.h> +#include <linux/soc/amd/isp4_misc.h> #include <linux/string.h> #include <linux/types.h> #include <linux/units.h> drivers/platform/x86/amd/amd_isp4.c MODULE_DEVICE_TABLE(acpi, amdisp_sensor_ids); · line 158
Quoted 8 lines
drivers/platform/x86/amd/amd_isp4.c +1
-1@@ -151,7 +152,7 @@ MODULE_DEVICE_TABLE(acpi, amdisp_sensor_ids);static inline bool is_isp_i2c_adapter (struct i2c_adapter *adap) { -return !strcmp (adap->owner->name,"i2c_designware_amdisp" ); +return !strcmp (adap->name,AMDISP_I2C_ADAP_NAME ); } static void instantiate_isp_i2c_client(struct amdisp_platform *isp4_platform,Acked-by Ilpo Järvinen <[email protected]>Andi, do you want to take this fix series through i2c tree or do you prefer me to take them through pdx86 tree?
Signature · 1 line
i.
Andi Shyti
maintainerRe: [PATCH v4 3/3] platform/x86: Use i2c adapter name to fix build errors
Hi Ilpo,
Quoted 10 lines · Ilpo Järvinen
Hi Andi,
(ping)
It seems by now people are starting to send workaround fixes (build only with =m) as this series is still pending and compile is breaking because of it.
I'm fine with you taking the entire series through i2c, or just let me know if you want me to take it through pdx86 tree instead.
Sorry for the late reply, I've been off the radar for some time and now I'm catching up. I will take all the series, thanks.
Andi
Andi Shyti
maintainerHi Pratap,
Quoted 4 lines
Pratap Nirujogi (3):
i2c: designware: Initialize adapter name only when not set
i2c: amd-isp: Initialize unique adapter name platform/x86: Use i2c adapter name to fix build errors
I merged this entire series in i2c/i2c-host-fixes. For the last patch I added the "Requires:" tag in order to include non-Fixes patches in the fixes pull request.
Thanks,
Andi
Thanks Andi. That's very helpful.
Thanks,
Pratap
Quoted 16 lines · Andi Shyti
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Hi Pratap,
Quoted 4 lines
Pratap Nirujogi (3):
i2c: designware: Initialize adapter name only when not set
i2c: amd-isp: Initialize unique adapter name platform/x86: Use i2c adapter name to fix build errorsI merged this entire series in i2c/i2c-host-fixes. For the last patch I added the "Requires:" tag in order to include non-Fixes patches in the fixes pull request.
Thanks,
Andi