Re: [PATCH v5 1/2] Driver for TI HDC20x0 humidity and temperature sensors

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

 



On Thu, 13 Feb 2020 22:13:07 +0000
Eugene Zalkonnikov <ez@xxxxxxxxxxxxx> wrote:

> Amended HDC2010/2080 diver and sysfs documentation for its heater element.
> 
> Signed-off-by: Eugene Zaikonnikov <eugene.zaikonnikov@xxxxxxxxxxxxx>

Sparse through up a brackets warning which made me take a closer look at this
line highlighted below.

> +	indio_dev->channels = hdc2010_channels;
> +	indio_dev->num_channels = ARRAY_SIZE(hdc2010_channels);
> +
> +	/* Enable Automatic Measurement Mode at 5Hz */
> +	hdc2010_update_drdy_config(data, HDC2010_AMM, HDC2010_AMM);
> +
> +	/*
> +	 * We enable both temp and humidity measurement.
> +	 * However the measurement won't start even in AMM until triggered.
> +	 */
> +	tmp = (u8)(~HDC2010_MEAS_CONF |
> +		   HDC2010_MEAS_TRIG & data->measurement_config) |
> +		HDC2010_MEAS_TRIG;
Sparse suggested brackets in this so it made me take a closer look.

I'm fairly sure that's the same as the more natural
(data->measurement_config & ~HDC2010_MEAS_CONF) | HDC2010_MEAS_TRIG;

What am I missing?

> +
> +	ret = i2c_smbus_write_byte_data(client,
> +					HDC2010_REG_MEASUREMENT_CONF, tmp);
> +	if (ret)
> +		return ret;
> +	data->measurement_config = tmp;
> +
> +	return devm_iio_device_register(&client->dev, indio_dev);
> +}



[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