ASoC: acpi: remove hard-coded i2c-device name length
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 11 Jan 2018 19:52:09 +0000 (13:52 -0600)
committerMark Brown <broonie@kernel.org>
Fri, 12 Jan 2018 21:05:41 +0000 (21:05 +0000)
Remove hard-codec [16] array size, replace with clearer description and
dependency on ACPI_ID_LEN
No functionality change

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-acpi.h
sound/soc/intel/boards/bytcht_da7213.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/bytcr_rt5640.c
sound/soc/intel/boards/bytcr_rt5651.c
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5672.c

index d1aaf876cd26b0530728fe90125e634936e93ac3..83320af8def28c71c86ba3246ab607de8d6cdd18 100644 (file)
@@ -27,6 +27,9 @@ struct snd_soc_acpi_package_context {
        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)
 /* 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]);
index c4d82ad41bd70b432ee82b327f6ce5ccd76024e5..6219c04d4731c06a63b307ecaeedbe984a113f3d 100644 (file)
@@ -219,7 +219,7 @@ static struct snd_soc_card bytcht_da7213_card = {
        .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)
 {
index ae24f6205f0593b85ae303af821e844ecd18de11..079f35cd4eafaf0ccd343201c55ca252426f83bb 100644 (file)
@@ -232,7 +232,7 @@ static struct snd_soc_card byt_cht_es8316_card = {
        .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)
 {
index f2c0fc415e52fccfb138597f0ff5c3ef6f6136ef..4548f75498d0ea132c443b681e23ea728727cce1 100644 (file)
@@ -713,7 +713,7 @@ static struct snd_soc_card byt_rt5640_card = {
        .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_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 
index 22c9cc5d135e365ebb71feff264d31e862129034..5a6b7dedb77319142f715c377f19e3a21d3b7b73 100644 (file)
@@ -509,7 +509,7 @@ static struct snd_soc_card byt_rt5651_card = {
        .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)
 {
index 18d129caa974f7c905930d6381f7673820b0323f..cef6a8c31c8d08eb9f2c4c2c14bac06946b72fe9 100644 (file)
@@ -49,7 +49,7 @@ struct cht_acpi_card {
 struct cht_mc_private {
        struct snd_soc_jack jack;
        struct cht_acpi_card *acpi_card;
-       char codec_name[16];
+       char codec_name[SND_ACPI_I2C_ID_LEN];
        struct clk *mclk;
 };
 
@@ -499,7 +499,7 @@ static struct cht_acpi_card snd_soc_cards[] = {
        {"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_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 
index f8f21eee9b2d373e4d8c60e8d696286e598e0ad0..1f3d38dc4fcbff797e0385c6f2972d46f5df407d 100644 (file)
@@ -35,7 +35,7 @@
 
 struct cht_mc_private {
        struct snd_soc_jack headset;
-       char codec_name[16];
+       char codec_name[SND_ACPI_I2C_ID_LEN];
        struct clk *mclk;
 };