linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency
@ 2021-06-15  9:48 Srinivas Kandagatla
  2021-06-15 12:35 ` Mark Brown
  2021-06-15 17:29 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2021-06-15  9:48 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, linux-kernel, lgirdwood, Srinivas Kandagatla,
	Stephen Rothwell

For some reason we ended up with cyclic dependency between snd_soc_wcd938x
and snd_soc_wcd938x_sdw modules.

Remove this cyclic dependency by handling them in respective modules.
Without this below error is reported during make modules_install

depmod: ERROR: Cycle detected: snd_soc_wcd938x -> snd_soc_wcd938x_sdw -> snd_soc_wcd938x
depmod: ERROR: Found 2 modules in dependency cycles!

Fixes: 045442228868 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/wcd938x-sdw.c | 19 ++++++++++++-------
 sound/soc/codecs/wcd938x.c     | 27 +++++----------------------
 sound/soc/codecs/wcd938x.h     |  4 +---
 3 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c
index d82c40ec6898..d1cabf300c36 100644
--- a/sound/soc/codecs/wcd938x-sdw.c
+++ b/sound/soc/codecs/wcd938x-sdw.c
@@ -176,8 +176,19 @@ static int wcd9380_interrupt_callback(struct sdw_slave *slave,
 				      struct sdw_slave_intr_status *status)
 {
 	struct wcd938x_sdw_priv *wcd = dev_get_drvdata(&slave->dev);
+	struct irq_domain *slave_irq = wcd->slave_irq;
+	struct regmap *regmap = dev_get_regmap(&slave->dev, NULL);
+	u32 sts1, sts2, sts3;
 
-	return wcd938x_handle_sdw_irq(wcd);
+	do {
+		handle_nested_irq(irq_find_mapping(slave_irq, 0));
+		regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_0, &sts1);
+		regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_1, &sts2);
+		regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_2, &sts3);
+
+	} while (sts1 || sts2 || sts3);
+
+	return IRQ_HANDLED;
 }
 
 static struct sdw_slave_ops wcd9380_slave_ops = {
@@ -239,16 +250,10 @@ static int wcd9380_probe(struct sdw_slave *pdev,
 					SDW_SCP_INT1_PARITY;
 	pdev->prop.lane_control_support = true;
 	if (wcd->is_tx) {
-		struct regmap *rm;
-
 		pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0);
 		pdev->prop.src_dpn_prop = wcd938x_dpn_prop;
 		wcd->ch_info = &wcd938x_sdw_tx_ch_info[0];
 		pdev->prop.wake_capable = true;
-
-		rm = devm_regmap_init_sdw(pdev, &wcd938x_regmap_config);
-		if (IS_ERR(rm))
-			return PTR_ERR(rm);
 	} else {
 		pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0);
 		pdev->prop.sink_dpn_prop = wcd938x_dpn_prop;
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index a2c76dc8fd89..24afe93830ce 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -1198,7 +1198,7 @@ static bool wcd938x_volatile_register(struct device *dev, unsigned int reg)
 	return false;
 }
 
-struct regmap_config wcd938x_regmap_config = {
+static struct regmap_config wcd938x_regmap_config = {
 	.name = "wcd938x_csr",
 	.reg_bits = 32,
 	.val_bits = 8,
@@ -1211,7 +1211,6 @@ struct regmap_config wcd938x_regmap_config = {
 	.volatile_reg = wcd938x_volatile_register,
 	.can_multi_write = true,
 };
-EXPORT_SYMBOL_GPL(wcd938x_regmap_config);
 
 static const struct regmap_irq wcd938x_irqs[WCD938X_NUM_IRQS] = {
 	REGMAP_IRQ_REG(WCD938X_IRQ_MBHC_BUTTON_PRESS_DET, 0, 0x01),
@@ -3472,24 +3471,6 @@ static int wcd938x_reset(struct wcd938x_priv *wcd938x)
 	return 0;
 }
 
-int wcd938x_handle_sdw_irq(struct wcd938x_sdw_priv *wcd)
-{
-	struct wcd938x_priv *wcd938x = wcd->wcd938x;
-	struct irq_domain *slave_irq = wcd938x->virq;
-	u32 sts1, sts2, sts3;
-
-	do {
-		handle_nested_irq(irq_find_mapping(slave_irq, 0));
-		regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_0, &sts1);
-		regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_1, &sts2);
-		regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_2, &sts3);
-
-	} while (sts1 || sts2 || sts3);
-
-	return IRQ_HANDLED;
-}
-EXPORT_SYMBOL_GPL(wcd938x_handle_sdw_irq);
-
 static int wcd938x_codec_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params,
 				struct snd_soc_dai *dai)
@@ -3573,6 +3554,7 @@ static int wcd938x_bind(struct device *dev)
 	}
 	wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev);
 	wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x;
+	wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq;
 
 	wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode);
 	if (!wcd938x->txdev) {
@@ -3581,6 +3563,7 @@ static int wcd938x_bind(struct device *dev)
 	}
 	wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev);
 	wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x;
+	wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq;
 	wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev);
 	if (!wcd938x->tx_sdw_dev) {
 		dev_err(dev, "could not get txslave with matching of dev\n");
@@ -3607,8 +3590,8 @@ static int wcd938x_bind(struct device *dev)
 		return -EINVAL;
 	}
 
-	wcd938x->regmap = dev_get_regmap(wcd938x->txdev, NULL);
-	if (!wcd938x->regmap) {
+	wcd938x->regmap = devm_regmap_init_sdw(wcd938x->tx_sdw_dev, &wcd938x_regmap_config);
+	if (IS_ERR(wcd938x->regmap)) {
 		dev_err(dev, "%s: tx csr regmap not found\n", __func__);
 		return PTR_ERR(wcd938x->regmap);
 	}
diff --git a/sound/soc/codecs/wcd938x.h b/sound/soc/codecs/wcd938x.h
index 9db3ab6e47a6..07b08de4cebf 100644
--- a/sound/soc/codecs/wcd938x.h
+++ b/sound/soc/codecs/wcd938x.h
@@ -663,11 +663,9 @@ struct wcd938x_sdw_priv {
 	int num_ports;
 	bool is_tx;
 	struct wcd938x_priv *wcd938x;
+	struct irq_domain *slave_irq;
 };
 
-extern struct regmap_config wcd938x_regmap_config;
-int wcd938x_handle_sdw_irq(struct wcd938x_sdw_priv *priv);
-
 #if IS_ENABLED(CONFIG_SND_SOC_WCD938X_SDW)
 int wcd938x_sdw_free(struct wcd938x_sdw_priv *wcd,
 		     struct snd_pcm_substream *substream,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency
  2021-06-15  9:48 [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency Srinivas Kandagatla
@ 2021-06-15 12:35 ` Mark Brown
  2021-06-15 17:29 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-06-15 12:35 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: alsa-devel, linux-kernel, lgirdwood, Stephen Rothwell

[-- Attachment #1: Type: text/plain, Size: 690 bytes --]

On Tue, Jun 15, 2021 at 10:48:39AM +0100, Srinivas Kandagatla wrote:
> For some reason we ended up with cyclic dependency between snd_soc_wcd938x
> and snd_soc_wcd938x_sdw modules.
> 
> Remove this cyclic dependency by handling them in respective modules.
> Without this below error is reported during make modules_install

This breaks an x86 allmodconfig build:

/mnt/kernel/sound/soc/codecs/wcd938x-sdw.c: In function 'wcd9380_interrupt_callback':
/mnt/kernel/sound/soc/codecs/wcd938x-sdw.c:184:3: error: implicit declaration of function 'handle_nested_irq' [-Werror=implicit-function-declaration]
   handle_nested_irq(irq_find_mapping(slave_irq, 0));
   ^~~~~~~~~~~~~~~~~


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency
  2021-06-15  9:48 [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency Srinivas Kandagatla
  2021-06-15 12:35 ` Mark Brown
@ 2021-06-15 17:29 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-06-15 17:29 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Mark Brown, alsa-devel, linux-kernel, Stephen Rothwell, lgirdwood

On Tue, 15 Jun 2021 10:48:39 +0100, Srinivas Kandagatla wrote:
> For some reason we ended up with cyclic dependency between snd_soc_wcd938x
> and snd_soc_wcd938x_sdw modules.
> 
> Remove this cyclic dependency by handling them in respective modules.
> Without this below error is reported during make modules_install
> 
> depmod: ERROR: Cycle detected: snd_soc_wcd938x -> snd_soc_wcd938x_sdw -> snd_soc_wcd938x
> depmod: ERROR: Found 2 modules in dependency cycles!

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: wcd938x: remove incorrect module interdependency
      commit: b90d9398d6ff6f518f352c39176450dbaf99e276

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-15 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15  9:48 [PATCH] ASoC: codecs: wcd938x: remove incorrect module interdependency Srinivas Kandagatla
2021-06-15 12:35 ` Mark Brown
2021-06-15 17:29 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).