Ahmad Fatoum 1940979657 include/linux/bcd.h: provide bcd_is_valid() helper
bcd2bin(0x0A) happily returns 10, despite this being an invalid BCD
value. RTC drivers converting possibly corrupted BCD timestamps might
want to validate their input before calling bcd2bin().

Provide a macro to do so. Unlike bcd2bin and bin2bcd, out-of-line
versions are not implemented. Should the macro experience enough use,
this can be retrofitted.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20221123095527.2771434-2-s.hauer@pengutronix.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-09 23:01:49 +01:00
..
2022-12-15 10:21:10 -08:00
2022-12-20 08:32:11 -06:00
2022-12-21 09:37:14 -08:00
2022-11-24 23:12:19 +11:00
2022-12-23 11:39:18 -08:00
2022-12-22 11:22:31 -08:00
2022-12-13 15:47:48 -08:00
2022-12-21 09:41:28 -08:00
2022-12-22 11:22:31 -08:00