Skip to contentSkip to conversation

drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'

DISCUSSION kernel test robot 4 participants 6 messages Nov 2, 2020 – Nov 26, 2020

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cea11cd5e3b00d91caf0b4730194039b45c5891
commit: 09309093d5e8f8774e4a3a0d42b73cf47e9421cf soundwire: qcom: fix SLIBMUS/SLIMBUS typo
date:   8 weeks ago
config: openrisc-randconfig-r005-20201102 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=09309093d5e8f8774e4a3a0d42b73cf47e9421cf
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 09309093d5e8f8774e4a3a0d42b73cf47e9421cf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

or1k-linux-ld: drivers/soundwire/qcom.o: in function `qcom_swrm_probe':

>> drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'
>> or1k-linux-ld: drivers/soundwire/qcom.c:771: undefined reference to `slimbus_bus'

vim +767 drivers/soundwire/qcom.c

02efb49aa805cee Srinivas Kandagatla  2020-01-13  756  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  757  static int qcom_swrm_probe(struct platform_device *pdev)
02efb49aa805cee Srinivas Kandagatla  2020-01-13  758  {
02efb49aa805cee Srinivas Kandagatla  2020-01-13  759  	struct device *dev = &pdev->dev;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  760  	struct sdw_master_prop *prop;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  761  	struct sdw_bus_params *params;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  762  	struct qcom_swrm_ctrl *ctrl;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  763  	int ret;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  764  	u32 val;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  765  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  766  	ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @767  	if (!ctrl)
02efb49aa805cee Srinivas Kandagatla  2020-01-13  768  		return -ENOMEM;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  769  
09309093d5e8f87 Jonathan Marek       2020-09-08  770  #if IS_ENABLED(CONFIG_SLIMBUS)
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @771  	if (dev->parent->bus == &slimbus_bus) {
5bd773242f75da3 Jonathan Marek       2020-09-05  772  #else
5bd773242f75da3 Jonathan Marek       2020-09-05  773  	if (false) {
5bd773242f75da3 Jonathan Marek       2020-09-05  774  #endif
d1df23fe688b58e Jonathan Marek       2020-09-05  775  		ctrl->reg_read = qcom_swrm_ahb_reg_read;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  776  		ctrl->reg_write = qcom_swrm_ahb_reg_write;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  777  		ctrl->regmap = dev_get_regmap(dev->parent, NULL);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  778  		if (!ctrl->regmap)
02efb49aa805cee Srinivas Kandagatla  2020-01-13  779  			return -EINVAL;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  780  	} else {
82f5c70c26511ba Jonathan Marek       2020-09-05  781  		ctrl->reg_read = qcom_swrm_cpu_reg_read;
82f5c70c26511ba Jonathan Marek       2020-09-05  782  		ctrl->reg_write = qcom_swrm_cpu_reg_write;
82f5c70c26511ba Jonathan Marek       2020-09-05  783  		ctrl->mmio = devm_platform_ioremap_resource(pdev, 0);
82f5c70c26511ba Jonathan Marek       2020-09-05  784  		if (IS_ERR(ctrl->mmio))
82f5c70c26511ba Jonathan Marek       2020-09-05  785  			return PTR_ERR(ctrl->mmio);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  786  	}
02efb49aa805cee Srinivas Kandagatla  2020-01-13  787  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  788  	ctrl->irq = of_irq_get(dev->of_node, 0);
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  789  	if (ctrl->irq < 0) {
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  790  		ret = ctrl->irq;
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  791  		goto err_init;
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  792  	}
02efb49aa805cee Srinivas Kandagatla  2020-01-13  793  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  794  	ctrl->hclk = devm_clk_get(dev, "iface");
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  795  	if (IS_ERR(ctrl->hclk)) {
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  796  		ret = PTR_ERR(ctrl->hclk);
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  797  		goto err_init;
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  798  	}
02efb49aa805cee Srinivas Kandagatla  2020-01-13  799  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  800  	clk_prepare_enable(ctrl->hclk);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  801  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  802  	ctrl->dev = dev;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  803  	dev_set_drvdata(&pdev->dev, ctrl);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  804  	spin_lock_init(&ctrl->comp_lock);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  805  	mutex_init(&ctrl->port_lock);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  806  	INIT_WORK(&ctrl->slave_work, qcom_swrm_slave_wq);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  807  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  808  	ctrl->bus.ops = &qcom_swrm_ops;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  809  	ctrl->bus.port_ops = &qcom_swrm_port_ops;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  810  	ctrl->bus.compute_params = &qcom_swrm_compute_params;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  811  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  812  	ret = qcom_swrm_get_port_config(ctrl);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  813  	if (ret)
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  814  		goto err_clk;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  815  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  816  	params = &ctrl->bus.params;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  817  	params->max_dr_freq = DEFAULT_CLK_FREQ;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  818  	params->curr_dr_freq = DEFAULT_CLK_FREQ;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  819  	params->col = SWRM_DEFAULT_COL;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  820  	params->row = SWRM_DEFAULT_ROWS;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  821  	ctrl->reg_read(ctrl, SWRM_MCP_STATUS, &val);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  822  	params->curr_bank = val & SWRM_MCP_STATUS_BANK_NUM_MASK;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  823  	params->next_bank = !params->curr_bank;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  824  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  825  	prop = &ctrl->bus.prop;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  826  	prop->max_clk_freq = DEFAULT_CLK_FREQ;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  827  	prop->num_clk_gears = 0;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  828  	prop->num_clk_freq = MAX_FREQ_NUM;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  829  	prop->clk_freq = &qcom_swrm_freq_tbl[0];
02efb49aa805cee Srinivas Kandagatla  2020-01-13  830  	prop->default_col = SWRM_DEFAULT_COL;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  831  	prop->default_row = SWRM_DEFAULT_ROWS;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  832  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  833  	ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &ctrl->version);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  834  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  835  	ret = devm_request_threaded_irq(dev, ctrl->irq, NULL,
02efb49aa805cee Srinivas Kandagatla  2020-01-13  836  					qcom_swrm_irq_handler,
4f1738f4c24b448 Samuel Zou           2020-05-06  837  					IRQF_TRIGGER_RISING |
4f1738f4c24b448 Samuel Zou           2020-05-06  838  					IRQF_ONESHOT,
02efb49aa805cee Srinivas Kandagatla  2020-01-13  839  					"soundwire", ctrl);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  840  	if (ret) {
02efb49aa805cee Srinivas Kandagatla  2020-01-13  841  		dev_err(dev, "Failed to request soundwire irq\n");
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  842  		goto err_clk;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  843  	}
02efb49aa805cee Srinivas Kandagatla  2020-01-13  844  
5cab3ff2489ede5 Pierre-Louis Bossart 2020-05-19  845  	ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  846  	if (ret) {
02efb49aa805cee Srinivas Kandagatla  2020-01-13  847  		dev_err(dev, "Failed to register Soundwire controller (%d)\n",
02efb49aa805cee Srinivas Kandagatla  2020-01-13  848  			ret);
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  849  		goto err_clk;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  850  	}
02efb49aa805cee Srinivas Kandagatla  2020-01-13  851  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  852  	qcom_swrm_init(ctrl);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  853  	ret = qcom_swrm_register_dais(ctrl);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  854  	if (ret)
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  855  		goto err_master_add;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  856  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  857  	dev_info(dev, "Qualcomm Soundwire controller v%x.%x.%x Registered\n",
02efb49aa805cee Srinivas Kandagatla  2020-01-13  858  		 (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff,
02efb49aa805cee Srinivas Kandagatla  2020-01-13  859  		 ctrl->version & 0xffff);
02efb49aa805cee Srinivas Kandagatla  2020-01-13  860  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  861  	return 0;
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  862  
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  863  err_master_add:
5cab3ff2489ede5 Pierre-Louis Bossart 2020-05-19  864  	sdw_bus_master_delete(&ctrl->bus);
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  865  err_clk:
02efb49aa805cee Srinivas Kandagatla  2020-01-13  866  	clk_disable_unprepare(ctrl->hclk);
91b5cfc0209b63b Pierre-Louis Bossart 2020-04-30  867  err_init:
02efb49aa805cee Srinivas Kandagatla  2020-01-13  868  	return ret;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  869  }
02efb49aa805cee Srinivas Kandagatla  2020-01-13  870  

:::::: The code at line 767 was first introduced by commit
:::::: 02efb49aa805cee643a643ab61a1118c2fd08b80 soundwire: qcom: add support for SoundWire controller

:::::: TO: Srinivas Kandagatla <[email protected]> :::::: CC: Vinod Koul <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#1 lore raw
Quoted 47 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3cea11cd5e3b00d91caf0b4730194039b45c5891
commit: 09309093d5e8f8774e4a3a0d42b73cf47e9421cf soundwire: qcom: fix SLIBMUS/SLIMBUS typo
date:   8 weeks ago
config: openrisc-randconfig-r005-20201102 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=09309093d5e8f8774e4a3a0d42b73cf47e9421cf
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 09309093d5e8f8774e4a3a0d42b73cf47e9421cf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

or1k-linux-ld: drivers/soundwire/qcom.o: in function `qcom_swrm_probe':

Quoted 2 lines
Quoted 2 lines

drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'
or1k-linux-ld: drivers/soundwire/qcom.c:771: undefined reference to `slimbus_bus'

vim +767 drivers/soundwire/qcom.c

02efb49aa805cee Srinivas Kandagatla  2020-01-13  756  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  757  static int qcom_swrm_probe(struct platform_device *pdev)
02efb49aa805cee Srinivas Kandagatla  2020-01-13  758  {
02efb49aa805cee Srinivas Kandagatla  2020-01-13  759  	struct device *dev = &pdev->dev;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  760  	struct sdw_master_prop *prop;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  761  	struct sdw_bus_params *params;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  762  	struct qcom_swrm_ctrl *ctrl;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  763  	int ret;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  764  	u32 val;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  765  
02efb49aa805cee Srinivas Kandagatla  2020-01-13  766  	ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @767  	if (!ctrl)
02efb49aa805cee Srinivas Kandagatla  2020-01-13  768  		return -ENOMEM;
02efb49aa805cee Srinivas Kandagatla  2020-01-13  769  
09309093d5e8f87 Jonathan Marek       2020-09-08  770  #if IS_ENABLED(CONFIG_SLIMBUS)
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @771  	if (dev->parent->bus == &slimbus_bus) {
5bd773242f75da3 Jonathan Marek       2020-09-05  772  #else
5bd773242f75da3 Jonathan Marek       2020-09-05  773  	if (false) {
5bd773242f75da3 Jonathan Marek       2020-09-05  774  #endif
Quoted 5 lines

:::::: The code at line 767 was first introduced by commit
:::::: 02efb49aa805cee643a643ab61a1118c2fd08b80 soundwire: qcom: add support for SoundWire controller

:::::: TO: Srinivas Kandagatla <[email protected]> :::::: CC: Vinod Koul <[email protected]>

config SOUNDWIRE_QCOM
tristate "Qualcomm SoundWire Master driver" imply SLIMBUS
depends on SND_SOC

The kernel config that was attached has:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

I expected that "imply" would make SLIMBUS=y since SOUNDWIRE_QCOM=y, but I guess that's not the case. :(

Any ideas about what to do here?

Signature · 1 line
~Randy
maintainer
#2 lore raw

Hi Randy,

Quoted 18 lines · Randy Dunlap
Quoted 11 lines · kernel test robot

All errors (new ones prefixed by >>):

or1k-linux-ld: drivers/soundwire/qcom.o: in function `qcom_swrm_probe':

Quoted 2 lines
Quoted 2 lines

drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'
or1k-linux-ld: drivers/soundwire/qcom.c:771: undefined reference to `slimbus_bus'

09309093d5e8f87 Jonathan Marek       2020-09-08  770  #if IS_ENABLED(CONFIG_SLIMBUS)
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @771  	if (dev->parent->bus == &slimbus_bus) {
5bd773242f75da3 Jonathan Marek       2020-09-05  772  #else
5bd773242f75da3 Jonathan Marek       2020-09-05  773  	if (false) {
5bd773242f75da3 Jonathan Marek       2020-09-05  774  #endif

config SOUNDWIRE_QCOM
tristate "Qualcomm SoundWire Master driver" imply SLIMBUS
depends on SND_SOC

Quoted 8 lines

The kernel config that was attached has:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

I expected that "imply" would make SLIMBUS=y since SOUNDWIRE_QCOM=y, but I guess that's not the case. :(

Any ideas about what to do here?

Sorry to have missed this earlier. I did some digging and found the Kconfig code to be correct, but not the driver code. Per the Documentation if we are using imply we should use IS_REACHABLE() rather than IS_ENABLED.

This seems to take care of build failure for me on arm64 and x64 builds.

Can you confirm with below patch:

---><8---

From: Vinod Koul <[email protected]>
Date: Wed, 25 Nov 2020 11:15:22 +0530
Subject: [PATCH] soundwire: qcom: Fix build failure when slimbus is module

Commit 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS") removed hard dependency on Slimbus for qcom driver but it results in build failure when:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

drivers/soundwire/qcom.o: In function `qcom_swrm_probe':
qcom.c:(.text+0xf44): undefined reference to `slimbus_bus'

Fix this by using IS_REACHABLE() in driver which is recommended to be sued with imply.

Fixes 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS")
---
 drivers/soundwire/qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
index fbca4ebf63e9..6d22df01f354 100644
@@ -799,7 +799,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
 	data = of_device_get_match_data(dev);
 	ctrl->rows_index = sdw_find_row_index(data->default_rows);
 	ctrl->cols_index = sdw_find_col_index(data->default_cols);
-#if IS_ENABLED(CONFIG_SLIMBUS)
+#if IS_REACHABLE(CONFIG_SLIMBUS)
 	if (dev->parent->bus == &slimbus_bus) {
 #else
 	if (false) {
Signature · 4 lines
2.26.2

-- 
~Vinod
Tested-by Reviewed-by
#3 lore raw
Quoted 54 lines · Vinod Koul

Hi Randy,

Quoted 18 lines · Randy Dunlap
Quoted 11 lines · kernel test robot

All errors (new ones prefixed by >>):

or1k-linux-ld: drivers/soundwire/qcom.o: in function `qcom_swrm_probe':

Quoted 2 lines
Quoted 2 lines

drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'
or1k-linux-ld: drivers/soundwire/qcom.c:771: undefined reference to `slimbus_bus'

09309093d5e8f87 Jonathan Marek       2020-09-08  770  #if IS_ENABLED(CONFIG_SLIMBUS)
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @771  	if (dev->parent->bus == &slimbus_bus) {
5bd773242f75da3 Jonathan Marek       2020-09-05  772  #else
5bd773242f75da3 Jonathan Marek       2020-09-05  773  	if (false) {
5bd773242f75da3 Jonathan Marek       2020-09-05  774  #endif

config SOUNDWIRE_QCOM
tristate "Qualcomm SoundWire Master driver" imply SLIMBUS
depends on SND_SOC

Quoted 8 lines

The kernel config that was attached has:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

I expected that "imply" would make SLIMBUS=y since SOUNDWIRE_QCOM=y, but I guess that's not the case. :(

Any ideas about what to do here?

Sorry to have missed this earlier. I did some digging and found the Kconfig code to be correct, but not the driver code. Per the Documentation if we are using imply we should use IS_REACHABLE() rather than IS_ENABLED.

This seems to take care of build failure for me on arm64 and x64 builds.

Can you confirm with below patch:

---><8---

From: Vinod Koul <[email protected]>
Date: Wed, 25 Nov 2020 11:15:22 +0530
Subject: [PATCH] soundwire: qcom: Fix build failure when slimbus is module

Commit 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS") removed hard dependency on Slimbus for qcom driver but it results in build failure when:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

drivers/soundwire/qcom.o: In function `qcom_swrm_probe':
qcom.c:(.text+0xf44): undefined reference to `slimbus_bus'

Quoted 7 lines

Fix this by using IS_REACHABLE() in driver which is recommended to be sued with imply.

Fixes 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS")

---

Thanks Vinod,

--srini

Quoted 17 lines
  drivers/soundwire/qcom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
index fbca4ebf63e9..6d22df01f354 100644
@@ -799,7 +799,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
  	data = of_device_get_match_data(dev);
  	ctrl->rows_index = sdw_find_row_index(data->default_rows);
  	ctrl->cols_index = sdw_find_col_index(data->default_cols);
-#if IS_ENABLED(CONFIG_SLIMBUS)
+#if IS_REACHABLE(CONFIG_SLIMBUS)
  	if (dev->parent->bus == &slimbus_bus) {
  #else
  	if (false) {
Acked-by
#4 lore raw
In reply to Vinod Koul
Quoted 51 lines · Vinod Koul

Hi Randy,

Quoted 18 lines · Randy Dunlap
Quoted 11 lines · kernel test robot

All errors (new ones prefixed by >>):

or1k-linux-ld: drivers/soundwire/qcom.o: in function `qcom_swrm_probe':

Quoted 2 lines
Quoted 2 lines

drivers/soundwire/qcom.c:767: undefined reference to `slimbus_bus'
or1k-linux-ld: drivers/soundwire/qcom.c:771: undefined reference to `slimbus_bus'

09309093d5e8f87 Jonathan Marek       2020-09-08  770  #if IS_ENABLED(CONFIG_SLIMBUS)
02efb49aa805cee Srinivas Kandagatla  2020-01-13 @771  	if (dev->parent->bus == &slimbus_bus) {
5bd773242f75da3 Jonathan Marek       2020-09-05  772  #else
5bd773242f75da3 Jonathan Marek       2020-09-05  773  	if (false) {
5bd773242f75da3 Jonathan Marek       2020-09-05  774  #endif

config SOUNDWIRE_QCOM
tristate "Qualcomm SoundWire Master driver" imply SLIMBUS
depends on SND_SOC

Quoted 8 lines

The kernel config that was attached has:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

I expected that "imply" would make SLIMBUS=y since SOUNDWIRE_QCOM=y, but I guess that's not the case. :(

Any ideas about what to do here?

Sorry to have missed this earlier. I did some digging and found the Kconfig code to be correct, but not the driver code. Per the Documentation if we are using imply we should use IS_REACHABLE() rather than IS_ENABLED.

This seems to take care of build failure for me on arm64 and x64 builds.

Can you confirm with below patch:

---><8---

From: Vinod Koul <[email protected]>
Date: Wed, 25 Nov 2020 11:15:22 +0530
Subject: [PATCH] soundwire: qcom: Fix build failure when slimbus is module

Commit 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS") removed hard dependency on Slimbus for qcom driver but it results in build failure when:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

Quoted 5 lines

drivers/soundwire/qcom.o: In function `qcom_swrm_probe':
qcom.c:(.text+0xf44): undefined reference to `slimbus_bus'

Fix this by using IS_REACHABLE() in driver which is recommended to be sued with imply.

used

Quoted 4 lines
Fixes 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS")

Thanks.

Quoted 18 lines
---
  drivers/soundwire/qcom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soundwire/qcom.c +1 -1
index fbca4ebf63e9..6d22df01f354 100644
@@ -799,7 +799,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
  	data = of_device_get_match_data(dev);
  	ctrl->rows_index = sdw_find_row_index(data->default_rows);
  	ctrl->cols_index = sdw_find_col_index(data->default_cols);
-#if IS_ENABLED(CONFIG_SLIMBUS)
+#if IS_REACHABLE(CONFIG_SLIMBUS)
  	if (dev->parent->bus == &slimbus_bus) {
  #else
  	if (false) {
maintainer
#5 lore raw
Quoted 12 lines · Randy Dunlap
Quoted 10 lines · Vinod Koul

From: Vinod Koul <[email protected]>
Date: Wed, 25 Nov 2020 11:15:22 +0530
Subject: [PATCH] soundwire: qcom: Fix build failure when slimbus is module

Commit 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS") removed hard dependency on Slimbus for qcom driver but it results in build failure when:
CONFIG_SOUNDWIRE_QCOM=y
CONFIG_SLIMBUS=m

Quoted 7 lines
Quoted 5 lines

drivers/soundwire/qcom.o: In function `qcom_swrm_probe':
qcom.c:(.text+0xf44): undefined reference to `slimbus_bus'

Fix this by using IS_REACHABLE() in driver which is recommended to be sued with imply.

used

right

Quoted 7 lines
Quoted 5 lines
Fixes 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS")

Thanks I have added this and Srini's and pushed out now.

Signature · 1 line
~Vinod