sound: riptide: Remove duplicate judgments code
PATCH 1/1 sound: riptide: Remove duplicate judgments code
Fix: delate duplicate judgments
Could you help check it out? Thank you!
--- sound/pci/riptide/riptide.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
sound/pci/riptide/riptide.c +4 -7
@@ -958,8 +958,7 @@ getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RSSV (cif, source, sink, &rptr) && -SEND_RSSV (cif, source, sink, &rptr)) +if (SEND_RSSV (cif, source, sink, &rptr))return -EIO ; *a = rptr.retbytes[0 ]; *b = rptr.retbytes[1 ];
@@ -978,8 +977,7 @@ getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) s = intdec;for (i =0 ; i <2 ; i++) {if (*s !=0xff ) { -if (SEND_RSRC (cif, *s, &rptr) && -SEND_RSRC (cif, *s, &rptr)) +if (SEND_RSRC (cif, *s, &rptr))return -EIO ; p[i] += rptr.retwords[1 ]; p[i] *= rptr.retwords[2 ];
@@ -1013,8 +1011,7 @@ setsampleformat(struct cmdif *cif, sig =snd_pcm_format_unsigned (format) !=0 ; order =snd_pcm_format_big_endian (format) !=0 ; -if (SEND_SETF (cif, mixer, w, ch, order, sig, id) && -SEND_SETF (cif, mixer, w, ch, order, sig, id)) { +if (SEND_SETF (cif, mixer, w, ch, order, sig, id)) {snd_printdd ("setsampleformat failed\n" );return -EIO ; }
@@ -1060,7 +1057,7 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RDGV (cif, num, num, &rptr) &&SEND_RDGV (cif, num, num, &rptr)) +if (SEND_RDGV (cif, num, num, &rptr))return -EIO ; *rval = rptr.retwords[0 ]; *lval = rptr.retwords[1 ];
Signature · 1 line
2.39.0
Quoted 3 lines · Minjie Du
Fix: delate duplicate judgments
Could you help check it out? Thank you!
I'm afraid that it's no right fix.
The duplicated calls actually send two commands sequentially, and if you drop one, it'll change the behavior completely.
Honestly speaking, I have no idea whether sending twice is mandatory for this chip. It's an ugly driver by reverse engineering, so who knows. We can get rid of it in future. But it's a different topic.
thanks,
Takashi
Quoted 52 lines
Signed-off-by Minjie Du <[email protected]>--- sound/pci/riptide/riptide.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)sound/pci/riptide/riptide.c +4
-7@@ -958,8 +958,7 @@ getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RSSV (cif, source, sink, &rptr) && -SEND_RSSV (cif, source, sink, &rptr)) +if (SEND_RSSV (cif, source, sink, &rptr))return -EIO ; *a = rptr.retbytes[0 ]; *b = rptr.retbytes[1 ];@@ -978,8 +977,7 @@ getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) s = intdec;for (i =0 ; i <2 ; i++) {if (*s !=0xff ) { -if (SEND_RSRC (cif, *s, &rptr) && -SEND_RSRC (cif, *s, &rptr)) +if (SEND_RSRC (cif, *s, &rptr))return -EIO ; p[i] += rptr.retwords[1 ]; p[i] *= rptr.retwords[2 ];@@ -1013,8 +1011,7 @@ setsampleformat(struct cmdif *cif, sig =snd_pcm_format_unsigned (format) !=0 ; order =snd_pcm_format_big_endian (format) !=0 ; -if (SEND_SETF (cif, mixer, w, ch, order, sig, id) && -SEND_SETF (cif, mixer, w, ch, order, sig, id)) { +if (SEND_SETF (cif, mixer, w, ch, order, sig, id)) {snd_printdd ("setsampleformat failed\n" );return -EIO ; }@@ -1060,7 +1057,7 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RDGV (cif, num, num, &rptr) &&SEND_RDGV (cif, num, num, &rptr)) +if (SEND_RDGV (cif, num, num, &rptr))return -EIO ; *rval = rptr.retwords[0 ]; *lval = rptr.retwords[1 ];Signature · 1 line
2.39.0
OK, Thank you for your reply.
-----邮件原件-----
发件人: Takashi Iwai <[email protected]>
发送时间: 2023年7月4日 17:32
收件人: 杜敏杰 <[email protected]>
抄送: Jaroslav Kysela <[email protected]>; Takashi Iwai <[email protected]>; Stephen Rothwell <[email protected]>; moderated list:SOUND <[email protected]>; open list <[email protected]>; opensource.kernel <[email protected]> 主题: Re: [PATCH v1] sound: riptide: Remove duplicate judgments code
[Some people who received this message don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Quoted 3 lines · Minjie Du
Fix: delate duplicate judgments
Could you help check it out? Thank you!
I'm afraid that it's no right fix.
The duplicated calls actually send two commands sequentially, and if you drop one, it'll change the behavior completely.
Honestly speaking, I have no idea whether sending twice is mandatory for this chip. It's an ugly driver by reverse engineering, so who knows. We can get rid of it in future. But it's a different topic.
thanks,
Takashi
Quoted 52 lines
Signed-off-by Minjie Du <[email protected]>--- sound/pci/riptide/riptide.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)sound/pci/riptide/riptide.c +2
-4@@ -958,8 +958,7 @@ getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RSSV (cif, source, sink, &rptr) && -SEND_RSSV (cif, source, sink, &rptr)) +if (SEND_RSSV (cif, source, sink, &rptr))return -EIO ; *a = rptr.retbytes[0 ]; *b = rptr.retbytes[1 ];@@ -978,8 +977,7 @@ getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) s = intdec;for (i =0 ; i <2 ; i++) {if (*s !=0xff ) { -if (SEND_RSRC (cif, *s, &rptr) && -SEND_RSRC (cif, *s, &rptr)) +if (SEND_RSRC (cif, *s, &rptr))return -EIO ; p[i] += rptr.retwords[1 ]; p[i] *= rptr.retwords[2]; @@ -1013,8 +1011,7 @@setsampleformat(struct cmdif *cif,
sig = snd_pcm_format_unsigned(format) != 0; order = snd_pcm_format_big_endian(format) != 0;sound/pci/riptide/riptide.c +2
-4-if (SEND_SETF (cif, mixer, w, ch, order, sig, id) && -SEND_SETF (cif, mixer, w, ch, order, sig, id)) { +if (SEND_SETF (cif, mixer, w, ch, order, sig, id)) {snd_printdd ("setsampleformat failed\n" );return -EIO ; }@@ -1060,7 +1057,7 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, {union cmdret rptr =CMDRET_ZERO ; -if (SEND_RDGV (cif, num, num, &rptr) &&SEND_RDGV (cif, num, num, &rptr)) +if (SEND_RDGV (cif, num, num, &rptr))return -EIO ; *rval = rptr.retwords[0 ]; *lval = rptr.retwords[1 ]; --2.39.0