Re: [PATCH v4 3/3] iio: chemical: bme680: add power management

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

 



On Thu, Nov 28, 2024 at 08:32:46PM +0100, Vasileios Amoiridis wrote:
> Add runtime power management to the device.

...

> +	struct bme680_data *data = iio_priv(indio_dev);
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
> +
> +	pm_runtime_get_sync(dev);
> +	ret = __bme680_read_raw(indio_dev, chan, val, val2, mask);

Does it make sense to read something if previous call failed?
Most likely you wanted to use


	ret = pm_runtime_resume_and_get(dev)
	if (ret)
		return ret;

	ret = __bme680_read_raw(indio_dev, chan, val, val2, mask);

> +	pm_runtime_mark_last_busy(dev);
> +	pm_runtime_put_autosuspend(dev);
> +
> +	return ret;

...

> +static int bme680_write_raw(struct iio_dev *indio_dev,
> +			    struct iio_chan_spec const *chan,
> +			    int val, int val2, long mask)

Ditto.

...

> +{
> +	struct bme680_data *data = iio_priv(indio_dev);
> +	struct device *dev = regmap_get_device(data->regmap);
> +
> +	pm_runtime_get_sync(dev);

No error check?

> +	return 0;
> +}


-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux