From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Erwan LE RAY <erwan.leray@foss.st.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
Jiri Slaby <jirislaby@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Gerald Baeza <gerald.baeza@st.com>,
Valentin Caron <valentin.caron@foss.st.com>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] serial: mctrl_gpio: add a new API to enable / disable wake_irq
Date: Tue, 8 Feb 2022 11:07:04 +0100 [thread overview]
Message-ID: <YgJAyAZFJBFXQGvf@kroah.com> (raw)
In-Reply-To: <cb09a49a-37f8-9e3f-168c-4c5dd62e2c07@foss.st.com>
On Fri, Feb 04, 2022 at 04:41:58PM +0100, Erwan LE RAY wrote:
> Hi Andy,
>
> On 2/4/22 10:07 AM, Andy Shevchenko wrote:
> >
> >
> > On Thursday, February 3, 2022, Erwan Le Ray <erwan.leray@foss.st.com
> > <mailto:erwan.leray@foss.st.com>> wrote:
> >
> > Add a new API to enable / disable wake_irq in order to enable gpio
> > irqs as
> > wakeup irqs for the uart port.
> >
> > Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com
> > <mailto:erwan.leray@foss.st.com>>
> >
> > diff --git a/drivers/tty/serial/serial_mctrl_gpio.c
> > b/drivers/tty/serial/serial_mctrl_gpio.c
> > index c41d8911ce95..1663b3afc3a0 100644
> > --- a/drivers/tty/serial/serial_mctrl_gpio.c
> > +++ b/drivers/tty/serial/serial_mctrl_gpio.c
> > @@ -299,4 +299,42 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios
> > *gpios)
> > }
> > EXPORT_SYMBOL_GPL(mctrl_gpio_disable_ms);
> >
> > +void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios)
> > +{
> > + enum mctrl_gpio_idx i;
> > +
> > + if (!gpios)
> > + return;
> > +
> > + if (!gpios->mctrl_on)
> > + return;
> > +
> > + for (i = 0; i < UART_GPIO_MAX; ++i) {
> > + if (!gpios->irq[i])
> > + continue;
> >
> >
> >
> > Why not simply
> >
> > if (gpios[])
> > enable_irq_...
> >
> > ?
> >
> > And same for disabling.
> >
> > +
> > + enable_irq_wake(gpios->irq[i]);
> > + }
> > +}
> > +EXPORT_SYMBOL_GPL(mctrl_gpio_enable_irq_wake);
> > +
> > +void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios)
> > +{
> > + enum mctrl_gpio_idx i;
> > +
> > + if (!gpios)
> > + return;
> > +
> > + if (!gpios->mctrl_on)
> > + return;
> > +
> > + for (i = 0; i < UART_GPIO_MAX; ++i) {
> > + if (!gpios->irq[i])
> > + continue;
> > +
> > + disable_irq_wake(gpios->irq[i]);
> > + }
> > +}
> > +EXPORT_SYMBOL_GPL(mctrl_gpio_disable_irq_wake);
> > +
> > MODULE_LICENSE("GPL");
> > diff --git a/drivers/tty/serial/serial_mctrl_gpio.h
> > b/drivers/tty/serial/serial_mctrl_gpio.h
> > index b134a0ffc894..fc76910fb105 100644
> > --- a/drivers/tty/serial/serial_mctrl_gpio.h
> > +++ b/drivers/tty/serial/serial_mctrl_gpio.h
> > @@ -91,6 +91,16 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios);
> > */
> > void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios);
> >
> > +/*
> > + * Enable gpio wakeup interrupts to enable wake up source.
> > + */
> > +void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios);
> > +
> > +/*
> > + * Disable gpio wakeup interrupts to enable wake up source.
> > + */
> > +void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios);
> > +
> > #else /* GPIOLIB */
> >
> > static inline
> > @@ -142,6 +152,14 @@ static inline void mctrl_gpio_disable_ms(struct
> > mctrl_gpios *gpios)
> > {
> > }
> >
> > +static inline void mctrl_gpio_enable_irq_wake(struct mctrl_gpios
> > *gpios)
> > +{
> > +}
> > +
> > +static inline void mctrl_gpio_disable_irq_wake(struct mctrl_gpios
> > *gpios)
> > +{
> > +}
> > +
> > #endif /* GPIOLIB */
> >
> > #endif
> > -- 2.17.1
> >
> >
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >
>
> Thanks for your review.
> I fully agree with your comment, but I wrote this code like it is to keep
> the same structure than all the other ops of serial_mcrtrl_gpio driver. I
> preferred keeping an homogeneous code in the driver rather than breaking the
> driver homogeneity with the addition of an optimized code.
>
> Greg, can you please indicate which solution you recommend ?
Sadly, this is the format in this file, so I'll take this as-is.
thanks,
greg k-h
next prev parent reply other threads:[~2022-02-08 11:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 17:16 [PATCH 0/2] STM32 enable gpio irqs as wakeup irqs for uart port Erwan Le Ray
2022-02-03 17:16 ` [PATCH 1/2] serial: mctrl_gpio: add a new API to enable / disable wake_irq Erwan Le Ray
[not found] ` <CAHp75VfxGj=3mKvjcRpQjyXBCM0szsidHVuJGdAL8yP5SmdBzw@mail.gmail.com>
2022-02-04 15:41 ` Erwan LE RAY
2022-02-08 10:07 ` Greg Kroah-Hartman [this message]
2022-02-03 17:16 ` [PATCH 2/2] serial: stm32: enable / disable wake irqs for mcrtl_gpio wakeup sources Erwan Le Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YgJAyAZFJBFXQGvf@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andy.shevchenko@gmail.com \
--cc=erwan.leray@foss.st.com \
--cc=gerald.baeza@st.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=valentin.caron@foss.st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox