Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: hda - Clean up redundant FG checks

Just refactoring, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+12 -18
+12 -18
sound/pci/hda/hda_codec.c
··· 1222 1222 static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, 1223 1223 hda_nid_t fg, unsigned int power_state); 1224 1224 1225 - static unsigned int hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 1225 + static unsigned int hda_set_power_state(struct hda_codec *codec, 1226 1226 unsigned int power_state); 1227 1227 1228 1228 /** ··· 1239 1239 { 1240 1240 struct hda_codec *codec; 1241 1241 char component[31]; 1242 + hda_nid_t fg; 1242 1243 int err; 1243 1244 1244 1245 if (snd_BUG_ON(!bus)) ··· 1316 1315 goto error; 1317 1316 } 1318 1317 1319 - err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); 1318 + fg = codec->afg ? codec->afg : codec->mfg; 1319 + err = read_widget_caps(codec, fg); 1320 1320 if (err < 0) { 1321 1321 snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); 1322 1322 goto error; ··· 1327 1325 goto error; 1328 1326 1329 1327 if (!codec->subsystem_id) { 1330 - hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; 1331 1328 codec->subsystem_id = 1332 - snd_hda_codec_read(codec, nid, 0, 1329 + snd_hda_codec_read(codec, fg, 0, 1333 1330 AC_VERB_GET_SUBSYSTEM_ID, 0); 1334 1331 } 1335 1332 1336 1333 #ifdef CONFIG_PM 1337 - codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, 1338 - codec->afg ? codec->afg : codec->mfg, 1334 + codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, fg, 1339 1335 AC_PWRST_CLKSTOP); 1340 1336 if (!codec->d3_stop_clk) 1341 1337 bus->power_keep_link_on = 1; 1342 1338 #endif 1343 - codec->epss = snd_hda_codec_get_supported_ps(codec, 1344 - codec->afg ? codec->afg : codec->mfg, 1339 + codec->epss = snd_hda_codec_get_supported_ps(codec, fg, 1345 1340 AC_PWRST_EPSS); 1346 1341 1347 1342 /* power-up all before initialization */ 1348 - hda_set_power_state(codec, 1349 - codec->afg ? codec->afg : codec->mfg, 1350 - AC_PWRST_D0); 1343 + hda_set_power_state(codec, AC_PWRST_D0); 1351 1344 1352 1345 snd_hda_codec_proc_new(codec); 1353 1346 ··· 3563 3566 /* 3564 3567 * set power state of the codec, and return the power state 3565 3568 */ 3566 - static unsigned int hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 3569 + static unsigned int hda_set_power_state(struct hda_codec *codec, 3567 3570 unsigned int power_state) 3568 3571 { 3572 + hda_nid_t fg = codec->afg ? codec->afg : codec->mfg; 3569 3573 int count; 3570 3574 unsigned int state; 3571 3575 ··· 3619 3621 if (codec->patch_ops.suspend) 3620 3622 codec->patch_ops.suspend(codec); 3621 3623 hda_cleanup_all_streams(codec); 3622 - state = hda_set_power_state(codec, 3623 - codec->afg ? codec->afg : codec->mfg, 3624 - AC_PWRST_D3); 3624 + state = hda_set_power_state(codec, AC_PWRST_D3); 3625 3625 cancel_delayed_work(&codec->power_work); 3626 3626 spin_lock(&codec->power_lock); 3627 3627 snd_hda_update_power_acct(codec); ··· 3640 3644 * in the resume / power-save sequence 3641 3645 */ 3642 3646 hda_keep_power_on(codec); 3643 - hda_set_power_state(codec, 3644 - codec->afg ? codec->afg : codec->mfg, 3645 - AC_PWRST_D0); 3647 + hda_set_power_state(codec, AC_PWRST_D0); 3646 3648 restore_pincfgs(codec); /* restore all current pin configs */ 3647 3649 restore_shutup_pins(codec); 3648 3650 hda_exec_init_verbs(codec);