Re: [PATCH v3 1/2] pinctrl: ocelot: Fix pincfg for lan966x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux