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: <20210104071531.oyc64zgfot43gupv@vireshk-i7>
Date:   Mon, 4 Jan 2021 12:45:31 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Yangtao Li <tiny.windzz@...il.com>
Cc:     myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
        cw00.choi@...sung.com, krzk@...nel.org, shawnguo@...nel.org,
        s.hauer@...gutronix.de, kernel@...gutronix.de, festevam@...il.com,
        linux-imx@....com, digetx@...il.com, thierry.reding@...il.com,
        jonathanh@...dia.com, yuq825@...il.com, airlied@...ux.ie,
        daniel@...ll.ch, robdclark@...il.com, sean@...rly.run,
        robh@...nel.org, tomeu.vizoso@...labora.com, steven.price@....com,
        alyssa.rosenzweig@...labora.com, stanimir.varbanov@...aro.org,
        agross@...nel.org, bjorn.andersson@...aro.org, mchehab@...nel.org,
        lukasz.luba@....com, adrian.hunter@...el.com,
        ulf.hansson@...aro.org, vireshk@...nel.org, nm@...com,
        sboyd@...nel.org, broonie@...nel.org, gregkh@...uxfoundation.org,
        jirislaby@...nel.org, rjw@...ysocki.net, jcrouse@...eaurora.org,
        hoegsberg@...gle.com, eric@...olt.net, tzimmermann@...e.de,
        marijn.suijten@...ainline.org, gustavoars@...nel.org,
        emil.velikov@...labora.com, jonathan@...ek.ca,
        akhilpo@...eaurora.org, smasetty@...eaurora.org,
        airlied@...hat.com, masneyb@...tation.org, kalyan_t@...eaurora.org,
        tanmay@...eaurora.org, ddavenport@...omium.org,
        jsanka@...eaurora.org, rnayak@...eaurora.org,
        tongtiangen@...wei.com, miaoqinglang@...wei.com,
        khsieh@...eaurora.org, abhinavk@...eaurora.org,
        chandanu@...eaurora.org, groeck@...omium.org, varar@...eaurora.org,
        mka@...omium.org, harigovi@...eaurora.org,
        rikard.falkeborn@...il.com, natechancellor@...il.com,
        georgi.djakov@...aro.org, akashast@...eaurora.org,
        parashar@...eaurora.org, dianders@...omium.org,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-samsung-soc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, lima@...ts.freedesktop.org,
        linux-arm-msm@...r.kernel.org, freedreno@...ts.freedesktop.org,
        linux-media@...r.kernel.org, linux-mmc@...r.kernel.org,
        linux-spi@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH 05/31] opp: Add devres wrapper for
 dev_pm_opp_register_notifier

On 01-01-21, 16:54, Yangtao Li wrote:
> Add devres wrapper for dev_pm_opp_register_notifier() to simplify driver
> code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@...il.com>
> ---
>  drivers/opp/core.c     | 38 ++++++++++++++++++++++++++++++++++++++
>  include/linux/pm_opp.h |  6 ++++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 6b83e373f0d8..ef3544f8cecd 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2599,6 +2599,44 @@ int dev_pm_opp_unregister_notifier(struct device *dev,
>  }
>  EXPORT_SYMBOL(dev_pm_opp_unregister_notifier);
>  
> +static void devm_pm_opp_notifier_release(struct device *dev, void *res)
> +{
> +	struct notifier_block *nb = *(struct notifier_block **)res;
> +
> +	WARN_ON(dev_pm_opp_unregister_notifier(dev, nb));
> +}
> +
> +/**
> + * devm_pm_opp_register_notifier() - Register OPP notifier for the device
> + * @dev:	Device for which notifier needs to be registered
> + * @nb:		Notifier block to be registered
> + *
> + * Return: 0 on success or a negative error value.
> + *
> + * The notifier will be unregistered after the device is destroyed.
> + */
> +int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb)
> +{
> +	struct notifier_block **ptr;
> +	int ret;
> +
> +	ptr = devres_alloc(devm_pm_opp_notifier_release, sizeof(*ptr), GFP_KERNEL);
> +	if (!ptr)
> +		return -ENOMEM;
> +
> +	ret = dev_pm_opp_register_notifier(dev, nb);
> +	if (ret) {
> +		devres_free(ptr);
> +		return ret;
> +	}
> +
> +	*ptr = nb;
> +	devres_add(dev, ptr);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(devm_pm_opp_register_notifier);

I am not in favor of this patch, and it only has one user, which makes
it more unwanted.

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ