@@ -174,7 +174,9 @@ static int fsl_xcvr_activate_ctl(struct snd_soc_dai *dai, const char *name,
174
174
struct snd_kcontrol * kctl ;
175
175
bool enabled ;
176
176
177
- kctl = snd_soc_card_get_kcontrol (card , name );
177
+ lockdep_assert_held (& card -> snd_card -> controls_rwsem );
178
+
179
+ kctl = snd_soc_card_get_kcontrol_locked (card , name );
178
180
if (kctl == NULL )
179
181
return - ENOENT ;
180
182
@@ -576,10 +578,14 @@ static int fsl_xcvr_startup(struct snd_pcm_substream *substream,
576
578
xcvr -> streams |= BIT (substream -> stream );
577
579
578
580
if (!xcvr -> soc_data -> spdif_only ) {
581
+ struct snd_soc_card * card = dai -> component -> card ;
582
+
579
583
/* Disable XCVR controls if there is stream started */
584
+ down_read (& card -> snd_card -> controls_rwsem );
580
585
fsl_xcvr_activate_ctl (dai , fsl_xcvr_mode_kctl .name , false);
581
586
fsl_xcvr_activate_ctl (dai , fsl_xcvr_arc_mode_kctl .name , false);
582
587
fsl_xcvr_activate_ctl (dai , fsl_xcvr_earc_capds_kctl .name , false);
588
+ up_read (& card -> snd_card -> controls_rwsem );
583
589
}
584
590
585
591
return 0 ;
@@ -598,11 +604,15 @@ static void fsl_xcvr_shutdown(struct snd_pcm_substream *substream,
598
604
/* Enable XCVR controls if there is no stream started */
599
605
if (!xcvr -> streams ) {
600
606
if (!xcvr -> soc_data -> spdif_only ) {
607
+ struct snd_soc_card * card = dai -> component -> card ;
608
+
609
+ down_read (& card -> snd_card -> controls_rwsem );
601
610
fsl_xcvr_activate_ctl (dai , fsl_xcvr_mode_kctl .name , true);
602
611
fsl_xcvr_activate_ctl (dai , fsl_xcvr_arc_mode_kctl .name ,
603
612
(xcvr -> mode == FSL_XCVR_MODE_ARC ));
604
613
fsl_xcvr_activate_ctl (dai , fsl_xcvr_earc_capds_kctl .name ,
605
614
(xcvr -> mode == FSL_XCVR_MODE_EARC ));
615
+ up_read (& card -> snd_card -> controls_rwsem );
606
616
}
607
617
ret = regmap_update_bits (xcvr -> regmap , FSL_XCVR_EXT_IER0 ,
608
618
FSL_XCVR_IRQ_EARC_ALL , 0 );
0 commit comments