summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-03-22 10:51:36 -0400
committerTakashi Iwai <tiwai@suse.de>2019-03-22 15:57:29 -0400
commit4fc90fb883fcb72d6bfbf84d554a3e820a05ef62 (patch)
treeae5dc16bdacbe8069ffea550e153a052051bd081
parentca0214ee2802dd47239a4e39fb21c5b00ef61b22 (diff)
ALSA: hda/ca0132 - Simplify alt firmware loading code
ca0132 codec driver loads the firmware selectively depending on the model in addition to the fallback of the default firmware. The code works good, but a minor problem is that the current code seems confusing for Clang where it spews a warning about uninitialized variable. This patch simplifies the code flow for such a false-positive warning. After this refactoring, the ca0132_spec.alt_firmware_present field is no longer used, hence it's eliminated as well. Reported-and-tested-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_ca0132.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 29882bda7632..e1ebc6d5f382 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -1005,7 +1005,6 @@ struct ca0132_spec {
1005 unsigned int scp_resp_header; 1005 unsigned int scp_resp_header;
1006 unsigned int scp_resp_data[4]; 1006 unsigned int scp_resp_data[4];
1007 unsigned int scp_resp_count; 1007 unsigned int scp_resp_count;
1008 bool alt_firmware_present;
1009 bool startup_check_entered; 1008 bool startup_check_entered;
1010 bool dsp_reload; 1009 bool dsp_reload;
1011 1010
@@ -7518,7 +7517,7 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
7518 bool dsp_loaded = false; 7517 bool dsp_loaded = false;
7519 struct ca0132_spec *spec = codec->spec; 7518 struct ca0132_spec *spec = codec->spec;
7520 const struct dsp_image_seg *dsp_os_image; 7519 const struct dsp_image_seg *dsp_os_image;
7521 const struct firmware *fw_entry; 7520 const struct firmware *fw_entry = NULL;
7522 /* 7521 /*
7523 * Alternate firmwares for different variants. The Recon3Di apparently 7522 * Alternate firmwares for different variants. The Recon3Di apparently
7524 * can use the default firmware, but I'll leave the option in case 7523 * can use the default firmware, but I'll leave the option in case
@@ -7529,33 +7528,26 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
7529 case QUIRK_R3D: 7528 case QUIRK_R3D:
7530 case QUIRK_AE5: 7529 case QUIRK_AE5:
7531 if (request_firmware(&fw_entry, DESKTOP_EFX_FILE, 7530 if (request_firmware(&fw_entry, DESKTOP_EFX_FILE,
7532 codec->card->dev) != 0) { 7531 codec->card->dev) != 0)
7533 codec_dbg(codec, "Desktop firmware not found."); 7532 codec_dbg(codec, "Desktop firmware not found.");
7534 spec->alt_firmware_present = false; 7533 else
7535 } else {
7536 codec_dbg(codec, "Desktop firmware selected."); 7534 codec_dbg(codec, "Desktop firmware selected.");
7537 spec->alt_firmware_present = true;
7538 }
7539 break; 7535 break;
7540 case QUIRK_R3DI: 7536 case QUIRK_R3DI:
7541 if (request_firmware(&fw_entry, R3DI_EFX_FILE, 7537 if (request_firmware(&fw_entry, R3DI_EFX_FILE,
7542 codec->card->dev) != 0) { 7538 codec->card->dev) != 0)
7543 codec_dbg(codec, "Recon3Di alt firmware not detected."); 7539 codec_dbg(codec, "Recon3Di alt firmware not detected.");
7544 spec->alt_firmware_present = false; 7540 else
7545 } else {
7546 codec_dbg(codec, "Recon3Di firmware selected."); 7541 codec_dbg(codec, "Recon3Di firmware selected.");
7547 spec->alt_firmware_present = true;
7548 }
7549 break; 7542 break;
7550 default: 7543 default:
7551 spec->alt_firmware_present = false;
7552 break; 7544 break;
7553 } 7545 }
7554 /* 7546 /*
7555 * Use default ctefx.bin if no alt firmware is detected, or if none 7547 * Use default ctefx.bin if no alt firmware is detected, or if none
7556 * exists for your particular codec. 7548 * exists for your particular codec.
7557 */ 7549 */
7558 if (!spec->alt_firmware_present) { 7550 if (!fw_entry) {
7559 codec_dbg(codec, "Default firmware selected."); 7551 codec_dbg(codec, "Default firmware selected.");
7560 if (request_firmware(&fw_entry, EFX_FILE, 7552 if (request_firmware(&fw_entry, EFX_FILE,
7561 codec->card->dev) != 0) 7553 codec->card->dev) != 0)