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:   Wed, 6 Jul 2022 23:52:07 +0300
From:   Dmitry Osipenko <dmitry.osipenko@...labora.com>
To:     Shreeya Patel <shreeya.patel@...labora.com>, jic23@...nel.org,
        lars@...afoo.de, robh+dt@...nel.org, Zhigang.Shi@...eon.com,
        krisman@...labora.com
Cc:     linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel@...labora.com,
        alvaro.soliverez@...labora.com, andy.shevchenko@...il.com,
        digetx@...il.com, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v6 2/2] iio: light: Add support for ltrf216a sensor

Hello Shreeya,

On 6/15/22 16:51, Shreeya Patel wrote:
> +static int ltrf216a_set_power_state(struct ltrf216a_data *data, bool on)
> +{
> +	struct device *dev = &data->client->dev;
> +	int ret, suspended;
> +
> +	if (on) {
> +		suspended = pm_runtime_suspended(dev);
> +		ret = pm_runtime_get_sync(dev);

The pm_runtime_get_sync() returns 1 if device was already resumed and as
Andy said there is no reason not to handle the RPM error. Hence we can
rewrite it like this:

if (on) {
	ret = pm_runtime_resume_and_get(dev);
	if (ret < 0) {
		dev_err(&data->client->dev, "failed to resume runtime PM: %d\n", ret);
		return ret;
	}

	/* Allow one integration cycle before allowing a reading */
	if (!ret)
		msleep(ltrf216a_int_time_reg[0][0]);
} else {
	pm_runtime_mark_last_busy(dev);
	ret = pm_runtime_put_autosuspend(dev);
}

-- 
Best regards,
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ