Op 01-10-2024 om 11:16 schreef Jack Yu:
This is the first version of common functions for Realtek soundwire codec driver. Signed-off-by: Jack Yu <jack.yu@xxxxxxxxxxx> --- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt-sdw-common.c | 238 +++++++++++++++++++++++++++++++ sound/soc/codecs/rt-sdw-common.h | 66 +++++++++ 4 files changed, 311 insertions(+) create mode 100644 sound/soc/codecs/rt-sdw-common.c create mode 100644 sound/soc/codecs/rt-sdw-common.h [...] +/** + * rt_sdca_btn_type - Decision of button type. + * + * @buffer: UMP message buffer. + * + * A button type will be returned regarding to buffer, + * it returns zero if buffer cannot be recognized. + */ +int rt_sdca_btn_type(unsigned char *buffer) +{ + u8 btn_type = 0; + int ret;
No initializer ?? You probably want to set it to zero here.
+ + btn_type |= buffer[0] & 0xf; + btn_type |= (buffer[0] >> 4) & 0xf; + btn_type |= buffer[1] & 0xf; + btn_type |= (buffer[1] >> 4) & 0xf; + + if (btn_type & BIT(0))
Variable "ret" is not initialized yet.
+ ret |= SND_JACK_BTN_2; + if (btn_type & BIT(1)) + ret |= SND_JACK_BTN_3; + if (btn_type & BIT(2)) + ret |= SND_JACK_BTN_0; + if (btn_type & BIT(3)) + ret |= SND_JACK_BTN_1; + + return ret; +} +EXPORT_SYMBOL_GPL(rt_sdca_btn_type);