linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle
@ 2022-07-12 15:35 Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-12 15:35 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Jaroslav Kysela, Takashi Iwai, James Schulman, David Rhodes,
	Richard Fitzgerald

Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
which is a better coding practice.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: new change
 sound/pci/hda/cs35l41_hda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index 49b25432a9f5..1a1afa0725e0 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -347,7 +347,7 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
 	/* To use the same release code for all laptop variants we can't use devm_ version of
 	 * gpiod_get here, as CLSA010* don't have a fully functional bios with an _DSD node
 	 */
-	cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
+	cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(adev), "reset", cs35l41->index,
 						     GPIOD_OUT_LOW, "cs35l41-reset");
 
 	property = "cirrus,speaker-position";
-- 
2.35.1


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

* [PATCH v2 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations
  2022-07-12 15:35 [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Andy Shevchenko
@ 2022-07-12 15:35 ` Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-12 15:35 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Jaroslav Kysela, Takashi Iwai, James Schulman, David Rhodes,
	Richard Fitzgerald

ACPI is needed only for functioning of this codec on some platforms,
there is no compilation dependency, so make it optional

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 sound/pci/hda/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 79ade4787d95..e86cf80bdf96 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -97,7 +97,7 @@ config SND_HDA_SCODEC_CS35L41
 config SND_HDA_SCODEC_CS35L41_I2C
 	tristate "Build CS35L41 HD-audio side codec support for I2C Bus"
 	depends on I2C
-	depends on ACPI
+	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
 	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
@@ -113,7 +113,7 @@ comment "Set to Y if you want auto-loading the side codec driver"
 config SND_HDA_SCODEC_CS35L41_SPI
 	tristate "Build CS35L41 HD-audio codec support for SPI Bus"
 	depends on SPI_MASTER
-	depends on ACPI
+	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
 	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
-- 
2.35.1


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

* [PATCH v2 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR()
  2022-07-12 15:35 [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
@ 2022-07-12 15:35 ` Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
  2022-07-13  6:28 ` [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-12 15:35 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Jaroslav Kysela, Takashi Iwai, James Schulman, David Rhodes,
	Richard Fitzgerald

ACPI_PTR() is more harmful than helpful. For example, in this case
if CONFIG_ACPI=n, the ID table left unused which is not what we want.

Instead of adding ifdeffery or attribute here and there, drop ACPI_PTR().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 sound/pci/hda/cs35l41_hda_i2c.c | 8 +++-----
 sound/pci/hda/cs35l41_hda_spi.c | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
index ec626e0fbedc..df39fc76e6be 100644
--- a/sound/pci/hda/cs35l41_hda_i2c.c
+++ b/sound/pci/hda/cs35l41_hda_i2c.c
@@ -6,9 +6,9 @@
 //
 // Author: Lucas Tanure <tanureal@opensource.cirrus.com>
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
-#include <linux/acpi.h>
 
 #include "cs35l41_hda.h"
 
@@ -43,19 +43,17 @@ static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
 	{}
 };
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
 	{"CLSA0100", 0 },
 	{"CSC3551", 0 },
-	{ },
+	{}
 };
 MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
-#endif
 
 static struct i2c_driver cs35l41_i2c_driver = {
 	.driver = {
 		.name		= "cs35l41-hda",
-		.acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
+		.acpi_match_table = cs35l41_acpi_hda_match,
 	},
 	.id_table	= cs35l41_hda_i2c_id,
 	.probe		= cs35l41_hda_i2c_probe,
diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
index 3a1472e1bc24..2f5afad3719e 100644
--- a/sound/pci/hda/cs35l41_hda_spi.c
+++ b/sound/pci/hda/cs35l41_hda_spi.c
@@ -6,7 +6,7 @@
 //
 // Author: Lucas Tanure <tanureal@opensource.cirrus.com>
 
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
 
@@ -39,18 +39,16 @@ static const struct spi_device_id cs35l41_hda_spi_id[] = {
 	{}
 };
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
 	{ "CSC3551", 0 },
-	{},
+	{}
 };
 MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
-#endif
 
 static struct spi_driver cs35l41_spi_driver = {
 	.driver = {
 		.name		= "cs35l41-hda",
-		.acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
+		.acpi_match_table = cs35l41_acpi_hda_match,
 	},
 	.id_table	= cs35l41_hda_spi_id,
 	.probe		= cs35l41_hda_spi_probe,
-- 
2.35.1


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

* [PATCH v2 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41
  2022-07-12 15:35 [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
  2022-07-12 15:35 ` [PATCH v2 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
@ 2022-07-12 15:35 ` Andy Shevchenko
  2022-07-13  6:28 ` [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-12 15:35 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Jaroslav Kysela, Takashi Iwai, James Schulman, David Rhodes,
	Richard Fitzgerald

Selections can be propagated via selections, while dependencies are not.
Hence, consolidate selections under the SND_HDA_SCODEC_CS35L41 option.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 sound/pci/hda/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index e86cf80bdf96..8b73a12d356f 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -93,16 +93,16 @@ config SND_HDA_PATCH_LOADER
 
 config SND_HDA_SCODEC_CS35L41
 	tristate
+	select SND_HDA_GENERIC
+	select REGMAP_IRQ
 
 config SND_HDA_SCODEC_CS35L41_I2C
 	tristate "Build CS35L41 HD-audio side codec support for I2C Bus"
 	depends on I2C
 	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
-	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
 	select SND_HDA_SCODEC_CS35L41
-	select REGMAP_IRQ
 	help
 	  Say Y or M here to include CS35L41 I2C HD-audio side codec support
 	  in snd-hda-intel driver, such as ALC287.
@@ -115,10 +115,8 @@ config SND_HDA_SCODEC_CS35L41_SPI
 	depends on SPI_MASTER
 	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
-	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
 	select SND_HDA_SCODEC_CS35L41
-	select REGMAP_IRQ
 	help
 	  Say Y or M here to include CS35L41 SPI HD-audio side codec support
 	  in snd-hda-intel driver, such as ALC287.
-- 
2.35.1


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

* Re: [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle
  2022-07-12 15:35 [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Andy Shevchenko
                   ` (2 preceding siblings ...)
  2022-07-12 15:35 ` [PATCH v2 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
@ 2022-07-13  6:28 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2022-07-13  6:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lucas Tanure, alsa-devel, linux-kernel, patches, Jaroslav Kysela,
	Takashi Iwai, James Schulman, David Rhodes, Richard Fitzgerald

On Tue, 12 Jul 2022 17:35:16 +0200,
Andy Shevchenko wrote:
> 
> Use acpi_fwnode_handle() instead of dereferencing an fwnode handle directly,
> which is a better coding practice.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: new change

Thanks, applied all four patches now.


Takashi

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

end of thread, other threads:[~2022-07-13  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 15:35 [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Andy Shevchenko
2022-07-12 15:35 ` [PATCH v2 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
2022-07-12 15:35 ` [PATCH v2 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
2022-07-12 15:35 ` [PATCH v2 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
2022-07-13  6:28 ` [PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle Takashi Iwai

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).