linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parport_pc: fix find_superio io compare code, should use equal test.
@ 2019-01-22 15:03 qiaochong
  2019-01-28 20:45 ` Sudip Mukherjee
  0 siblings, 1 reply; 3+ messages in thread
From: qiaochong @ 2019-01-22 15:03 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, QiaoChong

From: QiaoChong <qiaochong@loongson.cn>

git blame drivers/parport/parport_pc.c

181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1376) static struct superio_struct *find_superio(struct parport *p)
^1da177e4c3f4 (Linus Torvalds            2005-04-16 15:20:36 -0700 1377) {
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1378)        int i;
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1379)        for (i = 0; i < NR_SUPERIOS; i++)
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1380)                if (superios[i].io != p->base)
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1381)                        return &superios[i];
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1382)        return NULL;
181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1383) }
73e0d48b8c28f (Michael Buesch            2009-06-11 13:06:31 +0100 1384)

git log -1 -p 181bf1e815a2a

-static int get_superio_dma(struct parport *p)
+static struct superio_struct *find_superio(struct parport *p)
 {
-       int i = 0;
+       int i;
+       for (i = 0; i < NR_SUPERIOS; i++)
+               if (superios[i].io != p->base)
+                       return &superios[i];
+       return NULL;
+}

-       while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
-               i++;
-       if (i != NR_SUPERIOS)
-               return superios[i].dma;

the code before 181bf1e815a2a  also mean superio[i].io == p->base, fixup it.

Signed-off-by: QiaoChong <qiaochong@loongson.cn>
---
 drivers/parport/parport_pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 9c8249f744792..6296dbb83d470 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
 {
 	int i;
 	for (i = 0; i < NR_SUPERIOS; i++)
-		if (superios[i].io != p->base)
+		if (superios[i].io == p->base)
 			return &superios[i];
 	return NULL;
 }
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] parport_pc: fix find_superio io compare code, should use equal test.
  2019-01-22 15:03 [PATCH] parport_pc: fix find_superio io compare code, should use equal test qiaochong
@ 2019-01-28 20:45 ` Sudip Mukherjee
  0 siblings, 0 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2019-01-28 20:45 UTC (permalink / raw)
  To: qiaochong; +Cc: linux-kernel

Hi QiaoChong,

On Tue, Jan 22, 2019 at 3:04 PM qiaochong <qiaochong@loongson.cn> wrote:
>
> From: QiaoChong <qiaochong@loongson.cn>
>
> git blame drivers/parport/parport_pc.c
>
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1376) static struct superio_struct *find_superio(struct parport *p)
> ^1da177e4c3f4 (Linus Torvalds            2005-04-16 15:20:36 -0700 1377) {
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1378)        int i;
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1379)        for (i = 0; i < NR_SUPERIOS; i++)
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1380)                if (superios[i].io != p->base)
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1381)                        return &superios[i];
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1382)        return NULL;
> 181bf1e815a2a (Alan Cox                  2009-06-11 13:08:10 +0100 1383) }
> 73e0d48b8c28f (Michael Buesch            2009-06-11 13:06:31 +0100 1384)
>
> git log -1 -p 181bf1e815a2a
>
> -static int get_superio_dma(struct parport *p)
> +static struct superio_struct *find_superio(struct parport *p)
>  {
> -       int i = 0;
> +       int i;
> +       for (i = 0; i < NR_SUPERIOS; i++)
> +               if (superios[i].io != p->base)
> +                       return &superios[i];
> +       return NULL;
> +}
>
> -       while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
> -               i++;
> -       if (i != NR_SUPERIOS)
> -               return superios[i].dma;
>
> the code before 181bf1e815a2a  also mean superio[i].io == p->base, fixup it.

So, this means the Super-IO chips irq and dma has not worked since 2009. :(
Can you please resend this with a proper commit message..


-- 
Regards
Sudip

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] parport_pc: fix find_superio io compare code, should use equal test.
@ 2019-01-29  6:38 qiaochong
  0 siblings, 0 replies; 3+ messages in thread
From: qiaochong @ 2019-01-29  6:38 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, QiaoChong

From: QiaoChong <qiaochong@loongson.cn>

Fixes: 181bf1e815a2a("parport_pc: clean up the modified while loops using for").
The code find_superio should test superio[i].io == p->base then find out superio, fix it.

Signed-off-by: QiaoChong <qiaochong@loongson.cn>
---
 drivers/parport/parport_pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 9c8249f744792..6296dbb83d470 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
 {
 	int i;
 	for (i = 0; i < NR_SUPERIOS; i++)
-		if (superios[i].io != p->base)
+		if (superios[i].io == p->base)
 			return &superios[i];
 	return NULL;
 }
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-29  6:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 15:03 [PATCH] parport_pc: fix find_superio io compare code, should use equal test qiaochong
2019-01-28 20:45 ` Sudip Mukherjee
2019-01-29  6:38 qiaochong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).