linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl:mediatek:add judgment conditions
@ 2018-12-18  2:31 chuanjia.liu
  2018-12-22 18:50 ` Sean Wang
  0 siblings, 1 reply; 3+ messages in thread
From: chuanjia.liu @ 2018-12-18  2:31 UTC (permalink / raw)
  To: sean.wang, linus.walleij, matthias.bgg, linux-mediatek,
	linux-gpio, linux-arm-kernel, linux-kernel
  Cc: youlin.pei, zhiyong.tao, eddie.huang, hailong.fan, Chuanjia Liu

From: Chuanjia Liu <Chuanjia.Liu@mediatek.com>

This patch avoid return err when virtual gpio set SMT.

Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
---
change note:
v2 : 1. delete virtual gpio number
     2. add judgment conditions
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 4a9e0d4c2bbc..a576e417744a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -290,7 +290,11 @@ static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n)
 		return err;
 
 	err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, MTK_ENABLE);
-	if (err)
+
+	/* SMT doesn't support virtual GPIO, add err != -ENOTSUPP is used for
+	 * avoid return err when virtual gpio set SMT.
+	 */
+	if (err && err != -ENOTSUPP)
 		return err;
 
 	return 0;
-- 
2.19.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] pinctrl:mediatek:add judgment conditions
  2018-12-18  2:31 [PATCH v2] pinctrl:mediatek:add judgment conditions chuanjia.liu
@ 2018-12-22 18:50 ` Sean Wang
  2018-12-25  3:40   ` Chuanjia Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Wang @ 2018-12-22 18:50 UTC (permalink / raw)
  To: chuanjia.liu
  Cc: youlin.pei, zhiyong.tao, Linus Walleij, linux-kernel, linux-gpio,
	linux-mediatek, hailong.fan, Matthias Brugger, eddie.huang,
	linux-arm-kernel

On Mon, Dec 17, 2018 at 6:32 PM <chuanjia.liu@mediatek.com> wrote:
>

I thought the subject still is much general, it should be further
improved with something like "add EINT support to virtual GPIOs" and
should say more about what virtual GPIOs means by MTKers in the patch
description because "virtual" is a usual term used throughout the
kernel and that would easily cause others to fail to interpret
correctly.

> From: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
>
> This patch avoid return err when virtual gpio set SMT.
>
> Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
> ---
> change note:
> v2 : 1. delete virtual gpio number
>      2. add judgment conditions
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> index 4a9e0d4c2bbc..a576e417744a 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> @@ -290,7 +290,11 @@ static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n)
>                 return err;
>
>         err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, MTK_ENABLE);
> -       if (err)
> +
> +       /* SMT doesn't support virtual GPIO, add err != -ENOTSUPP is used for
> +        * avoid return err when virtual gpio set SMT.
> +        */

I'd prefer to the comments as the below

/*
SMT is supposed to be supported by every real GPIO and doesn't support
virtual GPIOs, so the extra condition err != -ENOTSUPP is just for
adding EINT support to these virtual GPIOs. It should add an extra
flag in the pin descriptor when more pins with distinctive
characteristic come out.
*/

> +       if (err && err != -ENOTSUPP)
>                 return err;
>
>         return 0;
> --
> 2.19.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] pinctrl:mediatek:add judgment conditions
  2018-12-22 18:50 ` Sean Wang
@ 2018-12-25  3:40   ` Chuanjia Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Chuanjia Liu @ 2018-12-25  3:40 UTC (permalink / raw)
  To: Sean Wang
  Cc: Youlin Pei (裴友林),
	Zhiyong Tao (陶志勇),
	Linus Walleij, linux-kernel, linux-gpio, linux-mediatek,
	Hailong Fan (范海龙),
	Matthias Brugger, Eddie Huang (黃智傑),
	linux-arm-kernel

On Sun, 2018-12-23 at 02:50 +0800, Sean Wang wrote:
> On Mon, Dec 17, 2018 at 6:32 PM <chuanjia.liu@mediatek.com> wrote:
> >
> 
> I thought the subject still is much general, it should be further
> improved with something like "add EINT support to virtual GPIOs" and
> should say more about what virtual GPIOs means by MTKers in the patch
> description because "virtual" is a usual term used throughout the
> kernel and that would easily cause others to fail to interpret
> correctly.
> 
Thank you for your advice,I will modify subject and description.
> > From: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
> >
> > This patch avoid return err when virtual gpio set SMT.
> >
> > Signed-off-by: Chuanjia Liu <Chuanjia.Liu@mediatek.com>
> > ---
> > change note:
> > v2 : 1. delete virtual gpio number
> >      2. add judgment conditions
> > ---
> >  drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > index 4a9e0d4c2bbc..a576e417744a 100644
> > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
> > @@ -290,7 +290,11 @@ static int mtk_xt_set_gpio_as_eint(void *data, unsigned long eint_n)
> >                 return err;
> >
> >         err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, MTK_ENABLE);
> > -       if (err)
> > +
> > +       /* SMT doesn't support virtual GPIO, add err != -ENOTSUPP is used for
> > +        * avoid return err when virtual gpio set SMT.
> > +        */
> 
> I'd prefer to the comments as the below
> 
> /*
> SMT is supposed to be supported by every real GPIO and doesn't support
> virtual GPIOs, so the extra condition err != -ENOTSUPP is just for
> adding EINT support to these virtual GPIOs. It should add an extra
> flag in the pin descriptor when more pins with distinctive
> characteristic come out.
> */
> 
Thank you for your advice,I will modify comments.
> > +       if (err && err != -ENOTSUPP)
> >                 return err;
> >
> >         return 0;
> > --
> > 2.19.1
> >



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2018-12-25  3:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18  2:31 [PATCH v2] pinctrl:mediatek:add judgment conditions chuanjia.liu
2018-12-22 18:50 ` Sean Wang
2018-12-25  3:40   ` Chuanjia Liu

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).