All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fix card registration regression.
@ 2020-02-19 10:25   ` Jerome Brunet
  0 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2020-02-19 10:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Jerome Brunet, alsa-devel, devicetree, linux-kernel,
	linux-rpi-kernel, Marek Szyprowski

This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.

This change might have been desirable to ensure the uniqueness of
the component name. It would have helped to better support linux
devices which register multiple components, something is which more
common than initially thought.

However, some card driver are directly using dev_name() to fill the
component names of the dai_link which is a problem if want to change
the way ASoC generates the component names.

Until we figure out the appropriate way to deal with this, revert the
change and keep the names as they were. There might be a couple of warning
related to debugfs (which were already present before the change) but it
is still better than breaking working audio cards.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/soc-core.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 30c17fde14ca..518b652cf872 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
 	return ret;
 }
 
-static char *snd_soc_component_unique_name(struct device *dev,
-					   struct snd_soc_component *component)
-{
-	struct snd_soc_component *pos;
-	int count = 0;
-	char *name, *unique;
-
-	name = fmt_single_name(dev, &component->id);
-	if (!name)
-		return name;
-
-	/* Count the number of components registred by the device */
-	for_each_component(pos) {
-		if (dev == pos->dev)
-			count++;
-	}
-
-	/* Keep naming as it is for the 1st component */
-	if (!count)
-		return name;
-
-	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
-	devm_kfree(dev, name);
-
-	return unique;
-}
-
 static int snd_soc_component_initialize(struct snd_soc_component *component,
 	const struct snd_soc_component_driver *driver, struct device *dev)
 {
@@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	INIT_LIST_HEAD(&component->card_list);
 	mutex_init(&component->io_mutex);
 
-	component->name = snd_soc_component_unique_name(dev, component);
+	component->name = fmt_single_name(dev, &component->id);
 	if (!component->name) {
 		dev_err(dev, "ASoC: Failed to allocate name\n");
 		return -ENOMEM;
-- 
2.24.1


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

* [PATCH] ASoC: fix card registration regression.
@ 2020-02-19 10:25   ` Jerome Brunet
  0 siblings, 0 replies; 6+ messages in thread
From: Jerome Brunet @ 2020-02-19 10:25 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, linux-kernel, linux-rpi-kernel,
	Jerome Brunet, Marek Szyprowski

This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.

This change might have been desirable to ensure the uniqueness of
the component name. It would have helped to better support linux
devices which register multiple components, something is which more
common than initially thought.

However, some card driver are directly using dev_name() to fill the
component names of the dai_link which is a problem if want to change
the way ASoC generates the component names.

Until we figure out the appropriate way to deal with this, revert the
change and keep the names as they were. There might be a couple of warning
related to debugfs (which were already present before the change) but it
is still better than breaking working audio cards.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/soc-core.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 30c17fde14ca..518b652cf872 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
 	return ret;
 }
 
-static char *snd_soc_component_unique_name(struct device *dev,
-					   struct snd_soc_component *component)
-{
-	struct snd_soc_component *pos;
-	int count = 0;
-	char *name, *unique;
-
-	name = fmt_single_name(dev, &component->id);
-	if (!name)
-		return name;
-
-	/* Count the number of components registred by the device */
-	for_each_component(pos) {
-		if (dev == pos->dev)
-			count++;
-	}
-
-	/* Keep naming as it is for the 1st component */
-	if (!count)
-		return name;
-
-	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
-	devm_kfree(dev, name);
-
-	return unique;
-}
-
 static int snd_soc_component_initialize(struct snd_soc_component *component,
 	const struct snd_soc_component_driver *driver, struct device *dev)
 {
@@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	INIT_LIST_HEAD(&component->card_list);
 	mutex_init(&component->io_mutex);
 
-	component->name = snd_soc_component_unique_name(dev, component);
+	component->name = fmt_single_name(dev, &component->id);
 	if (!component->name) {
 		dev_err(dev, "ASoC: Failed to allocate name\n");
 		return -ENOMEM;
-- 
2.24.1


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

* Re: [PATCH] ASoC: fix card registration regression.
  2020-02-19 10:25   ` Jerome Brunet
@ 2020-02-19 13:00     ` Marek Szyprowski
  -1 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2020-02-19 13:00 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown, Liam Girdwood
  Cc: alsa-devel, devicetree, linux-kernel, linux-rpi-kernel

Hi Jerome,

On 19.02.2020 11:25, Jerome Brunet wrote:
> This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.
>
> This change might have been desirable to ensure the uniqueness of
> the component name. It would have helped to better support linux
> devices which register multiple components, something is which more
> common than initially thought.
>
> However, some card driver are directly using dev_name() to fill the
> component names of the dai_link which is a problem if want to change
> the way ASoC generates the component names.
>
> Until we figure out the appropriate way to deal with this, revert the
> change and keep the names as they were. There might be a couple of warning
> related to debugfs (which were already present before the change) but it
> is still better than breaking working audio cards.
>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

As expected, this fixes vc4-drm driver registration on RPi3.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   sound/soc/soc-core.c | 29 +----------------------------
>   1 file changed, 1 insertion(+), 28 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 30c17fde14ca..518b652cf872 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
>   	return ret;
>   }
>   
> -static char *snd_soc_component_unique_name(struct device *dev,
> -					   struct snd_soc_component *component)
> -{
> -	struct snd_soc_component *pos;
> -	int count = 0;
> -	char *name, *unique;
> -
> -	name = fmt_single_name(dev, &component->id);
> -	if (!name)
> -		return name;
> -
> -	/* Count the number of components registred by the device */
> -	for_each_component(pos) {
> -		if (dev == pos->dev)
> -			count++;
> -	}
> -
> -	/* Keep naming as it is for the 1st component */
> -	if (!count)
> -		return name;
> -
> -	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
> -	devm_kfree(dev, name);
> -
> -	return unique;
> -}
> -
>   static int snd_soc_component_initialize(struct snd_soc_component *component,
>   	const struct snd_soc_component_driver *driver, struct device *dev)
>   {
> @@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
>   	INIT_LIST_HEAD(&component->card_list);
>   	mutex_init(&component->io_mutex);
>   
> -	component->name = snd_soc_component_unique_name(dev, component);
> +	component->name = fmt_single_name(dev, &component->id);
>   	if (!component->name) {
>   		dev_err(dev, "ASoC: Failed to allocate name\n");
>   		return -ENOMEM;

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* Re: [PATCH] ASoC: fix card registration regression.
@ 2020-02-19 13:00     ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2020-02-19 13:00 UTC (permalink / raw)
  To: Jerome Brunet, Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, linux-kernel, linux-rpi-kernel

Hi Jerome,

On 19.02.2020 11:25, Jerome Brunet wrote:
> This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.
>
> This change might have been desirable to ensure the uniqueness of
> the component name. It would have helped to better support linux
> devices which register multiple components, something is which more
> common than initially thought.
>
> However, some card driver are directly using dev_name() to fill the
> component names of the dai_link which is a problem if want to change
> the way ASoC generates the component names.
>
> Until we figure out the appropriate way to deal with this, revert the
> change and keep the names as they were. There might be a couple of warning
> related to debugfs (which were already present before the change) but it
> is still better than breaking working audio cards.
>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

As expected, this fixes vc4-drm driver registration on RPi3.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   sound/soc/soc-core.c | 29 +----------------------------
>   1 file changed, 1 insertion(+), 28 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 30c17fde14ca..518b652cf872 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
>   	return ret;
>   }
>   
> -static char *snd_soc_component_unique_name(struct device *dev,
> -					   struct snd_soc_component *component)
> -{
> -	struct snd_soc_component *pos;
> -	int count = 0;
> -	char *name, *unique;
> -
> -	name = fmt_single_name(dev, &component->id);
> -	if (!name)
> -		return name;
> -
> -	/* Count the number of components registred by the device */
> -	for_each_component(pos) {
> -		if (dev == pos->dev)
> -			count++;
> -	}
> -
> -	/* Keep naming as it is for the 1st component */
> -	if (!count)
> -		return name;
> -
> -	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
> -	devm_kfree(dev, name);
> -
> -	return unique;
> -}
> -
>   static int snd_soc_component_initialize(struct snd_soc_component *component,
>   	const struct snd_soc_component_driver *driver, struct device *dev)
>   {
> @@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
>   	INIT_LIST_HEAD(&component->card_list);
>   	mutex_init(&component->io_mutex);
>   
> -	component->name = snd_soc_component_unique_name(dev, component);
> +	component->name = fmt_single_name(dev, &component->id);
>   	if (!component->name) {
>   		dev_err(dev, "ASoC: Failed to allocate name\n");
>   		return -ENOMEM;

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* Applied "ASoC: fix card registration regression." to the asoc tree
  2020-02-19 10:25   ` Jerome Brunet
@ 2020-02-19 20:57     ` Mark Brown
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2020-02-19 20:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: alsa-devel, devicetree, Liam Girdwood, linux-kernel,
	linux-rpi-kernel, Marek Szyprowski, Mark Brown

The patch

   ASoC: fix card registration regression.

has been applied to the asoc tree at

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

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

From 6b62fa95b56bcc77cbbcc76e45f5170b4ec229b1 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Wed, 19 Feb 2020 11:25:26 +0100
Subject: [PATCH] ASoC: fix card registration regression.

This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.

This change might have been desirable to ensure the uniqueness of
the component name. It would have helped to better support linux
devices which register multiple components, something is which more
common than initially thought.

However, some card driver are directly using dev_name() to fill the
component names of the dai_link which is a problem if want to change
the way ASoC generates the component names.

Until we figure out the appropriate way to deal with this, revert the
change and keep the names as they were. There might be a couple of warning
related to debugfs (which were already present before the change) but it
is still better than breaking working audio cards.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20200219102526.692126-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-core.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 30c17fde14ca..518b652cf872 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
 	return ret;
 }
 
-static char *snd_soc_component_unique_name(struct device *dev,
-					   struct snd_soc_component *component)
-{
-	struct snd_soc_component *pos;
-	int count = 0;
-	char *name, *unique;
-
-	name = fmt_single_name(dev, &component->id);
-	if (!name)
-		return name;
-
-	/* Count the number of components registred by the device */
-	for_each_component(pos) {
-		if (dev == pos->dev)
-			count++;
-	}
-
-	/* Keep naming as it is for the 1st component */
-	if (!count)
-		return name;
-
-	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
-	devm_kfree(dev, name);
-
-	return unique;
-}
-
 static int snd_soc_component_initialize(struct snd_soc_component *component,
 	const struct snd_soc_component_driver *driver, struct device *dev)
 {
@@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	INIT_LIST_HEAD(&component->card_list);
 	mutex_init(&component->io_mutex);
 
-	component->name = snd_soc_component_unique_name(dev, component);
+	component->name = fmt_single_name(dev, &component->id);
 	if (!component->name) {
 		dev_err(dev, "ASoC: Failed to allocate name\n");
 		return -ENOMEM;
-- 
2.20.1


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

* Applied "ASoC: fix card registration regression." to the asoc tree
@ 2020-02-19 20:57     ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2020-02-19 20:57 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: devicetree, alsa-devel, Liam Girdwood, linux-kernel, Mark Brown,
	linux-rpi-kernel, Marek Szyprowski

The patch

   ASoC: fix card registration regression.

has been applied to the asoc tree at

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

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

From 6b62fa95b56bcc77cbbcc76e45f5170b4ec229b1 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Wed, 19 Feb 2020 11:25:26 +0100
Subject: [PATCH] ASoC: fix card registration regression.

This reverts commit b2354e4009a773c00054b964d937e1b81cb92078.

This change might have been desirable to ensure the uniqueness of
the component name. It would have helped to better support linux
devices which register multiple components, something is which more
common than initially thought.

However, some card driver are directly using dev_name() to fill the
component names of the dai_link which is a problem if want to change
the way ASoC generates the component names.

Until we figure out the appropriate way to deal with this, revert the
change and keep the names as they were. There might be a couple of warning
related to debugfs (which were already present before the change) but it
is still better than breaking working audio cards.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20200219102526.692126-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-core.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 30c17fde14ca..518b652cf872 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2442,33 +2442,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
 	return ret;
 }
 
-static char *snd_soc_component_unique_name(struct device *dev,
-					   struct snd_soc_component *component)
-{
-	struct snd_soc_component *pos;
-	int count = 0;
-	char *name, *unique;
-
-	name = fmt_single_name(dev, &component->id);
-	if (!name)
-		return name;
-
-	/* Count the number of components registred by the device */
-	for_each_component(pos) {
-		if (dev == pos->dev)
-			count++;
-	}
-
-	/* Keep naming as it is for the 1st component */
-	if (!count)
-		return name;
-
-	unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count);
-	devm_kfree(dev, name);
-
-	return unique;
-}
-
 static int snd_soc_component_initialize(struct snd_soc_component *component,
 	const struct snd_soc_component_driver *driver, struct device *dev)
 {
@@ -2477,7 +2450,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	INIT_LIST_HEAD(&component->card_list);
 	mutex_init(&component->io_mutex);
 
-	component->name = snd_soc_component_unique_name(dev, component);
+	component->name = fmt_single_name(dev, &component->id);
 	if (!component->name) {
 		dev_err(dev, "ASoC: Failed to allocate name\n");
 		return -ENOMEM;
-- 
2.20.1


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

end of thread, other threads:[~2020-02-19 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200219102548eucas1p1c4c4ec50d6d4e01500028bedfed5305e@eucas1p1.samsung.com>
2020-02-19 10:25 ` [PATCH] ASoC: fix card registration regression Jerome Brunet
2020-02-19 10:25   ` Jerome Brunet
2020-02-19 13:00   ` Marek Szyprowski
2020-02-19 13:00     ` Marek Szyprowski
2020-02-19 20:57   ` Applied "ASoC: fix card registration regression." to the asoc tree Mark Brown
2020-02-19 20:57     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.