3737 * Returns 0 for success.
3838 */
3939int snd_soc_info_enum_double (struct snd_kcontrol * kcontrol ,
40- struct snd_ctl_elem_info * uinfo )
40+ struct snd_ctl_elem_info * uinfo )
4141{
4242 struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
4343
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
5656 * Returns 0 for success.
5757 */
5858int snd_soc_get_enum_double (struct snd_kcontrol * kcontrol ,
59- struct snd_ctl_elem_value * ucontrol )
59+ struct snd_ctl_elem_value * ucontrol )
6060{
6161 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
6262 struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double);
8787 * Returns 0 for success.
8888 */
8989int snd_soc_put_enum_double (struct snd_kcontrol * kcontrol ,
90- struct snd_ctl_elem_value * ucontrol )
90+ struct snd_ctl_elem_value * ucontrol )
9191{
9292 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
9393 struct soc_enum * e = (struct soc_enum * )kcontrol -> private_value ;
@@ -124,8 +124,9 @@ EXPORT_SYMBOL_GPL(snd_soc_put_enum_double);
124124 * the given registervalue into a signed integer if sign_bit is non-zero.
125125 */
126126static void snd_soc_read_signed (struct snd_soc_component * component ,
127- unsigned int reg , unsigned int mask , unsigned int shift ,
128- unsigned int sign_bit , int * signed_val )
127+ unsigned int reg , unsigned int mask ,
128+ unsigned int shift , unsigned int sign_bit ,
129+ int * signed_val )
129130{
130131 int ret ;
131132 unsigned int val ;
@@ -168,7 +169,7 @@ static void snd_soc_read_signed(struct snd_soc_component *component,
168169 * Returns 0 for success.
169170 */
170171int snd_soc_info_volsw (struct snd_kcontrol * kcontrol ,
171- struct snd_ctl_elem_info * uinfo )
172+ struct snd_ctl_elem_info * uinfo )
172173{
173174 struct soc_mixer_control * mc =
174175 (struct soc_mixer_control * )kcontrol -> private_value ;
@@ -247,7 +248,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
247248 * Returns 0 for success.
248249 */
249250int snd_soc_get_volsw (struct snd_kcontrol * kcontrol ,
250- struct snd_ctl_elem_value * ucontrol )
251+ struct snd_ctl_elem_value * ucontrol )
251252{
252253 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
253254 struct soc_mixer_control * mc =
@@ -300,7 +301,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
300301 * Returns 0 for success.
301302 */
302303int snd_soc_put_volsw (struct snd_kcontrol * kcontrol ,
303- struct snd_ctl_elem_value * ucontrol )
304+ struct snd_ctl_elem_value * ucontrol )
304305{
305306 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
306307 struct soc_mixer_control * mc =
@@ -362,9 +363,8 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
362363 err = snd_soc_component_update_bits (component , reg2 , val_mask ,
363364 val2 );
364365 /* Don't discard any error code or drop change flag */
365- if (ret == 0 || err < 0 ) {
366+ if (ret == 0 || err < 0 )
366367 ret = err ;
367- }
368368 }
369369
370370 return ret ;
@@ -382,11 +382,11 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
382382 * Returns 0 for success.
383383 */
384384int snd_soc_get_volsw_sx (struct snd_kcontrol * kcontrol ,
385- struct snd_ctl_elem_value * ucontrol )
385+ struct snd_ctl_elem_value * ucontrol )
386386{
387387 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
388388 struct soc_mixer_control * mc =
389- (struct soc_mixer_control * )kcontrol -> private_value ;
389+ (struct soc_mixer_control * )kcontrol -> private_value ;
390390 unsigned int reg = mc -> reg ;
391391 unsigned int reg2 = mc -> rreg ;
392392 unsigned int shift = mc -> shift ;
@@ -423,18 +423,17 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
423423{
424424 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
425425 struct soc_mixer_control * mc =
426- (struct soc_mixer_control * )kcontrol -> private_value ;
427-
426+ (struct soc_mixer_control * )kcontrol -> private_value ;
428427 unsigned int reg = mc -> reg ;
429428 unsigned int reg2 = mc -> rreg ;
430429 unsigned int shift = mc -> shift ;
431430 unsigned int rshift = mc -> rshift ;
431+ unsigned int val , val_mask ;
432432 int max = mc -> max ;
433433 int min = mc -> min ;
434434 unsigned int mask = (1U << (fls (min + max ) - 1 )) - 1 ;
435435 int err = 0 ;
436436 int ret ;
437- unsigned int val , val_mask ;
438437
439438 if (ucontrol -> value .integer .value [0 ] < 0 )
440439 return - EINVAL ;
@@ -465,13 +464,13 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
465464 val2 = val2 << rshift ;
466465
467466 err = snd_soc_component_update_bits (component , reg2 , val_mask ,
468- val2 );
467+ val2 );
469468
470469 /* Don't discard any error code or drop change flag */
471- if (ret == 0 || err < 0 ) {
470+ if (ret == 0 || err < 0 )
472471 ret = err ;
473- }
474472 }
473+
475474 return ret ;
476475}
477476EXPORT_SYMBOL_GPL (snd_soc_put_volsw_sx );
@@ -487,7 +486,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
487486 * returns 0 for success.
488487 */
489488int snd_soc_info_volsw_range (struct snd_kcontrol * kcontrol ,
490- struct snd_ctl_elem_info * uinfo )
489+ struct snd_ctl_elem_info * uinfo )
491490{
492491 struct soc_mixer_control * mc =
493492 (struct soc_mixer_control * )kcontrol -> private_value ;
@@ -516,7 +515,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_range);
516515 * Returns 0 for success.
517516 */
518517int snd_soc_put_volsw_range (struct snd_kcontrol * kcontrol ,
519- struct snd_ctl_elem_value * ucontrol )
518+ struct snd_ctl_elem_value * ucontrol )
520519{
521520 struct soc_mixer_control * mc =
522521 (struct soc_mixer_control * )kcontrol -> private_value ;
@@ -568,11 +567,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
568567 val = val << shift ;
569568
570569 err = snd_soc_component_update_bits (component , rreg , val_mask ,
571- val );
570+ val );
572571 /* Don't discard any error code or drop change flag */
573- if (ret == 0 || err < 0 ) {
572+ if (ret == 0 || err < 0 )
574573 ret = err ;
575- }
576574 }
577575
578576 return ret ;
@@ -589,7 +587,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range);
589587 * Returns 0 for success.
590588 */
591589int snd_soc_get_volsw_range (struct snd_kcontrol * kcontrol ,
592- struct snd_ctl_elem_value * ucontrol )
590+ struct snd_ctl_elem_value * ucontrol )
593591{
594592 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
595593 struct soc_mixer_control * mc =
@@ -663,8 +661,7 @@ static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
663661 *
664662 * Return 0 for success, else error.
665663 */
666- int snd_soc_limit_volume (struct snd_soc_card * card ,
667- const char * name , int max )
664+ int snd_soc_limit_volume (struct snd_soc_card * card , const char * name , int max )
668665{
669666 struct snd_kcontrol * kctl ;
670667 int ret = - EINVAL ;
@@ -675,12 +672,15 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
675672
676673 kctl = snd_soc_card_get_kcontrol (card , name );
677674 if (kctl ) {
678- struct soc_mixer_control * mc = (struct soc_mixer_control * )kctl -> private_value ;
675+ struct soc_mixer_control * mc =
676+ (struct soc_mixer_control * )kctl -> private_value ;
677+
679678 if (max <= mc -> max - mc -> min ) {
680679 mc -> platform_max = max ;
681680 ret = snd_soc_clip_to_platform_max (kctl );
682681 }
683682 }
683+
684684 return ret ;
685685}
686686EXPORT_SYMBOL_GPL (snd_soc_limit_volume );
@@ -740,8 +740,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
740740{
741741 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
742742 struct soc_bytes * params = (void * )kcontrol -> private_value ;
743- int ret , len ;
744743 unsigned int val , mask ;
744+ int ret , len ;
745745
746746 if (!component -> regmap || !params -> num_regs )
747747 return - EINVAL ;
@@ -772,31 +772,27 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
772772 break ;
773773 case 2 :
774774 mask = ~params -> mask ;
775- ret = regmap_parse_val (component -> regmap ,
776- & mask , & mask );
775+ ret = regmap_parse_val (component -> regmap , & mask , & mask );
777776 if (ret != 0 )
778777 return ret ;
779778
780779 ((u16 * )data )[0 ] &= mask ;
781780
782- ret = regmap_parse_val (component -> regmap ,
783- & val , & val );
781+ ret = regmap_parse_val (component -> regmap , & val , & val );
784782 if (ret != 0 )
785783 return ret ;
786784
787785 ((u16 * )data )[0 ] |= val ;
788786 break ;
789787 case 4 :
790788 mask = ~params -> mask ;
791- ret = regmap_parse_val (component -> regmap ,
792- & mask , & mask );
789+ ret = regmap_parse_val (component -> regmap , & mask , & mask );
793790 if (ret != 0 )
794791 return ret ;
795792
796793 ((u32 * )data )[0 ] &= mask ;
797794
798- ret = regmap_parse_val (component -> regmap ,
799- & val , & val );
795+ ret = regmap_parse_val (component -> regmap , & val , & val );
800796 if (ret != 0 )
801797 return ret ;
802798
@@ -812,7 +808,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
812808EXPORT_SYMBOL_GPL (snd_soc_bytes_put );
813809
814810int snd_soc_bytes_info_ext (struct snd_kcontrol * kcontrol ,
815- struct snd_ctl_elem_info * ucontrol )
811+ struct snd_ctl_elem_info * ucontrol )
816812{
817813 struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
818814
@@ -824,7 +820,7 @@ int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
824820EXPORT_SYMBOL_GPL (snd_soc_bytes_info_ext );
825821
826822int snd_soc_bytes_tlv_callback (struct snd_kcontrol * kcontrol , int op_flag ,
827- unsigned int size , unsigned int __user * tlv )
823+ unsigned int size , unsigned int __user * tlv )
828824{
829825 struct soc_bytes_ext * params = (void * )kcontrol -> private_value ;
830826 unsigned int count = size < params -> max ? size : params -> max ;
@@ -840,6 +836,7 @@ int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
840836 ret = params -> put (kcontrol , tlv , count );
841837 break ;
842838 }
839+
843840 return ret ;
844841}
845842EXPORT_SYMBOL_GPL (snd_soc_bytes_tlv_callback );
@@ -856,10 +853,11 @@ EXPORT_SYMBOL_GPL(snd_soc_bytes_tlv_callback);
856853 * Returns 0 for success.
857854 */
858855int snd_soc_info_xr_sx (struct snd_kcontrol * kcontrol ,
859- struct snd_ctl_elem_info * uinfo )
856+ struct snd_ctl_elem_info * uinfo )
860857{
861858 struct soc_mreg_control * mc =
862859 (struct soc_mreg_control * )kcontrol -> private_value ;
860+
863861 uinfo -> type = SNDRV_CTL_ELEM_TYPE_INTEGER ;
864862 uinfo -> count = 1 ;
865863 uinfo -> value .integer .min = mc -> min ;
@@ -883,25 +881,26 @@ EXPORT_SYMBOL_GPL(snd_soc_info_xr_sx);
883881 * Returns 0 for success.
884882 */
885883int snd_soc_get_xr_sx (struct snd_kcontrol * kcontrol ,
886- struct snd_ctl_elem_value * ucontrol )
884+ struct snd_ctl_elem_value * ucontrol )
887885{
888886 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
889887 struct soc_mreg_control * mc =
890888 (struct soc_mreg_control * )kcontrol -> private_value ;
891889 unsigned int regbase = mc -> regbase ;
892890 unsigned int regcount = mc -> regcount ;
893891 unsigned int regwshift = component -> val_bytes * BITS_PER_BYTE ;
894- unsigned int regwmask = (1UL << regwshift )- 1 ;
892+ unsigned int regwmask = (1UL << regwshift ) - 1 ;
895893 unsigned int invert = mc -> invert ;
896- unsigned long mask = (1UL << mc -> nbits )- 1 ;
894+ unsigned long mask = (1UL << mc -> nbits ) - 1 ;
897895 long min = mc -> min ;
898896 long max = mc -> max ;
899897 long val = 0 ;
900898 unsigned int i ;
901899
902900 for (i = 0 ; i < regcount ; i ++ ) {
903- unsigned int regval = snd_soc_component_read (component , regbase + i );
904- val |= (regval & regwmask ) << (regwshift * (regcount - i - 1 ));
901+ unsigned int regval = snd_soc_component_read (component , regbase + i );
902+
903+ val |= (regval & regwmask ) << (regwshift * (regcount - i - 1 ));
905904 }
906905 val &= mask ;
907906 if (min < 0 && val > max )
@@ -928,17 +927,17 @@ EXPORT_SYMBOL_GPL(snd_soc_get_xr_sx);
928927 * Returns 0 for success.
929928 */
930929int snd_soc_put_xr_sx (struct snd_kcontrol * kcontrol ,
931- struct snd_ctl_elem_value * ucontrol )
930+ struct snd_ctl_elem_value * ucontrol )
932931{
933932 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
934933 struct soc_mreg_control * mc =
935934 (struct soc_mreg_control * )kcontrol -> private_value ;
936935 unsigned int regbase = mc -> regbase ;
937936 unsigned int regcount = mc -> regcount ;
938937 unsigned int regwshift = component -> val_bytes * BITS_PER_BYTE ;
939- unsigned int regwmask = (1UL << regwshift )- 1 ;
938+ unsigned int regwmask = (1UL << regwshift ) - 1 ;
940939 unsigned int invert = mc -> invert ;
941- unsigned long mask = (1UL << mc -> nbits )- 1 ;
940+ unsigned long mask = (1UL << mc -> nbits ) - 1 ;
942941 long max = mc -> max ;
943942 long val = ucontrol -> value .integer .value [0 ];
944943 int ret = 0 ;
@@ -950,10 +949,13 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
950949 val = max - val ;
951950 val &= mask ;
952951 for (i = 0 ; i < regcount ; i ++ ) {
953- unsigned int regval = (val >> (regwshift * (regcount - i - 1 ))) & regwmask ;
954- unsigned int regmask = (mask >> (regwshift * (regcount - i - 1 ))) & regwmask ;
955- int err = snd_soc_component_update_bits (component , regbase + i ,
952+ unsigned int regval = (val >> (regwshift * (regcount - i - 1 ))) &
953+ regwmask ;
954+ unsigned int regmask = (mask >> (regwshift * (regcount - i - 1 ))) &
955+ regwmask ;
956+ int err = snd_soc_component_update_bits (component , regbase + i ,
956957 regmask , regval );
958+
957959 if (err < 0 )
958960 return err ;
959961 if (err > 0 )
@@ -974,7 +976,7 @@ EXPORT_SYMBOL_GPL(snd_soc_put_xr_sx);
974976 * Returns 0 for success.
975977 */
976978int snd_soc_get_strobe (struct snd_kcontrol * kcontrol ,
977- struct snd_ctl_elem_value * ucontrol )
979+ struct snd_ctl_elem_value * ucontrol )
978980{
979981 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
980982 struct soc_mixer_control * mc =
@@ -1007,7 +1009,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_strobe);
10071009 * Returns 1 for success.
10081010 */
10091011int snd_soc_put_strobe (struct snd_kcontrol * kcontrol ,
1010- struct snd_ctl_elem_value * ucontrol )
1012+ struct snd_ctl_elem_value * ucontrol )
10111013{
10121014 struct snd_soc_component * component = snd_kcontrol_chip (kcontrol );
10131015 struct soc_mixer_control * mc =
0 commit comments