[PATCH v2 1/4] ALSA: hda: cs35l41: Don't dereference fwnode handle
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";
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
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,
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.
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
participants (2)
-
Andy Shevchenko
-
Takashi Iwai