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]
Message-ID: <d933f30b-4d53-eb97-d029-1c321ba84b62@kernel.org>
Date:   Mon, 13 Jun 2022 21:27:45 +0300
From:   Georgi Djakov <djakov@...nel.org>
To:     "Peng Fan (OSS)" <peng.fan@....nxp.com>, shawnguo@...nel.org,
        s.hauer@...gutronix.de, festevam@...il.com, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, abel.vesa@....com,
        abailon@...libre.com, l.stach@...gutronix.de,
        laurent.pinchart@...asonboard.com, marex@...x.de,
        paul.elder@...asonboard.com, Markus.Niebel@...tq-group.com,
        aford173@...il.com
Cc:     kernel@...gutronix.de, linux-pm@...r.kernel.org,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, linux-imx@....com,
        Peng Fan <peng.fan@....com>
Subject: Re: [PATCH 2/8] interconnect: add device managed bulk API

Hi Peng,

Thanks for the patches!

On 1.06.22 12:41, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
> 
> Add device managed bulk API to simplify driver.
> 
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
>   drivers/interconnect/bulk.c  | 34 ++++++++++++++++++++++++++++++++++
>   include/linux/interconnect.h |  6 ++++++
>   2 files changed, 40 insertions(+)
> 
> diff --git a/drivers/interconnect/bulk.c b/drivers/interconnect/bulk.c
> index 448cc536aa79..4918844bfe0d 100644
> --- a/drivers/interconnect/bulk.c
> +++ b/drivers/interconnect/bulk.c
> @@ -115,3 +115,37 @@ void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths)
>   		icc_disable(paths[num_paths].path);
>   }
>   EXPORT_SYMBOL_GPL(icc_bulk_disable);
> +
> +struct icc_bulk_devres {
> +	struct icc_bulk_data *paths;
> +	int num_paths;
> +};
> +
> +static void devm_icc_bulk_release(struct device *dev, void *res)
> +{
> +	struct icc_bulk_devres *devres = res;
> +
> +	icc_bulk_put(devres->num_paths, devres->paths);
> +}
> +
> +int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths)

Adding a kerneldoc would be nice.

> +{
> +	struct icc_bulk_devres *devres;
> +	int ret;
> +
> +	devres = devres_alloc(devm_icc_bulk_release, sizeof(*devres), GFP_KERNEL);
> +	if (!devres)
> +		return -ENOMEM;
> +
> +	ret = of_icc_bulk_get(dev, num_paths, paths);
> +	if (!ret) {
> +		devres->paths = paths;
> +		devres->num_paths = num_paths;
> +		devres_add(dev, devres);
> +	} else {
> +		devres_free(devres);
> +	}
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(devm_of_icc_bulk_get);
> diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h
> index f685777b875e..1a5fdf049edd 100644
> --- a/include/linux/interconnect.h
> +++ b/include/linux/interconnect.h
> @@ -44,6 +44,7 @@ struct icc_path *icc_get(struct device *dev, const int src_id,
>   			 const int dst_id);
>   struct icc_path *of_icc_get(struct device *dev, const char *name);
>   struct icc_path *devm_of_icc_get(struct device *dev, const char *name);
> +int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths);
>   struct icc_path *of_icc_get_by_index(struct device *dev, int idx);
>   void icc_put(struct icc_path *path);
>   int icc_enable(struct icc_path *path);
> @@ -116,6 +117,11 @@ static inline int of_icc_bulk_get(struct device *dev, int num_paths, struct icc_
>   	return 0;
>   }
>   
> +int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths)

Please make this static inline. The rest looks good!

Thanks,
Georgi

> +{
> +	return 0;
> +}
> +
>   static inline void icc_bulk_put(int num_paths, struct icc_bulk_data *paths)
>   {
>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ