[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOoeyxX+jTVB3T9Eu_66b9gHZbnbLpVKa=QK7F1YDkfsWdxo9g@mail.gmail.com>
Date: Mon, 23 Dec 2024 10:02:24 +0800
From: Ming Yu <a0282524688@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: tmyu0@...oton.com, lee@...nel.org, brgl@...ev.pl, andi.shyti@...nel.org,
mkl@...gutronix.de, mailhol.vincent@...adoo.fr, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
wim@...ux-watchdog.org, linux@...ck-us.net, jdelvare@...e.com,
alexandre.belloni@...tlin.com, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-rtc@...r.kernel.org
Subject: Re: [PATCH v3 2/7] gpio: Add Nuvoton NCT6694 GPIO support
Dear Linus,
Thank you for your comments,
Linus Walleij <linus.walleij@...aro.org> 於 2024年12月20日 週五 下午8:42寫道:
>
> Hi Ming,
>
> thanks for your patch!
>
> Some nits below:
>
> On Tue, Dec 10, 2024 at 11:46 AM Ming Yu <a0282524688@...il.com> wrote:
>
> > This driver supports GPIO and IRQ functionality for NCT6694 MFD
> > device based on USB interface.
> >
> > Signed-off-by: Ming Yu <tmyu0@...oton.com>
> (...)
> > +#include <linux/gpio/driver.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/mfd/core.h>
> > +#include <linux/mfd/nct6694.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
>
> #include <linux/bits.h>
> is missing, include it explicitly.
>
> > + return !(BIT(offset) & data->xmit_buf);
>
> Here you use the BIT() macro from <linux/bits.h>
>
Understood. I will add the header in the next patch.
> > +static int nct6694_direction_input(struct gpio_chip *gpio, unsigned int offset)
> > +{
> > + struct nct6694_gpio_data *data = gpiochip_get_data(gpio);
> > + int ret;
> > +
> > + guard(mutex)(&data->lock);
> > +
> > + ret = nct6694_read_msg(data->nct6694, NCT6694_GPIO_MOD,
> > + NCT6694_GPO_DIR + data->group,
> > + NCT6694_GPIO_LEN, &data->xmit_buf);
> > + if (ret < 0)
> > + return ret;
> > +
> > + data->xmit_buf &= ~(1 << offset);
>
> data->xmit_buf &= ~BIT(offset);
>
Okay! Fix it in the v4.
> > +static int nct6694_direction_output(struct gpio_chip *gpio,
> > + unsigned int offset, int val)
> > +{
> > + struct nct6694_gpio_data *data = gpiochip_get_data(gpio);
> > + int ret;
> > +
> > + guard(mutex)(&data->lock);
> > +
> > + /* Set direction to output */
> > + ret = nct6694_read_msg(data->nct6694, NCT6694_GPIO_MOD,
> > + NCT6694_GPO_DIR + data->group,
> > + NCT6694_GPIO_LEN, &data->xmit_buf);
> > + if (ret < 0)
> > + return ret;
> > +
> > + data->xmit_buf |= (1 << offset);
>
> data->xmit_buf |= BIT(offset);
>
Okay! Fix it in the v4.
> > + if (val)
> > + data->xmit_buf |= (1 << offset);
> > + else
> > + data->xmit_buf &= ~(1 << offset);
>
> Same
>
Okay! Fix it in the v4.
> > +static void nct6694_set_value(struct gpio_chip *gpio, unsigned int offset,
> > + int val)
> > +{
> (...)
> > + if (val)
> > + data->xmit_buf |= (1 << offset);
> > + else
> > + data->xmit_buf &= ~(1 << offset);
>
> Same
>
Okay! Fix it in the v4.
> > +static irqreturn_t nct6694_irq_handler(int irq, void *priv)
> > +{
> > + struct nct6694_gpio_data *data = priv;
> > + unsigned char status;
> > +
> > + guard(mutex)(&data->lock);
> > +
> > + nct6694_read_msg(data->nct6694, NCT6694_GPIO_MOD,
> > + NCT6694_GPI_STS + data->group,
> > + NCT6694_GPIO_LEN, &data->xmit_buf);
> > +
> > + status = data->xmit_buf;
> > +
> > + while (status) {
> > + int bit = __ffs(status);
> > +
> > + data->xmit_buf = BIT(bit);
> > + handle_nested_irq(irq_find_mapping(data->gpio.irq.domain, bit));
> > + status &= ~(1 << bit);
>
> Same
>
> Just use BIT() consistently please.
>
Okay! Fix it in the v4.
Best regards,
Ming
Powered by blists - more mailing lists