@@ -1222,7 +1222,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
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,6 +1239,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
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 ))
@@ -1315,7 +1316,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1315
1316
goto error ;
1316
1317
}
1317
1318
1318
- err = read_widget_caps (codec , codec -> afg ? codec -> afg : codec -> mfg );
1319
+ fg = codec -> afg ? codec -> afg : codec -> mfg ;
1320
+ err = read_widget_caps (codec , fg );
1319
1321
if (err < 0 ) {
1320
1322
snd_printk (KERN_ERR "hda_codec: cannot malloc\n" );
1321
1323
goto error ;
@@ -1325,27 +1327,22 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1325
1327
goto error ;
1326
1328
1327
1329
if (!codec -> subsystem_id ) {
1328
- hda_nid_t nid = codec -> afg ? codec -> afg : codec -> mfg ;
1329
1330
codec -> subsystem_id =
1330
- snd_hda_codec_read (codec , nid , 0 ,
1331
+ snd_hda_codec_read (codec , fg , 0 ,
1331
1332
AC_VERB_GET_SUBSYSTEM_ID , 0 );
1332
1333
}
1333
1334
1334
1335
#ifdef CONFIG_PM
1335
- codec -> d3_stop_clk = snd_hda_codec_get_supported_ps (codec ,
1336
- codec -> afg ? codec -> afg : codec -> mfg ,
1336
+ codec -> d3_stop_clk = snd_hda_codec_get_supported_ps (codec , fg ,
1337
1337
AC_PWRST_CLKSTOP );
1338
1338
if (!codec -> d3_stop_clk )
1339
1339
bus -> power_keep_link_on = 1 ;
1340
1340
#endif
1341
- codec -> epss = snd_hda_codec_get_supported_ps (codec ,
1342
- codec -> afg ? codec -> afg : codec -> mfg ,
1341
+ codec -> epss = snd_hda_codec_get_supported_ps (codec , fg ,
1343
1342
AC_PWRST_EPSS );
1344
1343
1345
1344
/* power-up all before initialization */
1346
- hda_set_power_state (codec ,
1347
- codec -> afg ? codec -> afg : codec -> mfg ,
1348
- AC_PWRST_D0 );
1345
+ hda_set_power_state (codec , AC_PWRST_D0 );
1349
1346
1350
1347
snd_hda_codec_proc_new (codec );
1351
1348
@@ -3566,9 +3563,10 @@ static unsigned int hda_sync_power_state(struct hda_codec *codec,
3566
3563
/*
3567
3564
* set power state of the codec, and return the power state
3568
3565
*/
3569
- static unsigned int hda_set_power_state (struct hda_codec * codec , hda_nid_t fg ,
3566
+ static unsigned int hda_set_power_state (struct hda_codec * codec ,
3570
3567
unsigned int power_state )
3571
3568
{
3569
+ hda_nid_t fg = codec -> afg ? codec -> afg : codec -> mfg ;
3572
3570
int count ;
3573
3571
unsigned int state ;
3574
3572
@@ -3621,9 +3619,7 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec)
3621
3619
if (codec -> patch_ops .suspend )
3622
3620
codec -> patch_ops .suspend (codec );
3623
3621
hda_cleanup_all_streams (codec );
3624
- state = hda_set_power_state (codec ,
3625
- codec -> afg ? codec -> afg : codec -> mfg ,
3626
- AC_PWRST_D3 );
3622
+ state = hda_set_power_state (codec , AC_PWRST_D3 );
3627
3623
cancel_delayed_work (& codec -> power_work );
3628
3624
spin_lock (& codec -> power_lock );
3629
3625
snd_hda_update_power_acct (codec );
@@ -3644,9 +3640,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3644
3640
* in the resume / power-save sequence
3645
3641
*/
3646
3642
hda_keep_power_on (codec );
3647
- hda_set_power_state (codec ,
3648
- codec -> afg ? codec -> afg : codec -> mfg ,
3649
- AC_PWRST_D0 );
3643
+ hda_set_power_state (codec , AC_PWRST_D0 );
3650
3644
restore_pincfgs (codec ); /* restore all current pin configs */
3651
3645
restore_shutup_pins (codec );
3652
3646
hda_exec_init_verbs (codec );
0 commit comments