All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mediatek: fix dual-edge code defect
@ 2016-05-21  7:23 ` hongkun.cao at mediatek.com
  0 siblings, 0 replies; 8+ messages in thread
From: hongkun.cao @ 2016-05-21  7:23 UTC (permalink / raw)
  To: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	matthias.bgg, linus.walleij, erin.lo
  Cc: devicetree, hongkun.cao, srv_heupstream, hongzhou.yang,
	linux-kernel, linux-gpio, yingjoe.chen, inux-mediatek,
	linux-arm-kernel

From: "hongkun.cao" <hongkun.cao@mediatek.com>

When a dual-edge irq is triggered, an incorrect irq will be reported on
condition that the external signal is not stable and this incorrect irq
has been registered.
Correct the register offset.

Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 2bbe6f7..92ae49f 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
 	const struct mtk_desc_pin *pin;
 
 	chained_irq_enter(chip, desc);
-	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
+	for (eint_num = 0;
+	     eint_num < pctl->devdata->ap_num;
+	     eint_num += 32, reg += 4) {
 		status = readl(reg);
-		reg += 4;
 		while (status) {
 			offset = __ffs(status);
 			index = eint_num + offset;
-- 
1.7.9.5

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

* [PATCH] pinctrl: mediatek: fix dual-edge code defect
@ 2016-05-21  7:23 ` hongkun.cao at mediatek.com
  0 siblings, 0 replies; 8+ messages in thread
From: hongkun.cao at mediatek.com @ 2016-05-21  7:23 UTC (permalink / raw)
  To: linux-arm-kernel

From: "hongkun.cao" <hongkun.cao@mediatek.com>

When a dual-edge irq is triggered, an incorrect irq will be reported on
condition that the external signal is not stable and this incorrect irq
has been registered.
Correct the register offset.

Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 2bbe6f7..92ae49f 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
 	const struct mtk_desc_pin *pin;
 
 	chained_irq_enter(chip, desc);
-	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
+	for (eint_num = 0;
+	     eint_num < pctl->devdata->ap_num;
+	     eint_num += 32, reg += 4) {
 		status = readl(reg);
-		reg += 4;
 		while (status) {
 			offset = __ffs(status);
 			index = eint_num + offset;
-- 
1.7.9.5

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

* Re: [PATCH] pinctrl: mediatek: fix dual-edge code defect
  2016-05-21  7:23 ` hongkun.cao at mediatek.com
@ 2016-05-23 10:39   ` Matthias Brugger
  -1 siblings, 0 replies; 8+ messages in thread
From: Matthias Brugger @ 2016-05-23 10:39 UTC (permalink / raw)
  To: hongkun.cao, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, linux, linus.walleij, erin.lo
  Cc: devicetree, srv_heupstream, hongzhou.yang, linux-kernel,
	linux-gpio, inux-mediatek, yingjoe.chen, linux-arm-kernel



On 21/05/16 09:23, hongkun.cao@mediatek.com wrote:
> From: "hongkun.cao" <hongkun.cao@mediatek.com>
>
> When a dual-edge irq is triggered, an incorrect irq will be reported on
> condition that the external signal is not stable and this incorrect irq
> has been registered.
> Correct the register offset.
>

I'm not sure what you want to say. From what I can see the without this 
fix, the the wrong IRQ will be cleared and raised. Is this what you are 
addressing?

If so:
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>
> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..92ae49f 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
>   	const struct mtk_desc_pin *pin;
>
>   	chained_irq_enter(chip, desc);
> -	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
> +	for (eint_num = 0;
> +	     eint_num < pctl->devdata->ap_num;
> +	     eint_num += 32, reg += 4) {
>   		status = readl(reg);
> -		reg += 4;
>   		while (status) {
>   			offset = __ffs(status);
>   			index = eint_num + offset;
>

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

* [PATCH] pinctrl: mediatek: fix dual-edge code defect
@ 2016-05-23 10:39   ` Matthias Brugger
  0 siblings, 0 replies; 8+ messages in thread
From: Matthias Brugger @ 2016-05-23 10:39 UTC (permalink / raw)
  To: linux-arm-kernel



On 21/05/16 09:23, hongkun.cao at mediatek.com wrote:
> From: "hongkun.cao" <hongkun.cao@mediatek.com>
>
> When a dual-edge irq is triggered, an incorrect irq will be reported on
> condition that the external signal is not stable and this incorrect irq
> has been registered.
> Correct the register offset.
>

I'm not sure what you want to say. From what I can see the without this 
fix, the the wrong IRQ will be cleared and raised. Is this what you are 
addressing?

If so:
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>
> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..92ae49f 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
>   	const struct mtk_desc_pin *pin;
>
>   	chained_irq_enter(chip, desc);
> -	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
> +	for (eint_num = 0;
> +	     eint_num < pctl->devdata->ap_num;
> +	     eint_num += 32, reg += 4) {
>   		status = readl(reg);
> -		reg += 4;
>   		while (status) {
>   			offset = __ffs(status);
>   			index = eint_num + offset;
>

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

* Re: [PATCH] pinctrl: mediatek: fix dual-edge code defect
  2016-05-23 10:39   ` Matthias Brugger
@ 2016-05-24  3:10       ` hongkun.cao
  -1 siblings, 0 replies; 8+ messages in thread
From: hongkun.cao @ 2016-05-24  3:10 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-lFZ/pmaqli7XmaaqVzeoHQ,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, pawel.moll-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	galak-sgV2jX0FEOL9JmXXK+q4OQ,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	erin.lo-NuS5LvNUpcJWk0Htik3J/w,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, 2016-05-23 at 12:39 +0200, Matthias Brugger wrote:
> 
> On 21/05/16 09:23, hongkun.cao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org wrote:
> > From: "hongkun.cao" <hongkun.cao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> >
> > When a dual-edge irq is triggered, an incorrect irq will be reported on
> > condition that the external signal is not stable and this incorrect irq
> > has been registered.
> > Correct the register offset.
> >
> 
> I'm not sure what you want to say. From what I can see the without this 
> fix, the the wrong IRQ will be cleared and raised. Is this what you are 
> addressing?
> 
> If so:

Hi, Matthias,
Thanks for your comments.
Yes, you are right.
Suppose there are two irqs registered in our system with special
relationship, One hardware irq  number is 17 with both edge trigger, and
the other hardware irq number is 49(17+32),then hardware irq 49 may be
reported unexpectedly if hardware irq 17 occurred.

> Reviewed-by: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> > Signed-off-by: hongkun.cao <hongkun.cao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> > ---
> >   drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > index 2bbe6f7..92ae49f 100644
> > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > @@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
> >   	const struct mtk_desc_pin *pin;
> >
> >   	chained_irq_enter(chip, desc);
> > -	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
> > +	for (eint_num = 0;
> > +	     eint_num < pctl->devdata->ap_num;
> > +	     eint_num += 32, reg += 4) {
> >   		status = readl(reg);
> > -		reg += 4;
> >   		while (status) {
> >   			offset = __ffs(status);
> >   			index = eint_num + offset;
> >

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

* [PATCH] pinctrl: mediatek: fix dual-edge code defect
@ 2016-05-24  3:10       ` hongkun.cao
  0 siblings, 0 replies; 8+ messages in thread
From: hongkun.cao @ 2016-05-24  3:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2016-05-23 at 12:39 +0200, Matthias Brugger wrote:
> 
> On 21/05/16 09:23, hongkun.cao at mediatek.com wrote:
> > From: "hongkun.cao" <hongkun.cao@mediatek.com>
> >
> > When a dual-edge irq is triggered, an incorrect irq will be reported on
> > condition that the external signal is not stable and this incorrect irq
> > has been registered.
> > Correct the register offset.
> >
> 
> I'm not sure what you want to say. From what I can see the without this 
> fix, the the wrong IRQ will be cleared and raised. Is this what you are 
> addressing?
> 
> If so:

Hi, Matthias,
Thanks for your comments.
Yes, you are right.
Suppose there are two irqs registered in our system with special
relationship, One hardware irq  number is 17 with both edge trigger, and
the other hardware irq number is 49(17+32),then hardware irq 49 may be
reported unexpectedly if hardware irq 17 occurred.

> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> 
> > Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>
> > ---
> >   drivers/pinctrl/mediatek/pinctrl-mtk-common.c |    5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > index 2bbe6f7..92ae49f 100644
> > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > @@ -1255,9 +1255,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
> >   	const struct mtk_desc_pin *pin;
> >
> >   	chained_irq_enter(chip, desc);
> > -	for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) {
> > +	for (eint_num = 0;
> > +	     eint_num < pctl->devdata->ap_num;
> > +	     eint_num += 32, reg += 4) {
> >   		status = readl(reg);
> > -		reg += 4;
> >   		while (status) {
> >   			offset = __ffs(status);
> >   			index = eint_num + offset;
> >

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

* Re: [PATCH] pinctrl: mediatek: fix dual-edge code defect
  2016-05-21  7:23 ` hongkun.cao at mediatek.com
@ 2016-05-31  8:13   ` Linus Walleij
  -1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2016-05-31  8:13 UTC (permalink / raw)
  To: hongkun.cao
  Cc: Rob Herring, Paweł Moll, Mark Rutland, ijc+devicetree,
	Kumar Gala, Russell King - ARM Linux, Matthias Brugger, Erin Lo,
	devicetree, srv_heupstream, Hongzhou Yang, linux-kernel,
	linux-gpio, inux-mediatek, Yingjoe Chen, linux-arm-kernel

On Sat, May 21, 2016 at 9:23 AM,  <hongkun.cao@mediatek.com> wrote:

> From: "hongkun.cao" <hongkun.cao@mediatek.com>
>
> When a dual-edge irq is triggered, an incorrect irq will be reported on
> condition that the external signal is not stable and this incorrect irq
> has been registered.
> Correct the register offset.
>
> Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>

Patch applied for fixes with Matthias' review tag.

Yours,
Linus Walleij

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

* [PATCH] pinctrl: mediatek: fix dual-edge code defect
@ 2016-05-31  8:13   ` Linus Walleij
  0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2016-05-31  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 21, 2016 at 9:23 AM,  <hongkun.cao@mediatek.com> wrote:

> From: "hongkun.cao" <hongkun.cao@mediatek.com>
>
> When a dual-edge irq is triggered, an incorrect irq will be reported on
> condition that the external signal is not stable and this incorrect irq
> has been registered.
> Correct the register offset.
>
> Signed-off-by: hongkun.cao <hongkun.cao@mediatek.com>

Patch applied for fixes with Matthias' review tag.

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-05-31  8:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-21  7:23 [PATCH] pinctrl: mediatek: fix dual-edge code defect hongkun.cao
2016-05-21  7:23 ` hongkun.cao at mediatek.com
2016-05-23 10:39 ` Matthias Brugger
2016-05-23 10:39   ` Matthias Brugger
     [not found]   ` <5742DDE5.7050701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-24  3:10     ` hongkun.cao
2016-05-24  3:10       ` hongkun.cao
2016-05-31  8:13 ` Linus Walleij
2016-05-31  8:13   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.