[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YszwRgsrcgmY789d@COLIN-DESKTOP1.localdomain>
Date: Mon, 11 Jul 2022 20:53:42 -0700
From: Colin Foster <colin.foster@...advantage.com>
To: Horatiu Vultur <horatiu.vultur@...rochip.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linus.walleij@...aro.org, kavyasree.kotagiri@...rochip.com,
alexandre.belloni@...tlin.com, UNGLinuxDriver@...rochip.com,
maxime.chevallier@...tlin.com, michael@...le.cc,
andy.shevchenko@...il.com
Subject: Re: [PATCH v3 1/2] pinctrl: ocelot: Fix pincfg for lan966x
On Mon, Jul 11, 2022 at 09:21:12PM +0200, Horatiu Vultur wrote:
> +
> struct ocelot_pinctrl {
> struct device *dev;
> struct pinctrl_dev *pctl;
> @@ -328,10 +329,16 @@ struct ocelot_pinctrl {
> struct regmap *map;
> struct regmap *pincfg;
> struct pinctrl_desc *desc;
> + struct ocelot_pincfg_data *pincfg_data;
I'm curious as to why desc and pincfg_data can't be const. [[ checks ]]
devm_pinctrl_register needs it - which is good enough for me.
But can pincfg_data be const? That way you could do:
const struct ocelot_pincfg_data *pincfg_data;
...
info->pincfg_data = &data->pincfg_data;
No need for another devm_kmemdup here then:
> - info->desc = (struct pinctrl_desc *)device_get_match_data(dev);
> + data = device_get_match_data(dev);
> + if (!data)
> + return -EINVAL;
> +
> + info->desc = devm_kmemdup(dev, &data->desc,
> + sizeof(struct pinctrl_desc), GFP_KERNEL);
> + info->pincfg_data = devm_kmemdup(dev, &data->pincfg_data,
> + sizeof(struct ocelot_match_data),
> + GFP_KERNEL);
>
> reset = devm_reset_control_get_optional_shared(dev, "switch");
> if (IS_ERR(reset))
> --
> 2.33.0
>
Powered by blists - more mailing lists