aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-07 09:23:44 -0500
committerTakashi Iwai <tiwai@suse.de>2014-01-08 03:59:00 -0500
commitd81e397c65279847e473a2284927ee5b4f712693 (patch)
treeb1e5524de6812f5f9e88449b30c14db42d8933eb /sound/pci
parent7546abfb8e1f9933b549f05898377e9444ee4cb2 (diff)
ALSA: hda - firmware patch code cleanup
Just a code refactoring: the need_codec flag in hda_patch_item struct can be removed by checking the current mode instead. No functional change. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_hwdep.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 0ec6fb1e9846..79b3dd0d4dd8 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -763,19 +763,18 @@ DEFINE_PARSE_ID_MODE(revision_id);
763struct hda_patch_item { 763struct hda_patch_item {
764 const char *tag; 764 const char *tag;
765 void (*parser)(char *buf, struct hda_bus *bus, struct hda_codec **retc); 765 void (*parser)(char *buf, struct hda_bus *bus, struct hda_codec **retc);
766 int need_codec;
767}; 766};
768 767
769static struct hda_patch_item patch_items[NUM_LINE_MODES] = { 768static struct hda_patch_item patch_items[NUM_LINE_MODES] = {
770 [LINE_MODE_CODEC] = { "[codec]", parse_codec_mode, 0 }, 769 [LINE_MODE_CODEC] = { "[codec]", parse_codec_mode },
771 [LINE_MODE_MODEL] = { "[model]", parse_model_mode, 1 }, 770 [LINE_MODE_MODEL] = { "[model]", parse_model_mode },
772 [LINE_MODE_VERB] = { "[verb]", parse_verb_mode, 1 }, 771 [LINE_MODE_VERB] = { "[verb]", parse_verb_mode },
773 [LINE_MODE_PINCFG] = { "[pincfg]", parse_pincfg_mode, 1 }, 772 [LINE_MODE_PINCFG] = { "[pincfg]", parse_pincfg_mode },
774 [LINE_MODE_HINT] = { "[hint]", parse_hint_mode, 1 }, 773 [LINE_MODE_HINT] = { "[hint]", parse_hint_mode },
775 [LINE_MODE_VENDOR_ID] = { "[vendor_id]", parse_vendor_id_mode, 1 }, 774 [LINE_MODE_VENDOR_ID] = { "[vendor_id]", parse_vendor_id_mode },
776 [LINE_MODE_SUBSYSTEM_ID] = { "[subsystem_id]", parse_subsystem_id_mode, 1 }, 775 [LINE_MODE_SUBSYSTEM_ID] = { "[subsystem_id]", parse_subsystem_id_mode },
777 [LINE_MODE_REVISION_ID] = { "[revision_id]", parse_revision_id_mode, 1 }, 776 [LINE_MODE_REVISION_ID] = { "[revision_id]", parse_revision_id_mode },
778 [LINE_MODE_CHIP_NAME] = { "[chip_name]", parse_chip_name_mode, 1 }, 777 [LINE_MODE_CHIP_NAME] = { "[chip_name]", parse_chip_name_mode },
779}; 778};
780 779
781/* check the line starting with '[' -- change the parser mode accodingly */ 780/* check the line starting with '[' -- change the parser mode accodingly */
@@ -846,7 +845,7 @@ int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf)
846 if (*buf == '[') 845 if (*buf == '[')
847 line_mode = parse_line_mode(buf, bus); 846 line_mode = parse_line_mode(buf, bus);
848 else if (patch_items[line_mode].parser && 847 else if (patch_items[line_mode].parser &&
849 (codec || !patch_items[line_mode].need_codec)) 848 (codec || line_mode <= LINE_MODE_CODEC))
850 patch_items[line_mode].parser(buf, bus, &codec); 849 patch_items[line_mode].parser(buf, bus, &codec);
851 } 850 }
852 return 0; 851 return 0;