linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Tomer Maimon <tmaimon77@gmail.com>
Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, avifishman70@gmail.com,
	tali.perry1@gmail.com, joel@jms.id.au, venture@google.com,
	yuenn@google.com, benjaminfair@google.com, j.neuschaefer@gmx.net,
	openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 2/2] pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver
Date: Mon, 11 Sep 2023 16:02:53 +0200	[thread overview]
Message-ID: <CACRpkdZk8dKGx2HUoRhkRo6DBkycKh5EkYiGWcFot3OOZnvdpg@mail.gmail.com> (raw)
In-Reply-To: <20230828140849.21724-3-tmaimon77@gmail.com>

On Mon, Aug 28, 2023 at 4:09 PM Tomer Maimon <tmaimon77@gmail.com> wrote:

> Add pinctrl and GPIO controller driver support to Arbel BMC NPCM8XX SoC.
>
> Arbel BMC NPCM8XX pinctrl driver based on Poleg NPCM7XX, except the
> pin mux mapping difference the NPCM8XX GPIO supports adjust debounce
> period time.
>
> Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>

As mentioned the patch is already applied, consider the following
as nitpicks you can address in followup patches.

> +struct npcm8xx_gpio {
> +       struct gpio_chip        gc;
> +       void __iomem            *base;
> +       struct debounce_time    debounce;
> +       int                     irqbase;

You're not really using this are you? Delete it.
Also the assignment further down: you do not use it I think.

> +       int                     irq;

You're not using this either. Delete it.

> +       struct irq_chip         irq_chip;

Not this either. Delete it.

> +static int npcm8xx_dt_node_to_map(struct pinctrl_dev *pctldev,
> +                                 struct device_node *np_config,
> +                                 struct pinctrl_map **map,
> +                                 u32 *num_maps)
> +{
> +       return pinconf_generic_dt_node_to_map(pctldev, np_config,
> +                                             map, num_maps,
> +                                             PIN_MAP_TYPE_INVALID);
> +}
> +
> +static void npcm8xx_dt_free_map(struct pinctrl_dev *pctldev,
> +                               struct pinctrl_map *map, u32 num_maps)
> +{
> +       kfree(map);
> +}

Can't you just call the generic functions directly?

> +static const struct pinctrl_ops npcm8xx_pinctrl_ops = {
> +       .get_groups_count = npcm8xx_get_groups_count,
> +       .get_group_name = npcm8xx_get_group_name,
> +       .get_group_pins = npcm8xx_get_group_pins,
> +       .dt_node_to_map = npcm8xx_dt_node_to_map,
> +       .dt_free_map = npcm8xx_dt_free_map,

Here?

(...)
> +static int npcm8xx_gpio_request_enable(struct pinctrl_dev *pctldev,
> +                                      struct pinctrl_gpio_range *range,
> +                                      unsigned int offset)
> +{
> +       struct npcm8xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev);
> +       const unsigned int *pin = &offset;
> +       int mode = fn_gpio;
> +
> +       if (pin[0] >= 183 && pin[0] <= 189)
> +               mode = pincfg[pin[0]].fn0;

These magic numbers should really be definies.

> +static void npcm8xx_gpio_request_free(struct pinctrl_dev *pctldev,
> +                                     struct pinctrl_gpio_range *range,
> +                                     unsigned int offset)
> +{
> +       struct npcm8xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev);
> +       int virq;
> +
> +       virq = irq_find_mapping(npcm->domain, offset);
> +       if (virq)
> +               irq_dispose_mapping(virq);
> +}

I would just rename "virq" to "irq", it is a Linux IRQ, not really
"virtual" which is what the "v" sometimes stand for.

Yours,
Linus Walleij

  reply	other threads:[~2023-09-11 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 14:08 [PATCH v7 0/2] pinctrl: nuvoton: add pinmux and GPIO driver for NPCM8XX Tomer Maimon
2023-08-28 14:08 ` [PATCH v7 1/2] dt-binding: pinctrl: Add NPCM8XX pinctrl and GPIO documentation Tomer Maimon
2023-08-28 14:08 ` [PATCH v7 2/2] pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver Tomer Maimon
2023-09-11 14:02   ` Linus Walleij [this message]
2023-09-11 13:53 ` [PATCH v7 0/2] pinctrl: nuvoton: add pinmux and GPIO driver for NPCM8XX Linus Walleij
2023-09-11 19:36   ` Tomer Maimon

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=CACRpkdZk8dKGx2HUoRhkRo6DBkycKh5EkYiGWcFot3OOZnvdpg@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=joel@jms.id.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=yuenn@google.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;
as well as URLs for NNTP newsgroup(s).