On Mon, Sep 30, 2024 at 11:22:42AM +0800, Peng Fan (OSS) wrote: > From: Joy Zou <[email protected]> > > Support NXP pmic pf0900 > > Reviewed-by: Ye Li <[email protected]> > Signed-off-by: Joy Zou <[email protected]> > Signed-off-by: Peng Fan <[email protected]> > --- > drivers/power/pmic/Kconfig | 15 ++ > drivers/power/pmic/Makefile | 1 + > drivers/power/pmic/pf0900.c | 174 +++++++++++++++++++++++ > include/power/pf0900.h | 269 ++++++++++++++++++++++++++++++++++++ > 4 files changed, 459 insertions(+) > create mode 100644 drivers/power/pmic/pf0900.c > create mode 100644 include/power/pf0900.h
No MAINTAINERS update for this file. And
[snip]
> +static u8 crc8_j1850(u8 *data, u8 length)
> +{
> + u8 t_crc;
> + u8 i, j;
> +
> + t_crc = 0xFF;
> + for (i = 0; i < length; i++) {
> + t_crc ^= data[i];
> + for (j = 0; j < 8; j++) {
> + if ((t_crc & 0x80) != 0) {
> + t_crc <<= 1;
> + t_crc ^= 0x1D;
> + } else {
> + t_crc <<= 1;
> + }
> + }
> + }
> + return t_crc;
> +}
This gets repeated in other drivers and I gather this is "CRC8 SAE
J1850" algorithm? This should get put in lib/crc8.c and re-used as
needed.
--
Tom
signature.asc
Description: PGP signature

