npcx: CEC: Fix issues with pushing to incoming buffer
npcx: CEC: Fix issues with pushing to incoming buffer

When pushing to the circular buffer, the read-offset mutex is no
longer taken, so don't unlock the mutex.

Don't allow writing to the last byte of the buffer. In that case,
the read and write pointers will become equal and the buffer will
be treated as empty.

Add handling for pushing messages of invalid size.

Signed-off-by: Stefan Adolfsson <e50dd6be847b40d13b2945548d6ccde363cae74b@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Turn on/off TV:
ectool cec write 0x40 0x36
ectool cec write 0x04 0x40
Verify that incoming messages still works when turning off TV:
ectool cec read -- -1

Change-Id: Id207c442fac573430aac0c744ec07fa203074228
Reviewed-on: https://chromium-review.googlesource.com/1068945
Commit-Ready: Stefan Adolfsson <e50dd6be847b40d13b2945548d6ccde363cae74b@chromium.org>
Tested-by: Stefan Adolfsson <e50dd6be847b40d13b2945548d6ccde363cae74b@chromium.org>
Reviewed-by: Stefan Adolfsson <e50dd6be847b40d13b2945548d6ccde363cae74b@chromium.org>
Reviewed-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec