media: media/cec: use CEC_MAX_MSG_SIZE instead of hardcoded 16
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 24 Aug 2022 06:57:26 +0000 (08:57 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 30 Aug 2022 05:37:02 +0000 (07:37 +0200)
Use the proper define for the maximum CEC message length instead of
hardcoding it.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/cec/platform/sti/stih-cec.c
drivers/media/i2c/adv7511-v4l2.c
drivers/media/i2c/adv7604.c
drivers/media/i2c/adv7842.c

index abf8e8bcbb34cff6c799478137095c24866e9920..4edbdd09535dd45c0b4f5bb3d1d04f6e638606d0 100644 (file)
@@ -256,8 +256,8 @@ static void stih_rx_done(struct stih_cec *cec, u32 status)
        if (!msg.len)
                return;
 
-       if (msg.len > 16)
-               msg.len = 16;
+       if (msg.len > CEC_MAX_MSG_SIZE)
+               msg.len = CEC_MAX_MSG_SIZE;
 
        for (i = 0; i < msg.len; i++)
                msg.msg[i] = readl(cec->regs + CEC_RX_DATA_BASE + i);
index 202e0cd83f908feb4a60b629a38a9f41c1281b01..910b5e83946a52fe44bf7f72e90bc6a5d26d0c6c 100644 (file)
@@ -943,8 +943,8 @@ static int adv7511_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
                v4l2_dbg(1, debug, sd, "%s: cec msg len %d\n", __func__,
                         msg.len);
 
-               if (msg.len > 16)
-                       msg.len = 16;
+               if (msg.len > CEC_MAX_MSG_SIZE)
+                       msg.len = CEC_MAX_MSG_SIZE;
 
                if (msg.len) {
                        u8 i;
index 497419a5cfddd4375f52bd6f9af5d06bc4db66ec..815fe108281f6299ca9bfe3a9b5046a1bcd3b33a 100644 (file)
@@ -2047,8 +2047,8 @@ static void adv76xx_cec_isr(struct v4l2_subdev *sd, bool *handled)
                struct cec_msg msg;
 
                msg.len = cec_read(sd, 0x25) & 0x1f;
-               if (msg.len > 16)
-                       msg.len = 16;
+               if (msg.len > CEC_MAX_MSG_SIZE)
+                       msg.len = CEC_MAX_MSG_SIZE;
 
                if (msg.len) {
                        u8 i;
index 22caa070273b43b87e0e78e9fc08e340c81afef2..c541f9b3444b5b5dec5714dc1c455dac5357c414 100644 (file)
@@ -2215,8 +2215,8 @@ static void adv7842_cec_isr(struct v4l2_subdev *sd, bool *handled)
                struct cec_msg msg;
 
                msg.len = cec_read(sd, 0x25) & 0x1f;
-               if (msg.len > 16)
-                       msg.len = 16;
+               if (msg.len > CEC_MAX_MSG_SIZE)
+                       msg.len = CEC_MAX_MSG_SIZE;
 
                if (msg.len) {
                        u8 i;