Commit 2be2d579 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: acpi: remove hard-coded i2c-device name length

Remove hard-codec [16] array size, replace with clearer description and
dependency on ACPI_ID_LEN
No functionality change
Suggested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-By: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3c22a73f
...@@ -27,6 +27,9 @@ struct snd_soc_acpi_package_context { ...@@ -27,6 +27,9 @@ struct snd_soc_acpi_package_context {
bool data_valid; bool data_valid;
}; };
/* codec name is used in DAIs is i2c-<HID>:00 with HID being 8 chars */
#define SND_ACPI_I2C_ID_LEN (4 + ACPI_ID_LEN + 3 + 1)
#if IS_ENABLED(CONFIG_ACPI) #if IS_ENABLED(CONFIG_ACPI)
/* translation fron HID to I2C name, needed for DAI codec_name */ /* translation fron HID to I2C name, needed for DAI codec_name */
const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]); const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
......
...@@ -219,7 +219,7 @@ static struct snd_soc_card bytcht_da7213_card = { ...@@ -219,7 +219,7 @@ static struct snd_soc_card bytcht_da7213_card = {
.num_dapm_routes = ARRAY_SIZE(audio_map), .num_dapm_routes = ARRAY_SIZE(audio_map),
}; };
static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ static char codec_name[SND_ACPI_I2C_ID_LEN];
static int bytcht_da7213_probe(struct platform_device *pdev) static int bytcht_da7213_probe(struct platform_device *pdev)
{ {
......
...@@ -232,7 +232,7 @@ static struct snd_soc_card byt_cht_es8316_card = { ...@@ -232,7 +232,7 @@ static struct snd_soc_card byt_cht_es8316_card = {
.fully_routed = true, .fully_routed = true,
}; };
static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ static char codec_name[SND_ACPI_I2C_ID_LEN];
static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
{ {
......
...@@ -713,7 +713,7 @@ static struct snd_soc_card byt_rt5640_card = { ...@@ -713,7 +713,7 @@ static struct snd_soc_card byt_rt5640_card = {
.fully_routed = true, .fully_routed = true,
}; };
static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ static char byt_rt5640_codec_name[SND_ACPI_I2C_ID_LEN];
static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */ static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
......
...@@ -509,7 +509,7 @@ static struct snd_soc_card byt_rt5651_card = { ...@@ -509,7 +509,7 @@ static struct snd_soc_card byt_rt5651_card = {
.fully_routed = true, .fully_routed = true,
}; };
static char byt_rt5651_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
static int snd_byt_rt5651_mc_probe(struct platform_device *pdev) static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
{ {
......
...@@ -49,7 +49,7 @@ struct cht_acpi_card { ...@@ -49,7 +49,7 @@ struct cht_acpi_card {
struct cht_mc_private { struct cht_mc_private {
struct snd_soc_jack jack; struct snd_soc_jack jack;
struct cht_acpi_card *acpi_card; struct cht_acpi_card *acpi_card;
char codec_name[16]; char codec_name[SND_ACPI_I2C_ID_LEN];
struct clk *mclk; struct clk *mclk;
}; };
...@@ -499,7 +499,7 @@ static struct cht_acpi_card snd_soc_cards[] = { ...@@ -499,7 +499,7 @@ static struct cht_acpi_card snd_soc_cards[] = {
{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650}, {"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
}; };
static char cht_rt5645_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ static char cht_rt5645_codec_name[SND_ACPI_I2C_ID_LEN];
static char cht_rt5645_codec_aif_name[12]; /* = "rt5645-aif[1|2]" */ static char cht_rt5645_codec_aif_name[12]; /* = "rt5645-aif[1|2]" */
static char cht_rt5645_cpu_dai_name[10]; /* = "ssp[0|2]-port" */ static char cht_rt5645_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
struct cht_mc_private { struct cht_mc_private {
struct snd_soc_jack headset; struct snd_soc_jack headset;
char codec_name[16]; char codec_name[SND_ACPI_I2C_ID_LEN];
struct clk *mclk; struct clk *mclk;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment