[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZk8dKGx2HUoRhkRo6DBkycKh5EkYiGWcFot3OOZnvdpg@mail.gmail.com>
Date: Mon, 11 Sep 2023 16:02:53 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Tomer Maimon <tmaimon77@...il.com>
Cc: robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org, avifishman70@...il.com, tali.perry1@...il.com,
joel@....id.au, venture@...gle.com, yuenn@...gle.com,
benjaminfair@...gle.com, j.neuschaefer@....net,
openbmc@...ts.ozlabs.org, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 2/2] pinctrl: nuvoton: add NPCM8XX pinctrl and GPIO driver
On Mon, Aug 28, 2023 at 4:09 PM Tomer Maimon <tmaimon77@...il.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@...il.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
Powered by blists - more mailing lists