[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfCDRRS+WdyN-s5h+C7wnpFOpxOp7DU9_X5rpkL32M45g@mail.gmail.com>
Date: Tue, 12 Jul 2022 16:49:13 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Henning Schild <henning.schild@...mens.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>,
Tasanakorn Phaipool <tasanakorn@...il.com>,
Sheng-Yuan Huang <syhuang3@...oton.com>,
Kuan-Wei Ho <cwho@...oton.com>
Subject: Re: [PATCH v3 1/3] gpio: nct6116d: add new driver for several Nuvoton
super io chips
On Tue, Jul 12, 2022 at 4:32 PM Henning Schild
<henning.schild@...mens.com> wrote:
>
> This patch adds gpio support for several Nuvoton NCTXXX chips. These
> Super-I/O chips offer multiple functions of which several already have
> drivers in the kernel, i.e. hwmon and watchdog.
...
> +#include <linux/gpio/driver.h>
> +#include <linux/init.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
+ bits.h
+ types.h.
...
> +static inline int superio_enter(int base)
> +{
> + /* Don't step on other drivers' I/O space by accident. */
> + if (!request_muxed_region(base, 2, KBUILD_MODNAME)) {
> + pr_err("I/O address 0x%04x already in use\n", base);
> + return -EBUSY;
> + }
> +
> + /* According to the datasheet the key must be send twice. */
sent
> + outb(SIO_UNLOCK_KEY, base);
> + outb(SIO_UNLOCK_KEY, base);
> +
> + return 0;
> +}
...
> +#define gpio_dir(base) ((base) + 0)
> +#define gpio_data(base) ((base) + 1)
Dunno, why haven't you changed this? It might be a hidden mine for the
future GPIO library development. I recommend using namespace whenever
it feels right, and here it's exactly the case.
> + if (dir & 1 << offset)
Another ignored comment... BIT(offset)
I'm stopping here to let you double check what version you have sent.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists