iio:common:ms_sensors:ms_sensors_i2c: rework CRC calculation helper
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 9 Jan 2021 23:11:46 +0000 (00:11 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 22 Jan 2021 08:52:06 +0000 (08:52 +0000)
commit7ae7f75080733d1d0e7c32156725c5729b02404d
tree6a5e26a89f1aa83d8feecf6f784a680a70a5d4c8
parent07498719bedecc8be1ecc62ea50315e91a668cac
iio:common:ms_sensors:ms_sensors_i2c: rework CRC calculation helper

The CRC calculation always happens on 8 words which is why there is an
extra element in the prom array of struct ms_tp_dev. However, on ms5637 and
similar, only 7 words are readable.

Then, set MS_SENSORS_TP_PROM_WORDS_NB to 8 and stop passing a len parameter
to ms_sensors_tp_crc_valid as this simply hide the fact that it is
hardcoded.

Finally, use the newly introduced hw->prom_len to know how many words can be
read.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210109231148.1168104-5-alexandre.belloni@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/common/ms_sensors/ms_sensors_i2c.c
drivers/iio/common/ms_sensors/ms_sensors_i2c.h