lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 May 2024 22:29:27 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: Sudeep Holla <sudeep.holla@....com>,
	Cristian Marussi <cristian.marussi@....com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Dong Aisheng <aisheng.dong@....com>, Jacky Bai <ping.bai@....com>,
	linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
	linux-gpio@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: Re: [PATCH v4 3/3] pinctrl: imx: support SCMI pinctrl protocol for
 i.MX95

Sun, May 05, 2024 at 11:47:19AM +0800, Peng Fan (OSS) kirjoitti:
> From: Peng Fan <peng.fan@....com>
> 
> The generic pinctrl-scmi.c driver could not be used for i.MX95 because
> i.MX95 SCMI firmware not supports functions, groups or generic
> 'Pin Configuration Type and Enumerations' listed in SCMI Specification.
> 
> i.MX95 System Control Management Interface(SCMI) firmware only supports
> below pin configuration types which are OEM specific types:
>     192: PIN MUX
>     193: PIN CONF
>     194: DAISY ID
>     195: DAISY VAL
> 
> To support Linux generic pinctrl properties(pinmux, bias-pull-[up,
> down], and etc), need extract the value from the property and map
> them to the format that i.MX95 SCMI pinctrl protocol understands,
> so add this driver.

..

> +struct imx_pin_group {
> +	struct pingroup data;
> +};

I don't see the necessity of having this wrapper structure. Can't you simply
use struct pingroup directly?

..

> +static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)
> +{
> +	int ret;
> +	struct device *dev = &sdev->dev;
> +	struct scmi_pinctrl_imx *pmx;
> +	const struct scmi_handle *handle;
> +	struct scmi_protocol_handle *ph;
> +	struct device_node *np __free(device_node) = of_find_node_by_path("/");
> +	const struct scmi_pinctrl_proto_ops *pinctrl_ops;

> +	if (!sdev->handle)
> +		return -EINVAL;

When this conditional can be true?

> +	if (!of_match_node(scmi_pinctrl_imx_allowlist, np))
> +		return -ENODEV;

> +	handle = sdev->handle;

It's even better to assign first and then check if the above check is needed at all.

> +	pinctrl_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PINCTRL, &ph);
> +	if (IS_ERR(pinctrl_ops))
> +		return PTR_ERR(pinctrl_ops);
> +
> +	pmx = devm_kzalloc(dev, sizeof(*pmx), GFP_KERNEL);
> +	if (!pmx)
> +		return -ENOMEM;
> +
> +	pmx->ph = ph;
> +	pmx->ops = pinctrl_ops;
> +
> +	pmx->dev = dev;
> +	pmx->pctl_desc.name = DRV_NAME;
> +	pmx->pctl_desc.owner = THIS_MODULE;
> +	pmx->pctl_desc.pctlops = &pinctrl_scmi_imx_pinctrl_ops;
> +	pmx->pctl_desc.pmxops = &pinctrl_scmi_imx_pinmux_ops;
> +	pmx->pctl_desc.confops = &pinctrl_scmi_imx_pinconf_ops;
> +
> +	ret = scmi_pinctrl_imx_get_pins(pmx, &pmx->pctl_desc);
> +	if (ret)
> +		return ret;
> +
> +	ret = scmi_pinctrl_imx_probe_dt(sdev, pmx);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_pinctrl_register_and_init(dev, &pmx->pctl_desc, pmx,
> +					     &pmx->pctldev);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to register pinctrl\n");
> +
> +	return pinctrl_enable(pmx->pctldev);
> +}

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ