diff mbox

[021/102] ASoC: ssm2602: Omit superfluous elements in input select array

Message ID 1392723422-12689-6-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Commit b38fbe30739afa83695c4969c8e966d919d828b0
Headers show

Commit Message

Takashi Iwai Feb. 18, 2014, 11:36 a.m. UTC
The array contains too many elements although it should have only
two.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/codecs/ssm2602.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Lars-Peter Clausen Feb. 18, 2014, 11:59 a.m. UTC | #1
On 02/18/2014 12:36 PM, Takashi Iwai wrote:
> The array contains too many elements although it should have only
> two.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>   sound/soc/codecs/ssm2602.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> index f444d585b916..e32b82ff6304 100644
> --- a/sound/soc/codecs/ssm2602.c
> +++ b/sound/soc/codecs/ssm2602.c
> @@ -75,15 +75,16 @@ static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
>
>   /*Appending several "None"s just for OSS mixer use*/
>   static const char *ssm2602_input_select[] = {
> -	"Line", "Mic", "None", "None", "None",
> -	"None", "None", "None",
> +	"Line", "Mic",
>   };

I never dared to change it because of the comment above the array. I must 
admit that I have no idea though why those extra None entries are necessary 
for OSS.
Girdwood, Liam R Feb. 18, 2014, 1:23 p.m. UTC | #2
On Tue, 2014-02-18 at 12:59 +0100, Lars-Peter Clausen wrote:
> On 02/18/2014 12:36 PM, Takashi Iwai wrote:
> > The array contains too many elements although it should have only
> > two.
> >
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >   sound/soc/codecs/ssm2602.c | 9 +++++----
> >   1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> > index f444d585b916..e32b82ff6304 100644
> > --- a/sound/soc/codecs/ssm2602.c
> > +++ b/sound/soc/codecs/ssm2602.c
> > @@ -75,15 +75,16 @@ static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
> >
> >   /*Appending several "None"s just for OSS mixer use*/
> >   static const char *ssm2602_input_select[] = {
> > -	"Line", "Mic", "None", "None", "None",
> > -	"None", "None", "None",
> > +	"Line", "Mic",
> >   };
> 
> I never dared to change it because of the comment above the array. I must 
> admit that I have no idea though why those extra None entries are necessary 
> for OSS.

iirc the OSS input mixer in userspace may expect a similar number of
entries to be compatible with the old Soundblaster16 input mixer ?

Liam 



---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Takashi Iwai Feb. 18, 2014, 1:29 p.m. UTC | #3
At Tue, 18 Feb 2014 13:23:27 +0000,
Liam Girdwood wrote:
> 
> On Tue, 2014-02-18 at 12:59 +0100, Lars-Peter Clausen wrote:
> > On 02/18/2014 12:36 PM, Takashi Iwai wrote:
> > > The array contains too many elements although it should have only
> > > two.
> > >
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > ---
> > >   sound/soc/codecs/ssm2602.c | 9 +++++----
> > >   1 file changed, 5 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> > > index f444d585b916..e32b82ff6304 100644
> > > --- a/sound/soc/codecs/ssm2602.c
> > > +++ b/sound/soc/codecs/ssm2602.c
> > > @@ -75,15 +75,16 @@ static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
> > >
> > >   /*Appending several "None"s just for OSS mixer use*/
> > >   static const char *ssm2602_input_select[] = {
> > > -	"Line", "Mic", "None", "None", "None",
> > > -	"None", "None", "None",
> > > +	"Line", "Mic",
> > >   };
> > 
> > I never dared to change it because of the comment above the array. I must 
> > admit that I have no idea though why those extra None entries are necessary 
> > for OSS.
> 
> iirc the OSS input mixer in userspace may expect a similar number of
> entries to be compatible with the old Soundblaster16 input mixer ?

But this array is referred as having only two elements,

	SOC_ENUM_SINGLE(SSM2602_APANA, 2, 2, ssm2602_input_select),

so the OSS access (via emulation) won't take more than two, either.


Takashi
Liam Girdwood Feb. 18, 2014, 3:35 p.m. UTC | #4
On Tue, 2014-02-18 at 14:29 +0100, Takashi Iwai wrote:
> At Tue, 18 Feb 2014 13:23:27 +0000,
> Liam Girdwood wrote:
> > 
> > On Tue, 2014-02-18 at 12:59 +0100, Lars-Peter Clausen wrote:
> > > On 02/18/2014 12:36 PM, Takashi Iwai wrote:
> > > > The array contains too many elements although it should have only
> > > > two.
> > > >
> > > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > > ---
> > > >   sound/soc/codecs/ssm2602.c | 9 +++++----
> > > >   1 file changed, 5 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
> > > > index f444d585b916..e32b82ff6304 100644
> > > > --- a/sound/soc/codecs/ssm2602.c
> > > > +++ b/sound/soc/codecs/ssm2602.c
> > > > @@ -75,15 +75,16 @@ static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
> > > >
> > > >   /*Appending several "None"s just for OSS mixer use*/
> > > >   static const char *ssm2602_input_select[] = {
> > > > -	"Line", "Mic", "None", "None", "None",
> > > > -	"None", "None", "None",
> > > > +	"Line", "Mic",
> > > >   };
> > > 
> > > I never dared to change it because of the comment above the array. I must 
> > > admit that I have no idea though why those extra None entries are necessary 
> > > for OSS.
> > 
> > iirc the OSS input mixer in userspace may expect a similar number of
> > entries to be compatible with the old Soundblaster16 input mixer ?
> 
> But this array is referred as having only two elements,
> 
> 	SOC_ENUM_SINGLE(SSM2602_APANA, 2, 2, ssm2602_input_select),
> 
> so the OSS access (via emulation) won't take more than two, either.

Hmm, that is quite odd then. Maybe an error on behalf of the original
author or just plain weirdness...

Liam
Mark Brown Feb. 20, 2014, 1:20 a.m. UTC | #5
On Tue, Feb 18, 2014 at 12:36:56PM +0100, Takashi Iwai wrote:
> The array contains too many elements although it should have only
> two.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index f444d585b916..e32b82ff6304 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -75,15 +75,16 @@  static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
 
 /*Appending several "None"s just for OSS mixer use*/
 static const char *ssm2602_input_select[] = {
-	"Line", "Mic", "None", "None", "None",
-	"None", "None", "None",
+	"Line", "Mic",
 };
 
 static const char *ssm2602_deemph[] = {"None", "32Khz", "44.1Khz", "48Khz"};
 
 static const struct soc_enum ssm2602_enum[] = {
-	SOC_ENUM_SINGLE(SSM2602_APANA, 2, 2, ssm2602_input_select),
-	SOC_ENUM_SINGLE(SSM2602_APDIGI, 1, 4, ssm2602_deemph),
+	SOC_ENUM_SINGLE(SSM2602_APANA, 2, ARRAY_SIZE(ssm2602_input_select),
+			ssm2602_input_select),
+	SOC_ENUM_SINGLE(SSM2602_APDIGI, 1, ARRAY_SIZE(ssm2602_deemph),
+			ssm2602_deemph),
 };
 
 static const unsigned int ssm260x_outmix_tlv[] = {