2020-08-13 11:16:03

by Hanks Chen

[permalink] [raw]
Subject: [PATCH] pinctrl: mediatek: check mtk_is_virt_gpio input parameter

check mtk_is_virt_gpio input parameter,
virtual gpio need to support eint mode.

add error handler for the ko case
to fix this boot fail:
pc : mtk_is_virt_gpio+0x20/0x38 [pinctrl_mtk_common_v2]
lr : mtk_gpio_get_direction+0x44/0xb0 [pinctrl_paris]

Fixes: edd546465002 ("pinctrl: mediatek: avoid virtual gpio trying to set reg")
Singed-off-by: sin_jieyang <[email protected]>
Signed-off-by: Hanks Chen <[email protected]>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index c53e2c391e32..27ab9c512ae1 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -259,6 +259,10 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n)

desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n];

+ /* if the GPIO is not supported for eint mode */
+ if (desc->eint.eint_m == EINT_NA)
+ return virt_gpio;
+
if (desc->funcs && !desc->funcs[desc->eint.eint_m].name)
virt_gpio = true;

--
2.18.0


2020-08-19 23:46:41

by Sean Wang

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: mediatek: check mtk_is_virt_gpio input parameter

Hi Hanks,

On Thu, Aug 13, 2020 at 4:14 AM Hanks Chen <[email protected]> wrote:
>
> check mtk_is_virt_gpio input parameter,
> virtual gpio need to support eint mode.
>
> add error handler for the ko case
> to fix this boot fail:
> pc : mtk_is_virt_gpio+0x20/0x38 [pinctrl_mtk_common_v2]
> lr : mtk_gpio_get_direction+0x44/0xb0 [pinctrl_paris]

it is better we post the complete call stack when the failure occurs

>
> Fixes: edd546465002 ("pinctrl: mediatek: avoid virtual gpio trying to set reg")
> Singed-off-by: sin_jieyang <[email protected]>

signed-off-by with the full name

> Signed-off-by: Hanks Chen <[email protected]>
> ---
> drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> index c53e2c391e32..27ab9c512ae1 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> @@ -259,6 +259,10 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n)
>
> desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n];
>
> + /* if the GPIO is not supported for eint mode */
> + if (desc->eint.eint_m == EINT_NA)

s/NO_EINT_SUPPORT/EINT_NA/ to align with pinctrl/mediatek/pinctrl-mtk-mt*.h uses

> + return virt_gpio;
> +
> if (desc->funcs && !desc->funcs[desc->eint.eint_m].name)
> virt_gpio = true;
>
> --
> 2.18.0

2020-08-20 11:23:20

by Hanks Chen

[permalink] [raw]
Subject: Re: [PATCH] pinctrl: mediatek: check mtk_is_virt_gpio input parameter

On Wed, 2020-08-19 at 16:43 -0700, Sean Wang wrote:
> Hi Hanks,
>
> On Thu, Aug 13, 2020 at 4:14 AM Hanks Chen <[email protected]> wrote:
> >
> > check mtk_is_virt_gpio input parameter,
> > virtual gpio need to support eint mode.
> >
> > add error handler for the ko case
> > to fix this boot fail:
> > pc : mtk_is_virt_gpio+0x20/0x38 [pinctrl_mtk_common_v2]
> > lr : mtk_gpio_get_direction+0x44/0xb0 [pinctrl_paris]
>
> it is better we post the complete call stack when the failure occurs
>
> >
> > Fixes: edd546465002 ("pinctrl: mediatek: avoid virtual gpio trying to set reg")
> > Singed-off-by: sin_jieyang <[email protected]>
>
> signed-off-by with the full name

Got it, I'll update it in next version.

>
> > Signed-off-by: Hanks Chen <[email protected]>
> > ---
> > drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > index c53e2c391e32..27ab9c512ae1 100644
> > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > @@ -259,6 +259,10 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n)
> >
> > desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n];
> >
> > + /* if the GPIO is not supported for eint mode */
> > + if (desc->eint.eint_m == EINT_NA)
>
> s/NO_EINT_SUPPORT/EINT_NA/ to align with pinctrl/mediatek/pinctrl-mtk-mt*.h uses

Got it, I'll fix it in next version.

Thanks for your reply


Hanks

>
> > + return virt_gpio;
> > +
> > if (desc->funcs && !desc->funcs[desc->eint.eint_m].name)
> > virt_gpio = true;
> >
> > --
> > 2.18.0